Getting map extents using mode=map

Richard Greenwood richard.greenwood at GMAIL.COM
Wed Nov 17 18:44:01 PST 2004


On Wed, 17 Nov 2004 10:08:54 -0600, Randy Page
<randy.page at terraverge.com> wrote:
> Hi All,
>
> I am using MapServer CGI, and have a questing regarding mode=map.   In the
> past I have used mode=browse, which allowed me to return information such
> as the map extents and scale via the template.   However, I now need to
> switch to mode=map, and need to know if there is a way to retrieve the
> extents and scale of the image produced.
>
> Any suggestions?
>
> Thanks,
>
> Randy Page
>

When you use mode=browse (or query, itemquery, etc.) mapserv processes
the template file you have defined in your map file. Your template
file can 'request' any number of things from mapserv by way of
replacable variables (the stuff inside the [] braces) e.g. a map
image, a scale bar image, a new map extent calculated from the
request, a scale ratio, etc. Images are written to the server's hard
disk, calculations like new map extents or scale are inserted into the
template HTML file, replacing the [stuff].

mode=map is a different, and unique, mode. It returns a map image
only. The image is not written to your server's hard disk. If you need
a calculation of a new map extent or scale, you either need to do it
yourself (with client side javascript, or server side mapscript) or
you could make a second request to CGI mapserv using
mode=browser&map=off and appropriate template to retreive the newly
calculated extents. (Probably not a recommended method because you're
making 2 requests to render on page).

HTH
--
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the MapServer-users mailing list