SteBra SteBra - 6 months ago 24
Swift Question

How to Set Map Zoom Settings to 20 - Skobbler map

I want to zoom in on the map as much as possible when the app starts.

Right now, I can zoom in only to level 16, and then I have to manually pinch to zoom even more.

SKRoutingService.sharedInstance().mapView?.animateToZoomLevel(16.0)


What I've tried but didn't work out was to set up mapZoomLimitmax to 20.0:

SKRoutingService.sharedInstance().mapView.settings.zoomLimits.mapZoomLimitMax = 20.0
SKRoutingService.sharedInstance().mapView?.animateToZoomLevel(20.0)


But that didn't work.
I see the entire planet Earth after I do this.

I know that there must be a way for zooming in more than level 16, because I can pinch-to-zoom after I zoom it in on level 16 programatically.

How can I achieve that?

Answer

The max zoom level is 18.999001 (although in the SkDefinitions header file it's indicated that kMaximumZoomLimit has a value of 19.0f I found that setting the zoom level to 19.0 did not really work, whereas 18.999001 worked).

At most what you can do is:

mapView.animateToZoomLevel(18.999001)

The mapZoomLimitMax should be 19.0 (leaving this property untouched also worked in my case). Setting it to higher values won't change anything.

Comments