@loaders.gl/json 4.2.0-alpha.4 → 4.2.0-alpha.5
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.
- package/dist/dist.dev.js +341 -409
- package/dist/dist.min.js +21 -0
- package/dist/geojson-loader.d.ts +1 -1
- package/dist/geojson-loader.d.ts.map +1 -1
- package/dist/geojson-loader.js +74 -72
- package/dist/geojson-writer.js +23 -20
- package/dist/index.cjs +120 -94
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +12 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/json-loader.js +29 -36
- package/dist/json-writer.js +14 -11
- package/dist/lib/clarinet/clarinet.js +511 -391
- package/dist/lib/encoder-utils/encode-table-row.d.ts +1 -1
- package/dist/lib/encoder-utils/encode-table-row.d.ts.map +1 -1
- package/dist/lib/encoder-utils/encode-table-row.js +46 -37
- package/dist/lib/encoder-utils/encode-utils.js +38 -25
- package/dist/lib/encoder-utils/utf8-encoder.js +25 -27
- package/dist/lib/encoders/geojson-encoder.d.ts +1 -1
- package/dist/lib/encoders/geojson-encoder.d.ts.map +1 -1
- package/dist/lib/encoders/geojson-encoder.js +43 -40
- package/dist/lib/encoders/json-encoder.d.ts +1 -1
- package/dist/lib/encoders/json-encoder.d.ts.map +1 -1
- package/dist/lib/encoders/json-encoder.js +17 -9
- package/dist/lib/json-parser/json-parser.d.ts +2 -2
- package/dist/lib/json-parser/json-parser.d.ts.map +1 -1
- package/dist/lib/json-parser/json-parser.js +85 -102
- package/dist/lib/json-parser/streaming-json-parser.d.ts +2 -2
- package/dist/lib/json-parser/streaming-json-parser.d.ts.map +1 -1
- package/dist/lib/json-parser/streaming-json-parser.js +86 -63
- package/dist/lib/jsonpath/jsonpath.js +77 -57
- package/dist/lib/parsers/parse-json-in-batches.d.ts +1 -1
- package/dist/lib/parsers/parse-json-in-batches.d.ts.map +1 -1
- package/dist/lib/parsers/parse-json-in-batches.js +76 -75
- package/dist/lib/parsers/parse-json.d.ts +1 -1
- package/dist/lib/parsers/parse-json.d.ts.map +1 -1
- package/dist/lib/parsers/parse-json.js +21 -22
- package/dist/lib/parsers/parse-ndjson-in-batches.js +26 -28
- package/dist/lib/parsers/parse-ndjson.js +10 -10
- package/dist/ndgeoson-loader.js +27 -19
- package/dist/ndjson-loader.js +21 -13
- package/dist/workers/geojson-worker.js +0 -1
- package/package.json +11 -7
- package/dist/geojson-loader.js.map +0 -1
- package/dist/geojson-writer.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/json-loader.js.map +0 -1
- package/dist/json-writer.js.map +0 -1
- package/dist/lib/clarinet/LICENSE +0 -28
- package/dist/lib/clarinet/clarinet.js.map +0 -1
- package/dist/lib/encoder-utils/encode-table-row.js.map +0 -1
- package/dist/lib/encoder-utils/encode-utils.js.map +0 -1
- package/dist/lib/encoder-utils/utf8-encoder.js.map +0 -1
- package/dist/lib/encoders/geojson-encoder.js.map +0 -1
- package/dist/lib/encoders/json-encoder.js.map +0 -1
- package/dist/lib/json-parser/json-parser.js.map +0 -1
- package/dist/lib/json-parser/streaming-json-parser.js.map +0 -1
- package/dist/lib/jsonpath/jsonpath.js.map +0 -1
- package/dist/lib/parsers/parse-json-in-batches.js.map +0 -1
- package/dist/lib/parsers/parse-json.js.map +0 -1
- package/dist/lib/parsers/parse-ndjson-in-batches.js.map +0 -1
- package/dist/lib/parsers/parse-ndjson.js.map +0 -1
- package/dist/ndgeoson-loader.js.map +0 -1
- package/dist/ndjson-loader.js.map +0 -1
- package/dist/workers/geojson-worker.js.map +0 -1
package/dist/dist.min.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if (typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
|
+
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
|
+
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
|
+
"use strict";var __exports__=(()=>{var de=Object.create;var Q=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,xe=Object.prototype.hasOwnProperty;var we=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),be=(e,t)=>{for(var r in t)Q(e,r,{get:t[r],enumerable:!0})},H=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ye(t))!xe.call(e,n)&&n!==r&&Q(e,n,{get:()=>t[n],enumerable:!(o=me(t,n))||o.enumerable});return e},X=(e,t,r)=>(H(e,t,"default"),r&&H(r,t,"default")),Ae=(e,t,r)=>(r=e!=null?de(ge(e)):{},H(t||!e||!e.__esModule?Q(r,"default",{value:e,enumerable:!0}):r,e)),Pe=e=>H(Q({},"__esModule",{value:!0}),e);var Lt=we((wr,_t)=>{_t.exports=globalThis.loaders});var Y={};be(Y,{JSONLoader:()=>at,JSONWriter:()=>Qt,NDJSONLoader:()=>Ht,_ClarinetParser:()=>L,_GeoJSONLoader:()=>U,_GeoJSONWorkerLoader:()=>Bt,_GeoJSONWriter:()=>pe,_JSONPath:()=>P,_rebuildJsonObject:()=>Zt});X(Y,Ae(Lt(),1));var q=class{constructor(t,r){if(this.length=0,this.rows=null,this.cursor=0,this._headers=[],this.options=r,this.schema=t,!Array.isArray(t)){this._headers=[];for(let o in t)this._headers[t[o].index]=t[o].name}}rowCount(){return this.length}addArrayRow(t,r){Number.isFinite(r)&&(this.cursor=r),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,r){Number.isFinite(r)&&(this.cursor=r),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;return t?(t=t.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}};function Ft(e,t){if(!e)throw new Error("null row");let r={};if(t)for(let o=0;o<t.length;o++)r[t[o]]=e[o];else for(let o=0;o<e.length;o++){let n=`column-${o}`;r[n]=e[o]}return r}function vt(e,t){if(!e)throw new Error("null row");if(t){let r=new Array(t.length);for(let o=0;o<t.length;o++)r[o]=e[t[o]];return r}return Object.values(e)}function Rt(e){let t=[];for(let r=0;r<e.length;r++){let o=`column-${r}`;t.push(o)}return t}function kt(e){return Object.keys(e)}var Tt=100,tt=class{constructor(t,r){if(this.length=0,this.objectRows=null,this.arrayRows=null,this.cursor=0,this._headers=null,this.options=r,this.schema=t,t){this._headers=[];for(let o in t)this._headers[t[o].index]=t[o].name}}rowCount(){return this.length}addArrayRow(t,r){switch(Number.isFinite(r)&&(this.cursor=r),this._headers||(this._headers=Rt(t)),this.options.shape){case"object-row-table":let o=Ft(t,this._headers);this.addObjectRow(o,r);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(Tt),this.arrayRows[this.length]=t,this.length++;break}}addObjectRow(t,r){switch(Number.isFinite(r)&&(this.cursor=r),this._headers||(this._headers=kt(t)),this.options.shape){case"array-row-table":let o=vt(t,this._headers);this.addArrayRow(o,r);break;case"object-row-table":this.objectRows=this.objectRows||new Array(Tt),this.objectRows[this.length]=t,this.length++;break}}getBatch(){let t=this.arrayRows||this.objectRows;return t?(t=t.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}};var et=class{constructor(t,r){this.length=0,this.allocated=0,this.columns={},this.schema=t,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(t){this._reallocateColumns();let r=0;for(let o in this.columns)this.columns[o][this.length]=t[r++];this.length++}addObjectRow(t){this._reallocateColumns();for(let r in t)this.columns[r][this.length]=t[r];this.length++}getBatch(){this._pruneColumns();let t=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(let o in this.schema){let n=this.schema[o];t[n.name]=this.columns[n.index]}return this.columns={},{shape:"columnar-table",batchType:"data",data:t,schema:this.schema,length:this.length}}_reallocateColumns(){if(!(this.length<this.allocated)){this.allocated=this.allocated>0?this.allocated*=2:100,this.columns={};for(let t in this.schema){let r=this.schema[t],o=r.type||Float32Array,n=this.columns[r.index];if(n&&ArrayBuffer.isView(n)){let s=new o(this.allocated);s.set(n),this.columns[r.index]=s}else n?(n.length=this.allocated,this.columns[r.index]=n):this.columns[r.index]=new o(this.allocated)}}}_pruneColumns(){for(let[t,r]of Object.entries(this.columns))this.columns[t]=r.slice(0,this.length)}};var je={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},Ne="TableBatchBuilder",N=class{constructor(t,r){this.aggregator=null,this.batchCount=0,this.bytesUsed=0,this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),this.totalLength=0,this.totalBytes=0,this.rowBytes=0,this.schema=t,this.options={...je,...r}}limitReached(){return!!(Boolean(this.options?.limit)&&this.totalLength>=this.options.limit||Boolean(this.options?._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){let r=this._getTableBatchType();this.aggregator=new r(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){let r=this._getTableBatchType();this.aggregator=new r(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),typeof t=="string"&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?t.length*8:Object.keys(t).length*8}_isFull(){if(!this.aggregator||this.aggregator.rowCount()===0)return!1;if(this.options.batchSize==="auto"){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs?!1:(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(t){if(!this.aggregator)return null;t?.bytesUsed&&(this.bytesUsed=t.bytesUsed);let r=this.aggregator.getBatch();return r.count=this.batchCount,r.bytesUsed=this.bytesUsed,Object.assign(r,t),this.batchCount++,this.aggregator=null,r}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return tt;case"columnar-table":return et;case"arrow-table":if(!N.ArrowBatch)throw new Error(Ne);return N.ArrowBatch;default:return q}}};function E(e){switch(e.shape){case"array-row-table":case"object-row-table":return e.data.length;case"geojson-table":return e.features.length;case"arrow-table":return e.data.numRows;case"columnar-table":for(let r of Object.values(e.data))return r.length||0;return 0;default:throw new Error("table")}}function rt(e){if(e.schema)return e.schema.fields.length;if(E(e)===0)throw new Error("empty table");switch(e.shape){case"array-row-table":return e.data[0].length;case"object-row-table":return Object.keys(e.data[0]).length;case"geojson-table":return Object.keys(e.features[0]).length;case"columnar-table":return Object.keys(e.data).length;case"arrow-table":return e.data.numCols;default:throw new Error("table")}}function ot(e,t,r,o){switch(e.shape){case"object-row-table":return o?Object.fromEntries(Object.entries(e.data[t])):e.data[t];case"array-row-table":if(e.schema){let c=r||{};for(let l=0;l<e.schema.fields.length;l++)c[e.schema.fields[l].name]=e.data[t][l];return c}throw new Error("no schema");case"geojson-table":if(e.schema){let c=r||{};for(let l=0;l<e.schema.fields.length;l++)c[e.schema.fields[l].name]=e.features[t][l];return c}throw new Error("no schema");case"columnar-table":if(e.schema){let c=r||{};for(let l=0;l<e.schema.fields.length;l++)c[e.schema.fields[l].name]=e.data[e.schema.fields[l].name][t];return c}else{let c=r||{};for(let[l,u]of Object.entries(e.data))c[l]=u[t];return c}case"arrow-table":let n=e.data,s=r||{},a=n.get(t),i=n.schema;for(let c=0;c<i.fields.length;c++)s[i.fields[c].name]=a?.[i.fields[c].name];return s;default:throw new Error("shape")}}function nt(e,t,r,o){switch(e.shape){case"array-row-table":return o?Array.from(e.data[t]):e.data[t];case"object-row-table":if(e.schema){let c=r||[];for(let l=0;l<e.schema.fields.length;l++)c[l]=e.data[t][e.schema.fields[l].name];return c}return Object.values(e.data[t]);case"geojson-table":if(e.schema){let c=r||[];for(let l=0;l<e.schema.fields.length;l++)c[l]=e.features[t][e.schema.fields[l].name];return c}return Object.values(e.features[t]);case"columnar-table":if(e.schema){let c=r||[];for(let l=0;l<e.schema.fields.length;l++)c[l]=e.data[e.schema.fields[l].name][t];return c}else{let c=r||[],l=0;for(let u of Object.values(e.data))c[l]=u[t],l++;return c}case"arrow-table":let n=e.data,s=r||[],a=n.get(t),i=n.schema;for(let c=0;c<i.fields.length;c++)s[c]=a?.[i.fields[c].name];return s;default:throw new Error("shape")}}function*pt(e,t){switch(t){case"array-row-table":yield*Ut(e);break;case"object-row-table":yield*Dt(e);break;default:throw new Error(`Unknown row type ${t}`)}}function*Ut(e,t=[]){let r=E(e);for(let o=0;o<r;o++)yield nt(e,o,t)}function*Dt(e,t={}){let r=E(e);for(let o=0;o<r;o++)yield ot(e,o,t)}function st(e,t="float32"){return e instanceof Date?"date-millisecond":e instanceof Number?t:typeof e=="string"?"utf8":(e===null||e==="undefined","null")}function Jt(e){let t=Oe(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=st(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function Oe(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function Gt(e){switch(e.shape){case"array-row-table":case"object-row-table":return Ie(e.data);case"columnar-table":return Se(e.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Se(e){let t=[];for(let[r,o]of Object.entries(e)){let n=Ee(o,r);t.push(n)}return{fields:t,metadata:{}}}function Ie(e){if(!e.length)throw new Error("deduce from empty table");let t=[],r=e[0];for(let[o,n]of Object.entries(r))t.push(Be(n,o));return{fields:t,metadata:{}}}function Ee(e,t){if(ArrayBuffer.isView(e)){let r=Jt(e);return{name:t,type:r.type||"null",nullable:r.nullable}}if(Array.isArray(e)&&e.length>0){let r=e[0],o=st(r);return{name:t,type:o,nullable:!0}}throw new Error("empty table")}function Be(e,t){let r=st(e);return{name:t,type:r,nullable:!0}}function D(e){let t;switch(Ce(e)){case"array-row-table":t={shape:"array-row-table",data:e};break;case"object-row-table":t={shape:"object-row-table",data:e};break;case"columnar-table":t={shape:"columnar-table",data:e};break;default:throw new Error("table")}let r=Gt(t);return{...t,schema:r}}function Ce(e){if(Array.isArray(e)){if(e.length===0)throw new Error("cannot deduce type of empty table");let t=e[0];if(Array.isArray(t))return"array-row-table";if(t&&typeof t=="object")return"object-row-table"}if(e&&typeof e=="object")return"columnar-table";throw new Error("invalid table")}function Mt(e,t){try{let r=JSON.parse(e);if(t.json?.table){let o=zt(r)||r;return D(o)}return r}catch{throw new Error("JSONLoader: failed to parse JSON")}}function zt(e){if(Array.isArray(e))return e;if(e&&typeof e=="object")for(let t of Object.values(e)){let r=zt(t);if(r)return r}return null}function dt(e,t){if(!e)throw new Error(t||"loader assertion failed.")}function Wt(...e){return _e(e)}function _e(e){let t=e.map(s=>s instanceof ArrayBuffer?new Uint8Array(s):s),r=t.reduce((s,a)=>s+a.byteLength,0),o=new Uint8Array(r),n=0;for(let s of t)o.set(s,n),n+=s.byteLength;return o.buffer}async function*J(e,t={}){let r=new TextDecoder(void 0,t);for await(let o of e)yield typeof o=="string"?o:r.decode(o,{stream:!0})}async function*mt(e){let t="";for await(let r of e){t+=r;let o;for(;(o=t.indexOf(`
|
|
8
|
+
`))>=0;){let n=t.slice(0,o+1);t=t.slice(o+1),yield n}}t.length>0&&(yield t)}async function*yt(e){let t=1;for await(let r of e)yield{counter:t,line:r},t++}async function gt(e){let t=[];for await(let r of e)t.push(r);return Wt(...t)}function B(e){return B=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(e)}function xt(e,t){if(B(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var o=r.call(e,t||"default");if(B(o)!=="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wt(e){var t=xt(e,"string");return B(t)==="symbol"?t:String(t)}function j(e,t,r){return t=wt(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var bt=Number.MAX_SAFE_INTEGER,h;(function(e){e[e.BEGIN=0]="BEGIN",e[e.VALUE=1]="VALUE",e[e.OPEN_OBJECT=2]="OPEN_OBJECT",e[e.CLOSE_OBJECT=3]="CLOSE_OBJECT",e[e.OPEN_ARRAY=4]="OPEN_ARRAY",e[e.CLOSE_ARRAY=5]="CLOSE_ARRAY",e[e.TEXT_ESCAPE=6]="TEXT_ESCAPE",e[e.STRING=7]="STRING",e[e.BACKSLASH=8]="BACKSLASH",e[e.END=9]="END",e[e.OPEN_KEY=10]="OPEN_KEY",e[e.CLOSE_KEY=11]="CLOSE_KEY",e[e.TRUE=12]="TRUE",e[e.TRUE2=13]="TRUE2",e[e.TRUE3=14]="TRUE3",e[e.FALSE=15]="FALSE",e[e.FALSE2=16]="FALSE2",e[e.FALSE3=17]="FALSE3",e[e.FALSE4=18]="FALSE4",e[e.NULL=19]="NULL",e[e.NULL2=20]="NULL2",e[e.NULL3=21]="NULL3",e[e.NUMBER_DECIMAL_POINT=22]="NUMBER_DECIMAL_POINT",e[e.NUMBER_DIGIT=23]="NUMBER_DIGIT"})(h||(h={}));var p={tab:9,lineFeed:10,carriageReturn:13,space:32,doubleQuote:34,plus:43,comma:44,minus:45,period:46,_0:48,_9:57,colon:58,E:69,openBracket:91,backslash:92,closeBracket:93,a:97,b:98,e:101,f:102,l:108,n:110,r:114,s:115,t:116,u:117,openBrace:123,closeBrace:125},Vt=/[\\"\n]/g,$t={onready:()=>{},onopenobject:()=>{},onkey:()=>{},oncloseobject:()=>{},onopenarray:()=>{},onclosearray:()=>{},onvalue:()=>{},onerror:()=>{},onend:()=>{},onchunkparsed:()=>{}},L=class{constructor(t={}){this.options=$t,this.bufferCheckPosition=bt,this.q="",this.c="",this.p="",this.closed=!1,this.closedRoot=!1,this.sawRoot=!1,this.error=null,this.state=h.BEGIN,this.stack=[],this.position=0,this.column=0,this.line=1,this.slashed=!1,this.unicodeI=0,this.unicodeS=null,this.depth=0,this.options={...$t,...t},this.textNode=void 0,this.numberNode="",this.emit("onready")}end(){return(this.state!==h.VALUE||this.depth!==0)&&this._error("Unexpected end"),this._closeValue(),this.c="",this.closed=!0,this.emit("onend"),this}resume(){return this.error=null,this}close(){return this.write(null)}emit(t,r){this.options[t]?.(r,this)}emitNode(t,r){this._closeValue(),this.emit(t,r)}write(t){if(this.error)throw this.error;if(this.closed)return this._error("Cannot write after close. Assign an onready handler.");if(t===null)return this.end();let r=0,o=t.charCodeAt(0),n=this.p;for(;o&&(n=o,this.c=o=t.charCodeAt(r++),n!==o?this.p=n:n=this.p,!!o);)switch(this.position++,o===p.lineFeed?(this.line++,this.column=0):this.column++,this.state){case h.BEGIN:o===p.openBrace?this.state=h.OPEN_OBJECT:o===p.openBracket?this.state=h.OPEN_ARRAY:G(o)||this._error("Non-whitespace before {[.");continue;case h.OPEN_KEY:case h.OPEN_OBJECT:if(G(o))continue;if(this.state===h.OPEN_KEY)this.stack.push(h.CLOSE_KEY);else if(o===p.closeBrace){this.emit("onopenobject"),this.depth++,this.emit("oncloseobject"),this.depth--,this.state=this.stack.pop()||h.VALUE;continue}else this.stack.push(h.CLOSE_OBJECT);o===p.doubleQuote?this.state=h.STRING:this._error('Malformed object key should start with "');continue;case h.CLOSE_KEY:case h.CLOSE_OBJECT:if(G(o))continue;o===p.colon?(this.state===h.CLOSE_OBJECT?(this.stack.push(h.CLOSE_OBJECT),this._closeValue("onopenobject"),this.depth++):this._closeValue("onkey"),this.state=h.VALUE):o===p.closeBrace?(this.emitNode("oncloseobject"),this.depth--,this.state=this.stack.pop()||h.VALUE):o===p.comma?(this.state===h.CLOSE_OBJECT&&this.stack.push(h.CLOSE_OBJECT),this._closeValue(),this.state=h.OPEN_KEY):this._error("Bad object");continue;case h.OPEN_ARRAY:case h.VALUE:if(G(o))continue;if(this.state===h.OPEN_ARRAY)if(this.emit("onopenarray"),this.depth++,this.state=h.VALUE,o===p.closeBracket){this.emit("onclosearray"),this.depth--,this.state=this.stack.pop()||h.VALUE;continue}else this.stack.push(h.CLOSE_ARRAY);o===p.doubleQuote?this.state=h.STRING:o===p.openBrace?this.state=h.OPEN_OBJECT:o===p.openBracket?this.state=h.OPEN_ARRAY:o===p.t?this.state=h.TRUE:o===p.f?this.state=h.FALSE:o===p.n?this.state=h.NULL:o===p.minus?this.numberNode+="-":p._0<=o&&o<=p._9?(this.numberNode+=String.fromCharCode(o),this.state=h.NUMBER_DIGIT):this._error("Bad value");continue;case h.CLOSE_ARRAY:if(o===p.comma)this.stack.push(h.CLOSE_ARRAY),this._closeValue("onvalue"),this.state=h.VALUE;else if(o===p.closeBracket)this.emitNode("onclosearray"),this.depth--,this.state=this.stack.pop()||h.VALUE;else{if(G(o))continue;this._error("Bad array")}continue;case h.STRING:this.textNode===void 0&&(this.textNode="");let s=r-1,a=this.slashed,i=this.unicodeI;t:for(;;){for(;i>0;)if(this.unicodeS+=String.fromCharCode(o),o=t.charCodeAt(r++),this.position++,i===4?(this.textNode+=String.fromCharCode(parseInt(this.unicodeS,16)),i=0,s=r-1):i++,!o)break t;if(o===p.doubleQuote&&!a){this.state=this.stack.pop()||h.VALUE,this.textNode+=t.substring(s,r-1),this.position+=r-1-s;break}if(o===p.backslash&&!a&&(a=!0,this.textNode+=t.substring(s,r-1),this.position+=r-1-s,o=t.charCodeAt(r++),this.position++,!o))break;if(a){if(a=!1,o===p.n?this.textNode+=`
|
|
9
|
+
`:o===p.r?this.textNode+="\r":o===p.t?this.textNode+=" ":o===p.f?this.textNode+="\f":o===p.b?this.textNode+="\b":o===p.u?(i=1,this.unicodeS=""):this.textNode+=String.fromCharCode(o),o=t.charCodeAt(r++),this.position++,s=r-1,o)continue;break}Vt.lastIndex=r;let c=Vt.exec(t);if(c===null){r=t.length+1,this.textNode+=t.substring(s,r-1),this.position+=r-1-s;break}if(r=c.index+1,o=t.charCodeAt(c.index),!o){this.textNode+=t.substring(s,r-1),this.position+=r-1-s;break}}this.slashed=a,this.unicodeI=i;continue;case h.TRUE:o===p.r?this.state=h.TRUE2:this._error(`Invalid true started with t${o}`);continue;case h.TRUE2:o===p.u?this.state=h.TRUE3:this._error(`Invalid true started with tr${o}`);continue;case h.TRUE3:o===p.e?(this.emit("onvalue",!0),this.state=this.stack.pop()||h.VALUE):this._error(`Invalid true started with tru${o}`);continue;case h.FALSE:o===p.a?this.state=h.FALSE2:this._error(`Invalid false started with f${o}`);continue;case h.FALSE2:o===p.l?this.state=h.FALSE3:this._error(`Invalid false started with fa${o}`);continue;case h.FALSE3:o===p.s?this.state=h.FALSE4:this._error(`Invalid false started with fal${o}`);continue;case h.FALSE4:o===p.e?(this.emit("onvalue",!1),this.state=this.stack.pop()||h.VALUE):this._error(`Invalid false started with fals${o}`);continue;case h.NULL:o===p.u?this.state=h.NULL2:this._error(`Invalid null started with n${o}`);continue;case h.NULL2:o===p.l?this.state=h.NULL3:this._error(`Invalid null started with nu${o}`);continue;case h.NULL3:o===p.l?(this.emit("onvalue",null),this.state=this.stack.pop()||h.VALUE):this._error(`Invalid null started with nul${o}`);continue;case h.NUMBER_DECIMAL_POINT:o===p.period?(this.numberNode+=".",this.state=h.NUMBER_DIGIT):this._error("Leading zero not followed by .");continue;case h.NUMBER_DIGIT:p._0<=o&&o<=p._9?this.numberNode+=String.fromCharCode(o):o===p.period?(this.numberNode.indexOf(".")!==-1&&this._error("Invalid number has two dots"),this.numberNode+="."):o===p.e||o===p.E?((this.numberNode.indexOf("e")!==-1||this.numberNode.indexOf("E")!==-1)&&this._error("Invalid number has two exponential"),this.numberNode+="e"):o===p.plus||o===p.minus?(n===p.e||n===p.E||this._error("Invalid symbol in number"),this.numberNode+=String.fromCharCode(o)):(this._closeNumber(),r--,this.state=this.stack.pop()||h.VALUE);continue;default:this._error(`Unknown state: ${this.state}`)}return this.position>=this.bufferCheckPosition&&Le(this),this.emit("onchunkparsed"),this}_closeValue(t="onvalue"){this.textNode!==void 0&&this.emit(t,this.textNode),this.textNode=void 0}_closeNumber(){this.numberNode&&this.emit("onvalue",parseFloat(this.numberNode)),this.numberNode=""}_error(t=""){this._closeValue(),t+=`
|
|
10
|
+
Line: ${this.line}
|
|
11
|
+
Column: ${this.column}
|
|
12
|
+
Char: ${this.c}`;let r=new Error(t);this.error=r,this.emit("onerror",r)}};function G(e){return e===p.carriageReturn||e===p.lineFeed||e===p.space||e===p.tab}function Le(e){let t=Math.max(bt,10),r=0;for(let o of["textNode","numberNode"]){let n=e[o]===void 0?0:e[o].length;if(n>t)switch(o){case"text":break;default:e._error(`Max buffer length exceeded: ${o}`)}r=Math.max(r,n)}e.bufferCheckPosition=bt-r+e.position}var P=class{constructor(t=null){if(this.path=["$"],t instanceof P){this.path=[...t.path];return}if(Array.isArray(t)){this.path.push(...t);return}if(typeof t=="string"&&(this.path=t.split("."),this.path[0]!=="$"))throw new Error("JSONPaths must start with $")}clone(){return new P(this)}toString(){return this.path.join(".")}push(t){this.path.push(t)}pop(){return this.path.pop()}set(t){this.path[this.path.length-1]=t}equals(t){if(!this||!t||this.path.length!==t.path.length)return!1;for(let r=0;r<this.path.length;++r)if(this.path[r]!==t.path[r])return!1;return!0}setFieldAtPath(t,r){let o=[...this.path];o.shift();let n=o.pop();for(let s of o)t=t[s];t[n]=r}getFieldAtPath(t){let r=[...this.path];r.shift();let o=r.pop();for(let n of r)t=t[n];return t[o]}};var M=class{constructor(t){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new P,this.reset(),this.parser=new L({onready:()=>{this.jsonpath=new P,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:r=>{this._openObject({}),typeof r<"u"&&this.parser.emit("onkey",r)},onkey:r=>{this.jsonpath.set(r),this.currentState.key=r},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:r=>{this._pushOrSet(r)},onerror:r=>{throw r},onend:()=>{this.result=this.currentState.container.pop()},...t})}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new P}write(t){this.parser.write(t)}close(){this.parser.close()}_pushOrSet(t){let{container:r,key:o}=this.currentState;o!==null?(r[o]=t,this.currentState.key=null):r.push(t)}_openArray(t=[]){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(t={}){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}};var z=class extends M{constructor(t={}){super({onopenarray:()=>{if(!this.streamingArray&&this._matchJSONPath()){this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],this._openArray(this.streamingArray);return}this._openArray()},onopenobject:o=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),typeof o<"u"&&this.parser.emit("onkey",o)}}),this.streamingJsonPath=null,this.streamingArray=null,this.topLevelObject=null;let r=t.jsonpaths||[];this.jsonPaths=r.map(o=>new P(o))}write(t){super.write(t);let r=[];return this.streamingArray&&(r=[...this.streamingArray],this.streamingArray.length=0),r}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){let t=this.getJsonPath();if(this.jsonPaths.length===0)return!0;for(let r of this.jsonPaths)if(r.equals(t))return!0;return!1}};async function*it(e,t){let r=J(e),{metadata:o}=t,{jsonpaths:n}=t.json||{},s=!0,a=null,i=new N(a,t),c=new z({jsonpaths:n});for await(let d of r){let f=c.write(d),y=f.length>0&&c.getStreamingJsonPathAsString();f.length>0&&s&&(o&&(yield{shape:t?.json?.shape||"array-row-table",batchType:"partial-result",data:[],length:0,bytesUsed:0,container:c.getPartialResult(),jsonpath:y}),s=!1);for(let w of f){i.addRow(w);let A=i.getFullBatch({jsonpath:y});A&&(yield A)}i.chunkComplete(d);let m=i.getFullBatch({jsonpath:y});m&&(yield m)}let l=c.getStreamingJsonPathAsString(),u=i.getFinalBatch({jsonpath:l});u&&(yield u),o&&(yield{shape:"json",batchType:"final-result",container:c.getPartialResult(),jsonpath:c.getStreamingJsonPathAsString(),data:[],length:0})}function Zt(e,t){if(dt(e.batchType==="final-result"),e.jsonpath==="$")return t;if(e.jsonpath&&e.jsonpath.length>1){let r=e.container;return new P(e.jsonpath).setFieldAtPath(r,t),r}return e.container}var Fe="4.2.0-alpha.4",at={name:"JSON",id:"json",module:"json",version:Fe,extensions:["json","geojson"],mimeTypes:["application/json"],category:"table",text:!0,options:{json:{shape:void 0,table:!1,jsonpaths:[]}},parse:ve,parseTextSync:Kt,parseInBatches:Re};async function ve(e,t){return Kt(new TextDecoder().decode(e),t)}function Kt(e,t){let r={...t,json:{...at.options.json,...t?.json}};return Mt(e,r)}function Re(e,t){let r={...t,json:{...at.options.json,...t?.json}};return it(e,r)}function At(e){let r=e.trim().split(`
|
|
13
|
+
`).map((o,n)=>{try{return JSON.parse(o)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${n+1}`)}});return D(r)}async function*Yt(e,t){let r=J(e),o=mt(r),n=yt(o),s=null,a="row-table",i=new N(s,{...t,shape:a});for await(let{counter:l,line:u}of n)try{let d=JSON.parse(u);i.addRow(d),i.chunkComplete(u);let f=i.getFullBatch();f&&(yield f)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${l}`)}let c=i.getFinalBatch();c&&(yield c)}var ke="4.2.0-alpha.4",Ht={name:"NDJSON",id:"ndjson",module:"json",version:ke,extensions:["ndjson","jsonl"],mimeTypes:["application/x-ndjson","application/jsonlines","application/json-seq"],category:"table",text:!0,parse:async e=>At(new TextDecoder().decode(e)),parseTextSync:At,parseInBatches:Yt,options:{}};function Pt(e,t){let r=t?.json?.shape||"object-row-table",o=[],n=pt(e,r);for(let s of n)o.push(JSON.stringify(s));return`[${o.join(",")}]`}var Qt={id:"json",version:"latest",module:"json",name:"JSON",extensions:["json"],mimeTypes:["application/json"],options:{},text:!0,encode:async(e,t)=>new TextEncoder().encode(Pt(e,t)).buffer,encodeTextSync:(e,t)=>Pt(e,t)};var W={x:0,y:1,z:2};function k(e,t={}){let{start:r=0,end:o=e.length,plane:n="xy"}=t,s=t.size||2,a=0,i=W[n[0]],c=W[n[1]];for(let l=r,u=o-s;l<o;l+=s)a+=(e[l+i]-e[u+i])*(e[l+c]+e[u+c]),u=l;return a/2}function Nt(e,t,r=2,o,n="xy"){let s=t&&t.length,a=s?t[0]*r:e.length,i=qt(e,0,a,r,!0,o&&o[0],n),c=[];if(!i||i.next===i.prev)return c;let l,u,d,f,y,m,w;if(s&&(i=ze(e,t,i,r,o,n)),e.length>80*r){f=u=e[0],y=d=e[1];for(let A=r;A<a;A+=r)m=e[A],w=e[A+1],m<f&&(f=m),w<y&&(y=w),m>u&&(u=m),w>d&&(d=w);l=Math.max(u-f,d-y),l=l!==0?32767/l:0}return V(i,c,r,f,y,l,0),c}function qt(e,t,r,o,n,s,a){let i,c;s===void 0&&(s=k(e,{start:t,end:r,size:o,plane:a}));let l=W[a[0]],u=W[a[1]];if(n===s<0)for(i=t;i<r;i+=o)c=Xt(i,e[i+l],e[i+u],c);else for(i=r-o;i>=t;i-=o)c=Xt(i,e[i+l],e[i+u],c);return c&&ut(c,c.next)&&(Z(c),c=c.next),c}function F(e,t){if(!e)return e;t||(t=e);let r=e,o;do if(o=!1,!r.steiner&&(ut(r,r.next)||b(r.prev,r,r.next)===0)){if(Z(r),r=t=r.prev,r===r.next)break;o=!0}else r=r.next;while(o||r!==t);return t}function V(e,t,r,o,n,s,a){if(!e)return;!a&&s&&Ke(e,o,n,s);let i=e,c,l;for(;e.prev!==e.next;){if(c=e.prev,l=e.next,s?Je(e,o,n,s):De(e)){t.push(c.i/r|0),t.push(e.i/r|0),t.push(l.i/r|0),Z(e),e=l.next,i=l.next;continue}if(e=l,e===i){a?a===1?(e=Ge(F(e),t,r),V(e,t,r,o,n,s,2)):a===2&&Me(e,t,r,o,n,s):V(F(e),t,r,o,n,s,1);break}}}function De(e){let t=e.prev,r=e,o=e.next;if(b(t,r,o)>=0)return!1;let n=t.x,s=r.x,a=o.x,i=t.y,c=r.y,l=o.y,u=n<s?n<a?n:a:s<a?s:a,d=i<c?i<l?i:l:c<l?c:l,f=n>s?n>a?n:a:s>a?s:a,y=i>c?i>l?i:l:c>l?c:l,m=o.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=y&&T(n,i,s,c,a,l,m.x,m.y)&&b(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Je(e,t,r,o){let n=e.prev,s=e,a=e.next;if(b(n,s,a)>=0)return!1;let i=n.x,c=s.x,l=a.x,u=n.y,d=s.y,f=a.y,y=i<c?i<l?i:l:c<l?c:l,m=u<d?u<f?u:f:d<f?d:f,w=i>c?i>l?i:l:c>l?c:l,A=u>d?u>f?u:f:d>f?d:f,v=jt(y,m,t,r,o),R=jt(w,A,t,r,o),x=e.prevZ,g=e.nextZ;for(;x&&x.z>=v&&g&&g.z<=R;){if(x.x>=y&&x.x<=w&&x.y>=m&&x.y<=A&&x!==n&&x!==a&&T(i,u,c,d,l,f,x.x,x.y)&&b(x.prev,x,x.next)>=0||(x=x.prevZ,g.x>=y&&g.x<=w&&g.y>=m&&g.y<=A&&g!==n&&g!==a&&T(i,u,c,d,l,f,g.x,g.y)&&b(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;x&&x.z>=v;){if(x.x>=y&&x.x<=w&&x.y>=m&&x.y<=A&&x!==n&&x!==a&&T(i,u,c,d,l,f,x.x,x.y)&&b(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;g&&g.z<=R;){if(g.x>=y&&g.x<=w&&g.y>=m&&g.y<=A&&g!==n&&g!==a&&T(i,u,c,d,l,f,g.x,g.y)&&b(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function Ge(e,t,r){let o=e;do{let n=o.prev,s=o.next.next;!ut(n,s)&&te(n,o,o.next,s)&&$(n,s)&&$(s,n)&&(t.push(n.i/r|0),t.push(o.i/r|0),t.push(s.i/r|0),Z(o),Z(o.next),o=e=s),o=o.next}while(o!==e);return F(o)}function Me(e,t,r,o,n,s){let a=e;do{let i=a.next.next;for(;i!==a.prev;){if(a.i!==i.i&&Qe(a,i)){let c=ee(a,i);a=F(a,a.next),c=F(c,c.next),V(a,t,r,o,n,s,0),V(c,t,r,o,n,s,0);return}i=i.next}a=a.next}while(a!==e)}function ze(e,t,r,o,n,s){let a=[],i,c,l,u,d;for(i=0,c=t.length;i<c;i++)l=t[i]*o,u=i<c-1?t[i+1]*o:e.length,d=qt(e,l,u,o,!1,n&&n[i+1],s),d===d.next&&(d.steiner=!0),a.push(He(d));for(a.sort(We),i=0;i<a.length;i++)r=Ve(a[i],r);return r}function We(e,t){return e.x-t.x}function Ve(e,t){let r=$e(e,t);if(!r)return t;let o=ee(r,e);return F(o,o.next),F(r,r.next)}function $e(e,t){let r=t,o=e.x,n=e.y,s=-1/0,a;do{if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let f=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(f<=o&&f>s&&(s=f,a=r.x<r.next.x?r:r.next,f===o))return a}r=r.next}while(r!==t);if(!a)return null;let i=a,c=a.x,l=a.y,u=1/0,d;r=a;do o>=r.x&&r.x>=c&&o!==r.x&&T(n<l?o:s,n,c,l,n<l?s:o,n,r.x,r.y)&&(d=Math.abs(n-r.y)/(o-r.x),$(r,e)&&(d<u||d===u&&(r.x>a.x||r.x===a.x&&Ze(a,r)))&&(a=r,u=d)),r=r.next;while(r!==i);return a}function Ze(e,t){return b(e.prev,e,t.prev)<0&&b(t.next,e,e.next)<0}function Ke(e,t,r,o){let n=e;do n.z===0&&(n.z=jt(n.x,n.y,t,r,o)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,Ye(n)}function Ye(e){let t,r,o=1,n,s,a,i,c,l;do{for(s=e,e=null,l=null,n=0;s;){for(n++,i=s,a=0,r=0;r<o&&(a++,i=i.nextZ,!!i);r++);for(c=o;a>0||c>0&&i;)a!==0&&(c===0||!i||s.z<=i.z)?(t=s,s=s.nextZ,a--):(t=i,i=i.nextZ,c--),l?l.nextZ=t:e=t,t.prevZ=l,l=t;s=i}l.nextZ=null,o*=2}while(n>1);return e}function jt(e,t,r,o,n){return e=(e-r)*n|0,t=(t-o)*n|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function He(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function T(e,t,r,o,n,s,a,i){return(n-a)*(t-i)>=(e-a)*(s-i)&&(e-a)*(o-i)>=(r-a)*(t-i)&&(r-a)*(s-i)>=(n-a)*(o-i)}function Qe(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Xe(e,t)&&($(e,t)&&$(t,e)&&qe(e,t)&&(b(e.prev,e,t.prev)||b(e,t.prev,t))||ut(e,t)&&b(e.prev,e,e.next)>0&&b(t.prev,t,t.next)>0)}function b(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function ut(e,t){return e.x===t.x&&e.y===t.y}function te(e,t,r,o){let n=lt(b(e,t,r)),s=lt(b(e,t,o)),a=lt(b(r,o,e)),i=lt(b(r,o,t));return!!(n!==s&&a!==i||n===0&&ct(e,r,t)||s===0&&ct(e,o,t)||a===0&&ct(r,e,o)||i===0&&ct(r,t,o))}function ct(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function lt(e){return e>0?1:e<0?-1:0}function Xe(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&te(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function $(e,t){return b(e.prev,e,e.next)<0?b(e,t,e.next)>=0&&b(e,e.prev,t)>=0:b(e,t,e.prev)<0||b(e,e.next,t)<0}function qe(e,t){let r=e,o=!1,n=(e.x+t.x)/2,s=(e.y+t.y)/2;do r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(o=!o),r=r.next;while(r!==e);return o}function ee(e,t){let r=new K(e.i,e.x,e.y),o=new K(t.i,t.x,t.y),n=e.next,s=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,o.next=r,r.prev=o,s.next=o,o.prev=s,o}function Xt(e,t,r,o){let n=new K(e,t,r);return o?(n.next=o.next,n.prev=o,o.next.prev=n,o.next=n):(n.prev=n,n.next=n),n}function Z(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}var K=class{constructor(t,r,o){j(this,"i",void 0),j(this,"x",void 0),j(this,"y",void 0),j(this,"prev",null),j(this,"next",null),j(this,"z",0),j(this,"prevZ",null),j(this,"nextZ",null),j(this,"steiner",!1),this.i=t,this.x=r,this.y=o}};function ne(e,t,r){let o=nr(e),n=Object.keys(o).filter(s=>o[s]!==Array);return sr(e,{propArrayTypes:o,...t},{numericPropKeys:r&&r.numericPropKeys||n,PositionDataType:r?r.PositionDataType:Float32Array,triangulate:r?r.triangulate:!0})}function nr(e){let t={};for(let r of e)if(r.properties)for(let o in r.properties){let n=r.properties[o];t[o]=hr(n,t[o])}return t}function sr(e,t,r){let{pointPositionsCount:o,pointFeaturesCount:n,linePositionsCount:s,linePathsCount:a,lineFeaturesCount:i,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:u,polygonFeaturesCount:d,propArrayTypes:f,coordLength:y}=t,{numericPropKeys:m=[],PositionDataType:w=Float32Array,triangulate:A=!0}=r,v=e[0]&&"id"in e[0],R=e.length>65535?Uint32Array:Uint16Array,x={type:"Point",positions:new w(o*y),globalFeatureIds:new R(o),featureIds:n>65535?new Uint32Array(o):new Uint16Array(o),numericProps:{},properties:[],fields:[]},g={type:"LineString",pathIndices:s>65535?new Uint32Array(a+1):new Uint16Array(a+1),positions:new w(s*y),globalFeatureIds:new R(s),featureIds:i>65535?new Uint32Array(s):new Uint16Array(s),numericProps:{},properties:[],fields:[]},O={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(u+1):new Uint16Array(u+1),positions:new w(c*y),globalFeatureIds:new R(c),featureIds:d>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};A&&(O.triangles=[]);for(let S of[x,g,O])for(let _ of m){let I=f[_];S.numericProps[_]=new I(S.positions.length/y)}g.pathIndices[a]=s,O.polygonIndices[l]=c,O.primitivePolygonIndices[u]=c;let C={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let S of e){let _=S.geometry,I=S.properties||{};switch(_.type){case"Point":ir(_,x,C,y,I),x.properties.push(St(I,m)),v&&x.fields.push({id:S.id}),C.pointFeature++;break;case"LineString":ar(_,g,C,y,I),g.properties.push(St(I,m)),v&&g.fields.push({id:S.id}),C.lineFeature++;break;case"Polygon":cr(_,O,C,y,I),O.properties.push(St(I,m)),v&&O.fields.push({id:S.id}),C.polygonFeature++;break;default:throw new Error("Invalid geometry type")}C.feature++}return ur(x,g,O,y)}function ir(e,t,r,o,n){t.positions.set(e.data,r.pointPosition*o);let s=e.data.length/o;It(t,n,r.pointPosition,s),t.globalFeatureIds.fill(r.feature,r.pointPosition,r.pointPosition+s),t.featureIds.fill(r.pointFeature,r.pointPosition,r.pointPosition+s),r.pointPosition+=s}function ar(e,t,r,o,n){t.positions.set(e.data,r.linePosition*o);let s=e.data.length/o;It(t,n,r.linePosition,s),t.globalFeatureIds.fill(r.feature,r.linePosition,r.linePosition+s),t.featureIds.fill(r.lineFeature,r.linePosition,r.linePosition+s);for(let a=0,i=e.indices.length;a<i;++a){let c=e.indices[a],l=a===i-1?e.data.length:e.indices[a+1];t.pathIndices[r.linePath++]=r.linePosition,r.linePosition+=(l-c)/o}}function cr(e,t,r,o,n){t.positions.set(e.data,r.polygonPosition*o);let s=e.data.length/o;It(t,n,r.polygonPosition,s),t.globalFeatureIds.fill(r.feature,r.polygonPosition,r.polygonPosition+s),t.featureIds.fill(r.polygonFeature,r.polygonPosition,r.polygonPosition+s);for(let a=0,i=e.indices.length;a<i;++a){let c=r.polygonPosition;t.polygonIndices[r.polygonObject++]=c;let l=e.areas[a],u=e.indices[a],d=e.indices[a+1];for(let y=0,m=u.length;y<m;++y){let w=u[y],A=y===m-1?d===void 0?e.data.length:d[0]:u[y+1];t.primitivePolygonIndices[r.polygonRing++]=r.polygonPosition,r.polygonPosition+=(A-w)/o}let f=r.polygonPosition;lr(t,l,u,{startPosition:c,endPosition:f,coordLength:o})}}function lr(e,t,r,{startPosition:o,endPosition:n,coordLength:s}){if(!e.triangles)return;let a=o*s,i=n*s,c=e.positions.subarray(a,i),l=r[0],u=r.slice(1).map(f=>(f-l)/s),d=Nt(c,u,s,t);for(let f=0,y=d.length;f<y;++f)e.triangles.push(o+d[f])}function Ot(e,t){let r={};for(let o in e)r[o]={value:e[o],size:t};return r}function ur(e,t,r,o){let n={shape:"binary-feature-collection",points:{...e,positions:{value:e.positions,size:o},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Ot(e.numericProps,1)},lines:{...t,positions:{value:t.positions,size:o},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Ot(t.numericProps,1)},polygons:{...r,positions:{value:r.positions,size:o},polygonIndices:{value:r.polygonIndices,size:1},primitivePolygonIndices:{value:r.primitivePolygonIndices,size:1},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Ot(r.numericProps,1)}};return n.polygons&&r.triangles&&(n.polygons.triangles={value:new Uint32Array(r.triangles),size:1}),n}function It(e,t,r,o){for(let n in e.numericProps)if(n in t){let s=t[n];e.numericProps[n].fill(s,r,r+o)}}function St(e,t){let r={};for(let o in e)t.includes(o)||(r[o]=e[o]);return r}function hr(e,t){return t===Array||!Number.isFinite(e)?Array:t===Float64Array||Math.fround(e)!==e?Float64Array:Float32Array}function se(e){let t=0,r=0,o=0,n=0,s=0,a=0,i=0,c=0,l=0,u=new Set;for(let d of e){let f=d.geometry;switch(f.type){case"Point":r++,t++,u.add(f.coordinates.length);break;case"MultiPoint":r++,t+=f.coordinates.length;for(let m of f.coordinates)u.add(m.length);break;case"LineString":s++,o+=f.coordinates.length,n++;for(let m of f.coordinates)u.add(m.length);break;case"MultiLineString":s++;for(let m of f.coordinates){o+=m.length,n++;for(let w of m)u.add(w.length)}break;case"Polygon":l++,i++,c+=f.coordinates.length;let y=f.coordinates.flat();a+=y.length;for(let m of y)u.add(m.length);break;case"MultiPolygon":l++;for(let m of f.coordinates){i++,c+=m.length;let w=m.flat();a+=w.length;for(let A of w)u.add(A.length)}break;default:throw new Error(`Unsupported geometry type: ${f.type}`)}}return{coordLength:u.size>0?Math.max(...u):2,pointPositionsCount:t,pointFeaturesCount:r,linePositionsCount:o,linePathsCount:n,lineFeaturesCount:s,polygonPositionsCount:a,polygonObjectsCount:i,polygonRingsCount:c,polygonFeaturesCount:l}}function ce(e,t={coordLength:2,fixRingWinding:!0}){return e.map(r=>fr(r,t))}function ie(e,t,r,o){r.push(t.length),t.push(...e);for(let n=e.length;n<o.coordLength;n++)t.push(0)}function Et(e,t,r,o){r.push(t.length);for(let n of e){t.push(...n);for(let s=n.length;s<o.coordLength;s++)t.push(0)}}function ae(e,t,r,o,n){let s=0,a=[],i=[];for(let c of e){let l=c.map(f=>f.slice(0,2)),u=k(l.flat()),d=u<0;n.fixRingWinding&&(s===0&&!d||s>0&&d)&&(c.reverse(),u=-u),a.push(u),Et(c,t,i,n),s++}s>0&&(o.push(a),r.push(i))}function fr(e,t){let{geometry:r}=e;if(r.type==="GeometryCollection")throw new Error("GeometryCollection type not supported");let o=[],n=[],s,a;switch(r.type){case"Point":a="Point",ie(r.coordinates,o,n,t);break;case"MultiPoint":a="Point",r.coordinates.map(i=>ie(i,o,n,t));break;case"LineString":a="LineString",Et(r.coordinates,o,n,t);break;case"MultiLineString":a="LineString",r.coordinates.map(i=>Et(i,o,n,t));break;case"Polygon":a="Polygon",s=[],ae(r.coordinates,o,n,s,t);break;case"MultiPolygon":a="Polygon",s=[],r.coordinates.map(i=>ae(i,o,n,s,t));break;default:throw new Error(`Unknown type: ${a}`)}return{...e,geometry:{type:a,indices:n,data:o,areas:s}}}function ht(e,t={fixRingWinding:!0,triangulate:!0}){let r=se(e),o=r.coordLength,{fixRingWinding:n}=t,s=ce(e,{coordLength:o,fixRingWinding:n});return ne(s,r,{numericPropKeys:t.numericPropKeys,PositionDataType:t.PositionDataType||Float32Array,triangulate:t.triangulate})}var pr="4.2.0-alpha.4",Bt={name:"GeoJSON",id:"geojson",module:"geojson",version:pr,worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:{geojson:{shape:"object-row-table"},json:{shape:"object-row-table",jsonpaths:["$","$.features"]},gis:{format:"geojson"}}},U={...Bt,parse:dr,parseTextSync:le,parseInBatches:mr};async function dr(e,t){return le(new TextDecoder().decode(e),t)}function le(e,t){t={...U.options,...t},t.geojson={...U.options.geojson,...t.geojson},t.gis=t.gis||{};let r;try{r=JSON.parse(e)}catch{r={}}let o={shape:"geojson-table",type:"FeatureCollection",features:r?.features||[]};switch(t.gis.format){case"binary":return ht(o.features);default:return o}}function mr(e,t){t={...U.options,...t},t.json={...U.options.geojson,...t.geojson};let r=it(e,t);switch(t.gis.format){case"binary":return yr(r);default:return r}}async function*yr(e){for await(let t of e)t.data=ht(t.data),yield t}function ue(e){let t=e.schema?.fields.findIndex(r=>r.name==="geometry")??-1;if(t>-1)return t;if(E(e)>0){let r=nt(e,0);for(let o=0;o<rt(e);o++){let n=r?.[o];if(n&&typeof n=="object")return o}}throw new Error("Failed to detect geometry column")}function he(e,t,r=[]){let o={};for(let n=0;n<rt(e);++n){let s=e.schema?.fields[n].name;s&&!r.includes(n)&&(o[s]=t[s])}return o}function fe(e,t,r,o){let n=ot(e,t);if(!n)return;let s=gr(e,n,r),a=JSON.stringify(s);o.push(a)}function gr(e,t,r){let o=he(e,t,[r]),n=e.schema?.fields[r].name,s=n&&t[n];if(!s)return{type:"Feature",geometry:null,properties:o};if(typeof s=="string")try{s=JSON.parse(s)}catch{throw new Error("Invalid string geometry")}if(typeof s!="object"||typeof s?.type!="string")throw new Error("invalid geometry column value");return s?.type==="Feature"?{...s,properties:o}:{type:"Feature",geometry:s,properties:o}}var ft=class{constructor(t){this.strings=[],this.totalLength=0,this.textEncoder=new TextEncoder,this.chunkSize=t}push(...t){for(let r of t)this.strings.push(r),this.totalLength+=r.length}isFull(){return this.totalLength>=this.chunkSize}getArrayBufferBatch(){return this.textEncoder.encode(this.getStringBatch()).buffer}getStringBatch(){let t=this.strings.join("");return this.strings=[],this.totalLength=0,t}};async function*Ct(e,t={}){let r={geojson:{},chunkSize:1e4,...t},o=new ft(r.chunkSize);r.geojson.featureArray||o.push(`{
|
|
14
|
+
`,`"type": "FeatureCollection",
|
|
15
|
+
`,`"features":
|
|
16
|
+
`),o.push("[");let n=r.geojson.geometryColumn,s=!0,a=0;for await(let i of e){let c=a+E(i);n||(n=n||ue(i));for(let u=a;u<c;++u)s||o.push(","),o.push(`
|
|
17
|
+
`),s=!1,fe(i,u,n,o),o.isFull()&&(yield o.getArrayBufferBatch()),a=c;let l=o.getArrayBufferBatch();l.byteLength>0&&(yield l)}o.push(`
|
|
18
|
+
`),o.push(`]
|
|
19
|
+
`),r.geojson.featureArray||o.push("}"),yield o.getArrayBufferBatch()}var pe={id:"geojson",version:"latest",module:"geojson",name:"GeoJSON",extensions:["geojson"],mimeTypes:["application/geo+json"],text:!0,options:{geojson:{featureArray:!1,geometryColumn:null}},async encode(e,t){let o=Ct([e],t);return await gt(o)},encodeInBatches:(e,t)=>Ct(e,t)};return Pe(Y);})();
|
|
20
|
+
return __exports__;
|
|
21
|
+
});
|
package/dist/geojson-loader.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Loader, LoaderWithParser } from '@loaders.gl/loader-utils';
|
|
2
2
|
import type { GeoJSON, TableBatch } from '@loaders.gl/schema';
|
|
3
|
-
import type { JSONLoaderOptions } from
|
|
3
|
+
import type { JSONLoaderOptions } from "./json-loader.js";
|
|
4
4
|
export type GeoJSONLoaderOptions = JSONLoaderOptions & {
|
|
5
5
|
geojson?: {
|
|
6
6
|
shape?: 'object-row-table';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-loader.d.ts","sourceRoot":"","sources":["../src/geojson-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAC,OAAO,EAAgB,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAC,iBAAiB,EAAC,
|
|
1
|
+
{"version":3,"file":"geojson-loader.d.ts","sourceRoot":"","sources":["../src/geojson-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAC,OAAO,EAAgB,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAC,iBAAiB,EAAC,yBAAsB;AASrD,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG;IACrD,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,kBAAkB,CAAC;KAC5B,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;KAC/B,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,oBAAoB,CAsBjF,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,oBAAoB,CAOrF,CAAC"}
|
package/dist/geojson-loader.js
CHANGED
|
@@ -1,88 +1,90 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { geojsonToBinary } from '@loaders.gl/gis';
|
|
5
|
+
// import {parseJSONSync} from './lib/parsers/parse-json';
|
|
2
6
|
import { parseJSONInBatches } from "./lib/parsers/parse-json-in-batches.js";
|
|
7
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
8
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
3
9
|
const VERSION = typeof "4.2.0-alpha.4" !== 'undefined' ? "4.2.0-alpha.4" : 'latest';
|
|
10
|
+
/**
|
|
11
|
+
* GeoJSON loader
|
|
12
|
+
*/
|
|
4
13
|
export const GeoJSONWorkerLoader = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
name: 'GeoJSON',
|
|
15
|
+
id: 'geojson',
|
|
16
|
+
module: 'geojson',
|
|
17
|
+
version: VERSION,
|
|
18
|
+
worker: true,
|
|
19
|
+
extensions: ['geojson'],
|
|
20
|
+
mimeTypes: ['application/geo+json'],
|
|
21
|
+
category: 'geometry',
|
|
22
|
+
text: true,
|
|
23
|
+
options: {
|
|
24
|
+
geojson: {
|
|
25
|
+
shape: 'object-row-table'
|
|
26
|
+
},
|
|
27
|
+
json: {
|
|
28
|
+
shape: 'object-row-table',
|
|
29
|
+
jsonpaths: ['$', '$.features']
|
|
30
|
+
},
|
|
31
|
+
gis: {
|
|
32
|
+
format: 'geojson'
|
|
33
|
+
}
|
|
24
34
|
}
|
|
25
|
-
}
|
|
26
35
|
};
|
|
27
36
|
export const GeoJSONLoader = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
...GeoJSONWorkerLoader,
|
|
38
|
+
// @ts-expect-error
|
|
39
|
+
parse,
|
|
40
|
+
// @ts-expect-error
|
|
41
|
+
parseTextSync,
|
|
42
|
+
parseInBatches
|
|
32
43
|
};
|
|
33
44
|
async function parse(arrayBuffer, options) {
|
|
34
|
-
|
|
45
|
+
return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
|
|
35
46
|
}
|
|
36
47
|
function parseTextSync(text, options) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
...GeoJSONLoader.options,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
default:
|
|
62
|
-
return table;
|
|
63
|
-
}
|
|
48
|
+
// Apps can call the parse method directly, we so apply default options here
|
|
49
|
+
options = { ...GeoJSONLoader.options, ...options };
|
|
50
|
+
options.geojson = { ...GeoJSONLoader.options.geojson, ...options.geojson };
|
|
51
|
+
options.gis = options.gis || {};
|
|
52
|
+
let geojson;
|
|
53
|
+
try {
|
|
54
|
+
geojson = JSON.parse(text);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
geojson = {};
|
|
58
|
+
}
|
|
59
|
+
const table = {
|
|
60
|
+
shape: 'geojson-table',
|
|
61
|
+
// TODO - deduce schema from geojson
|
|
62
|
+
// TODO check that parsed data is of type FeatureCollection
|
|
63
|
+
type: 'FeatureCollection',
|
|
64
|
+
features: geojson?.features || []
|
|
65
|
+
};
|
|
66
|
+
switch (options.gis.format) {
|
|
67
|
+
case 'binary':
|
|
68
|
+
return geojsonToBinary(table.features);
|
|
69
|
+
default:
|
|
70
|
+
return table;
|
|
71
|
+
}
|
|
64
72
|
}
|
|
65
73
|
function parseInBatches(asyncIterator, options) {
|
|
66
|
-
|
|
67
|
-
...GeoJSONLoader.options,
|
|
68
|
-
...options
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
case 'binary':
|
|
77
|
-
return makeBinaryGeometryIterator(geojsonIterator);
|
|
78
|
-
default:
|
|
79
|
-
return geojsonIterator;
|
|
80
|
-
}
|
|
74
|
+
// Apps can call the parse method directly, we so apply default options here
|
|
75
|
+
options = { ...GeoJSONLoader.options, ...options };
|
|
76
|
+
options.json = { ...GeoJSONLoader.options.geojson, ...options.geojson };
|
|
77
|
+
const geojsonIterator = parseJSONInBatches(asyncIterator, options);
|
|
78
|
+
switch (options.gis.format) {
|
|
79
|
+
case 'binary':
|
|
80
|
+
return makeBinaryGeometryIterator(geojsonIterator);
|
|
81
|
+
default:
|
|
82
|
+
return geojsonIterator;
|
|
83
|
+
}
|
|
81
84
|
}
|
|
82
85
|
async function* makeBinaryGeometryIterator(geojsonIterator) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
for await (const batch of geojsonIterator) {
|
|
87
|
+
batch.data = geojsonToBinary(batch.data);
|
|
88
|
+
yield batch;
|
|
89
|
+
}
|
|
87
90
|
}
|
|
88
|
-
//# sourceMappingURL=geojson-loader.js.map
|
package/dist/geojson-writer.js
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
// Copyright Foursquare, Inc 20222
|
|
1
5
|
import { concatenateArrayBuffersAsync } from '@loaders.gl/loader-utils';
|
|
2
6
|
import { encodeTableAsGeojsonInBatches } from "./lib/encoders/geojson-encoder.js";
|
|
3
7
|
export const GeoJSONWriter = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
id: 'geojson',
|
|
9
|
+
version: 'latest',
|
|
10
|
+
module: 'geojson',
|
|
11
|
+
name: 'GeoJSON',
|
|
12
|
+
extensions: ['geojson'],
|
|
13
|
+
mimeTypes: ['application/geo+json'],
|
|
14
|
+
text: true,
|
|
15
|
+
options: {
|
|
16
|
+
geojson: {
|
|
17
|
+
featureArray: false,
|
|
18
|
+
geometryColumn: null
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
async encode(table, options) {
|
|
22
|
+
const tableIterator = [table];
|
|
23
|
+
const batches = encodeTableAsGeojsonInBatches(tableIterator, options);
|
|
24
|
+
return await concatenateArrayBuffersAsync(batches);
|
|
25
|
+
},
|
|
26
|
+
encodeInBatches: (tableIterator, options) => encodeTableAsGeojsonInBatches(tableIterator, options)
|
|
23
27
|
};
|
|
24
|
-
//# sourceMappingURL=geojson-writer.js.map
|