Projecting image on map

1486
2
Jump to solution
05-12-2014 06:49 AM
SjorsProvoost
New Contributor II
I have an image which I would like to project on a map at a certain coordinate, scale and rotation. For example the image might by 1000 by 1000 pixels and represent an area the size of 0.01x0.05 decimal degrees, oriented north to keep things simple. It's transparant so I want to see the base map below it.

I tried using a AGSPictureMarkerSymbol but it displays the image with a fixed number of pixels, regardless of zoom level. So it would look as big as the earth or as small as a house, rather than a fixed 0.01x0.05 decimal degrees.

    AGSPictureMarkerSymbol *symbol = [AGSPictureMarkerSymbol pictureMarkerSymbolWithImageNamed:@"SomeObject"];      double lat =  55.0;     double lon = 5.0          AGSMutablePolygon *area = [[AGSMutablePolygon alloc] initWithSpatialReference:[AGSSpatialReference wgs84SpatialReference] ];     [area addRingToPolygon];     [area addPointToRing:[AGSPoint pointWithX:lon y:lat spatialReference:nil]];     [area addPointToRing:[AGSPoint pointWithX:lon + 0.01 y:lat spatialReference:nil]];     [area addPointToRing:[AGSPoint pointWithX:lon+0.01 y:lat + 0.005 spatialReference:nil]];     [area addPointToRing:[AGSPoint pointWithX:lon y:lat + 0.005 spatialReference:nil]];     [area closePolygon];          AGSPoint *webMercatorArea = (AGSPoint *)[[AGSGeometryEngine defaultGeometryEngine] projectGeometry:area toSpatialReference:[AGSSpatialReference webMercatorSpatialReference]];      AGSGraphic *previewGraphic = [AGSGraphic graphicWithGeometry:webMercatorArea symbol:symbol attributes:nil];        [self.documentGraphicsLayer addGraphic:graphic];


I also tried using AGSPictureFillSymbol. This at least prevents the image from drawing outside the specified area on the map, but the scale is still wrong.

AGSPictureFillSymbol *symbol = [AGSPictureFillSymbol pictureFillSymbolWithImageNamed:@"SomeObject"];


I'm probably using the wrong approach here.
0 Kudos
1 Solution

Accepted Solutions
DiveshGoyal
Esri Regular Contributor
Yeah, the picture marker symbol resizes to original size after you finish zooming in/out. What you really want to do is georeference an image on the map. This is covered in this forum post - http://forums.arcgis.com/threads/60285-How-do-I-create-a-layer-that-is-generated-from-an-image

There is also a custom layer that we wrote as a demo that does this for you -
https://github.com/Esri/tips-and-tricks-ios/tree/master/UC2013_TipsAndTricksDemos/CustomDynamicLayer

View solution in original post

0 Kudos
2 Replies
DiveshGoyal
Esri Regular Contributor
Yeah, the picture marker symbol resizes to original size after you finish zooming in/out. What you really want to do is georeference an image on the map. This is covered in this forum post - http://forums.arcgis.com/threads/60285-How-do-I-create-a-layer-that-is-generated-from-an-image

There is also a custom layer that we wrote as a demo that does this for you -
https://github.com/Esri/tips-and-tricks-ios/tree/master/UC2013_TipsAndTricksDemos/CustomDynamicLayer
0 Kudos
SjorsProvoost
New Contributor II
Thanks! That should help me get started. Is there a guide for when I want to do more advanced stuff with a AGSDynamicLayer subclass?

For example the layer would contain multiple images for different locations, the images might overlap, the images need to be rotated and perhaps it makes sense to adjust their resolution based on the zoom level.

For now I just need to make a proof of concept with a single image, so I can do that with the example in Github you pointed me to.
0 Kudos