Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 1.61 KB

README.md

File metadata and controls

25 lines (20 loc) · 1.61 KB

Maps Distance Matrix Generator

forthebadge HitCount

About a month ago my friends ask me to make some script to generate some data. She want to make a scheduling job using saving matrix algorithm, but she found a problem when it comes to create a distance matrix between some places based on Google Maps distance. Instead of manually doing that, I create this Maps Distance and Duration Matrix Generator from provided location longitude and latitude by using Google Maps Distance Matrix API.

Requirements

  • List of place name, longitude, and latitude provided on coordinate.csv file. (For example see : coordinate.csv)
  • Python 3
  • Python package : simplejson (to install : pip install simplejson)

Usage

To generate your matrix, run this command inside this project folder.

  python maps_matrix.py

After execute command above, you will see two generated file named distance_matrix.csv and duration_matrix.csv.

Important Notes

  • CSV format I use here is Microsoft Excel format, using ; (semicolon) as separator.
  • Google Maps Distance Matrix API limits your free request up to 2500 request/day. After reach your limit the distance/duration data inside the matrix will be write as error.
  • If you have Google Maps API Key, for now you can add it manually to the code on variable url.
  • It's free :)
:) heronimus (github.com/heronimus)