SUM: [UMN_MAPSERVER-USERS] Changing Map Projection Dynamically

Bill Thoen bthoen at GISNET.COM
Fri Jul 13 16:02:28 EDT 2007


Thanks everyone for your help with my question about changing the map 
projection dynamically as one zooms into a local area. Edward Bates 
mentioned that you can pass the map_PROJECTION setting on the request 
URL (but you'll also have to set the mapext parameter to a valid setting 
in the new projection's coordinate system.)

If you open a MapServer map showing the USA in a Lambert projection and 
then append the mapext and map_PROJECTION parameters  (escaping spaces 
and '=' signs) like so:
&mapext=-122%2030%20-75%2050&map_PROJECTION=proj%3dlatlong%2cellps%3dWGS84%2cdatum%3dWGS84
to the request URL, you can change the projection on the fly.

As Frank Warmerdam pointed out this will involve a bit of work to 
calculate the region limits in the new coordinate system. To do that on 
the client side, Richard Greenwood suggested a JavaScript port of some 
of the Proj.4 code at:
 http://svn.codehaus.org/mapbuilder/cscs/trunk/cscs/, and to handle it 
on the server side, Jan Hartmann suggested coding the solution with 
PHP/MapScript code and to install PostGIS and the EPSG database 
(http://docs.codehaus.org/display/GEOTOOLS/How+to+install+the+EPSG+database+in+PostgreSQL)

The problem is bigger than I want to tackle right now, but for the 
meantime I can probably use something like what Bates' suggested in the 
form of a list of pre-selected URLs in a select control that lists a 
collection of fixed views for various locations and scales.

- Bill Thoen



More information about the mapserver-users mailing list