Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
566 views
in Technique[技术] by (71.8m points)

xamarin - API Google Maps doesn't return enough of step

I'm making an app with Xamarin.Forms.Maps and then, I need to get all of the steps between two "place id" to make my own polyline. However, when I'm making my request, I get about only thirty five steps.

35 steps.. Between Le Mans (France) and Paris (France).. About 200km but only 35 steps.. The problem isn't that the two points aren't connected to the polyline made, no, the problem is that the polyline get out of the existing road..

Google API direction seems to give me, only, some important information, like important steps, but without following the road.. Does it normal?

PS: This is my request (I use Postman to test it)

https://maps.googleapis.com/maps/api/directions/json?origin=Le Mans&destination=Paris&key=[MY_API_KEY]&travel_mode=DRIVING
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Are you using the polyline results in each driving step?

I used your example and got 31 start_location that each contain Encoded Polylines for drawing that path on the map.

The "Take the exit toward Paris-Centre Porte de Bercy" step results in:

"polyline": {
   "points": "mn_iHmxqM@[?WA_@Ck@CeAAMGcAEi@Gc@Ke@GUI[IYGSIMIKGECAMIMEA?EAA?A?K?I@A?C?IBE@C@?@C@GBOHEHGJIVIX_@j@"
 },

Decoded that is:

enter image description here

The "Take the exit on the left onto Bd Périphérique" step results in 91 points, etc...

There are hundreds and hundreds of locations points within the results, you just have to decode the locations of each driving step and plot them:

Google's Interactive Poly Line Utility


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...