osm2geojson-ultra
Version:
a faster & more complete OSM & Overpass (either in xml or in json formats) to geojson convertor - 4x faster than xmldom + osmtogeojson in most situations - implemented in TypeScript with txml for XML parsing
27 lines (26 loc) • 704 B
JavaScript
import { OsmObject } from "./osm-object.js";
import { strArrayToFloat } from "./utils.js";
export class Node extends OsmObject {
constructor(id, refElems) {
super("node", id, refElems);
}
setLatLng(latLng) {
this.latLng = latLng;
}
toFeature() {
if (this.latLng) {
return {
type: "Feature",
id: this.getCompositeId(),
properties: this.getProps(),
geometry: {
type: "Point",
coordinates: strArrayToFloat([this.latLng.lon, this.latLng.lat]),
},
};
}
}
getLatLng() {
return this.latLng;
}
}