0

我正在开发一个允许用户在地图上选择位置的应用程序。整个地图被细分为不规则区域(行政边界),当用户触摸地图上的一个点时,我需要能够弄清楚该点属于哪个区域。澄清一下,没有可供用户选择的有限点集,他们只需点击地图上的任意位置。

实现这一目标的最佳方法是什么?我一直在MKPolygon上课,但无法真正弄清楚这是否是要走的路。如果是,我会使用协议的intersectsMapRect:方法MKOverlay来检查匹配吗?有没有关于这种地图操作的好教程?

4

1 回答 1

1

A good approach here might be the MapBox iOS SDK and it's RMInteractiveSource, which is designed for this. Check out this sample app which shows interactive regions.

This is done by a space-optimized, offline-capable key-value store of sorts that keys pixels at varying zoom levels to arbitrary content values (region name, data, imagery, etc.)

In MapKit proper, you'll need some sort of spatial analysis (maybe Spatialite?) to determine intersections between points touched and irregularly-shaped regions.

于 2013-10-16T16:25:55.853 回答