Tuesday, June 14, 2016

[iOS] How to zoom in iOS map more than zoom level 21

As we know you can only zoom in to zoom level 20 before iOS 9, zoom level 21 has been supported since iOS 9.

Actually you can zoom in the iOS map to zoom level 21 more,  in that case, the background map (building and road) will not be shown any more, but all labels are kept and the coordinate (latitude/longitude) system works properly on it as well, here is the steps to do it:

1. Add world wide overlay on top of map and road and bottom of labels
Overlay:
MKMapPoint corners[4];
        corners[0] = MKMapPointMake(MKMapRectGetMaxX(MKMapRectWorld), MKMapRectGetMaxY(MKMapRectWorld));
        corners[1] = MKMapPointMake(MKMapRectGetMinX(MKMapRectWorld), MKMapRectGetMaxY(MKMapRectWorld));
        corners[2] = MKMapPointMake(MKMapRectGetMinX(MKMapRectWorld), MKMapRectGetMinY(MKMapRectWorld));
        corners[3] = MKMapPointMake(MKMapRectGetMaxX(MKMapRectWorld), MKMapRectGetMinY(MKMapRectWorld));

        MKPolygon *instance = [MKPolygon polygonWithPoints:corners count:4];
Render:
MKPolygonRenderer *renderer = [[MKPolygonRenderer alloc] initWithPolygon:overlay];
        renderer.fillColor = [UIColor clearcolor];
        renderer.lineWidth = 0.0;

        renderer.strokeColor = renderer.fillColor

2. Add another overlay on top of it which can be zoom in/out (just like a PDF or something)


After finish that when you zoom in/out on the map you will see the altitude of camera could be as low as 6 meters, but the iOS map disappears once the altitude of camera less about 202 meters.

No comments:

Post a Comment