Arrow Mark over Polyline in Android Google Route Map -
how show arrowheads on polyline in android google map v2
i have gone through couple of links , of them gives link js https://google-developers.appspot.com/maps/documentation/javascript/examples/overlay-symbol-arrow need in android not js , can't use codes in android
some using mapactivity followed tutorial creat map activity https://developers.google.com/maps/documentation/android/v1/hello-mapview didnt work can't generate mapactivity , couldn't use locationoverlays
i have got posts commenting available in v3 requirement in v2
this question has been asked lot many times here know still couldn't find proper answer
how can show arrowhead on polyline show direction supposed go
any examples or tutorials helpful.
thanks
in google maps api v2 demo there markerdemoactivity class in can see how custom image set googlemap. use marker show arrowhead this:
// first need rotate bitmap of arrowhead somewhere in code matrix matrix = new matrix(); matrix.postrotate(rotationdegrees); // create rotated arrowhead bitmap bitmap arrowheadbitmap = bitmap.createbitmap(originalbitmap, 0, 0, width, height, matrix, true); // gonna add marker marrowhead = mmap.addmarker(new markeroptions() .position(position) .icon(arrowheadbitmap)); some clarifications: when drawing route, or if got 2 points draw, rotationdegrees can them doing this:
rotationdegrees = math.todegrees(math.atan2(originlat-destinylat, originlon-destinylon)); the classic rotation game algorithm :d
be sure of arrowhead image pointing up. note if don't want use image show arrowhead , instead of that, want use polylines, can achieve taking last latlng point (where going display arrowhead) , use translation algorithm 45ยบ draw 2 lines make arrowhead.
Comments
Post a Comment