Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw a grid onto an MKMapView

I'd like to draw a grid into my map, that represents the size of a tile at a certain zoom level. So for example I'd like to have a grid on my mapview that shows the outline of a zoom level 10 tile. So the outline of where this tile would be. No matter if the mapview itself is at zoom level 5 or 15, it should display the outline of where that tile would be placed.

The problem I have is how to calculate the proper rect that represents each visible "tile".

Any help is sooo much appreciated!!!

Or maybe the answer to following question would help:

How can I convert a MKMapRect to a MKTileOverlayPath?

like image 205
Georg Avatar asked Aug 25 '14 08:08

Georg


2 Answers

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

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

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

In the long run, replacing MapKit with Google maps gives you far more features and options and has better geolocation and reverse geolocation than Apple

like image 53
Zigglzworth Avatar answered Nov 01 '22 19:11

Zigglzworth


You can also look at Mapbox. Between using TileMill to create a grid layer by setting the Map background to a pattern image, you could then only export zoom level 10 and either host it on Mapbox or export it to MBTiles format (SQLite-based). Then one of the Mapbox mobile toolkits could serve the tiles out as an overlay on your map.

like image 1
incanus Avatar answered Nov 01 '22 18:11

incanus