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

Richard Greenwood rich at greenwoodmap.com
Wed Mar 24 02:13:16 EST 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.

The CGI itemquery and itemnquery modes may be what you are looking for, 
however they will zoom to the full extent of the feature, not the first 
vertex. You could, however, have a second layer with just the verticies, 
zoom to them and also display the road polyline. Here is an example:

   http://www2.tetonwyo.org/mapserver/mapserv.exe?
    qstring=438&
    mode=itemquery&
    qitem=id&
    map=tc/tc.map&
    mapext=shapes&
    qlayer=Road_CLq&layer=Roads&
    zoomsize=2&
    savequery=true&

Regards,
-- 
Richard Greenwood
www.greenwoodmap.com



More information about the mapserver-users mailing list