Authored by Obrand69

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

added sample code in MapViewViewController
@@ -61,7 +61,9 @@ @@ -61,7 +61,9 @@
61 NSLog(@"Marker mercator location: X:%lf, Y:%lf", point.x, point.y); 61 NSLog(@"Marker mercator location: X:%lf, Y:%lf", point.x, point.y);
62 CGPoint screenPoint = [mapView getMarkerScreenCoordinate: aMarker]; 62 CGPoint screenPoint = [mapView getMarkerScreenCoordinate: aMarker];
63 NSLog(@"Marker screen location: X:%lf, Y:%lf", screenPoint.x, screenPoint.y); 63 NSLog(@"Marker screen location: X:%lf, Y:%lf", screenPoint.x, screenPoint.y);
64 - 64 + CLLocationCoordinate2D coordinates = [mapView getMarkerCoordinate2D: aMarker];
  65 + NSLog(@"Marker Lat/Lon location: Lat:%lf, Lon:%lf", coordinates.latitude, coordinates.longitude);
  66 +
65 [mapView removeMarker:aMarker]; 67 [mapView removeMarker:aMarker];
66 } 68 }
67 69
@@ -121,5 +121,6 @@ enum { @@ -121,5 +121,6 @@ enum {
121 - (NSArray *)getMarkers; 121 - (NSArray *)getMarkers;
122 - (void) removeMarker:(RMMarker *)marker; 122 - (void) removeMarker:(RMMarker *)marker;
123 - (CGPoint) getMarkerScreenCoordinate: (RMMarker *)marker; 123 - (CGPoint) getMarkerScreenCoordinate: (RMMarker *)marker;
  124 +- (CLLocationCoordinate2D) getMarkerCoordinate2D: (RMMarker *) marker;
124 125
125 @end 126 @end
@@ -579,4 +579,9 @@ static BOOL _performExpensiveOperations = YES; @@ -579,4 +579,9 @@ static BOOL _performExpensiveOperations = YES;
579 return [mercatorToScreenProjection projectXYPoint:[marker location]]; 579 return [mercatorToScreenProjection projectXYPoint:[marker location]];
580 } 580 }
581 581
  582 +- (CLLocationCoordinate2D) getMarkerCoordinate2D: (RMMarker *) marker
  583 +{
  584 + return [self pixelToLatLong:[self getMarkerScreenCoordinate:marker]];
  585 +}
  586 +
582 @end 587 @end
@@ -64,5 +64,6 @@ typedef struct { @@ -64,5 +64,6 @@ typedef struct {
64 - (NSArray *) getMarkers; 64 - (NSArray *) getMarkers;
65 - (void) removeMarker:(RMMarker *)marker; 65 - (void) removeMarker:(RMMarker *)marker;
66 - (CGPoint) getMarkerScreenCoordinate: (RMMarker *)marker; 66 - (CGPoint) getMarkerScreenCoordinate: (RMMarker *)marker;
  67 +- (CLLocationCoordinate2D) getMarkerCoordinate2D: (RMMarker *) marker;
67 68
68 @end 69 @end
@@ -359,4 +359,9 @@ @@ -359,4 +359,9 @@
359 return [contents getMarkerScreenCoordinate:marker]; 359 return [contents getMarkerScreenCoordinate:marker];
360 } 360 }
361 361
  362 +- (CLLocationCoordinate2D) getMarkerCoordinate2D: (RMMarker *) marker
  363 +{
  364 + return [contents getMarkerCoordinate2D:marker];
  365 +}
  366 +
362 @end 367 @end