Adding Map Layers

1183
12
06-14-2010 06:17 AM
JeffPapirtis
New Contributor III
Since ESRI documentation on the Beta SDK is still a work in progress, can any one give me some help on adding individual map layers from a rest service?  I am pretty solid on adding the map service from the documentation thus far, but am not exactly sure on how to impelement individual layers within the map.

Ex: basemap rest service
(3) = roads

"http://server.maphost_example/ArcGIS/rest/services/basemap/MapServer/3"

I just want to add one layer from my map service.

Any Ideas?

Thanks in advance!
0 Kudos
12 Replies
DarrenMackiewicz
Occasional Contributor
My question is :
Do you have to remove the entire DynamicMapLayer each time you want to change the visible layers on the fly? (as in, I've already created the dynamicmaplayer and added it to the mapView.Now I want to make a change to the visible layers in the middle of running the app)

So, Do I have to do this entire process of removing the layer either by reset or removing it by name, recreating it, and adding it back in?

[self.mapView reset];

Then rebuild the AGSDynamicMapServiceLayer  and addit to the 

    self.baseDynamicLayer = [[[AGSDynamicMapServiceLayer alloc] initWithMapServiceInfo:bms]autorelease];
   
    self.baseDynamicLayer.visibleLayers = [NSArray arrayWithObjects:[NSNumber numberWithInt:2], nil];

[self.mapView addMapLayer:baseDynamicLayer withName:@"baseLayer"];


Or - is there a better way I can accomplish changing visible layers without REMOVING the AGSDynamicMapServiceLayer from the mapView and adding back in ?
0 Kudos
NimeshJarecha
Esri Regular Contributor
No, you do not need to remove the layer and add it back in order to change the visibleLayers. Just setting the self.baseDynamicLayer.visibleLayers with desired visible layers is enough.

Regards,
Nimesh
0 Kudos
DarrenMackiewicz
Occasional Contributor
Confirmed.
Thanks Nimesh!
0 Kudos