AnsweredAssumed Answered

How do I create a layer that is generated from an image?

Question asked by nalenb on Jun 18, 2012
Latest reply on Dec 31, 2013 by somnuslee1988
I'm trying to add an overlay image to the map in iOS. The iOS MapKit allows me to specify an overlay image to use on top of the map and that's what version 1.0 of my app did. I've changed to use the ArcGIS maps and I want to add the same type of overlay.

I'm able to create the AGSMapView and add it to my view and everything works fine. I'm able to add a graphics layer and add some symbols with callouts just fine too.

I have the image retrieved from the server and I know the envelope of the affected area where I want to overlay the image. I'm just not sure how to add a given image to the map. I've tried:

- Create a custom tiled layer - but after reading a blog post on esri it seemed to indicate that images should use the dynamic layer

- Create a custom dynamic layer - I subclassed AGSDynamicLayer. My subclass returns the right envelope, spatial reference, units and initial envelope. I'm also defining exportMapImage but I don't know what should go in that method. I'm creating a subclass of NSOperation which implements AGSDynamicLayerDrawingOperation but it doesn't seem to do anything. I'm also calling [self.exportDelegate dynamicLayer:self exportMapImageOperation:operation didFinishWithImage:self.mapImage]; in exportMapImage. I can see my method get called and the image and parameters seem good. But no image shows on the map (I've added my custom dynamic layer to the AGSMapView).

- Create a new graphic layer - I created a graphics layer and added my image to it using AGSGraphic graphicWithGeometry:graphicRect symbol:graphicSymbol attributes:graphicAttributes infoTemplateDelegate:self]; where the graphicRect is bounds of my image envelope and the graphicSymbol is [AGSPictureMarkerSymbol pictureMarkerSymbolWithImage:mapImage]; - This does put my image on the map, but it's not scaling correctly when I zoom or move the map. I want it to remain in the specified rectangle even when the map is moved or zoomed.

I'm not sure what direction I should take, I feel like I'm not going about this the right way.

Here's an example of what I want to do:
- go to
- on the left, pick AZ - Avondale from the Jump To City dropdown
- on the left, check the box in front of density map under the Analytic Layers section.
- the image the shows up on the map is the image I'm retrieving from the server and want to add on top of the map on the iPhone/iPad