Created
January 23, 2019 16:36
-
-
Save ryanpcmcquen/07c7d4b9ed30edb57fabb37a37c97fc2 to your computer and use it in GitHub Desktop.
Validate address using the Nominatim OpenStreetMap API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
/* global fetch */ | |
require('isomorphic-fetch') | |
const path = require('path') | |
fs.readFile(process.argv[2], 'utf8', (err, data) => { | |
if (err) { | |
return console.log(err) | |
} | |
const addresses = JSON.parse(data) | |
addresses.forEach((address) => | |
fetch( | |
`https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent( | |
address | |
)}` | |
) | |
) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment