hex
hex

Reputation: 119

How to draw circle using Google Maps SDK for iOS?

I am really confused with this issue. I want to draw circle on google map in my iOS app. In SDK help provide examples for polygons only. Anyone have the same problem?

Upvotes: 5

Views: 7655

Answers (2)

Thomas Leduc
Thomas Leduc

Reputation: 1102

I have no idea why you are noted down because I have the same problem. After many research, and the Saxon Druce's answer, I've seen the Circle on Android SDK but not in iOS.

--- EDIT ---

There are 2 solutions here : How to display a circle in GMSMapView

--- EDIT 2 ----

Since his version 1.2.1 (23 April 2013), Google Maps SDK for iOS count a GMSCircle in his Shapes.

Now you can draw like this :

CLLocationCoordinate2D circleCenter = CLLocationCoordinate2DMake(37.35, -122.0);
GMSCircle *circ = [GMSCircle circleWithPosition:circleCenter
                                         radius:1000];

circ.fillColor = [UIColor colorWithRed:0.25 green:0 blue:0 alpha:0.05];
circ.strokeColor = [UIColor redColor];
circ.strokeWidth = 5;
circ.map = mapView;

source here

Upvotes: 8

Saxon Druce
Saxon Druce

Reputation: 17624

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?

Upvotes: 2

Related Questions