Solved

Direction using Python


Userlevel 4
Badge +30

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
icon

Best answer by carsonlam 31 May 2017, 20:33

View original

5 replies

Badge

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.

Userlevel 4
Badge +30

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

 

Badge +22
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.

 

Badge
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
.
Userlevel 4
Badge +30
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