Extracts data from OpenStreetMap using Overpass API.
npm i osm-extractor
Geocode and extract area using Overpass API
const fs = require("fs");
const { extractWithGeocode } = require("osm-extractor");
extractWithGeocode("Liechtenstein").then(data =>
data.pipe(fs.createWriteStream("data.osm"))
);
Extract OpenStreetMap data from Overpass using BBox
const fs = require("fs");
const { extractWithBBox } = require("osm-extractor");
extractWithBBox([11.5, 48.1, 11.6, 48.2]).then(data =>
data.pipe(fs.createWriteStream("data.osm"))
);
Extract from Overpass API using Overpass QL
const fs = require("fs");
const { extractWithQuery } = require("osm-extractor");
const query = "node(50.745,7.17,50.75,7.18);out;";
extractWithQuery(query).then(data =>
data.pipe(fs.createWriteStream("data.osm"))
);