Search code examples
iosswift3mkmapviewmapkitzooming

How do I achieve the maximum zoom level in iOS mapKit?


I'm aware of this post: How to get to the max zoomlevel on iOS MKMapView

And it seems to be exactly what I need to solve the problem, however, the technique does not work for me.

If I set the eyeAltitude at 50, or even 100, I get the same map zoom returned. However, once the map is displayed, I can pinch to zoom to the desired zoom level. is there a solution to programmatically achieve the pinched in zoom level at the initial load of the map view?

EDIT: I've tried using setRegion but the problem seems to be related to using .satelliteFlyover specifically. I need to use .satelliteFlyover due to the difference in image quality. Further EDIT: I've also discovered that the simulator seems to give a different 'native zoom' than when it runs on my device. I hope someone reads this that can provide insight!!

the code I'm using is:

let greenLocation:CLLocationCoordinate2D = CLLocationCoordinate2DMake(CLLocationDegrees(greenX),CLLocationDegrees(greenY))
        let altitude:CLLocationDistance = 80
        self.greenMap.mapType = .satelliteFlyover
        let camera = MKMapCamera(lookingAtCenter: greenLocation, fromEyeCoordinate: greenLocation, eyeAltitude: altitude)
        self.greenMap.setCamera(camera, animated: true)

Solution

  • I solved this by... using a different SDK for mapping. What I found through continued testing is that appleMaps doesn't always have the imagery down to the specific zoom level, and seems to get tripped up when you zoom in ultra close. on some locations it would zoom perfectly, and others it would not - an inconsistency that as a developer you may want to be weary of. googleMap had higher quality imagery and no issues with zoom consistency.