Android Question Remove Polyline from GoogleMap

Blueforcer

Well-Known Member
Licensed User
Longtime User
Hello,

anybody knows how to remove a polyline from the googlemaps?
I need to redraw one Polyline every change from the Gyroscope, but without removing the markers.
At the moment i use gmap.clear but this also removes all markes. How can i do this?

B4X:
Sub DrawAngle
    Dim Distance As Int = 1
    Dim Radius As Int = 1
    Dim Bearing As Double = Status.AngleX

    Distance = (Distance /Radius)
    LatB = ASinD(SinD(Status.myPosLat) * Cos(Distance/Radius) + CosD(Status.myPosLat) * Sin(Distance/Radius) * CosD(Bearing))
    LonB = Status.myPosLon + ATan2D(SinD(Bearing) * Sin(Distance / Radius) * CosD(Status.myPosLat), Cos(Distance / Radius) - SinD(Status.myPosLat) * SinD(LatB))
    gmap.clear
    line = gmap.AddPolyline
    points.Initialize
    line.color=Colors.Red 'Array As Int(255,255,255)
    line.Geodesic=True
    line.Visible =True
    line.Width=2
    Point.Initialize(LatB, LonB)
    points.Add(Point)
    Point.Initialize(Status.myPosLat, Status.myPosLon)
    points.Add(Point)
    line.points=points
    points.Clear
End Sub
 
Top