Authored by Obrand69

Added method for retrieving a marker's lat/lon coordinate

added sample code in MapViewViewController
... ... @@ -61,7 +61,9 @@
NSLog(@"Marker mercator location: X:%lf, Y:%lf", point.x, point.y);
CGPoint screenPoint = [mapView getMarkerScreenCoordinate: aMarker];
NSLog(@"Marker screen location: X:%lf, Y:%lf", screenPoint.x, screenPoint.y);
CLLocationCoordinate2D coordinates = [mapView getMarkerCoordinate2D: aMarker];
NSLog(@"Marker Lat/Lon location: Lat:%lf, Lon:%lf", coordinates.latitude, coordinates.longitude);
[mapView removeMarker:aMarker];
}
... ...
... ... @@ -121,5 +121,6 @@ enum {
- (NSArray *)getMarkers;
- (void) removeMarker:(RMMarker *)marker;
- (CGPoint) getMarkerScreenCoordinate: (RMMarker *)marker;
- (CLLocationCoordinate2D) getMarkerCoordinate2D: (RMMarker *) marker;
@end
... ...
... ... @@ -579,4 +579,9 @@ static BOOL _performExpensiveOperations = YES;
return [mercatorToScreenProjection projectXYPoint:[marker location]];
}
- (CLLocationCoordinate2D) getMarkerCoordinate2D: (RMMarker *) marker
{
return [self pixelToLatLong:[self getMarkerScreenCoordinate:marker]];
}
@end
... ...
... ... @@ -64,5 +64,6 @@ typedef struct {
- (NSArray *) getMarkers;
- (void) removeMarker:(RMMarker *)marker;
- (CGPoint) getMarkerScreenCoordinate: (RMMarker *)marker;
- (CLLocationCoordinate2D) getMarkerCoordinate2D: (RMMarker *) marker;
@end
... ...
... ... @@ -359,4 +359,9 @@
return [contents getMarkerScreenCoordinate:marker];
}
- (CLLocationCoordinate2D) getMarkerCoordinate2D: (RMMarker *) marker
{
return [contents getMarkerCoordinate2D:marker];
}
@end
... ...