iOS Question How to draw an irregular polygon on google maps?

cepope13

New Member
Licensed User
I have a b4a app that draws a legislative district on google maps from a KML file where I just load the coordinates into a point list and call:

'add polygon
Dim PolygonOptions1 As PolygonOptions
PolygonOptions1.Initialize
PolygonOptions1.AddPoints(points)
PolygonOptions1.FillColor = 0x2500ff00
PolygonOptions1.Geodesic=True
PolygonOptions1.Visible=True
GoogleMapsExtras1.AddPolygon(gmap,PolygonOptions1)

I use the same approach for b4i using googlemapsextra.bas:
gextra.Initialize(gmap)
gextra.AddPolygon(points, 0x800000FF, Colors.Gray)

But I get nothing on the map. To debug I verified that a simple four-point example works fine and I added a drawcircle at each coordinate to confirm that the coordinates are correct.

Google search implies the points need to be sorted to a "convex hull" to work. If so, this must be happening automatically in b4a since I use the same kml file in both apps.

So what's the best way to get the b4a polygon behavior working in b4i? Thanks
 
Top