[mapserver-users] MapServer ITEMQUERY

Steve Lime Steve.Lime at dnr.state.mn.us
Mon Aug 24 20:37:14 PDT 2009


One thing to note about item queries is that they do also use the map extent as a
pre-filter. If you want to make sure all features are candidates then make sure your
map extent encompasses all your features.

Now, for your error. The Kropla book predates many changes on the security side of
MapServer and this is one example. In effect an attribute query mucks with the
FILTER of a layer and since that could be a where clause in a database  you don't
want to pass just anything. Assuming you have a cities layer it might look like
so:

LAYER
  NAME 'cities'
  DATA 'some shapefile'
  TYPE POINT
  METADATA
    # allow query strings consisting of 2 or 3 character country codes
    qstring_validation_pattern '^[A-Z]{2,3}$' 
  END
  ...
  TEMPLATE 'some template' # to be queryable
END

and you'd query like so:

http://yourserver/cgi-bin/mapserv?map=yourmapfile.map&mode=itemquery&qstring=US&qitem=country&qlayer=cities

Make sense?

Steve

>>> MapServer Newbie <mapservernewbie at yahoo.com> 08/21/09 7:47 AM >>>
Hello All!
I am a MapServer and Ubuntu newbie, trying to use the example code from:
Bill Kropla, Begining MapServer Open Source GIS Development
http://www.apress.com/book/downloadfile/2213
Chapter 5, fourth.map fourth.html...
the QUERY and NQUERY modes work (although the TOLERANCE is not changed from the value in the .map file when he tries to use [map_Cities_tolerance] in the URL) but I am unable to get the ITEMQUERY mode to work at all. I am using his example of: qlayer=Cities qitem=COUNTRY qstring=/US/
I have also tried the non-regular expression query items: US 'US' "US"
I always get the following error message:
mapserv(): Web application error. Parameter 'qstring' value fails to validate. msValidateParameter(): Regular expression error. Parameter pattern validation failed. 
the URL is:
http://localhost:8080/cgi-bin/mapserv?
zoomdir=0&zoomsize=2
&layer=Cities&layer=Countries
&mode=itemquery&qlayer=Cities&imgbox=&qitem=COUNTRY&imgshape=&qstring=%2FUS%2F
&mapshape=&map_Cities_tolerance=0&shapeindex=&map_Countries_tolerance=0
&imgxy=320+160&imgext=-180.000000+-89.859155+180.000000+89.859155
&map=%2Fhome%2Fgeorge%2Ffgs%2Fapps%2Fgmap-demo-cvs_MS_VERSION_54%2Fhtdocs%2Ffourth.map
&program=mapserv&slayer=Countries&previousmode=[previousmode]&savequery=true

I am running MapTools fgs-mapserver_extended_5.4.2-fgs_9.5-linux-i386.bin on Ubuntu 9.04 Desktop

Anyone have any idea why ITEMQUERY doesn't work?
Anyone have an ITEMQUERY example that does work?



      



More information about the MapServer-users mailing list