How to draw polygon on google map in iOS, postcode wise in iOS
I am working on a map display where I have a zip list and I want to highlight an area of ββeach zip in the map. I am using google map. I have a list of zip codes. I really need the boundary coordinates of each zip.
the actual requirements are shown in the figure.
CLGeocoder *geoCoder = [[CLGeocoder alloc] init];
[geoCoder geocodeAddressString:@"94111" completionHandler:^(NSArray *placemarks, NSError *error) {
GMSMutablePath *rect = [GMSMutablePath path];
for (CLPlacemark* aPlacemark in placemarks)
{
// Process the placemark.
CLLocation *location = aPlacemark.location;
CLLocationCoordinate2D coordinate = location.coordinate;
NSLog(@"Latitude %f", coordinate.latitude);
NSLog(@"Longitude %f", coordinate.longitude);
[rect addCoordinate:CLLocationCoordinate2DMake(coordinate.latitude, coordinate.longitude)];
}
// Create the polygon, and assign it to the map.
GMSPolygon *polygon = [GMSPolygon polygonWithPath:rect];
polygon.fillColor = [UIColor colorWithRed:0.25 green:0 blue:0 alpha:0.75];
polygon.strokeColor = [UIColor blackColor];
polygon.strokeWidth = 2;
polygon.map = self.mapVew;
}];
+3
source to share
No one has answered this question yet
Check out similar questions: