well-known-parser
Version:
A WKT/WKB/EWKT/EWKB/TWKB/GeoJSON parser and serializer
3 lines (2 loc) • 1.23 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./well-known-parser5.cjs"),c=require("./well-known-parser4.cjs"),a=require("./well-known-parser16.cjs");function h(e,n){const t=new o.LineString;if(t.srid=n.srid,t.hasZ=n.hasZ??!1,t.hasM=n.hasM??!1,e.isMatch(["EMPTY"]))return t;e.expectGroupStart();const r=e.matchCoordinates(n);for(const i of r)t.points.push(i);return e.expectGroupEnd(),t}function S(e,n){const t=new o.LineString;t.srid=n.srid,t.hasZ=n.hasZ??!1,t.hasM=n.hasM??!1;const r=e.readUInt32(),i={...n,srid:void 0};for(let s=0;s<r;s++)t.points.push(a.parsePointWkb(e,i));return t}function g(e,n){const t=new o.LineString;if(t.hasZ=n.hasZ??!1,t.hasM=n.hasM??!1,n.isEmpty)return t;const r=new c.Point(0,0,n.hasZ?0:void 0,n.hasM?0:void 0),i=e.readVarInt();for(let s=0;s<i;s++)t.points.push(a.parseRelativePointTwkb(e,n,r));return t}function p(e){const n=new o.LineString;e.coordinates.length>0&&(n.hasZ=e.coordinates[0].length>2);for(const t of e.coordinates)n.points.push(a.parsePointGeoJSON(t));return n}exports.parseLineStringGeoJSON=p;exports.parseLineStringTwkb=g;exports.parseLineStringWkb=S;exports.parseLineStringWkt=h;
//# sourceMappingURL=well-known-parser17.cjs.map