开发者

MKMapView tile-based overlay

I want to draw a tile-based overlay on top of a MKMapView, but there's n开发者_如何学Pythono obvious way to do this.

This appears to be tricky since you can zoom to any level with MKMapView (unlike Google Maps).

Has anyone attempted to do this?


Incase this question is still getting views readers should check out the HazardMap and TileMap demo code from WWDC2010.


I'm working on a game where I need to overlay objects on the map and have them scroll and zoom with the map.

Using annotation views I've been able to solve the first problem and partially solve the second problem. Annotations automatically move with the map. For scaling them, I use the mapView:regionDidChangeAnimated: delegate method to resize my annotations after a zoom event. The problem is that the annotations don't rescale until after the zoom gesture is complete.

I can think of two approaches other than filing a bug with Apple requesting that they provide an API for map overlays:

  1. Put a (mostly invisible) view over the top of the MKMapView that intercepts zoom and scroll events, handles them, and passes them on to the map view.

  2. Customize the open-source RouteMe library with tiles from Open Street Map or CloudMade (the former is slow, the latter costs money). But it's fully open source so you should be able to do overlays to your heart's content. You could also run your own tile server that does the tile overlays on the server.


Something I discovered later:

http://www.gisnotes.com/wordpress/2009/10/iphone-devnote-14-drawing-a-point-line-polygon-on-top-of-mkmapview/

Not quite a tile-based solution, but interesting nonetheless.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜