AnsweredAssumed Answered

AGSMapView zoomToEnvelope does not zoom as expected

Question asked by j.eyreesri-ch-esridist Employee on Sep 17, 2014
Latest reply on Sep 23, 2014 by j.eyreesri-ch-esridist

I am developing an app where I have a small map in a view. I have two points on the map, and I would like to zoom to those two features. I have tried the following, but the map does not zoom to the expected extent.


    AGSGeometryEngine* engine = [AGSGeometryEngine defaultGeometryEngine];

    AGSPoint* gpsPoint = (AGSPoint*)[engine projectGeometry:currentLocation


    NSArray* geometries = [NSArray arrayWithObjects:gpsPoint, point, nil];

    AGSMutableMultipoint* multipoint = (AGSMutableMultipoint*)[engine unionGeometries:geometries];

    AGSEnvelope* envelope = multipoint.envelope;


    [self.mapView zoomToEnvelope: envelope animated:NO];


The two points (gpsPoint and point) make an envelope that is wide but not very high.  The map in the view is pretty much a square. When I call the zoomToEnvelope, I get an extent which does not show my features. It is a small envelope somewhere between my features. I do not see the features on the map.


Is there a function which allows me to zoom to an envelope, that will automatically expand itself to an envelope which contains the whole envelope I desire to zoom to?