overpass-frontend
Version:
A JavaScript (NodeJS/Browser) library to easily access data from OpenStreetMap via Overpass API or from an OSM File. The objects can directly be used with LeafletJS or exported to GeoJSON. Data will be cached in the browser memory.
20 lines (15 loc) • 352 B
JavaScript
module.exports = {
id: 'OSMJSON',
willLoad (url, content, options) {
return url.match(/\.osm\.json$/)
},
load (content, options, callback) {
let result
try {
result = JSON.parse(content)
} catch (err) {
return callback(new Error('Error parsing JSON file: ' + err.message))
}
callback(null, result)
}
}