5

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?

computingfreak
  • 4,939
  • 1
  • 34
  • 51
hex
  • 119
  • 1
  • 4

2 Answers2

8

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

Community
  • 1
  • 1
Thomas Leduc
  • 1,092
  • 1
  • 20
  • 44
  • Hello! Unfortunately, I didn't find solution, so I draw polygon with large amount of vertexes. Still hope that Google integrate this functionality in next release of SDK – hex Mar 21 '13 at 08:16
  • 5
    Since now google maps sdk for ios has circle class! https://developers.google.com/maps/documentation/ios/shapes?hl=ru – hex Apr 24 '13 at 07:26
  • I still got the exception .... whenever comes to circ.map = mapView; and circ setMap: mapView . Wht should I check first ? – Jeff Bootsholz Oct 20 '16 at 08:15
  • @RajuGujarati it's been a while since I touch to iOS (this question has 3 year) but you can maybe see [the official doc](https://developers.google.com/maps/documentation/ios-sdk/shapes#circles) – Thomas Leduc Oct 20 '16 at 12:59
2

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?

Saxon Druce
  • 17,406
  • 5
  • 50
  • 71