Draw a grid on MKMapView

I would like to draw a grid on my map that represents the size of a tile with a specific zoom level. So, for example, I would like to have a grid on my map that shows a 10th level diagram of the zoom level. So, the outline where this tile will be. Regardless of whether the image of the image itself will be at the 5 or 15 zoom level, it should display the outline where this tile will be placed.

The problem is how to calculate the correct rectangle that represents each visible tile.

Any help is greatly appreciated!

Or maybe the answer to the following question will help:

How to convert MKMapRect to MKTileOverlayPath?

+6
source share
2 answers

I find that MapKit is too limited when you want to start more and more with maps.

I would recommend using the Google Maps SDK for iOS: https://developers.google.com/maps/documentation/ios/start

and then using GMSTileLayer for snippets: https://developers.google.com/maps/documentation/ios/reference/interface_g_m_s_tile_layer

Ultimately, replacing MapKit with Google maps gives you more options and capabilities, as well as better geolocation and reverse geolocation than Apple.

+1
source

You can also see Mapbox . Between using TileMill to create a mesh layer by setting the Map background to a template image, you can only export a scale of 10 and either place it on a Mapbox or export to MBTiles (based on SQLite). Then one of the Mapbox mobile sets could serve the tiles as an overlay on your map.

+1
source

Source: https://habr.com/ru/post/974296/


All Articles