-2

I am trying to implement google map markers in android google v2.

i can show markers in the map too using json parsing, but the problem im facing is:

1: the parsing just tells u-turn but it doesn't tell left u-turn or right so even if im am using some images for showing its a u-turn i don't know which way the u-turn should be.

2:Is it possible to draw or show an arrowhead over the polyline in map v2 as u can see in the below image

route map direction

so any tutorial or example how to do this..

thanks

Ari
  • 1,296
  • 1
  • 18
  • 36
  • may i know the reason for this downvote??? if there is any link or example already available can you please redirect me to that? – Ari Aug 13 '13 at 07:17
  • Can you provide an example request you're making to get the driving directions? Just asking because when I get the [driving directions from Toronto to Montreal](http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=true&units=metric&mode=driving), there is a key-value pair saying `"maneuver" : "turn-right"` (or if you're using xml: `turn-right`). The value will obviously differ per maneuver; i.e. other values in the linked example are `merge` and `ramp-right`. [More values here](http://stackoverflow.com/a/17975099/1029225). – MH. Aug 13 '13 at 08:04
  • using the key-value mauever i have got the turns but the problem i am having is about the way it it is supposed to show. please check the added image @MH – Ari Aug 13 '13 at 09:29

1 Answers1

2

IF this is your only problem:

the parsing just tells u-turn but it doesn't tell left u-turn or right so even if im am using some images for showing its a u-turn i don't know which way the u-turn should be.

Then you can easily find out the direction - your route is built from "points" A -> B -> C -> D ... having coordinates of A & B you have vector. And you can also have vector using B & C. No you just need to calculate angle between these two vectors and you will know which direction it goes.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141