Changing Map Projection Dynamically

Frank Warmerdam warmerdam at POBOX.COM
Thu Jul 12 14:49:53 EDT 2007


Bill Thoen wrote:
> This has probably been asked before, but I can't find any info on it. 
> Basically, I'd like to know how to change the map projection in 
> MapServer as I zoom in to a larger scale map view. Specifically, I start 
> at a national scale using a Lambert projection, but when I zoom into a 
> state scale, I'd like to choose a more appropriate projection (like 
> State Plane).
> 
> Can this be done easily with a map file or an HTML template? What's the 
> best way to solve this problem?

Bill,

I likely shouldn't speak up since I don't really know the best way to do
this.  But I do not believe it can be done entirely from the server side
with mapserv cgi and a map file.  Either you would have to have a mapscript
application on the server that decided at some point to switch projections
or you would have to engineer all the logic on the client side.

With WMS you can request specific projections using the SRS (or CRS?)
item in the request.  With the non-OGC "classic" mapserver interface
there is also a way of overriding the map projection which I think has
been recently discussed on this list though I don't know the exact
details.

But one important thing to remember is that the region requested is going
to have to match the projection which means there has to be quite a bit
of smarts either in the client (to change the coordinate system of the BBOX)
or in a mapscript script on the server to reproject the requested box into
the alternate projection.  And in that case the returned window won't
be exactly what was requested.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list