Skip to content

Instantly share code, notes, and snippets.

@ryanpcmcquen
Created January 23, 2019 16:36
Show Gist options
  • Save ryanpcmcquen/07c7d4b9ed30edb57fabb37a37c97fc2 to your computer and use it in GitHub Desktop.
Save ryanpcmcquen/07c7d4b9ed30edb57fabb37a37c97fc2 to your computer and use it in GitHub Desktop.
Validate address using the Nominatim OpenStreetMap API.
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