Changing Map Projection Dynamically
Richard Greenwood
richard.greenwood at GMAIL.COM
Thu Jul 12 20:02:29 PDT 2007
On 7/12/07, Frank Warmerdam <warmerdam at pobox.com> wrote:
> 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
>
Bill,
You have a pretty interesting problem. Frank summarized the challenges
that you may encounter . If you decide to do it on the client side,
there is a JavaScript port of some of the Proj.4 code at:
http://svn.codehaus.org/mapbuilder/cscs/trunk/cscs/
that might be useful. I am particularly interested determining an
appropriate coordinate system based on location.
Please keep us posted.
Rich
--
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com
More information about the MapServer-users
mailing list