Select to view content in your preferred language

Displaying callouts

2682
4
Jump to solution
11-09-2012 02:48 PM
PhilippFauser
Emerging Contributor
Hi,

I want to display callouts on my map.
The map and the layer for the graphic objects is displayed with this code:
NSString* passauStreetMapUrl = @"http://www.geoportal.passau.de/ArcGIS/rest/services/STADTPLAN/MapServer"; NSString* passauPoiLayerUrl = @"http://www.geoportal.passau.de/ArcGIS/rest/services/APPDATEN/MapServer"; NSString* worldMapUrl = @"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer";  //set this class as the delegate for the callout (popups)     self.mapView.calloutDelegate = self;          //set this class as the delegate for the mapview     self.mapView.layerDelegate = self;              //set wrap around vor the world map view     self.mapView.wrapAround = YES;          //create url     NSURL* urlPassauMap = [NSURL URLWithString: passauStreetMapUrl];     NSURL* urlPassauPoiLayer = [NSURL URLWithString: passauPoiLayerUrl];          //create tiled(PassauAirMap) and dynamic(PassauMap with layers) maps     self.layerPassauMap = [AGSDynamicMapServiceLayer dynamicMapServiceLayerWithURL: urlPassauMap];     self.layerPassauPoi = [AGSDynamicMapServiceLayer dynamicMapServiceLayerWithURL: urlPassauPoiLayer];          //add maps to view     self.lyrView = [self.mapView addMapLayer:self.layerPassauMap withName:@"layerPassauMap"];     self.lyrView = [self.mapView addMapLayer:self.layerPassauPoi withName:@"layerPassauPoi"];          //set certain layers of the PassauMap to visible     self.layerPassauPoi.visibleLayers = [NSArray arrayWithObjects:[NSNumber numberWithInt:0], nil];


Now I want to add callout to the graphic objects on self.layerPassauPoi.
Is it possible to get the graphic objects out of the layerPassauPoi.visibleLayers (AGSDynamicMapServiceLayer) array and set the "infoTemplateDelegate" on these graphic objects? Or maybe not from the visibleLayers-array but from an other part of the AGSDynamicMapServiceLayer?
Or is this approach completely wrong?

It would be great if someone could give me a little hint!:)

______
Philipp
0 Kudos
1 Solution

Accepted Solutions
NimeshJarecha
Esri Regular Contributor
Yes, you are correct. You've to use AGSFeatureLayer if you want your tap to recognize graphic and show callout/popup.

Regards,
Nimesh

View solution in original post

0 Kudos
4 Replies
PhilippFauser
Emerging Contributor
Okay, I think I'm gonna rephrase my question:

First: I add a layer to my mapView. On this layer I use the layer.visibleLayers array to display the sub-layer (these are certain points of sights on the map)

Second: Now I want to show a popup window if the user clicks on a sight point.

Now my question:
Is "Second" possible with the method I display the points on the map (described in "First")?
The API about layer.visibleLayers says "The sub-layers to be included in the map image exported by the map service.". Does that mean the sight points are no extra graphics but included in the map image, so a click on a sight point is not recognized?

If all answers are "No": How can I achieve this functionality with other methods?
0 Kudos
PhilippFauser
Emerging Contributor
And the answer is "No"! 😉
I have to use an AGSFeatureLayer instead of the AGSDynamicMapServiceLayer.
0 Kudos
NimeshJarecha
Esri Regular Contributor
Yes, you are correct. You've to use AGSFeatureLayer if you want your tap to recognize graphic and show callout/popup.

Regards,
Nimesh
0 Kudos
DiveshGoyal
Esri Regular Contributor
Check out our latest sample showing how to display popups.
0 Kudos