Understanding zoomToEnvelope

Discussion created by doldev on May 17, 2011
Latest reply on Jun 27, 2011 by muratdzhusupov

I currently developing a iOS app for a botanical garden. Thx to ESRI and there well done iOS framework. It's well documented and easy to use.

During my programming I came across a strange behavior. If the AGSEnvelope has a quite small difference from xmin to xmax, but a lot bigger difference between ymin and ymax, the map will be aligned only on x direction, if I'm using zoomToEnvelope. The ymin and ymax value will not be at the edge of the mapview. Do I'm understand something wrong with the zoomToEnvelope.
This happens only, if I'm using the custom tiled layers ( and a scale of approx. 1:300 - 1:600.
My understanding of zoomToEnvelope is, that the mapView will enclose the envelope. But currently, it will only adjust to one value (xmin and xmax).
Without the custom tiled layers it works as expected. Could it be, that the calculation of the  zoomToEnvelope only works until a certain zoomLevel (scale). I've added my own scale levels: 1:1500, 1:1000, 1:600, 1:300 for a small area.
Btw: The spacial references are all the same. wkid = 102100

I could add a special zoom function, that will calculate an envelope from a existing envelope relative to the current mapView screen size. Not sure, if this is not already implemented.

I can provide more code, if needed.
AGSSpatialReference *wgs102100 = [AGSSpatialReference spatialReferenceWithWKID:102100];
AGSEnvelope*   envPoly = [AGSEnvelope envelopeWithXmin:843900

Thanks for your advice.