Skip to content

anajian-rms/batch-geocoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Batch Geocoding with the Google Maps Geocoding API

Allows batch geocoding using Google Maps Geocoding API calls.

Description

Geocoding is the process of turning an address like 1600 Amphitheatre Parkway, Mountain View, CA into a latitude and longitude pair (37.422388, -122.0841883).

It turns out that there is a lot of technical work that goes on behind the scenes to do this conversion. The upshot is that latitude and longitude are better to work with because they uniquely determine a location on Earth. This makes geocoded addresses great for creating heatmaps, for example.

Fortunately, there are a lot of geocoding services out there. Even better, Google Maps provides a high quality Geocoding API.

Requirements

  • Python 2.7 or later.
  • A Google Maps API key.
  • pandas, numpy, and googlemaps (Note: tqdm is included to reduce dependencies)

API Key

If you do not have a Google Maps API key, follow the instructions to get an API key.

$ export GOOGLE_API_KEY=AI...

Usage Limits

The Google Maps Geocoding API has usage limits. At the time of this writing, the standard tier gives 2,500 free requests per day at up to 50 requests per second. They have pay-as-you-go billing (must be manually enabled) $0.50 USD / 1000 additional requests, up to 100,000 daily.

Usage

To batch geocode all addresses in the example file provided:

$ python batch_geocoder.py -i addresses_to_geocode.csv -o geocoded_addresses.csv --no-header

Optionally, a limit on the number of addresses to batch geocode can be specified:

$ python batch_geocoder.py -i addresses_to_geocode.csv -o geocoded_addresses.csv --no-header --limit 3

About

Batch geocoder using Google Maps Geocoding API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages