Method for getting the URL of current map?

495
2
05-31-2011 06:57 AM
DanBowerman
New Contributor II
Hi there,

I'm curious if there's a method in the JS API v2.2 that will return back the URL of the current state of the map?

For instance, in Google Maps, you can click "Link" at the top, and it will give you an URL that will take you directly to the map as you were viewing it, with all the appropriate parameters. (http://maps.google.ca/?ie=UTF8&ll=49.891235,-97.15369&spn=31.500974,79.365234&t=h&z=4)

Forgive me if this is a novice question... but I am a novice! Any insight would be greatly appreciated.
0 Kudos
2 Replies
HemingZhu
Occasional Contributor III
Hi there,

I'm curious if there's a method in the JS API v2.2 that will return back the URL of the current state of the map?

For instance, in Google Maps, you can click "Link" at the top, and it will give you an URL that will take you directly to the map as you were viewing it, with all the appropriate parameters. (http://maps.google.ca/?ie=UTF8&ll=49.891235,-97.15369&spn=31.500974,79.365234&t=h&z=4)

Forgive me if this is a novice question... but I am a novice! Any insight would be greatly appreciated.


esri.layers.Layer.url and esri.dijit.BasemapLayer.url will cover all the esri layers that are added to the map. Are these properties you are looking for?
0 Kudos
derekswingley1
Frequent Contributor
If you're talking about linking to a specific geographic extent and/or showing/hiding layers based on query string parameters that are part of a URL, there is not a built-in way to do that. But it can easily be coded in your app. The ArcGIS.com - Full Map sample shows how to load a web map based on a query string parameter. You could implement a similar strategy to keep track of the map's center or currently visible layers.
0 Kudos