Skip to content

Generate Distance and Duration CSV Matrix from provided location longitude and latitude. Distance and duration provided by Google Maps Distance Matrix.

Notifications You must be signed in to change notification settings

heronimus/maps-distance-matrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Generate Distance and Duration CSV Matrix from provided location longitude and latitude. Distance and duration provided by Google Maps Distance Matrix.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages