[mapserver-users] Multiple queries with PostGIS

Obe, Regina DND\MIS Regina.Obe.PFD at ci.boston.ma.us
Wed Apr 17 10:06:45 EDT 2002


I don't know if this helps - here is a sample from my postgis map file that
searches by form fields named StNum and Street and Zip

LAYER
	STATUS OFF
  	NAME "parcelsq"
	CONNECTIONTYPE postgis
	CONNECTION "user=robedev dbname=dnddts host=dnd1" 
  	DATA "the_geom from streets"
	TYPE LINE
	FILTER "upper(street) Like upper('%Street%%') AND zip LIKE '%zip%%'
AND ('%StNum%'='' or '%StNum%' between fromleft and toleft or '%StNum%'
between fromright and toright) "
	CLASS
	  SYMBOL 0
	  OUTLINECOLOR 25 25 0
	END
	HEADER parcelfinder.htm
	#TEMPLATE parcelstreetsds.htm
	TEMPLATE blank.htm
	FOOTER parcelfooter.htm
END

My html form looks like this

	<form action="/mapserv/scripts/mapserv35.exe" method=get>
	<B>Query By Address</B><BR>
	Street Num: <input type="text" name="StNum" size=4> Street: <input
type="text" name="Street" size=15> <B>Zip:</B> <input type=text name=zip
size=5 maxlength=5> <input type=submit name="cmdSearch" value="Search">
	<input type=hidden name=qlayer value="parcelsq">
	<input type=hidden name=template value="parcelfinder.htm">
	<input type=hidden name=map value="[map]">
	<input type=hidden name=mode value="itemnquery">
	<input type=hidden name=layer value="parcelsq">
	<input type="hidden" name="mapext" value="shapes">
	</form>



-----Original Message-----
From: Diego Magni [mailto:diego at torno.ing.unico.it]
Sent: Wednesday, April 17, 2002 4:46 AM
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] Multiple queries with PostGIS


Dear List,

   I'm working with MapServer 3.5.1 (downloaded with Windows32 binary), 
   PostgreSQL 7.1.1 and PostGIS 0.6.2.
   I have problems for implementing multiple queries (CGI mode:
   "FEATUREQUERY" or "ITEMNQUERY") because I can't modify the filter SQL
   string via a form or a URL. After the selection of a new map file FILTER
   parameter, the PostGIS connection doesn't open the database and the error
   message appearing is

   	msPOSTGISLayerWhichShapes(): Query error. prep_DB:Error executing
POSTGIS	
        DECLARE statement (0.6 failed - retried 0.5 and it failed too).

   I've tried also to build multiple queries using the CLASSITEM and
   EXPRESSION map file parameters and changing them via form. I've seen
   that it's possible to do it, but in this way you can't use complex SQL
   strings available in case of the filter change.

       How can I make multiple query with the possibility of selecting item
   and value to be searched by the user?
       In other words, can I create queries using an association
   item-value like it was possible with MapServer 3.3?

   Thank you

   Best regards

			Diego Magni




More information about the mapserver-users mailing list