Android Question Draw a polygon GoogleMap Help!

Discussion in 'Android Questions' started by Acro Soluciones, Jul 9, 2016.

  1. Acro Soluciones

    Acro Soluciones New Member

    Hi, this is my first program with B4A and i think it is great. I followed the google map tutorial and now i have it running in my device without problems. Now i would like to draw a polygon when the user click over the map. How can i do this? Thanks
     
  2. eurojam

    eurojam Well-Known Member Licensed User

    Welcome in the forum,
    it is something like this:
    Code:
    Sub DrawPolygon (PointList As List)
        
    Dim GoogleMapsExtras1 As GoogleMapsExtras
        
    Dim polygonoptions1 As PolygonOptions
        polygonoptions1.Initialize
        polygonoptions1.FillColor=
    Colors.ARGB(150,255,255,0)
        polygonoptions1.AddPoints(PointList)
        polygonoptions1.StrokeColor=
    Colors.DarkGray
        polygonoptions1.StrokeWidth=
    3
        
    Dim pg As Polygon = GoogleMapsExtras1.AddPolygon(gmap, polygonoptions1)
    End Sub
    The Pointlist is a List containing objects of the type LatLng. You can collect them for example from the click event on the mapfraqment.
    Code:
    Sub MapFragment1_LongClick (mPoint As LatLng)
    ...
    'put the latLng into a list
    end sub
     
    inakigarm likes this.
  3. Acro Soluciones

    Acro Soluciones New Member

    Hi, thanks for your answer, i advance a lot in my program, but i still cant draw polygons.
    Here:
    Dim GoogleMapsExtras1 AsGoogleMapsExtras
    Dim polygonoptions1 AsPolygonOptions

    The program says: Unknown type GoogleMapsExtras.

    Thanks
     
  4. Erel

    Erel Administrator Staff Member Licensed User

  5. Acro Soluciones

    Acro Soluciones New Member

    Yes, i tried to download the zip but the system does not allowed me to. I think i need to buy a license.
    Thanks
     
  6. s4agtech

    s4agtech New Member Licensed User

    Hi, i downloaded the library and use the code, i still dont know how can i draw a polygon clicking on map. Thanks
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice