@loaders.gl/wkt 3.1.0-alpha.3 → 3.1.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/dist.min.js +1 -1
  2. package/dist/es5/bundle.js +7 -0
  3. package/dist/es5/bundle.js.map +1 -0
  4. package/dist/es5/index.js +42 -0
  5. package/dist/es5/index.js.map +1 -0
  6. package/dist/es5/lib/encode-wkt.js +61 -0
  7. package/dist/es5/lib/encode-wkt.js.map +1 -0
  8. package/dist/es5/lib/parse-wkb.js +346 -0
  9. package/dist/es5/lib/parse-wkb.js.map +1 -0
  10. package/dist/es5/lib/parse-wkt.js +205 -0
  11. package/dist/es5/lib/parse-wkt.js.map +1 -0
  12. package/dist/es5/lib/utils/version.js +9 -0
  13. package/dist/es5/lib/utils/version.js.map +1 -0
  14. package/dist/es5/wkb-loader.js +70 -0
  15. package/dist/es5/wkb-loader.js.map +1 -0
  16. package/dist/es5/wkt-loader.js +67 -0
  17. package/dist/es5/wkt-loader.js.map +1 -0
  18. package/dist/es5/wkt-writer.js +26 -0
  19. package/dist/es5/wkt-writer.js.map +1 -0
  20. package/dist/es5/workers/wkb-worker.js +8 -0
  21. package/dist/es5/workers/wkb-worker.js.map +1 -0
  22. package/dist/es5/workers/wkt-worker.js +8 -0
  23. package/dist/es5/workers/wkt-worker.js.map +1 -0
  24. package/dist/{bundle.js → esm/bundle.js} +0 -0
  25. package/dist/esm/bundle.js.map +1 -0
  26. package/dist/{index.js → esm/index.js} +0 -0
  27. package/dist/esm/index.js.map +1 -0
  28. package/dist/{lib → esm/lib}/encode-wkt.js +0 -0
  29. package/dist/esm/lib/encode-wkt.js.map +1 -0
  30. package/dist/{lib → esm/lib}/parse-wkb.js +0 -0
  31. package/dist/esm/lib/parse-wkb.js.map +1 -0
  32. package/dist/{lib → esm/lib}/parse-wkt.js +0 -0
  33. package/dist/esm/lib/parse-wkt.js.map +1 -0
  34. package/dist/esm/lib/utils/version.js +2 -0
  35. package/dist/esm/lib/utils/version.js.map +1 -0
  36. package/dist/{wkb-loader.js → esm/wkb-loader.js} +0 -0
  37. package/dist/esm/wkb-loader.js.map +1 -0
  38. package/dist/{wkt-loader.js → esm/wkt-loader.js} +0 -0
  39. package/dist/esm/wkt-loader.js.map +1 -0
  40. package/dist/{wkt-writer.js → esm/wkt-writer.js} +0 -0
  41. package/dist/esm/wkt-writer.js.map +1 -0
  42. package/dist/{workers → esm/workers}/wkb-worker.js +0 -0
  43. package/dist/esm/workers/wkb-worker.js.map +1 -0
  44. package/dist/{workers → esm/workers}/wkt-worker.js +0 -0
  45. package/dist/esm/workers/wkt-worker.js.map +1 -0
  46. package/dist/wkt-worker.js +1 -1
  47. package/package.json +6 -6
  48. package/dist/bundle.js.map +0 -1
  49. package/dist/index.js.map +0 -1
  50. package/dist/lib/encode-wkt.js.map +0 -1
  51. package/dist/lib/parse-wkb.js.map +0 -1
  52. package/dist/lib/parse-wkt.js.map +0 -1
  53. package/dist/lib/utils/version.js +0 -2
  54. package/dist/lib/utils/version.js.map +0 -1
  55. package/dist/wkb-loader.js.map +0 -1
  56. package/dist/wkt-loader.js.map +0 -1
  57. package/dist/wkt-writer.js.map +0 -1
  58. package/dist/workers/wkb-worker.js.map +0 -1
  59. package/dist/workers/wkt-worker.js.map +0 -1
package/dist/dist.min.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(window,(function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){const o=n(1);globalThis.loaders=globalThis.loaders||{},t.exports=Object.assign(globalThis.loaders,o)},function(t,e,n){"use strict";n.r(e),n.d(e,"WKBLoader",(function(){return f})),n.d(e,"WKBWorkerLoader",(function(){return a})),n.d(e,"WKTLoader",(function(){return m})),n.d(e,"WKTWorkerLoader",(function(){return d})),n.d(e,"WKTWriter",(function(){return h}));const o={0:2,1:3,2:3,3:4};function r(t){const e=new DataView(t);let n=0;const r=1===e.getUint8(n);n++;const a=e.getUint32(n,r);n+=4;const f=a%1e3,p=o[(a-f)/1e3];switch(f){case 1:return i(e,n,p,r).geometry;case 2:return s(e,n,p,r).geometry;case 3:return l(e,n,p,r).geometry;case 4:const t=function(t,e,n,o){const r=t.getUint32(e,o);e+=4;const s=[];for(let o=0;o<r;o++){const o=1===t.getUint8(e);if(e++,t.getUint32(e,o)%1e3!=1)throw new Error("WKB: Inner geometries of MultiPoint not of type Point");const r=i(t,e+=4,n,o);e=r.offset,s.push(r.geometry)}return function(t,e){const n=t.map(t=>t.positions.value);return{type:"Point",positions:{value:new Float64Array(c(n).buffer),size:e}}}(s,n)}(e,n,p,r);return t.type="Point",t;case 5:const o=function(t,e,n,o){const r=t.getUint32(e,o);e+=4;const i=[];for(let o=0;o<r;o++){const o=1===t.getUint8(e);if(e++,t.getUint32(e,o)%1e3!=2)throw new Error("WKB: Inner geometries of MultiLineString not of type LineString");const r=s(t,e+=4,n,o);e=r.offset,i.push(r.geometry)}return function(t,e){const n=t.map(t=>t.positions.value),o=new Float64Array(c(n).buffer),r=n.map(t=>t.length/e).map(u(0));return r.unshift(0),{type:"LineString",positions:{value:o,size:e},pathIndices:{value:new Uint16Array(r),size:1}}}(i,n)}(e,n,p,r);return o.type="LineString",o;case 6:const a=function(t,e,n,o){const r=t.getUint32(e,o);e+=4;const i=[];for(let o=0;o<r;o++){const o=1===t.getUint8(e);if(e++,t.getUint32(e,o)%1e3!=3)throw new Error("WKB: Inner geometries of MultiPolygon not of type Polygon");const r=l(t,e+=4,n,o);e=r.offset,i.push(r.geometry)}return function(t,e){const n=[],o=[];for(const e of t){const{positions:t,primitivePolygonIndices:r}=e;n.push(t.value),o.push(r.value)}const r=new Float64Array(c(n).buffer),i=n.map(t=>t.length/e).map(u(0));i.unshift(0);const s=[0];for(const t of o)s.push(...t.filter(t=>t>0).map(t=>t+s[s.length-1]));return{type:"Polygon",positions:{value:r,size:e},polygonIndices:{value:new Uint16Array(i),size:1},primitivePolygonIndices:{value:new Uint16Array(s),size:1}}}(i,n)}(e,n,p,r);return a.type="Polygon",a;default:throw new Error("WKB: Unsupported geometry type: "+f)}}function i(t,e,n,o){const r=new Float64Array(n);for(let i=0;i<n;i++)r[i]=t.getFloat64(e,o),e+=8;return{geometry:{type:"Point",positions:{value:r,size:n}},offset:e}}function s(t,e,n,o){const r=t.getUint32(e,o);e+=4;const i=new Float64Array(r*n);for(let s=0;s<r*n;s++)i[s]=t.getFloat64(e,o),e+=8;const s=[0];return r>0&&s.push(r),{geometry:{type:"LineString",positions:{value:i,size:n},pathIndices:{value:new Uint16Array(s),size:1}},offset:e}}const u=t=>e=>t+=e;function l(t,e,n,o){const r=t.getUint32(e,o);e+=4;const i=[];for(let u=0;u<r;u++){const r=s(t,e,n,o),{positions:u}=r.geometry;e=r.offset,i.push(u.value)}const l=new Float64Array(c(i).buffer),a=[0];l.length>0&&a.push(l.length/n);const f=i.map(t=>t.length/n).map(u(0));return f.unshift(0),{geometry:{type:"Polygon",positions:{value:l,size:n},polygonIndices:{value:new Uint16Array(a),size:1},primitivePolygonIndices:{value:new Uint16Array(f),size:1}},offset:e}}function c(t){let e=0;for(let n=0;n<t.length;++n)e+=t[n].byteLength;const n=new Uint8Array(e);let o=0;for(let r=0;r<t.length;++r){const i=new Uint8Array(t[r].buffer);e=i.length;for(let t=0;t<e;++t)n[o++]=i[t]}return n}const a={name:"WKB",id:"wkb",module:"wkt",version:"3.1.0-alpha.3",worker:!0,category:"geometry",extensions:["wkb"],mimeTypes:[],options:{wkb:{}}},f={...a,parse:async t=>r(t),parseSync:r},p=/[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/,y=new RegExp("^"+p.source+"(\\s"+p.source+"){1,}");function g(t){const e=t.split(";");let n=e.pop();const o=(e.shift()||"").split("=").pop();let r=0;function i(t){const e=n.substring(r).match(t);return e?(r+=e[0].length,e[0]):null}function s(){i(/^\s*/)}function u(){s();let t=0;const e=[],n=[e];let o,r=e;for(;o=i(/^(\()/)||i(/^(\))/)||i(/^(,)/)||i(y);){if("("===o)n.push(r),r=[],n[n.length-1].push(r),t++;else if(")"===o){if(0===r.length)return null;if(r=n.pop(),!r)return null;if(t--,0===t)break}else if(","===o)r=[],n[n.length-1].push(r);else{if(o.split(/\s/g).some(isNaN))return null;Array.prototype.push.apply(r,o.split(/\s/g).map(parseFloat))}s()}return 0!==t?null:e}function l(){const t=[];let e,n;for(;n=i(y)||i(/^(,)/);)","===n?(t.push(e),e=[]):n.split(/\s/g).some(isNaN)||(e||(e=[]),Array.prototype.push.apply(e,n.split(/\s/g).map(parseFloat))),s();return e?(t.push(e),t.length?t:null):null}function c(){return function(){if(!i(/^(point(\sz)?)/i))return null;if(s(),!i(/^(\()/))return null;const t=l();return t?(s(),i(/^(\))/)?{type:"Point",coordinates:t[0]}:null):null}()||function(){if(!i(/^(linestring(\sz)?)/i))return null;if(s(),!i(/^(\()/))return null;const t=l();return t&&i(/^(\))/)?{type:"LineString",coordinates:t}:null}()||function(){if(!i(/^(polygon(\sz)?)/i))return null;s();const t=u();return t?{type:"Polygon",coordinates:t}:null}()||function(){if(!i(/^(multipoint)/i))return null;s();const t=n.substring(n.indexOf("(")+1,n.length-1).replace(/\(/g,"").replace(/\)/g,"");n="MULTIPOINT ("+t+")";const e=u();return e?(s(),{type:"MultiPoint",coordinates:e}):null}()||function(){if(!i(/^(multilinestring)/i))return null;s();const t=u();return t?(s(),{type:"MultiLineString",coordinates:t}):null}()||function(){if(!i(/^(multipolygon)/i))return null;s();const t=u();return t?{type:"MultiPolygon",coordinates:t}:null}()||function(){const t=[];let e;if(!i(/^(geometrycollection)/i))return null;if(s(),!i(/^(\()/))return null;for(;e=c();)t.push(e),s(),i(/^(,)/),s();return i(/^(\))/)?{type:"GeometryCollection",geometries:t}:null}()}return(a=c())&&o.match(/\d+/)&&(a.crs={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+o}}),a;var a}const d={name:"WKT (Well-Known Text)",id:"wkt",module:"wkt",version:"3.1.0-alpha.3",worker:!0,extensions:["wkt"],mimeTypes:["text/plain"],category:"geometry",text:!0,options:{wkt:{}}},m={...d,parse:async t=>g((new TextDecoder).decode(t)),parseTextSync:g};const h={name:"WKT (Well Known Text)",id:"wkt",module:"wkt",version:"3.1.0-alpha.3",extensions:["wkt"],encode:function t(e){function n(t){return t.join(" ")}function o(t){return t.map(n).join(", ")}function r(t){return t.map(o).map(i).join(", ")}function i(t){return`(${t})`}switch("Feature"===e.type&&(e=e.geometry),e.type){case"Point":return"POINT "+i(n(e.coordinates));case"LineString":return"LINESTRING "+i(o(e.coordinates));case"Polygon":return"POLYGON "+i(r(e.coordinates));case"MultiPoint":return"MULTIPOINT "+i(o(e.coordinates));case"MultiPolygon":return"MULTIPOLYGON "+i(e.coordinates.map(r).map(i).join(", "));case"MultiLineString":return"MULTILINESTRING "+i(r(e.coordinates));case"GeometryCollection":return"GEOMETRYCOLLECTION "+i(e.geometries.map(t).join(", "));default:return(t=>{throw new Error("stringify requires a valid GeoJSON Feature or geometry object as input")})()}},options:{wkt:{}}}}])}));
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(window,(function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){const o=n(1);globalThis.loaders=globalThis.loaders||{},t.exports=Object.assign(globalThis.loaders,o)},function(t,e,n){"use strict";n.r(e),n.d(e,"WKBLoader",(function(){return f})),n.d(e,"WKBWorkerLoader",(function(){return a})),n.d(e,"WKTLoader",(function(){return m})),n.d(e,"WKTWorkerLoader",(function(){return d})),n.d(e,"WKTWriter",(function(){return h}));const o={0:2,1:3,2:3,3:4};function r(t){const e=new DataView(t);let n=0;const r=1===e.getUint8(n);n++;const a=e.getUint32(n,r);n+=4;const f=a%1e3,p=o[(a-f)/1e3];switch(f){case 1:return i(e,n,p,r).geometry;case 2:return s(e,n,p,r).geometry;case 3:return l(e,n,p,r).geometry;case 4:const t=function(t,e,n,o){const r=t.getUint32(e,o);e+=4;const s=[];for(let o=0;o<r;o++){const o=1===t.getUint8(e);if(e++,t.getUint32(e,o)%1e3!=1)throw new Error("WKB: Inner geometries of MultiPoint not of type Point");const r=i(t,e+=4,n,o);e=r.offset,s.push(r.geometry)}return function(t,e){const n=t.map(t=>t.positions.value);return{type:"Point",positions:{value:new Float64Array(c(n).buffer),size:e}}}(s,n)}(e,n,p,r);return t.type="Point",t;case 5:const o=function(t,e,n,o){const r=t.getUint32(e,o);e+=4;const i=[];for(let o=0;o<r;o++){const o=1===t.getUint8(e);if(e++,t.getUint32(e,o)%1e3!=2)throw new Error("WKB: Inner geometries of MultiLineString not of type LineString");const r=s(t,e+=4,n,o);e=r.offset,i.push(r.geometry)}return function(t,e){const n=t.map(t=>t.positions.value),o=new Float64Array(c(n).buffer),r=n.map(t=>t.length/e).map(u(0));return r.unshift(0),{type:"LineString",positions:{value:o,size:e},pathIndices:{value:new Uint16Array(r),size:1}}}(i,n)}(e,n,p,r);return o.type="LineString",o;case 6:const a=function(t,e,n,o){const r=t.getUint32(e,o);e+=4;const i=[];for(let o=0;o<r;o++){const o=1===t.getUint8(e);if(e++,t.getUint32(e,o)%1e3!=3)throw new Error("WKB: Inner geometries of MultiPolygon not of type Polygon");const r=l(t,e+=4,n,o);e=r.offset,i.push(r.geometry)}return function(t,e){const n=[],o=[];for(const e of t){const{positions:t,primitivePolygonIndices:r}=e;n.push(t.value),o.push(r.value)}const r=new Float64Array(c(n).buffer),i=n.map(t=>t.length/e).map(u(0));i.unshift(0);const s=[0];for(const t of o)s.push(...t.filter(t=>t>0).map(t=>t+s[s.length-1]));return{type:"Polygon",positions:{value:r,size:e},polygonIndices:{value:new Uint16Array(i),size:1},primitivePolygonIndices:{value:new Uint16Array(s),size:1}}}(i,n)}(e,n,p,r);return a.type="Polygon",a;default:throw new Error("WKB: Unsupported geometry type: "+f)}}function i(t,e,n,o){const r=new Float64Array(n);for(let i=0;i<n;i++)r[i]=t.getFloat64(e,o),e+=8;return{geometry:{type:"Point",positions:{value:r,size:n}},offset:e}}function s(t,e,n,o){const r=t.getUint32(e,o);e+=4;const i=new Float64Array(r*n);for(let s=0;s<r*n;s++)i[s]=t.getFloat64(e,o),e+=8;const s=[0];return r>0&&s.push(r),{geometry:{type:"LineString",positions:{value:i,size:n},pathIndices:{value:new Uint16Array(s),size:1}},offset:e}}const u=t=>e=>t+=e;function l(t,e,n,o){const r=t.getUint32(e,o);e+=4;const i=[];for(let u=0;u<r;u++){const r=s(t,e,n,o),{positions:u}=r.geometry;e=r.offset,i.push(u.value)}const l=new Float64Array(c(i).buffer),a=[0];l.length>0&&a.push(l.length/n);const f=i.map(t=>t.length/n).map(u(0));return f.unshift(0),{geometry:{type:"Polygon",positions:{value:l,size:n},polygonIndices:{value:new Uint16Array(a),size:1},primitivePolygonIndices:{value:new Uint16Array(f),size:1}},offset:e}}function c(t){let e=0;for(let n=0;n<t.length;++n)e+=t[n].byteLength;const n=new Uint8Array(e);let o=0;for(let r=0;r<t.length;++r){const i=new Uint8Array(t[r].buffer);e=i.length;for(let t=0;t<e;++t)n[o++]=i[t]}return n}const a={name:"WKB",id:"wkb",module:"wkt",version:"3.1.0-alpha.4",worker:!0,category:"geometry",extensions:["wkb"],mimeTypes:[],options:{wkb:{}}},f={...a,parse:async t=>r(t),parseSync:r},p=/[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/,y=new RegExp("^"+p.source+"(\\s"+p.source+"){1,}");function g(t){const e=t.split(";");let n=e.pop();const o=(e.shift()||"").split("=").pop();let r=0;function i(t){const e=n.substring(r).match(t);return e?(r+=e[0].length,e[0]):null}function s(){i(/^\s*/)}function u(){s();let t=0;const e=[],n=[e];let o,r=e;for(;o=i(/^(\()/)||i(/^(\))/)||i(/^(,)/)||i(y);){if("("===o)n.push(r),r=[],n[n.length-1].push(r),t++;else if(")"===o){if(0===r.length)return null;if(r=n.pop(),!r)return null;if(t--,0===t)break}else if(","===o)r=[],n[n.length-1].push(r);else{if(o.split(/\s/g).some(isNaN))return null;Array.prototype.push.apply(r,o.split(/\s/g).map(parseFloat))}s()}return 0!==t?null:e}function l(){const t=[];let e,n;for(;n=i(y)||i(/^(,)/);)","===n?(t.push(e),e=[]):n.split(/\s/g).some(isNaN)||(e||(e=[]),Array.prototype.push.apply(e,n.split(/\s/g).map(parseFloat))),s();return e?(t.push(e),t.length?t:null):null}function c(){return function(){if(!i(/^(point(\sz)?)/i))return null;if(s(),!i(/^(\()/))return null;const t=l();return t?(s(),i(/^(\))/)?{type:"Point",coordinates:t[0]}:null):null}()||function(){if(!i(/^(linestring(\sz)?)/i))return null;if(s(),!i(/^(\()/))return null;const t=l();return t&&i(/^(\))/)?{type:"LineString",coordinates:t}:null}()||function(){if(!i(/^(polygon(\sz)?)/i))return null;s();const t=u();return t?{type:"Polygon",coordinates:t}:null}()||function(){if(!i(/^(multipoint)/i))return null;s();const t=n.substring(n.indexOf("(")+1,n.length-1).replace(/\(/g,"").replace(/\)/g,"");n="MULTIPOINT ("+t+")";const e=u();return e?(s(),{type:"MultiPoint",coordinates:e}):null}()||function(){if(!i(/^(multilinestring)/i))return null;s();const t=u();return t?(s(),{type:"MultiLineString",coordinates:t}):null}()||function(){if(!i(/^(multipolygon)/i))return null;s();const t=u();return t?{type:"MultiPolygon",coordinates:t}:null}()||function(){const t=[];let e;if(!i(/^(geometrycollection)/i))return null;if(s(),!i(/^(\()/))return null;for(;e=c();)t.push(e),s(),i(/^(,)/),s();return i(/^(\))/)?{type:"GeometryCollection",geometries:t}:null}()}return(a=c())&&o.match(/\d+/)&&(a.crs={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+o}}),a;var a}const d={name:"WKT (Well-Known Text)",id:"wkt",module:"wkt",version:"3.1.0-alpha.4",worker:!0,extensions:["wkt"],mimeTypes:["text/plain"],category:"geometry",text:!0,options:{wkt:{}}},m={...d,parse:async t=>g((new TextDecoder).decode(t)),parseTextSync:g};const h={name:"WKT (Well Known Text)",id:"wkt",module:"wkt",version:"3.1.0-alpha.4",extensions:["wkt"],encode:function t(e){function n(t){return t.join(" ")}function o(t){return t.map(n).join(", ")}function r(t){return t.map(o).map(i).join(", ")}function i(t){return`(${t})`}switch("Feature"===e.type&&(e=e.geometry),e.type){case"Point":return"POINT "+i(n(e.coordinates));case"LineString":return"LINESTRING "+i(o(e.coordinates));case"Polygon":return"POLYGON "+i(r(e.coordinates));case"MultiPoint":return"MULTIPOINT "+i(o(e.coordinates));case"MultiPolygon":return"MULTIPOLYGON "+i(e.coordinates.map(r).map(i).join(", "));case"MultiLineString":return"MULTILINESTRING "+i(r(e.coordinates));case"GeometryCollection":return"GEOMETRYCOLLECTION "+i(e.geometries.map(t).join(", "));default:return(t=>{throw new Error("stringify requires a valid GeoJSON Feature or geometry object as input")})()}},options:{wkt:{}}}}])}));
2
2
  //# sourceMappingURL=dist.min.js.map
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ var moduleExports = require('./index');
4
+
5
+ globalThis.loaders = globalThis.loaders || {};
6
+ module.exports = Object.assign(globalThis.loaders, moduleExports);
7
+ //# sourceMappingURL=bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":";;AACA,IAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "WKBLoader", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _wkbLoader.WKBLoader;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "WKBWorkerLoader", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _wkbLoader.WKBWorkerLoader;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "WKTLoader", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _wktLoader.WKTLoader;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "WKTWorkerLoader", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _wktLoader.WKTWorkerLoader;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "WKTWriter", {
31
+ enumerable: true,
32
+ get: function get() {
33
+ return _wktWriter.WKTWriter;
34
+ }
35
+ });
36
+
37
+ var _wkbLoader = require("./wkb-loader");
38
+
39
+ var _wktLoader = require("./wkt-loader");
40
+
41
+ var _wktWriter = require("./wkt-writer");
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA","sourcesContent":["export {WKBLoader, WKBWorkerLoader} from './wkb-loader';\nexport {WKTLoader, WKTWorkerLoader} from './wkt-loader';\nexport {WKTWriter} from './wkt-writer';\n"],"file":"index.js"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = encodeWKT;
7
+
8
+ function encodeWKT(gj) {
9
+ if (gj.type === 'Feature') {
10
+ gj = gj.geometry;
11
+ }
12
+
13
+ function pairWKT(c) {
14
+ return c.join(' ');
15
+ }
16
+
17
+ function ringWKT(r) {
18
+ return r.map(pairWKT).join(', ');
19
+ }
20
+
21
+ function ringsWKT(r) {
22
+ return r.map(ringWKT).map(wrapParens).join(', ');
23
+ }
24
+
25
+ function multiRingsWKT(r) {
26
+ return r.map(ringsWKT).map(wrapParens).join(', ');
27
+ }
28
+
29
+ function wrapParens(s) {
30
+ return "(".concat(s, ")");
31
+ }
32
+
33
+ switch (gj.type) {
34
+ case 'Point':
35
+ return "POINT ".concat(wrapParens(pairWKT(gj.coordinates)));
36
+
37
+ case 'LineString':
38
+ return "LINESTRING ".concat(wrapParens(ringWKT(gj.coordinates)));
39
+
40
+ case 'Polygon':
41
+ return "POLYGON ".concat(wrapParens(ringsWKT(gj.coordinates)));
42
+
43
+ case 'MultiPoint':
44
+ return "MULTIPOINT ".concat(wrapParens(ringWKT(gj.coordinates)));
45
+
46
+ case 'MultiPolygon':
47
+ return "MULTIPOLYGON ".concat(wrapParens(multiRingsWKT(gj.coordinates)));
48
+
49
+ case 'MultiLineString':
50
+ return "MULTILINESTRING ".concat(wrapParens(ringsWKT(gj.coordinates)));
51
+
52
+ case 'GeometryCollection':
53
+ return "GEOMETRYCOLLECTION ".concat(wrapParens(gj.geometries.map(encodeWKT).join(', ')));
54
+
55
+ default:
56
+ return function (_x) {
57
+ throw new Error('stringify requires a valid GeoJSON Feature or geometry object as input');
58
+ }(gj);
59
+ }
60
+ }
61
+ //# sourceMappingURL=encode-wkt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/encode-wkt.ts"],"names":["encodeWKT","gj","type","geometry","pairWKT","c","join","ringWKT","r","map","ringsWKT","wrapParens","multiRingsWKT","s","coordinates","geometries","_x","Error"],"mappings":";;;;;;;AASe,SAASA,SAAT,CAAmBC,EAAnB,EAAmD;AAChE,MAAIA,EAAE,CAACC,IAAH,KAAY,SAAhB,EAA2B;AACzBD,IAAAA,EAAE,GAAGA,EAAE,CAACE,QAAR;AACD;;AAED,WAASC,OAAT,CAAiBC,CAAjB,EAA8B;AAC5B,WAAOA,CAAC,CAACC,IAAF,CAAO,GAAP,CAAP;AACD;;AAED,WAASC,OAAT,CAAiBC,CAAjB,EAAgC;AAC9B,WAAOA,CAAC,CAACC,GAAF,CAAML,OAAN,EAAeE,IAAf,CAAoB,IAApB,CAAP;AACD;;AAED,WAASI,QAAT,CAAkBF,CAAlB,EAAmC;AACjC,WAAOA,CAAC,CAACC,GAAF,CAAMF,OAAN,EAAeE,GAAf,CAAmBE,UAAnB,EAA+BL,IAA/B,CAAoC,IAApC,CAAP;AACD;;AAED,WAASM,aAAT,CAAuBJ,CAAvB,EAA0C;AACxC,WAAOA,CAAC,CAACC,GAAF,CAAMC,QAAN,EAAgBD,GAAhB,CAAoBE,UAApB,EAAgCL,IAAhC,CAAqC,IAArC,CAAP;AACD;;AAED,WAASK,UAAT,CAAoBE,CAApB,EAA+B;AAC7B,sBAAWA,CAAX;AACD;;AAED,UAAQZ,EAAE,CAACC,IAAX;AACE,SAAK,OAAL;AACE,6BAAgBS,UAAU,CAACP,OAAO,CAACH,EAAE,CAACa,WAAJ,CAAR,CAA1B;;AACF,SAAK,YAAL;AACE,kCAAqBH,UAAU,CAACJ,OAAO,CAACN,EAAE,CAACa,WAAJ,CAAR,CAA/B;;AACF,SAAK,SAAL;AACE,+BAAkBH,UAAU,CAACD,QAAQ,CAACT,EAAE,CAACa,WAAJ,CAAT,CAA5B;;AACF,SAAK,YAAL;AACE,kCAAqBH,UAAU,CAACJ,OAAO,CAACN,EAAE,CAACa,WAAJ,CAAR,CAA/B;;AACF,SAAK,cAAL;AACE,oCAAuBH,UAAU,CAACC,aAAa,CAACX,EAAE,CAACa,WAAJ,CAAd,CAAjC;;AACF,SAAK,iBAAL;AACE,uCAA0BH,UAAU,CAACD,QAAQ,CAACT,EAAE,CAACa,WAAJ,CAAT,CAApC;;AACF,SAAK,oBAAL;AACE,0CAA6BH,UAAU,CAACV,EAAE,CAACc,UAAH,CAAcN,GAAd,CAAkBT,SAAlB,EAA6BM,IAA7B,CAAkC,IAAlC,CAAD,CAAvC;;AACF;AACE,aAAQ,UAACU,EAAD,EAAsB;AAC5B,cAAM,IAAIC,KAAJ,CAAU,wEAAV,CAAN;AACD,OAFM,CAEJhB,EAFI,CAAP;AAhBJ;AAoBD","sourcesContent":["// Fork of https://github.com/mapbox/wellknown under ISC license (MIT/BSD-2-clause equivalent)\n// eslint-disable-next-line import/no-unresolved\nimport type {Feature, Geometry} from 'geojson';\n/**\n * Stringifies a GeoJSON object into WKT\n * @param geojson\n * @returns string\n */\n\nexport default function encodeWKT(gj: Geometry | Feature): string {\n if (gj.type === 'Feature') {\n gj = gj.geometry;\n }\n\n function pairWKT(c: number[]) {\n return c.join(' ');\n }\n\n function ringWKT(r: number[][]) {\n return r.map(pairWKT).join(', ');\n }\n\n function ringsWKT(r: number[][][]) {\n return r.map(ringWKT).map(wrapParens).join(', ');\n }\n\n function multiRingsWKT(r: number[][][][]) {\n return r.map(ringsWKT).map(wrapParens).join(', ');\n }\n\n function wrapParens(s: string) {\n return `(${s})`;\n }\n\n switch (gj.type) {\n case 'Point':\n return `POINT ${wrapParens(pairWKT(gj.coordinates))}`;\n case 'LineString':\n return `LINESTRING ${wrapParens(ringWKT(gj.coordinates))}`;\n case 'Polygon':\n return `POLYGON ${wrapParens(ringsWKT(gj.coordinates))}`;\n case 'MultiPoint':\n return `MULTIPOINT ${wrapParens(ringWKT(gj.coordinates))}`;\n case 'MultiPolygon':\n return `MULTIPOLYGON ${wrapParens(multiRingsWKT(gj.coordinates))}`;\n case 'MultiLineString':\n return `MULTILINESTRING ${wrapParens(ringsWKT(gj.coordinates))}`;\n case 'GeometryCollection':\n return `GEOMETRYCOLLECTION ${wrapParens(gj.geometries.map(encodeWKT).join(', '))}`;\n default:\n return ((_x: never): never => {\n throw new Error('stringify requires a valid GeoJSON Feature or geometry object as input');\n })(gj);\n }\n}\n"],"file":"encode-wkt.js"}
@@ -0,0 +1,346 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = parseWKB;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+
12
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
13
+
14
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
15
+
16
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
17
+
18
+ var NUM_DIMENSIONS = {
19
+ 0: 2,
20
+ 1: 3,
21
+ 2: 3,
22
+ 3: 4
23
+ };
24
+
25
+ function parseWKB(buffer) {
26
+ var view = new DataView(buffer);
27
+ var offset = 0;
28
+ var littleEndian = view.getUint8(offset) === 1;
29
+ offset++;
30
+ var geometryCode = view.getUint32(offset, littleEndian);
31
+ offset += 4;
32
+ var geometryType = geometryCode % 1000;
33
+ var dimension = NUM_DIMENSIONS[(geometryCode - geometryType) / 1000];
34
+
35
+ switch (geometryType) {
36
+ case 1:
37
+ var point = parsePoint(view, offset, dimension, littleEndian);
38
+ return point.geometry;
39
+
40
+ case 2:
41
+ var line = parseLineString(view, offset, dimension, littleEndian);
42
+ return line.geometry;
43
+
44
+ case 3:
45
+ var polygon = parsePolygon(view, offset, dimension, littleEndian);
46
+ return polygon.geometry;
47
+
48
+ case 4:
49
+ var multiPoint = parseMultiPoint(view, offset, dimension, littleEndian);
50
+ multiPoint.type = 'Point';
51
+ return multiPoint;
52
+
53
+ case 5:
54
+ var multiLine = parseMultiLineString(view, offset, dimension, littleEndian);
55
+ multiLine.type = 'LineString';
56
+ return multiLine;
57
+
58
+ case 6:
59
+ var multiPolygon = parseMultiPolygon(view, offset, dimension, littleEndian);
60
+ multiPolygon.type = 'Polygon';
61
+ return multiPolygon;
62
+
63
+ default:
64
+ throw new Error("WKB: Unsupported geometry type: ".concat(geometryType));
65
+ }
66
+ }
67
+
68
+ function parsePoint(view, offset, dimension, littleEndian) {
69
+ var positions = new Float64Array(dimension);
70
+
71
+ for (var i = 0; i < dimension; i++) {
72
+ positions[i] = view.getFloat64(offset, littleEndian);
73
+ offset += 8;
74
+ }
75
+
76
+ return {
77
+ geometry: {
78
+ type: 'Point',
79
+ positions: {
80
+ value: positions,
81
+ size: dimension
82
+ }
83
+ },
84
+ offset: offset
85
+ };
86
+ }
87
+
88
+ function parseLineString(view, offset, dimension, littleEndian) {
89
+ var nPoints = view.getUint32(offset, littleEndian);
90
+ offset += 4;
91
+ var positions = new Float64Array(nPoints * dimension);
92
+
93
+ for (var i = 0; i < nPoints * dimension; i++) {
94
+ positions[i] = view.getFloat64(offset, littleEndian);
95
+ offset += 8;
96
+ }
97
+
98
+ var pathIndices = [0];
99
+
100
+ if (nPoints > 0) {
101
+ pathIndices.push(nPoints);
102
+ }
103
+
104
+ return {
105
+ geometry: {
106
+ type: 'LineString',
107
+ positions: {
108
+ value: positions,
109
+ size: dimension
110
+ },
111
+ pathIndices: {
112
+ value: new Uint16Array(pathIndices),
113
+ size: 1
114
+ }
115
+ },
116
+ offset: offset
117
+ };
118
+ }
119
+
120
+ var cumulativeSum = function cumulativeSum(sum) {
121
+ return function (value) {
122
+ return sum += value;
123
+ };
124
+ };
125
+
126
+ function parsePolygon(view, offset, dimension, littleEndian) {
127
+ var nRings = view.getUint32(offset, littleEndian);
128
+ offset += 4;
129
+ var rings = [];
130
+
131
+ for (var i = 0; i < nRings; i++) {
132
+ var parsed = parseLineString(view, offset, dimension, littleEndian);
133
+ var positions = parsed.geometry.positions;
134
+ offset = parsed.offset;
135
+ rings.push(positions.value);
136
+ }
137
+
138
+ var concatenatedPositions = new Float64Array(concatTypedArrays(rings).buffer);
139
+ var polygonIndices = [0];
140
+
141
+ if (concatenatedPositions.length > 0) {
142
+ polygonIndices.push(concatenatedPositions.length / dimension);
143
+ }
144
+
145
+ var primitivePolygonIndices = rings.map(function (l) {
146
+ return l.length / dimension;
147
+ }).map(cumulativeSum(0));
148
+ primitivePolygonIndices.unshift(0);
149
+ return {
150
+ geometry: {
151
+ type: 'Polygon',
152
+ positions: {
153
+ value: concatenatedPositions,
154
+ size: dimension
155
+ },
156
+ polygonIndices: {
157
+ value: new Uint16Array(polygonIndices),
158
+ size: 1
159
+ },
160
+ primitivePolygonIndices: {
161
+ value: new Uint16Array(primitivePolygonIndices),
162
+ size: 1
163
+ }
164
+ },
165
+ offset: offset
166
+ };
167
+ }
168
+
169
+ function parseMultiPoint(view, offset, dimension, littleEndian) {
170
+ var nPoints = view.getUint32(offset, littleEndian);
171
+ offset += 4;
172
+ var binaryPointGeometries = [];
173
+
174
+ for (var i = 0; i < nPoints; i++) {
175
+ var littleEndianPoint = view.getUint8(offset) === 1;
176
+ offset++;
177
+
178
+ if (view.getUint32(offset, littleEndianPoint) % 1000 !== 1) {
179
+ throw new Error('WKB: Inner geometries of MultiPoint not of type Point');
180
+ }
181
+
182
+ offset += 4;
183
+ var parsed = parsePoint(view, offset, dimension, littleEndianPoint);
184
+ offset = parsed.offset;
185
+ binaryPointGeometries.push(parsed.geometry);
186
+ }
187
+
188
+ return concatenateBinaryPointGeometries(binaryPointGeometries, dimension);
189
+ }
190
+
191
+ function parseMultiLineString(view, offset, dimension, littleEndian) {
192
+ var nLines = view.getUint32(offset, littleEndian);
193
+ offset += 4;
194
+ var binaryLineGeometries = [];
195
+
196
+ for (var i = 0; i < nLines; i++) {
197
+ var littleEndianLine = view.getUint8(offset) === 1;
198
+ offset++;
199
+
200
+ if (view.getUint32(offset, littleEndianLine) % 1000 !== 2) {
201
+ throw new Error('WKB: Inner geometries of MultiLineString not of type LineString');
202
+ }
203
+
204
+ offset += 4;
205
+ var parsed = parseLineString(view, offset, dimension, littleEndianLine);
206
+ offset = parsed.offset;
207
+ binaryLineGeometries.push(parsed.geometry);
208
+ }
209
+
210
+ return concatenateBinaryLineGeometries(binaryLineGeometries, dimension);
211
+ }
212
+
213
+ function parseMultiPolygon(view, offset, dimension, littleEndian) {
214
+ var nPolygons = view.getUint32(offset, littleEndian);
215
+ offset += 4;
216
+ var binaryPolygonGeometries = [];
217
+
218
+ for (var i = 0; i < nPolygons; i++) {
219
+ var littleEndianPolygon = view.getUint8(offset) === 1;
220
+ offset++;
221
+
222
+ if (view.getUint32(offset, littleEndianPolygon) % 1000 !== 3) {
223
+ throw new Error('WKB: Inner geometries of MultiPolygon not of type Polygon');
224
+ }
225
+
226
+ offset += 4;
227
+ var parsed = parsePolygon(view, offset, dimension, littleEndianPolygon);
228
+ offset = parsed.offset;
229
+ binaryPolygonGeometries.push(parsed.geometry);
230
+ }
231
+
232
+ return concatenateBinaryPolygonGeometries(binaryPolygonGeometries, dimension);
233
+ }
234
+
235
+ function concatenateBinaryPointGeometries(binaryPointGeometries, dimension) {
236
+ var positions = binaryPointGeometries.map(function (geometry) {
237
+ return geometry.positions.value;
238
+ });
239
+ var concatenatedPositions = new Float64Array(concatTypedArrays(positions).buffer);
240
+ return {
241
+ type: 'Point',
242
+ positions: {
243
+ value: concatenatedPositions,
244
+ size: dimension
245
+ }
246
+ };
247
+ }
248
+
249
+ function concatenateBinaryLineGeometries(binaryLineGeometries, dimension) {
250
+ var lines = binaryLineGeometries.map(function (geometry) {
251
+ return geometry.positions.value;
252
+ });
253
+ var concatenatedPositions = new Float64Array(concatTypedArrays(lines).buffer);
254
+ var pathIndices = lines.map(function (line) {
255
+ return line.length / dimension;
256
+ }).map(cumulativeSum(0));
257
+ pathIndices.unshift(0);
258
+ return {
259
+ type: 'LineString',
260
+ positions: {
261
+ value: concatenatedPositions,
262
+ size: dimension
263
+ },
264
+ pathIndices: {
265
+ value: new Uint16Array(pathIndices),
266
+ size: 1
267
+ }
268
+ };
269
+ }
270
+
271
+ function concatenateBinaryPolygonGeometries(binaryPolygonGeometries, dimension) {
272
+ var polygons = [];
273
+ var primitivePolygons = [];
274
+
275
+ var _iterator = _createForOfIteratorHelper(binaryPolygonGeometries),
276
+ _step;
277
+
278
+ try {
279
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
280
+ var binaryPolygon = _step.value;
281
+ var positions = binaryPolygon.positions,
282
+ _primitivePolygonIndices = binaryPolygon.primitivePolygonIndices;
283
+ polygons.push(positions.value);
284
+ primitivePolygons.push(_primitivePolygonIndices.value);
285
+ }
286
+ } catch (err) {
287
+ _iterator.e(err);
288
+ } finally {
289
+ _iterator.f();
290
+ }
291
+
292
+ var concatenatedPositions = new Float64Array(concatTypedArrays(polygons).buffer);
293
+ var polygonIndices = polygons.map(function (p) {
294
+ return p.length / dimension;
295
+ }).map(cumulativeSum(0));
296
+ polygonIndices.unshift(0);
297
+ var primitivePolygonIndices = [0];
298
+
299
+ for (var _i = 0, _primitivePolygons = primitivePolygons; _i < _primitivePolygons.length; _i++) {
300
+ var primitivePolygon = _primitivePolygons[_i];
301
+ primitivePolygonIndices.push.apply(primitivePolygonIndices, (0, _toConsumableArray2.default)(primitivePolygon.filter(function (x) {
302
+ return x > 0;
303
+ }).map(function (x) {
304
+ return x + primitivePolygonIndices[primitivePolygonIndices.length - 1];
305
+ })));
306
+ }
307
+
308
+ return {
309
+ type: 'Polygon',
310
+ positions: {
311
+ value: concatenatedPositions,
312
+ size: dimension
313
+ },
314
+ polygonIndices: {
315
+ value: new Uint16Array(polygonIndices),
316
+ size: 1
317
+ },
318
+ primitivePolygonIndices: {
319
+ value: new Uint16Array(primitivePolygonIndices),
320
+ size: 1
321
+ }
322
+ };
323
+ }
324
+
325
+ function concatTypedArrays(arrays) {
326
+ var byteLength = 0;
327
+
328
+ for (var i = 0; i < arrays.length; ++i) {
329
+ byteLength += arrays[i].byteLength;
330
+ }
331
+
332
+ var buffer = new Uint8Array(byteLength);
333
+ var byteOffset = 0;
334
+
335
+ for (var _i2 = 0; _i2 < arrays.length; ++_i2) {
336
+ var data = new Uint8Array(arrays[_i2].buffer);
337
+ byteLength = data.length;
338
+
339
+ for (var j = 0; j < byteLength; ++j) {
340
+ buffer[byteOffset++] = data[j];
341
+ }
342
+ }
343
+
344
+ return buffer;
345
+ }
346
+ //# sourceMappingURL=parse-wkb.js.map