开发者

iOS: Using vector data in MKOverlay in MapKit

I'd like to overlay a custom map using MapKit. I've currently implemented the TileMap sample from WWDC10. However, my overlay map is in vector form (pdf) and it seems like a terrible waste to rasterise it and convert it to tiles (also takes up about 10megs as opposed to 300KB).

Is there a开发者_如何学C way to either:

a) overlay a pdf using MKOverlay, or

b) easily convert a vector graphic into MKPolygons, lines etc., so I can recreate my overlay map in MapKit?

Notes: The map I'm trying to overlay is pretty simple but geographically huge. It does need to work offline.


You can overlay a PDF using MKOverlay. In the drawMapRect:zoomScale:inContext: method of your MKOverlayView just use standard PDF drawing functions. You can find those functions here.

The problem with this approach is that for each maprect that is sent to that drawing method you will have to draw the entire PDF each time. This will be really slow. I think you will see the best performance by rasterizing the PDF and converting it to tiles. 10 MB is not too large of a dataset to ship with an iOS app.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜