[Mapserver-users] itemquery

Martin, Daniel DMartin at erac.com
Tue Mar 4 11:09:21 EST 2003


I just got itemquery working myself, after many failed attempts over the
past year.  Disregard this if you are using a 3.7 build, because I
understand itemquery changes in that version.  Here's my take on it:

I suggest, for starters, to get it working by manually manipulating the
query string.  At a minimum, your query string needs this: 
qlayer=MyLayerName&queryvalue=MyValue&mapext=shapes

Where I use "queryvalue" you can call it whatever you want, but it must
match the FILTER setting below.  If it is a point layer, you also need:
&buffer=.005
(play with the buffer value to get the zoom you want, could be very
different depending on your units)

An example of a working (for me) image tag that works, based on a point
layer, is:
<img
src="/cgi-bin/mapserv.exe?mode=itemquerymap&map=d%3A%5CMapServer%5CMAPFiles%
5CmyMap.map&layer=MyLayer&qlayer=MyLayer&value=MyValue&mapext=shapes&buffer=
.005">

At the very least you need a FILTERITEM and FILTER on the LAYER in question.
The FILTERITEM should be the field/collumn name.  The FILTER should be a
regex that includes the query value from the query string.  Following my
example, I would have:

LAYER MyLayerName
  ....
  FILTERITEM MyCollumnName
  FILTER /^%queryvalue%/
  ...
END

I'm sure I left something out, but I hope that helps.

-Dan Martin

> -----Original Message-----
> From: randy james [mailto:rjames57 at yahoo.com]
> Sent: Monday, March 03, 2003 4:53 PM
> To: Mapserver Users
> Subject: [Mapserver-users] itemquery
> 
> 
> Hi
> 
> I have been trying to figure out itemquery, without
> results yet. I would like to show the attribute
> information and a map that shows the polygon in the
> template output. I am missing something important i'm
> sure. So far i have a search.html which contains:
> 
> <!--  search form -->
> <form method="get"
> action="http://mapserver.ltc/cgi-bin/mapserv";>
> <input type="hidden" name="map"
> value="/var/www/html/gis/maps/territory_proj.map">
> <input type="hidden" name="mode" value="itemnquery">
> <input type="hidden" name="qlayer" value="l_fc">
> <input type="hidden" name="item" value="MAPSTAND">
> <input type="TEXT" size="30" name="value" value="">
> <input type="submit" value="Search">
> </form>
> <!-- /search form -->
> <input type="hidden" name="imgext" value="[mapext]">
> <input type="hidden" name="savequery" value="true">
> <input type="hidden" name="mapext" value="shapes">
> 
> A template file that contains all the database items
> 
> <table cellpadding=5 cellspacing=2 border=0>
> <tr bgcolor=#CCCCCC>
>        <td>[Mapstand]</td><td>[Opening
> Number]</td><td>[Planted spe]....
> 
> The portion of the map file for the layer
> 
>   # 7 layer {Forest Cover}
>   layer
>     data "l_fc"
>     footer "l_fc_footer.html"
>     header "l_fc_header.html"
>     labelitem "SPECIES1"
>        template l_fc.html
>     labelmaxscale 200000
>     labelminscale 60
> #   labelsizeitem "2"
>     name "l_fc"
>     status off
>     type polygon
> # transparency 50
> #  filteritem "MAPSTAND"
> #   1 class #none
>  CLASS
>     name 'Forest Cover'
> #     color 0 0 0
>          OUTLINECOLOR 168 0 255
>   LABEL
>         TYPE truetype
>        FONT arial
>         SIZE 6
>        COLOR 0 0 0
>         ANTIALIAS TRUE
>          END
>         END
> 
> The url seems to be right to me:
> 
> http://mapserver.ltc/cgi-bin/mapserv?map=%2Fvar%2Fwww%2Fhtml%2
Fgis%2Fmaps%2Fterritory_proj.map&mode=itemnquery&qlayer=l_fc&item=MAPSTAND&v
alue=test

This gives the error:

msQueryByAttributes(): Query error. No query
expression defined. 

Anyone still reading, and can help? ;-)

Cheers
Randy


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list