Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am pretty new to ArcGIS Server and am building a map applications using the Javascript API. I can easily load the map layer below by adding it as a ArcGISDynamicMapServiceLayer

http://www.parkcounty.org/ArcGIS/rest/services/Roads_Map/MapServer/

As you can see there are many layers as part of the above url. What if I just want to load the roads layer as a ArcGISDynamicMapServiceLayer? I've tried replacing the above url with the road specific URL below and that does not seem to work

http://www.parkcounty.org/ArcGIS/rest/services/Roads_Map/MapServer//2

Is there something else I can do as the front end developer or is it up to those that are hosting and managing the server to create a unique url for the roads?

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

Make use of the layers property when asking for the exportmap operation from a dynamic map service.

REST API Help on Exportmap operation.

e.g.
This service was published with 3 visible layers. However, can make a request for certain layers.

  • show: Only the layers specified in this list will be exported.
  • hide: All layers except those specified in this list will be exported.
  • include: In addition to the layers exported by default, the layers specified in this list will be exported.
  • exclude: The layers exported by default excluding those specified in this list will be exported.

http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/export?layers=show:2

Also take a look at what additional behaviour you can do with the use of dynamic layers.

share|improve this answer
add comment

Check out the ESRI API Reference Page for DynamicMapServiceLayer. I believe you will want to incorporate setVisibleLayers into your code.

share|improve this answer
    
I am not going to be managing the server for this project, just building the front-end. For easier management in the future would it make more sense for all the map layers to be setup/organized differently on the backend? Eventually I will build the front end to give users controls of many layers visibility, opacity etc. –  snowgage Oct 29 '12 at 21:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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