1

I am a newbie and I am looking to persist the map extent across sessions so that it can be loaded instead of the default extent.

I believe what I need to do is to store the extent in a cookie after every map extent change. Then when the user reloads the page, set the map extent to the extent last saved. I came across the 'onExtentChange' event as well as the read only property map.extent and map.SetExtent.

What is the difference between using the event or using the map.Extent method? Can someone please explain?

1 Answer 1

3

onExtentChange is an event that is run every time the user changes the extent in your map (you add a dojo listener for this event, which then runs the rest of your code)

map.extent is the value of the current value of the view-extent in the map (which you would be saving everytime the onExtentChange event is fired

and lastly map.setExtent is the function used to set/change the maps extent, e.g. from a cookie

take a look at this example on the arcgis developer site: showing current map extent

2
  • Ok thanks for the info. Got it to work now after going through the link and your description. Thanks much.
    – Aqua267
    Commented Apr 9, 2014 at 16:35
  • 1
    @Aqua267 please mark weaverk's answer as the answer to this thread. Commented Apr 10, 2014 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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