Hello, i am trying to create a marker with custom image and would like the image to rotate according to the direction/bearing of the street (eg Uber). please guide
this code snipplet rotates a marker. How you will get the bearing of the street? will you use OSM for that?
B4X:
Dim GoogleMapsExtras1 As GoogleMapsExtras
Dim AndroidResources1 As AndroidResources
Dim BitmapDescriptor1 As BitmapDescriptor
Dim BitmapDescriptorFactory1 As BitmapDescriptorFactory
Dim Icon As Bitmap
Dim Mydrawable1 As BitmapDrawable
Dim Markeropts As MarkerOptions
Markeropts.Initialize
Markeropts.Position2(48,9).Snippet("").Title("").Visible(True)
Mydrawable1=AndroidResources1.GetApplicationDrawable("icon1")
Icon=Mydrawable1.Bitmap
BitmapDescriptor1=BitmapDescriptorFactory1.FromBitmap(Icon)
Markeropts.Icon(BitmapDescriptor1)
Markeropts.Rotate(45) 'Rotate the marker
Dim Marker1 As Marker=GoogleMapsExtras1.AddMarker(gmap, Markeropts)
Thank you for the reply. Would it be possible to get the angle/bearing of the street so that we can rotate the marker accordingly. So everytime the street's direction changes, marker is rotated . Not sure if I am making my question clear. See screenshot in the first post
1) if you have 2 adresses in the street e.g. Chambers Street no 6 / Chambers Street no 8 you can geocode the adresses (with googlegeocode api) and then calculate the bearing of the 2 points...
2) you have the vector data of the streets (OpenStreetMap), then you can calculate the bearing from the vector data