Obtain drive times in traffic without purchasing a "Google Maps for work API"
$30-250 USD
Terminado
Publicado hace alrededor de 9 años
$30-250 USD
Pagado a la entrega
Hi There,
Project Requirements:
1. Obtain a Python 2.7 code to obtain drive times that factor in traffic for two departure times (8:00am PST and 5:00pm PST) for the the following Origins and Destinations (see attached: '[login to view URL]' ). FYI: I previously tried using the Free Google Matrix Distance API (see: attached '[login to view URL]'), but it only provides drive times w/o factoring in traffic. You need a, "Google Map API for Work customers" (see below) to obtain travel times in traffic.
Thus, one solution could be to use Regular Expressions and automate google searches (though would nee d to be adapted for google maps) via the following:
[login to view URL]
[login to view URL]
"For requests where the travel mode is driving: Google Maps API for Work customers can specify the departure_time to receive trip duration considering current traffic conditions. The departure_time must be set to within a few minutes of the current time."
Goal of the code:
Obtains drive times (that factor in traffic ) (in minutes) for 200 unique trips outlined in the, "[login to view URL]", in Python (version 2.7).
-Beginning at, 'Origin_Zip' and ends at, 'Destination_BH'. Input the duration (in minutes) in the corresponding cell under: 'time_to_BH.'
-Beginning at, 'Origin_Zip' and ends at, 'Destination_SM'. Input the duration (in minutes) in the corresponding cell under: 'time_to_SM.'
*FYI: I was using the following GitHub as blueprint to structure my code: [login to view URL]
Overall, I need this code in Python 2.7, and emailed to my by 11:00am (EST) on 4/13/15.
I look forward to answering any questions, and obtaining a Python code to obtain a solution to this issue.
Dear employer,
i've been testing for a solution to your problem and after different tries and without using the "Google Map API for Work customers" i think the only solution is to use some browser component like Selenium.
Why? Because Google uses an obfuscated format for the data to send the request, using a "data" parameter like this "&data=!3m1!4b1!4m17!4m16!1m5!1m1!1s0x80c2b4600e063063:0x5354ae938d24ee88!2m2!1d-118.3754131!2d33.865913!1m5!1m1!1s0x80c2bc0..."
Using Selenium the url's to be requested would be like this:
request_url = "[login to view URL]%s/%s" % (origin, destination))
From here Selenium allows to simulate the human interaction with the web page, but using code. This allows selecting the time, day... and finally parse the html response.
3 problems with this approach:
1) It's slow. Each request requires about 8 seconds.
2) The code is subject to future changes in the web page design.
3) Without using an API, the multiple requests must be done using proxies to avoid a I.P ban by Google.
For the 2) a proxy support is needed. The requests should be done through different proxies. This is a solution almost always used in web scrapping.
For the 1) there's nothing to do. The code should be updated if the Google changes the Google Maps page.
Let me know if you're still interested in a solution of this kind.
Best Regards,
Jordi Gacia
Computer Engineer