- (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]; }
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.
Start with https://developers.arcgis.com/ios/guide/geometry-objects.htm
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.