Select to view content in your preferred language

Can we pass the map service (REST) URL as a URL parameter to the JS API map template?

1912
8
07-26-2011 11:02 AM
DonBarker
Regular Contributor
The ArcGIS.com (Javascript) viewer accepts a map service (REST) URL as a URL parameter, like this:

http://www.arcgis.com/home/webmap/viewer.html?url=http%3a%2f%2f129.2.24.163%2fArcGIS%2frest%2fservic...

When I try this with my locally-hosted JS API map template, nothing appears.

Can we pass the map service (REST) URL as a URL parameter to the JS API map template?

Thanks,
Don
0 Kudos
8 Replies
DonBarker
Regular Contributor
Derek,

Thanks for taking time to reply.

But my question is about passing in the REST URL as a parameter, rather than the unique id of an AGO web map.

Thanks,
Don
0 Kudos
DonBarker
Regular Contributor
Derek,

Thanks for taking time to reply.

But I don't see where the REST URL for a map service is passed as a URL parameter in either of the examples.
0 Kudos
derekswingley1
Deactivated User
The same strategy applies. After you grab the URL using esri.urlToObject(), create a dynamic map service layer and add it to the map.
0 Kudos
DonBarker
Regular Contributor
Thanks for this explanation.

So, it requires some Javascript coding.  Whereas, the example I provided for the ArcGIS.com viewer (above),

and this example of the AGXO (Silverlight) viewer

http://explorer.arcgis.com/?url=http://129.2.24.163/ArcGIS/rest/services/00_SMC_Environmental_Health...

require no scripting.  Or, please let me know if I'm missing something.

Thanks,
Don
0 Kudos
derekswingley1
Deactivated User
If you want to host it locally and/or do something not explicitly demonstrated in a sample, then yes, it requires a little code.

You're free to use the ArcGIS.com viewer or Explorer Online, though.
0 Kudos
DonBarker
Regular Contributor
Yes, these are very cool.

And a core part of our San Mateo County strategy to publish our county geodatabase map layers using AGO resources; i.e. at little or no cost besides our existing investment in ArcGIS Server and geodatabase.
0 Kudos
derekswingley1
Deactivated User
Nice. If you're interested in hosting your data on ArcGIS.com you should talk to your account rep.
0 Kudos