iPhone 的 MapKit 是否可以实现图块叠加
我已经设置了一个图块源以与 Google Maps JavaScript API 一起使用。我正在尝试将其翻译为与 iPhone MapKit 一起使用。我已将 javascript 缩放级别正确实现到 Mapkit 中。每当调用 - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
时,我都会根据相同的中心点将区域捕捉到最近的缩放级别。
是否可以使用 CATiledLayer 来实现平铺解决方案。 iPhone 是否像谷歌地图一样使用标准的 256x256 图块?对此的任何指导或帮助将不胜感激。如果不可能的话,我宁愿不浪费几周的时间来尝试实现这一点。
I already have a tile source set up for use with the Google Maps JavaScript API. I am trying to translate this for use with the iPhone MapKit. I have correctly implemented the javascript zooming levels into mapkit. Whenever - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
is called, I snap the region to the nearest zoom level based on the same center point.
Is it possible to implement a solution possibly with CATiledLayer to implement a tiling solution. Does the iPhone use the standard 256x256 tiles like google maps does natively? Any direction or help on this would be greatly appreciated. I would rather not waste a couple weeks trying to implement this if it's not possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
FWIW,我花了相当多的时间寻找一个像样的解决方案......在深入研究 CATiledLayer 示例之前,我注意到 MKOverlay 和 MKOverlayView ——它们是 iOS 4 中的新功能,可以直接插入 MKMapView。
找不到使用 MKOverlays 提取任意图像数据(例如,来自远程图块服务器的 UIImages)的良好示例实现,但我对 API 进行了足够的修改,直到它正常工作。
构建了一个简单的示例实现,以防任何人(像我)想要参考:
http://github.com /mtigas/iOS-MapLayerDemo
希望这对将来的人有所帮助。
FWIW, I spent quite a bit of time looking for a decent solution… before diving into a CATiledLayer example, I noticed MKOverlay and MKOverlayView — which are new in iOS 4 and plug right into a MKMapView.
Couldn’t find a good example implementation of using MKOverlays that pull arbitrary image data (say, UIImages from a remote tile server), but I tinkered around with the API enough until I got it working.
Built a simple example implementation of it in case anyone (like me) wants a reference:
http://github.com/mtigas/iOS-MapLayerDemo
Hope this helps someone out in the future.
MapKit 没有提供太多自定义图块源的方式(事实上,它完全没有提供任何自定义源:您要么使用 Google 地图,要么不使用)。不过,我自己也一直在处理类似的问题,并且我发现 RouteMe 对于自定义地图来说是一个非常好的解决方案:http://code.google.com/p/route-me/
内置支持 OpenStreetMaps、OpenAerialMaps(目前处于离线状态)、Virtual Earth 和 Yahoo Maps,但该框架也使得插入您自己的图块源变得非常容易。
MapKit doesn't provide much in the way of custom tile sources (in fact, it provides absolutely nothing to customize sources: you either use Google Maps or you don't). I've been working with a similar problem myself, though, and I've found RouteMe to be a pretty good solution for custom maps: http://code.google.com/p/route-me/
Built-in support exists for OpenStreetMaps, OpenAerialMaps (which is currently offline), Virtual Earth, and Yahoo Maps, but the framework makes it pretty easy to plug in your own tile source, too.
是的,从 iOS 7 开始,MKTileOverlay 会这样做:
https ://developer.apple.com/library/ios/documentation/MapKit/Reference/MKTileOverlay_class/Reference/Reference.html
Yes, since iOS 7, MKTileOverlay will do:
https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKTileOverlay_class/Reference/Reference.html