[mapserver-users] RE: itemquery, itemnquery, qstring struggles

Jim.Haug at state.sd.us Jim.Haug at state.sd.us
Wed Oct 22 08:52:53 PDT 2008


Anybody have any ideas? Is the problem in the map file layer setup?

-----Original Message-----
From: Haug, Jim 
Sent: Monday, October 20, 2008 9:01 PM
To: mapserver-users at lists.osgeo.org
Subject: itemquery, itemnquery, qstring struggles


I've run into a brick wall on this. I've been trying to incorporate
itemquery in a mapserver, first just through a simple test page that
does a quick query. The test page is a simplified form of the itemquery
in the test suite. If I use the qitem setting I get a
"msDBFGetItemIndex(): DBASE file error. Item '[SITE_NO]' not found"
error. If I drop the qitem, I get either the first item in the data, or
in the case of an itemnquery, all of the data.

What I'm doing is setting up a mapserver for archaeological site data in
South Dakota. The query will let a user enter an archaeological site
number (i.e. 39RO0005). In the test case, the server should find the
site and give just a list of the site number it found; eventually I'll
work it into zooming in on the site on the map. The problem is, that the
search either ends up in an error (above) or it returns site '39AU0001',
which is the first site in the dataset. If I try itemnquery, I get all
19,000 sites.

Here is the test web page:

<html>
<head>
<title>ItemQuery test</title>
</head>

<body>
<p>
<form name="test" method="get" action="/cgi-bin/mapserv"> <input
type="hidden" name="map" value="/gisdata/sd/sd_x.map"> <input
type="hidden" name="mode" value="itemquery"> <input type="hidden"
name="qlayer" value="sites"> <input type="hidden" name="qitem"
value="SITE_NO">

Site: <input type="text" name="qstring" maxlength="50"> <input
type="submit" value="Go!">

</form>


</body>
</html>


and here is the layer part of the map file:

  LAYER
    NAME 'sites'
    TYPE POLYGON
    DATA '/gisdata/sd/arch/sites.shp'
    METADATA
      qstring_validation_pattern '.'
    END
    STATUS OFF
    OPACITY 50
    PROJECTION
      "init=epsg:4326"
    END
    LABELITEM "SITE_NO"
    LABELMAXSCALEDENOM 48000
    CLASS
       NAME 'sites' 
       TEMPLATE "/var/www/sd/templates/sites.html"
       LABEL
         COLOR 96 64 64
       END
       STYLE
         SYMBOL 0 
         SIZE 3 
         OUTLINECOLOR 64 64 64
         COLOR 200 64 64
       END
    END
    HEADER "/var/www/sd/templates/sites_h.html"
  	FOOTER "/var/www/sd/templates/sites_f.html"
  END


I've tried a few different qstring validation templates, but none of
them seem to work. The line in the address on the browser I get from the
server is:

http://hawken/cgi-bin/mapserv?map=/gisdata/sd/sd_x.map&mode=itemquery&ql
ayer=sites&qstring=39ro0005

I'm stumped. I don't know what I'm doing wrong. Any suggestions,
corrections, ridicule, whatever?

-Jim Haug



More information about the MapServer-users mailing list