How to display a circle in GMSMapView
It's a bit late since the question is over a year old, but Google searches led me here, so I thought I'd update this. Posterity 4TW!
There is now a GMSCircle
which can do, as far as I know, just about everything an MKCircle
can.
Google's documentation on the GMSCircle.
// Build a circle for the GMSMapView
GMSCircle *geoFenceCircle = [[GMSCircle alloc] init];
geoFenceCircle.radius = 130; // Meters
geoFenceCircle.position = SOME_CLLOCATION.coordinate; // Some CLLocationCoordinate2D position
geoFenceCircle.fillColor = [UIColor colorWithWhite:0.7 alpha:0.5];
geoFenceCircle.strokeWidth = 3;
geoFenceCircle.strokeColor = [UIColor orangeColor];
geoFenceCircle.map = mapView; // Add it to the map.
//Updating code for Swift 5.3
let circle = GMSCircle(position: position, radius:10)
circle.fillColor = .clear
circle.strokeWidth = 3
circle.strokeColor = .black
circle.map = mapView
It behaves very similarly to an MKCircle (overlay) in that it resizes with the zoom level of the map, etc. Please disregard the blue circle in the center; that's the user location shown on the map view, and I just used the same coordinate for the center point of the GMSCircle.
Super easy. Check out the images:
One zoom level:
And here, we're zoomed out a bit:
At the moment the SDK doesn't support circles, but there is a feature request to add circles here:
https://code.google.com/p/gmaps-api-issues/issues/detail?id=4971
In the meantime you could maybe fake a circle by drawing a polyline, with several short segments?