Skip to main content
Solved

Direction using Python

  • May 31, 2017
  • 5 replies
  • 52 views

danilo_fme
Celebrity
Forum|alt.badge.img+51

Hello Team,

I want to extract a direction of driving between address points using the API from gogglemaps.

First i have the Origin Point and i need to find the next address ( point b for example ) from xls file. After from the point B find the next address ( point C ) and repeat this process 10 times.

 

I believe the best way to do this is a loop in python. Attached my template file.Thanks in Advance,Danilo

Best answer by carsonlam

Instead of making directions requests from A to B, then B to C, then C to D, etc., consider using the Waypoints feature in the Google Maps Directions API: https://developers.google.com/maps/documentation/directions/intro#Waypoints. That API allows up to 23 waypoints in a single Directions request.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

carsonlam
Safer
Forum|alt.badge.img+7
  • Safer
  • Best Answer
  • May 31, 2017

Instead of making directions requests from A to B, then B to C, then C to D, etc., consider using the Waypoints feature in the Google Maps Directions API: https://developers.google.com/maps/documentation/directions/intro#Waypoints. That API allows up to 23 waypoints in a single Directions request.


danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Author
  • Celebrity
  • May 31, 2017

Instead of making directions requests from A to B, then B to C, then C to D, etc., consider using the Waypoints feature in the Google Maps Directions API: https://developers.google.com/maps/documentation/directions/intro#Waypoints. That API allows up to 23 waypoints in a single Directions request.

Hello @carsonlam, thanks your reply.

 

So the URL needs to put the end address first, and after the Waypoints. In my case the problem is when i read a xls file with address and needs to generate the route ( 20 points ) i doent know the end address.

 

Thanks Danilo

 


jdh
Contributor
Forum|alt.badge.img+38
  • Contributor
  • May 31, 2017
Hello @carsonlam, thanks your reply.

 

So the URL needs to put the end address first, and after the Waypoints. In my case the problem is when i read a xls file with address and needs to generate the route ( 20 points ) i doent know the end address.

 

Thanks Danilo

 

Presumably the end address is the last line of the excel file, ie the feature with the max value of xlsx_row_id.

 


carsonlam
Safer
Forum|alt.badge.img+7
  • Safer
  • May 31, 2017
Hello @carsonlam, thanks your reply.

 

So the URL needs to put the end address first, and after the Waypoints. In my case the problem is when i read a xls file with address and needs to generate the route ( 20 points ) i doent know the end address.

 

Thanks Danilo

 

The order of the URL arguments should not matter. You should be able to build up a URL with parameters like 
?origin=Surrey,BC&waypoints;=Coquitlam,BC|Burnaby,BC&destination;=Vancouver,BC
.

danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Author
  • Celebrity
  • May 31, 2017
The order of the URL arguments should not matter. You should be able to build up a URL with parameters like 
?origin=Surrey,BC&waypoints;=Coquitlam,BC|Burnaby,BC&destination;=Vancouver,BC
.
Thanks all your help. :) 

 

I updated my template file and it brings in JSON attribute the point next to point A ( start ) = Valor{2}.

 

0684Q00000ArNPMQA3.png

 

Now in Loop i need to get this point B and search the next address ( others two attributes from xls file Rua Cedral,366,Jardim Satelite, Sao Jose dos Campos and Avenida Doutor Joao Batista Souza Soares,300, Jardim America,Sao Jose dos Campos )

 

 

Thanks in Advance,

 

workspace-api-google-maps.fmwt