2

I'm trying to create a solid clustering mechanism using a subclass of an MKMapView. I came across a task that have I've been banging my head against the wall for quite some time now - grouping annotations into a single cluster when they're overlapping with one another. I can get the distance in meters between two annotations, but how can I get that distance relative to a zoom level (latitudeDelta)? Ideally I would like to know when two annotations overlap with each other considering their width and height for example are 40x40.

4

1 に答える 1

4

convertCoordinate:toPointToView:注釈の実際のスクリーン ポイントの位置を取得するために使用できます。

CGPoint annotationPoint = [self.mapView convertCoordinate:annotation.coordinate 
                                            toPointToView:self.mapView];

その後、三角法のスキルを使用して、2 点間の距離を見つけます。

于 2013-05-03T09:31:08.833 に答える