开发者

mapkit annotation error correction on iphone

i have 4 annotation with same lat/long as they are pointing some location in 1 building , since they share common lat/long so i can show only one of them on map?? so is there a开发者_运维百科ny way to use some error correction so that i can show them Lil side by side??

here is my annotation code

MKCoordinateRegion SecondRegiona;
SecondRegiona.center.latitude = 111.31888;
SecondRegiona.center.longitude = 203.861;

MyAnnotation *aSecondAnnotationa = [[[MyAnnotation alloc] init]autorelease];
aSecondAnnotationa.title = [listItems objectAtIndex:15];//@"3rd Annotation";


aSecondAnnotationa.subtitle = [listItems objectAtIndex:16];
aSecondAnnotationa.coordinate = SecondRegiona.center;


Why would you expect the platform to position something someplace different than where you told it to place it? That certainly sounds undesirable and not something that I would call "Error Correction"

You need to detect that state and do something reasonable like coalesce them into a single custom annotation or adjust the lat lngs to position them nearby according to your needs.


I would detect whether points are really close together (maybe use the distance formula to see how close points are?) and use - (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view to get CLLocationCoordinate2D of a point close to the original pin (say, 3 pixels to the right, 3 pixels down). You would use this CLLocationCoordinate2D to display the new, "adjacent" point.

As for what "coalesce" means, Nick means to merge points together -- take points that are really close to each other and display only one to represent the close points. I guess this isn't what you're looking for though.

Hope this helps!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜