Skip to content

lwinxp/google-maps-geocoding-api-script

Repository files navigation

google-maps-geocoding-api-script

Purpose

  • The scripts in this repo take in a input CSV file with 1 column of location address

  • Request is made to map API service for location codes (latitude, longitude)

  • Results are returned in a new output CSV file with 1 column of the original location address, 1 column of latitude and 1 column of logitude

Setup

  1. Adapted from https://github.com/googlemaps/google-maps-services-python for project use. Follow setup instructions here in the google repo.

  2. Requires setup of Google Cloud Platform, APIs and services, credentials API key. Key needs to be provided in google_map_api.py

Google Maps API Usage

  1. Update the input CSV filename and output CSV filename in google_map_api.py

  2. Update GCP API key

  3. $ python3 google_map_api.py

OpenStreetMap Nominatim API Usage

Script in the nominatim-openmaps-api folder works, although suggest not to use unless understand limitations in Additional Details

  1. Update the input CSV filename and output CSV filename in main.py

  2. $ python3 main.py

Additional Info

  1. google_map_api.py can be used directly in jupyter notebook as well.

  2. Resources for OpenMap search Nominatim API:

  1. Nominatim geocoding API does not recognise abbreviations in addresses, and will return error if in request body. Google Maps geocoding API recognises abbreviations

  2. abbreviations_cleaning.ipynb contains suggested regex to cleanup abbreviations before constructing the input CSV file.

  3. Nominatim API geocoding data may not be complete for newer locations. A number of required locations were not available and returned error when tried.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages