Skip to main content
Solved

Direction using Python


danilo_fme
Evangelist
Forum|alt.badge.img+44

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.

View original
Did this help you find an answer to your question?

5 replies

carsonlam
Safer
Forum|alt.badge.img
  • 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
Evangelist
Forum|alt.badge.img+44
  • Author
  • Evangelist
  • May 31, 2017
carsonlam wrote:

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+28
  • Contributor
  • May 31, 2017
danilo_fme wrote:
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
  • Safer
  • May 31, 2017
danilo_fme wrote:
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
Evangelist
Forum|alt.badge.img+44
  • Author
  • Evangelist
  • May 31, 2017
carsonlam wrote:
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

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings