Select to view content in your preferred language

Change spatial reference of map

7120
2
Jump to solution
07-21-2015 11:49 PM
MatejVrtich
Esri Contributor

In JSAPI v3.x it's not possible to change spatial reference of a map which has been already initialized (as a workaround we used to create a new map, set extent with the required spatial reference and copy all layers from the original map to the new one).

We do this because we need to support switching basemaps with different coordinate systems in the same app.

Is it possible to change spatial reference of a map in JSAPI v4.0?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
KristianEkenes
Esri Regular Contributor

Yes. We plan on supporting the ability to switch the Map's spatial reference in 4.0. It's not there yet, but it will be explored.

As of now, it looks like this will only be possible with Maps that have NO basemap. The SpatialReference of the map and all of the dynamic layers and FeatureLayers would reproject after changing the SpatialReference directly on the Map.spatialReference property.

map.spatialReference = new SpatialReference( {wkid: 4326} );  //or some other spatial reference object

View solution in original post

2 Replies
KristianEkenes
Esri Regular Contributor

Yes. We plan on supporting the ability to switch the Map's spatial reference in 4.0. It's not there yet, but it will be explored.

As of now, it looks like this will only be possible with Maps that have NO basemap. The SpatialReference of the map and all of the dynamic layers and FeatureLayers would reproject after changing the SpatialReference directly on the Map.spatialReference property.

map.spatialReference = new SpatialReference( {wkid: 4326} );  //or some other spatial reference object

MatejVrtich
Esri Contributor

Kristian,

Thank you for sharing.

Ideally, if I switch basemap with different spatial reference, the map should change it's spatial reference (and tiling scheme) according the new basemap. Every layer in the map should be reprojected if supported by the layer itself (I understand the on-the-fly reprojection is no supported by tiled services).

If there is no basemap in the map, it should be possible to change spatial reference of map directly on the map itself (setting the map.spatialReference property).

0 Kudos