UNPKG

well-known-parser

Version:

A WKT/WKB/EWKT/EWKB/TWKB/GeoJSON parser and serializer

46 lines (45 loc) 1.38 kB
import { MultiPoint as i } from "./well-known-parser7.js"; import { Point as a } from "./well-known-parser4.js"; import { parseRelativePointTwkb as c, parsePointGeoJSON as f } from "./well-known-parser16.js"; import { parseWkb as h } from "./well-known-parser11.js"; function M(r, t) { const n = new i(); if (n.srid = t.srid, n.hasZ = t.hasZ ?? !1, n.hasM = t.hasM ?? !1, r.isMatch(["EMPTY"])) return n; r.expectGroupStart(); const s = r.matchCoordinates(t); for (const o of s) n.points.push(o); return r.expectGroupEnd(), n; } function P(r, t) { const n = new i(); n.srid = t.srid, n.hasZ = t.hasZ ?? !1, n.hasM = t.hasM ?? !1; const s = r.readUInt32(); for (let o = 0; o < s; o++) n.points.push(h(r, t)); return n; } function l(r, t) { const n = new i(); if (n.hasZ = t.hasZ ?? !1, n.hasM = t.hasM ?? !1, t.isEmpty) return n; const s = new a(0, 0, t.hasZ ? 0 : void 0, t.hasM ? 0 : void 0), o = r.readVarInt(); for (let e = 0; e < o; e++) n.points.push(c(r, t, s)); return n; } function Z(r) { const t = new i(); r.coordinates.length > 0 && (t.hasZ = r.coordinates[0].length > 2); for (const n of r.coordinates) t.points.push(f(n)); return t; } export { Z as parseMultiPointGeoJSON, l as parseMultiPointTwkb, P as parseMultiPointWkb, M as parseMultiPointWkt }; //# sourceMappingURL=well-known-parser19.js.map