I have a list of coordinates (yLat, xLon) with an angle (bearing in degrees, e.g. 160) to draw on my map, and I would like to do it with lines or arrows which start from the coordinates and head to the bearing.
I started to do it using a Polyline:
LatLng thisPoint = new LatLng(yLat, xLon);
Polyline site = googleMap.addPolyline(new PolylineOptions()
.add(thisPoint, new LatLng(11.593, 104.932))
.width(5)
.color(Color.MAGENTA));
However the line is too small when I zoom out: I want the line to be always the same size on the screen to show the direction to the user and independently of the zoom level.
See the example below: on the first screenshot the magenta line is big enough, but on the second one after zooming out, the line becomes smaller and we cannot see the direction as clearly.
Any suggestion?
I found the best way to address my need: I created a marker with an icon with a vertical arrow in the middle of a transparent square (R.mipmap.ic_arrow_up), then I create the marker applying a rotation of the desired angle:
googleMap.addMarker(new MarkerOptions()
.position(myLatLng)
.title(myTitle)
.snippet(mySnippet)
.icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_arrow_up))
.rotation(myAngle));
Hope this helps other people