Zooming not working on World Imagery Map

1650
4
Jump to solution
02-02-2014 01:55 PM
ToddBarker
New Contributor
[ATTACH=CONFIG]31055[/ATTACH]

I tried to modify the WebmapSample to display the following image from the World Imagery gallery:

http://www.arcgis.com/home/webmap/viewer.html?webmap=d802f08316e84c6592ef681c50178f17&extent=-122.57...

Based on my inspection of the URL I needed to create an AGSEnvelope object  which contains the extent parameters displayed
in the URL.

Extent Parameters:
Xmin:-122.578926
ymin:37.720084
xmax:-122.258263
ymax:37.927545

My modification of the application involved:

1. Added a string constant for the id of map of interest
2. Added AGSMapViewLayerDelegate protocol to WebmapSampleViewController.h
3. Set the WebmapSampleView controller to be the delegate object for the protocol mentioned.
3. Added the function -(void)mapViewDidLoad: (AGSMapView*)mapView in WebmapSampleViewController.m (code snippet below)

- (void)mapViewDidLoad:(AGSMapView *)mapView {               NSURL * goldengateURL = [NSURL URLWithString:@"http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"];     AGSTiledMapServiceLayer * tiledLayer = [[AGSTiledMapServiceLayer alloc] initWithURL:goldengateURL];     [self.mapView addMapLayer:tiledLayer withName:@"Tiled Layer"];          AGSSpatialReference *sr = [AGSSpatialReference spatialReferenceWithWKID:102100];     AGSEnvelope * env = [AGSEnvelope envelopeWithXmin:-122.578926 ymin:37.720084 xmax:-122.258263 ymax:37.927545 spatialReference:sr];     [self.mapView zoomToEnvelope:env animated:YES];           }


When the program is invoked the contents of the display turn black and purple. This issue was also highlighted
in the following forum post:

http://forums.arcgis.com/threads/75752-world-imagery-service-canadian-imagery-weirdly-purple

I need to know if I have modified the code correctly. I did not want to assume that it was directly related to the previous post.
Notice that I set the infrastructure for the zoom in the delegate method. I have seen other posts on resource examples that do this in the view controllers - (void)viewDidLoad method.

I am hoping there is a work around for this. I need to zoom. It would be a waste if all of this high resolution imagery could not be processed.
0 Kudos
1 Solution

Accepted Solutions
DiveshGoyal
Esri Regular Contributor
The envelope you're providing has coordinates in WGS84 (SR : 4326), but the spatial reference you're setting is web mercator (SR : 102100). Set the spatial reference to 4326, or provide coordinates in web mercator.

View solution in original post

0 Kudos
4 Replies
DiveshGoyal
Esri Regular Contributor
The envelope you're providing has coordinates in WGS84 (SR : 4326), but the spatial reference you're setting is web mercator (SR : 102100). Set the spatial reference to 4326, or provide coordinates in web mercator.
0 Kudos
ToddBarker
New Contributor
The envelope you're providing has coordinates in WGS84 (SR : 4326), but the spatial reference you're setting is web mercator (SR : 102100). Set the spatial reference to 4326, or provide coordinates in web mercator.


Thank you for your input! I set the spatial reference to 4326 and it worked 🙂

When I looked through the World Imagery specifications I saw SR = 102100.
Is there a tutorial or guide on this subject matter?
What link displays 4326?


[ATTACH=CONFIG]31104[/ATTACH]
0 Kudos
DiveshGoyal
Esri Regular Contributor
0 Kudos
ToddBarker
New Contributor
0 Kudos