Hello all,
i'm a beginner with xamarin, i've well place a google maps with two markers and i can download the route between these two markers in json format.
all works fine until now
now, i wonder how i can get the html_instructions who is the way i must to follow ?
i would like with the html_instructions that the phone speak and tell me the way to follow ?
here is it a part of the json :
{ "geocoded_waypoints" : [ { "geocoder_status" : "OK", "place_id" : "ChIJYYGvK8VIlUcRArt1YtOl6Zo", "types" : [ "route" ] }, { "geocoder_status" : "OK", "place_id" : "ChIJR8dEqiJJlUcRR9xQ2ZVqqbg", "types" : [ "route" ] } ], "routes" : [ { "bounds" : { "northeast" : { "lat" : 49.6096028, "lng" : 6.133682500000001 }, "southwest" : { "lat" : 49.5913682, "lng" : 6.1055486 } }, "copyrights" : "Données cartographiques ©2016 Google", "legs" : [ { "distance" : { "text" : "4,6 km", "value" : 4616 }, "duration" : { "text" : "13 minutes", "value" : 795 }, "end_address" : "Rue de Cessange, Luxembourg, Luxembourg", "end_location" : { "lat" : 49.5913682, "lng" : 6.1056934 }, "start_address" : "Place de la Gare, Luxembourg, Luxembourg", "start_location" : { "lat" : 49.5982808, "lng" : 6.1324296 }, "steps" : [ { "distance" : { "text" : "0,7 km", "value" : 723 }, "duration" : { "text" : "4 minutes", "value" : 217 }, "end_location" : { "lat" : 49.6046039, "lng" : 6.1334556 }, "html_instructions" : "Prendre la direction \u003cb\u003enord\u003c/b\u003e sur \u003cb\u003ePlace de la Gare\u003c/b\u003e/\u003cb\u003eN3\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003eContinuer de suivre N3\u003c/div\u003e", "polyline" : { "points" : "[email protected]@[email protected]?YO[[email protected][email protected]@[email protected][email protected]@iAF}[email protected]?QAOC}[email protected]" }, "start_location" : { "lat" : 49.5982808, "lng" : 6.1324296 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0,2 km", "value" : 237 }, "duration" : { "text" : "1 minute", "value" : 33 }, "end_location" : { "lat" : 49.60672280000001, "lng" : 6.133654099999999 }, "html_instructions" : "Continuer sur \u003cb\u003eViaduc\u003c/b\u003e/\u003cb\u003eN50\u003c/b\u003e", "polyline" : { "points" : "wkwmHc}[email protected]][email protected]" }, "start_location" : { "lat" : 49.6046039, "lng" : 6.1334556 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0,7 km", "value" : 698 }, "duration" : { "text" : "2 minutes", "value" : 129 }, "end_location" : { "lat" : 49.60949720000001, "lng" : 6.126239099999999 }, "html_instructions" : "Prendre légèrement \u003cb\u003eà gauche\u003c/b\u003e sur \u003cb\u003eBoulevard Franklin Delano Roosevelt\u003c/b\u003e/\u003cb\u003eViaduc\u003c/b\u003e/\u003cb\u003eN50\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003eContinuer de suivre Boulevard Franklin Delano Roosevelt/N50\u003c/div\u003e", "maneuver" : "turn-slight-left", "polyline" : { "points" : "[email protected][[email protected]@[email protected]][email protected]@O^[email protected]
@aC|[email protected]@E^E@[email protected]@~BB|BFxDDjD" }, "start_location" : { "lat" : 49.60672280000001, "lng" : 6.133654099999999 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0,6 km", "value" : 562 }, "duration" : { "text" : "1 minute", "value" : 89 }, "end_location" : { "lat" : 49.60651439999999, "lng" : 6.119965199999999 }, "html_instructions" : "Continuer sur \u003cb\u003eAvenue Marie-Thérèse\u003c/b\u003e/\u003cb\u003eN4\u003c/b\u003e", "polyline" : { "points" : "[email protected]@[email protected]@X|@^[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]\\[email protected]" }, "start_location" : { "lat" : 49.60949720000001, "lng" : 6.126239099999999 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0,8 km", "value" : 802 }, "duration" : { "text" : "2 minutes", "value" : 104 }, "end_location" : { "lat" : 49.5999039, "lng" : 6.1185201 }, "html_instructions" : "Prendre \u003cb\u003eà gauche\u003c/b\u003e sur \u003cb\u003eBoulevard Grande-Duchesse Charlotte\u003c/b\u003e/\u003cb\u003eRoute d'Esch\u003c/b\u003e/\u003cb\u003eN4\u003c/b\u003e/\u003cb\u003eN51\u003c/b\u003e\u003cdiv style=\"font-size:0.9em\"\u003eContinuer de suivre Route d'Esch/N4\u003c/div\u003e", "maneuver" : "turn-left", "polyline" : { "points" : "[email protected]@[email protected]
@[email protected][email protected]~GuCZIPE\\[email protected]@[email protected]^[email protected]@[email protected]@[email protected]^[email protected]@BHXF\\" }, "start_location" : { "lat" : 49.60651439999999, "lng" : 6.119965199999999 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "92 m", "value" : 92 }, "duration" : { "text" : "1 minute", "value" : 13 }, "end_location" : { "lat" : 49.59989299999999, "lng" : 6.1172447 }, "html_instructions" : "Prendre légèrement \u003cb\u003eà droite\u003c/b\u003e sur \u003cb\u003eRoute d'Esch\u003c/b\u003e/\u003cb\u003eN4\u003c/b\u003e/\u003cb\u003eN56\u003c/b\u003e", "maneuver" : "turn-slight-right", "polyline" : { "points" : "[email protected][email protected]?\\[email protected]@rB" }, "start_location" : { "lat" : 49.5999039, "lng" : 6.1185201 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0,1 km", "value" : 112 }, "duration" : { "text" : "1 minute", "value" : 33 }, "end_location" : { "lat" : 49.5989626, "lng" : 6.117219299999999 }, "html_instructions" : "Prendre \u003cb\u003eà gauche\u003c/b\u003e sur \u003cb\u003eRoute d'Esch\u003c/b\u003e/\u003cb\u003eN4\u003c/b\u003e", "maneuver" : "turn-left", "polyline" : { "points" : "[email protected]@[email protected][email protected]?FCBCDEHIHK" }, "start_location" : { "lat" : 49.59989299999999, "lng" : 6.1172447 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "19 m", "value" : 19 }, "duration" : { "text" : "1 minute", "value" : 12 }, "end_location" : { "lat" : 49.5989495, "lng" : 6.1174861 }, "html_instructions" : "Prendre \u003cb\u003eà gauche\u003c/b\u003e sur \u003cb\u003eN4\u003c/b\u003e/\u003cb\u003eN56\u003c/b\u003e", "maneuver" : "turn-left", "polyline" : { "points" : "[email protected]@[email protected]" }, "start_location" : { "lat" : 49.5989626, "lng" : 6.117219299999999 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "0,2 km", "value" : 176 }, "duration" : { "text" : "1 minute", "value" : 39 }, "end_location" : { "lat" : 49.5975653, "lng" : 6.1177522 }, "html_instructions" : "Prendre \u003cb\u003eà droite\u003c/b\u003e sur \u003cb\u003eRoute d'Esch\u003c/b\u003e/\u003cb\u003eN4\u003c/b\u003e", "maneuver" : "turn-right", "polyline" : { "points" : "[email protected]@[email protected]\\HLBfCX" }, "start_location" : { "lat" : 49.5989495, "lng" : 6.1174861 }, "travel_mode" : "DRIVING" }, { "distance" : { "text" : "1,2 km", "value" : 1195 }, "duration" : { "text" : "2 minutes", "value" : 126 }, "end_location" : { "lat" : 49.5913682, "lng" : 6.1056934 }, "html_instructions" : "Prendre \u003cb\u003eà droite\u003c/b\u003e sur \u003cb\u003eRue de Cessange\u003c/b\u003e/\u003cb\u003eCR179\u003c/b\u003e", "maneuver" : "turn-right", "polyline" : { "points" : "y_vmH}[email protected][email protected][email protected]@[email protected]@[email protected]\\D\\[email protected]@[email protected]@[email protected]@[email protected][email protected]@[email protected]@[email protected]|[email protected][email protected]@[email protected]^RZRXVXZV^[email protected]@N?NCNCLE
@M"
},
"start_location" : {
"lat" : 49.5975653,
"lng" : 6.1177522
},
"travel_mode" : "DRIVING"
}
],
"traffic_speed_entry" : [],
"via_waypoint" : []
}
],
"overview_polyline" : {
"points" : "[email protected][[email protected]@[email protected]@]mB}@[email protected]@[email protected]}[email protected]_AYcAS_AE}[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@aC|GYnAK
[email protected]@L^[email protected]~@[email protected]~C~H~@bCfAxCbA[email protected]@[email protected][email protected]
@[email protected]@[email protected]@[email protected]@J\;F\[email protected][email protected]@[email protected]@[email protected][[email protected]@[email protected]\D\RVZHZ`@[email protected]|[email protected]|AjI|[email protected]@[email protected]@[email protected]@ZV^T\;HTB^C~@W"
},
"summary" : "N4 et Rue de Cessange/CR179",
"warnings" : [],
"waypoint_order" : []
}
],
"status" : "OK"
}
`
Any idea or sample would be appreceate ..
thanks for all
Posts
Hello xamarin golden dev
someone have an idea about how to get the html instructions and tell to the phone to speak => html instruction
thanks
@ChristopheBERNARD i know this is very late but this can help someone else.
First you need to use the google direction API (Enable API) ,which i have provided below
var googleDirection = "https://maps.googleapis.com/maps/api/directions/json?origin=" + Latitude +","+Longitude + "&destination=" + Latitude + "," + Longitude + "&key=" + "Your API key here";
this will give you JSON data , which you can Deserialize and get your html instruction like this,
googleDirection.routes[0].legs[0].steps[0].html_instructions;