Find latitudes and longitudes for an array of addresses
Finds latitudes and longitudes for an array of addresses via Google Maps GeoCoding API
$ npm install --global find-lat-lng-cli
You'll need a Google Maps API-key as an environment variable GOOGLE_MAPS_API_KEY
$ export GOOGLE_MAPS_API_KEY={YOUR_API_KEY}
# then
$ find-lat-lng --help
Usage
$ find-lat-lng input [output]
Options
--debug, -d Add debug information
Example
$ find-lan-lng-cli input.json
[
{ address: 'Lonnrotinkatu 5, Helsinki', lat: 60.166924, lng: 24.939788},
{ address: 'Lonnrotinkatu 4, Helsinki', lat: 60.167142, lng: 24.940959},
...
]
Your input file should be a list of addresses:
[
"Lonnrotinkatu 4, Helsinki",
"Lonnrotinkatu 5, Helsinki",
]
If output file was provided, the script will output the data to the file instead of STDOUT
.
You can also use npx
:
$ npx cross-env GOOGLE_MAPS_API_KEY={YOUR_API_KEY} npx find-lat-lng-cli input.json output.json
Verbose output to see errors if you need to troubleshoot.
- find-lat-lng - API for this module
MIT © Pete Nykänen