Skip to content

Instantly share code, notes, and snippets.

@p4ul
Created March 29, 2020 22:30
Show Gist options
  • Save p4ul/508eb79eaab4982964cbf1bc4ec44a09 to your computer and use it in GitHub Desktop.
Save p4ul/508eb79eaab4982964cbf1bc4ec44a09 to your computer and use it in GitHub Desktop.
country/region bounding box scraper
// go to https://nominatim.openstreetmap.org/search?q=waikato&format=json
// in chrome console paste this
const list = []
const countryRegion = [
'waikato, new zealand',
'perth, australia'
]
for(let i = 0; i < countryRegion.length; i++) {
const searchTerm = countryRegion[i]
await fetch(`https://nominatim.openstreetmap.org/search?q=${searchTerm}&format=json`).then(response => response.json()).then(data1 => {
const data = data1.pop()
console.log("pushing")
list.push([data.display_name, JSON.stringify(data.boundingbox)])
})
}
console.table(list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment