I have markers on my GMSMapView and I want to add an overlay to the country in which the marker is located. The code I have is below.
[geocode geocodeAddressString:[NSString stringWithFormat:@"%@, %@",placeName,cityName] inRegion:region completionHandler:^(NSArray *placemarks, NSError *error) {
if(placemarks && placemarks.count > 0)
{
CLPlacemark *topResult = [placemarks objectAtIndex:0];
GMSMutablePath *rect = [GMSMutablePath path];
// Add Northeast
[rect addCoordinate:CLLocationCoordinate2DMake(region.center.latitude + region.span.latitudeDelta / 2,region.center.longitude - region.span.longitudeDelta / 2)];
// Add Southwest
[rect addCoordinate:CLLocationCoordinate2DMake(region.center.latitude - region.span.latitudeDelta / 2,region.center.longitude + region.span.longitudeDelta / 2)];
[rect addCoordinate:marker.position];
GMSPolygon *polygon = [GMSPolygon polygonWithPath:rect];
polygon.fillColor = [UIColor colorWithRed:0.25 green:0 blue:0 alpha:0.05];
polygon.strokeColor = [UIColor blackColor];
polygon.strokeWidth = 2;
polygon.map = _map;
}
}
];
The code above strokes some path around the marker, but this is not what I am looking for. Let us say my marker is in NY. How can I get all CLLocationCoordinate2D around the boundary of NY and add a polygon for it. Is there a readily available DB/Service which I can use.