Takes a CSV containing location data and will carry out geocoding or reverse geocoding using the Google Geocoding API. Supports Python 3 and 2.
##Installation
pip install googlegeocodingcli
When geocoding the CSV file requires a column containing the address.
geocode --keys xxxxxxxxx --file path/test.csv
This will create a temporary file that will store the results of the geocoding and when completed will replace the original file.
address |
---|
31 Duke Street, Brighton BN1 1AG |
into
address | longitude | latitude |
---|---|---|
31 Duke Street, Brighton BN1 1AG | -0.1428505 | 50.8227147 |
When reverse geocoding the CSV file requires two columns called 'latitude' and 'longitude'.
reverse_geocode --keys xxxxxxxx --file path/test.csv
longitude | latitude |
---|---|
-0.1428505 | 50.8227147 |
into
address | longitude | latitude |
---|---|---|
31 Duke Street, Brighton BN1 1AG | -0.1428505 | 50.8227147 |
To increase the number of searches you can conduct per day you can use multiple Google API keys. The keys will be automatically switched once they reach their daily quota.
reverse_geocode --keys xxxxxx,xxxxxx,xxxxxx --file path/test.csv
If you reach you daily quota you for all your keys you can run the CLI again the next day and it will start from where it left (when using the same file).
####Running the tests
- Clone the repo
Now run the following inside the project's directory
virtualenv env
source env/bin/activate
pip install --editable .
./runtests