3

I've got a new requirement to switch basemaps that have different spatial references. The app is using ArcGIS Javascript, and switching to Silverlight is not an option at this point in development. I saw this question from 2 years ago and was hoping there was an alternative. Is there an easier way to change basemaps that have different spatial references in 3.6?

3

The basemap defines the spatial reference of the map; changing the basemap and its spatial reference could cause unintended issues. Some possible alternatives are:

  1. Destroy and recreate the map with the new basemap and load any other layers. You would want to be sure you destroy all handlers and other objects before recreating the map to avoid memory leaks.

  2. Create a new map with the new basemap. If you want to switch back and forth, keep the old map; otherwise destroy it.

  3. Insert the new basemap as a layer just above the basemap in the display order. The new layer would be warped to the map's spatial reference, which might slow down your map and look kinda crappy depending on the layer's contents.

  • With option 2, how would the event handlers work? Would I need to disconnect them from the first map, before connecting them to the second? Or is this a non-issue when the first map gets hidden? – Jaq Sep 20 '13 at 15:33
  • 1
    It might take up a litle more memory, but you could add event handlers to both maps (onClick, etc). If the first map is hidden, click events on it are a non-issue. – raykendo Sep 20 '13 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.