[Mapserver-users] zoom to result (was MapServer)
Richard Greenwood
rich at greenwoodmap.com
Mon Feb 2 01:15:02 PST 2004
On 2 Feb 2004 at 16:21, Charles Young wrote:
>>Hi,
>>
>>Do you possibly know of a way to run a dynamic search in MapServer and
>>then zoom to the result?
>>
>>
>>Best Regards
>>
>>Charles Young
>>Director: Business Development
>>
>>Spatial Dimension
>>Cape Town
>>South Africa
>>Tel: +2721 531 3132
>>Fax: +2721 531 4209
>>Cell: 083 679 1789
>>Web: www.spatialdimension.co.za
>>
>>ESRI Foundation Business Partner of the Year 2003
>>
>>
Take a look at mode=itemquery. Following is example HTML code to put a
"Show Map" button into a listing page. This is a bare-bones HTML
example, it can also be done with Javascript, and there are a lot of
other possible options and variations. Cut and paste the following into
a listing page.
<FORM action="/mapserver/mapserv.exe" method="get">
<input type="hidden" name="map" value="rejh/rejh.map">
<input type="hidden" name="mode" value="itemquery">
<input type="hidden" name="qlayer" value="join_region_spatial">
<input type="hidden" name="qitem" value="pidn">
<input type="hidden" name="mapext" value="shapes">
<input type="hidden" name="savequery" value="true">
<input type="hidden" name="qstring" value="12345">
<input type="submit" name="Submit" value="Show Map">
</FORM>
Explanation by line:
1. <Form .... > Open an HTML form element so we can submit to the server.
action="/mapserver/mapserv.exe" The URI to the CGI. This assumes
that
mapserver is on the same server as the calling page. If not, a
fully
qualified URI can be specified.
2. <input type="hidden" name="map" value="rejh/rejh.map">
The "map" file is mapserver's configuration file, it defines layers,
sets styles and colors, specifies paths, etc. It will always be same.
3. <input type="hidden" name="mode" value="itemquery">
Mode tells mapserver what we want it to do, in this case - draw a
map zoomed in on the specified property.
4. <input type="hidden" name="qlayer" value="join_region_spatial">
The qlayer (query layer) will highlight the selected property, we
can set the style, color,labeling, etc. with this layer.
5. <input type="hidden" name="qitem" value="pidn">
This is the column name in the mapserver database to query against.
6. <input type="hidden" name="mapext" value="shapes">
This requires a pretty lengthy eplanation. Just go with it for now.
7. <input type="hidden" name="savequery" value="true">
Here we are telling mapserver to keep the selected property
highlighted.
This is optional.
8. <input type="hidden" name="qstring" value="12345">
The value being searched for.
9. <input type="submit" name="Submit" value="Show Map">
Submit the form.
--
Richard Greenwood
www.greenwoodmap.com
More information about the MapServer-users
mailing list