[Mapserver-users] Zoom to location by string match in query on SHP files. {Scanned} {Scanned}

Siki Zoltan siki at agt.bme.hu
Wed Mar 24 16:38:21 EST 2004


Hi,

On Tue, 23 Mar 2004, Jason M. Nielsen wrote:

> Is there a way to perform a query on shape files for a string match then return
> that record and extract specific data about it?
> 
> Example:
> 
> I have a shape file of all roads in an area. Among other attributes all of these
> roads have a name and vertex coordinates. I would like to be able to enter a
> street name, find it in the shape file then zoom to say the first X,Y point
> starting that road.
> 
> This would probably be very easy using PostGIS and php but unforunately as
> things stand these are not available to me atm. All I have is the cgi mapserver
> and shape files. They want to keep shape files as the datasource as well due to
> some other issues.

I could solve it with cgi mapserver, template and form.
This example based on mapserver 4.x
Create a form in your html 
...
<form method="GET" name="mapserv" action="cgi-bin/mapserv">
<input type="hidden" name="map" value="_your map file_">
<input type="hidden" name="mapext" value="shape">
<input type="hidden" name="mode" value="itemquery">
<input type="hidden" name="qlayer" value="_layer name_">
<input type="hidden" name="qitem" value="_field name_">
Enter value:<input type="text" name="qstring">
<input type="submit" name="Find">
...

in your map file

you shoud ad
TEMPLATE
HEADER
FOOTER
to the queried layer.

I hope this help.

Bye
Zoltan





More information about the mapserver-users mailing list