[OpenLayers-Users] Changing the srs of a map

Eric Lemoine eric.lemoine at camptocamp.com
Fri Feb 19 03:54:20 EST 2010


On Friday, February 19, 2010, Christopher Schmidt
<crschmidt at metacarta.com> wrote:
> On Thu, Feb 18, 2010 at 11:25:39PM +0100, Andreas Hocevar wrote:
>> Phil Scadden wrote:
>> > I am wanting to change the SRS of map "on the fly", (largely dependent
>> > on what imagery is selected am using as a backdrop). Can you just change
>> > it for an existing map or do you have to destroy the map and recreate
>> > with a the new srs?
>>
>> If your backdrop is a base layer, and configured with the right srs, the
>> map will automatically switch to the srs that is configured for the base
>> layer.
>
> Sort of. Vectors loaded statically won't reproject.

+ I think one needs to reconfigure the overlays, i.e. set the
projection, recalculate min/maxResolution, etc.

We, at Camptocamp, have been working on a SelectZone control. This
control allows switching to a new geographic zone, with a new
projection, max extent etc. Switching zone can be done manually using
control.select(newzone) or automatically on zoom in/out.

See the example
<http://trac.openlayers.org/browser/sandbox/elemoine/reproject/examples/reproject-map.html>.
The example includes the code of the Control.

This control relies on three OpenLayers patches, see #2360, #2427, and
#2359. I think these patches could be useful for other "reproject map"
implementations than our SelectZone control.

Also, note that the control doesn't currently support reprojecting
vectors, but adding that shoudn't be a problem.

And FYI we've been thinking about making the SelectZone an OpenLayers
addin, but we haven't gotten to that at this point.

Cheers,



-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list