Android Question Draw a Polygon on a Map

Discussion in 'Android Questions' started by rafaelmotaquintana, Aug 7, 2019.

  1. rafaelmotaquintana

    rafaelmotaquintana Active Member Licensed User

    I have a google maps working in a test app.
    I What I need is to draw a polygon on the map then calculate the area. I have searched with no luck.
    I also have installed the navigation library. What I don't know is to mark the points in the maps then retrieve the coordinates for the calculation.
    If there is any sample in the forum, it would be greatly appreciated is somebody send me the link.
    Thanks
     
  2. MarcoRome

    MarcoRome Expert Licensed User




    Code:
    Sub MapFragment1_LongClick (mPoint As LatLng)
       ...
        gmap.AddMarker3(mPoint.Latitude,mPoint.Longitude, 
    "MicroArea " &  Starter.numero_microarea,LoadBitmap(File.DirAssets,"flag50.png") ).InfoWindowShown = True
      ....

        lista_punta.Add(mPoint)
        
    If lista_punta.Size = 6 Then
            DrawPolygon(lista_punta)
        
    End If
    End Sub

    Sub MapFragment1_Click (Point As LatLng)
        .....
        
    Log(Point.Latitude)
        
    Log(Point.Longitude)
        .....
    End Sub


    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
     
  3. rafaelmotaquintana

    rafaelmotaquintana Active Member Licensed User

    Wow, beautiful app.
    What is 'gmap' ?
    The libraries required are: googlemaps, googlemapsextra, navigation. Anything else?
     
    MarkusR likes this.
  4. rafaelmotaquintana

    rafaelmotaquintana Active Member Licensed User

    Sorry. I found it.
    Would you please show me the declaration of 'lista_punta' list?
     
  5. MarcoRome

    MarcoRome Expert Licensed User

    Code:
    Dim lista_punta as List
     
    rafaelmotaquintana likes this.
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