Zoom to fit

Steve Lime Steve.Lime at DNR.STATE.MN.US
Wed Dec 13 12:19:39 PST 2006


Hi Stefan: MapServer (the CGI interface) has this ability associated
with queries
which is basically what your two examples are: an attribute query and a
bbox query.

If you do a regular query and add the parameter mapext=shapes (I think
that is right)
then MapServer will compute a new extent frow the extents of the
features in the
result set. That extent is then available to a query map or simply
through the [mapext]
template substitution.

Here's an example from my test suite:

http://maps.dnr.state.mn.us/cgi-bin/mapserv46?map=%2Fusr%2Flocal%2Fwww%2Fdocs_maps%2Fmapserver_demos%2Ftests46%2Ffeaturequery%2Ftest.map&imgext=74000.000000+4654833.333333+798000.000000+5620166.666667&imgxy=149.5+199.5&program=%2Fcgi-bin%2Fmapserv46&htmlroot=%2Fmapserver_demos%2Ftests46&map_web_imagepath=%2Fusr%2Flocal%2Fwww%2Fdocs_maps%2Ftmp%2F&map_web_imageurl=%2Ftmp%2F&slayer=counties&mode=featurenquery&zoom=1&img.x=198&img.y=154&mapext=shapes

Try the URL with and without the mapext=shapes to see the difference...

Steve

>>> "Schnitter, Stefan" <Stefan.Schnitter at T-SYSTEMS.COM> 12/13/06 11:33
AM >>>
Hi all,

Is there a way to zoom automatically to fit a certain group of elements?
Example1: I have a layer which has a filter and I'd like to show that
extent that includes all filtered objects or
Example2: I use "normal" zoom interface with which the user marks a
bounding box - can I tell mapserver somehow to zoom further to fit the
objects that are actually contained in this box?

Does anyone know of some mapserver-feature or mapscript solution with
which one could accomplish somehting like this?

TIA, Stefan

--
Dr. Stefan Schnitter
T-Systems Enterprise Services GmbH, SSC ENPS, PCT11sts
Traffic Management & Network Optimization
Phone: +49 (0) 6151 937-8521



More information about the MapServer-users mailing list