iOS Question How to draw a circle in Google Maps

Luiz Fernando Orlandini

Active Member
Licensed User
Longtime User
Hi All...

How can I draw a Circle over a marker using b4i? In B4A we have GoogleMapsExtra library, but it is incompatible with B4i

Thanks.
 

Luiz Fernando Orlandini

Active Member
Licensed User
Longtime User
Initialize it and then you can add circles with this code:
B4X:
Sub gmap_Click (Point As LatLng)
   gextra.AddCircle(Point.Latitude, Point.Longitude, 10000, Colors.Red)
End Sub
Thanks Erel. I just received a message saying that GoogleMapsExtras was created in a newer version than mine. I'm using B4i 1.8, we have any new version?

Thanks.
 
Upvote 0

Luiz Fernando Orlandini

Active Member
Licensed User
Longtime User
Initialize it and then you can add circles with this code:
B4X:
Sub gmap_Click (Point As LatLng)
   gextra.AddCircle(Point.Latitude, Point.Longitude, 10000, Colors.Red)
End Sub
Erel it works very well =D

Just one more requirement... Is it possible to set a alpha in fillColor, since it's necessary to see the map content below draw circle
 
Upvote 0

Luiz Fernando Orlandini

Active Member
Licensed User
Longtime User
I found the code below in GMaps docs...

B4X:
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;

But I don't know how to write this code in B4i.
 
Upvote 0

Fabio vega

Member
Licensed User
Hello, some example with transparent color like: This no found

B4X:
Public Sub AddCircle (  gplt As LatLng , Radius As Double, Color As Int)
    Dim no As NativeObject = Me
    Dim circle As NativeObject = no.RunMethod( "createCircle:::", Array(gplt.Latitude, gplt.Longitude, Radius))
    circle.SetField("map", gmap)
    circle.SetField("strokeWidth", 2)
    circle.SetField("fillColor", circle.ColorToUIColor( Colors.Transparent) )
    circle.SetField("strokeColor", circle.ColorToUIColor( Color)) 

End Sub
 
Last edited:
Upvote 0
Top