Created
March 29, 2020 22:30
-
-
Save p4ul/508eb79eaab4982964cbf1bc4ec44a09 to your computer and use it in GitHub Desktop.
country/region bounding box scraper
This file contains 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
// 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