Basic zooming issue.

2873
1
Jump to solution
09-20-2015 05:28 PM
SyedMahmud
New Contributor

Hi, I'm trying to use esri map for the first time in my iOS app POC. I have instantiated the map object but I seem to have a problem zooming to user current location using AGSEnvelope object. Here is code:

CLLocation *location = self.myLocationManager.location;

float extentDelta = 0.025;

AGSEnvelope *envelope = [AGSEnvelope envelopeWithXmin:(location.coordinate.longitude - extentDelta)

   ymin:(location.coordinate.latitude -  extentDelta)

   xmax:(location.coordinate.longitude + extentDelta)

   ymax:(location.coordinate.latitude +  extentDelta)

   spatialReference:[AGSSpatialReference wgs84SpatialReference]];

  [self.ibMapView zoomToEnvelope:envelope animated:YES];

It is zooming into North Sea near UK. I am sure the CLLocation is coming with my current location. Please help.

0 Kudos
1 Solution

Accepted Solutions
GagandeepSingh
Occasional Contributor II

Can you double check the spatial reference of the map view? This usually happens if the the spatial reference of the envelope is different from the map view.

Also, you should look into this sample​, it shows you how to use `AGSLocationDisplay` to achieve the same result.

View solution in original post

0 Kudos
1 Reply
GagandeepSingh
Occasional Contributor II

Can you double check the spatial reference of the map view? This usually happens if the the spatial reference of the envelope is different from the map view.

Also, you should look into this sample​, it shows you how to use `AGSLocationDisplay` to achieve the same result.

0 Kudos