UNPKG

osm2geojson-lite

Version:

a lightweight yet faster osm (either in xml or in json formats) to geojson convertor - 4x faster than xmldom + osmtogeojson in most situations - implemented in pure JavaScript without any 3rd party dependency

32 lines (31 loc) 893 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Node = void 0; const osm_object_1 = require("./osm-object"); const utils_1 = require("./utils"); class Node extends osm_object_1.OsmObject { constructor(id, refElems) { super('node', id, refElems); } setLatLng(latLng) { this.latLng = latLng; } toFeatureArray() { if (this.latLng) { return [{ type: 'Feature', id: this.getCompositeId(), properties: this.getProps(), geometry: { type: 'Point', coordinates: (0, utils_1.strArrayToFloat)([this.latLng.lon, this.latLng.lat]), }, }]; } return []; } getLatLng() { return this.latLng; } } exports.Node = Node;