@loaders.gl/gis 3.1.0-beta.3 → 3.1.0
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/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/index.js +6 -6
- package/dist/es5/lib/binary-to-geojson.js +139 -93
- package/dist/es5/lib/binary-to-geojson.js.map +1 -1
- package/dist/es5/lib/geojson-to-binary.js +377 -200
- package/dist/es5/lib/geojson-to-binary.js.map +1 -1
- package/dist/es5/lib/transform.js +24 -9
- package/dist/es5/lib/transform.js.map +1 -1
- package/dist/esm/lib/geojson-to-binary.js +13 -6
- package/dist/esm/lib/geojson-to-binary.js.map +1 -1
- package/dist/lib/geojson-to-binary.d.ts +4 -0
- package/dist/lib/geojson-to-binary.d.ts.map +1 -1
- package/dist/lib/geojson-to-binary.js +15 -11
- package/package.json +4 -4
- package/src/lib/geojson-to-binary.ts +19 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/geojson-to-binary.ts"],"names":["geojsonToBinary","features","options","firstPassData","firstPass","secondPass","coordLength","numericPropKeys","PositionDataType","Float32Array","TEST_EXPORTS","pointPositionsCount","pointFeaturesCount","linePositionsCount","linePathsCount","lineFeaturesCount","polygonPositionsCount","polygonObjectsCount","polygonRingsCount","polygonFeaturesCount","coordLengths","Set","feature","geometry","type","add","coordinates","length","point","coord","line","flatten","polygon","Error","properties","key","val","undefined","isNumeric","size","Math","max","Object","keys","filter","k","GlobalFeatureIdsDataType","Uint32Array","Uint16Array","points","positions","globalFeatureIds","featureIds","numericProps","Array","fields","lines","pathIndices","polygons","polygonIndices","primitivePolygonIndices","object","propName","indexMap","pointPosition","pointFeature","linePosition","linePath","lineFeature","polygonPosition","polygonObject","polygonRing","polygonFeature","handlePoint","push","keepStringProperties","handleMultiPoint","handleLineString","handleMultiLineString","handlePolygon","handleMultiPolygon","makeAccessorObjects","coords","set","fillNumericProperties","fillCoords","nPositions","fill","ring","returnObj","value","geomType","numericProp","index","numericPropName","numericKeys","props","includes","array","startVertex","arrays","concat","x","Number","isFinite"],"mappings":";;;;;;;;AAUO,SAASA,eAAT,CACLC,QADK,EAELC,OAA+B,GAAG,EAF7B,EAGW;AAChB,QAAMC,aAAa,GAAGC,SAAS,CAACH,QAAD,CAA/B;AACA,SAAOI,UAAU,CAACJ,QAAD,EAAWE,aAAX,EAA0B;AACzCG,IAAAA,WAAW,EAAEJ,OAAO,CAACI,WAAR,IAAuBH,aAAa,CAACG,WADT;AAEzCC,IAAAA,eAAe,EAAEL,OAAO,CAACK,eAAR,IAA2BJ,aAAa,CAACI,eAFjB;AAGzCC,IAAAA,gBAAgB,EAAEN,OAAO,CAACM,gBAAR,IAA4BC;AAHL,GAA1B,CAAjB;AAKD;;AAEM,MAAMC,YAAY,GAAG;AAC1BN,EAAAA,SAD0B;AAE1BC,EAAAA;AAF0B,CAArB;;;AA0BP,SAASD,SAAT,CAAmBH,QAAnB,EAAuD;AAErD,MAAIU,mBAAmB,GAAG,CAA1B;AACA,MAAIC,kBAAkB,GAAG,CAAzB;AACA,MAAIC,kBAAkB,GAAG,CAAzB;AACA,MAAIC,cAAc,GAAG,CAArB;AACA,MAAIC,iBAAiB,GAAG,CAAxB;AACA,MAAIC,qBAAqB,GAAG,CAA5B;AACA,MAAIC,mBAAmB,GAAG,CAA1B;AACA,MAAIC,iBAAiB,GAAG,CAAxB;AACA,MAAIC,oBAAoB,GAAG,CAA3B;AACA,QAAMC,YAAY,GAAG,IAAIC,GAAJ,EAArB;AACA,QAAMd,eAAe,GAAG,EAAxB;;AAEA,OAAK,MAAMe,OAAX,IAAsBrB,QAAtB,EAAgC;AAC9B,UAAMsB,QAAQ,GAAGD,OAAO,CAACC,QAAzB;;AACA,YAAQA,QAAQ,CAACC,IAAjB;AACE,WAAK,OAAL;AACEZ,QAAAA,kBAAkB;AAClBD,QAAAA,mBAAmB;AACnBS,QAAAA,YAAY,CAACK,GA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AAuBrD,UAAU,CAAC4D,eAAD,CAAjC,CADF,EAEED,KAFF;AAID;AACF;AACF;;AAGD,SAASlB,oBAAT,CAA8BzC,UAA9B,EAA0C6D,WAA1C,EAAoF;AAClF,QAAMC,KAAK,GAAG,EAAd;;AACA,OAAK,MAAM7D,GAAX,IAAkBD,UAAlB,EAA8B;AAC5B,QAAI,CAAC6D,WAAW,CAACE,QAAZ,CAAqB9D,GAArB,CAAL,EAAgC;AAC9B6D,MAAAA,KAAK,CAAC7D,GAAD,CAAL,GAAaD,UAAU,CAACC,GAAD,CAAvB;AACD;AACF;;AACD,SAAO6D,KAAP;AACD;;AAGD,SAASX,UAAT,CAAoBa,KAApB,EAA2BhB,MAA3B,EAAmCiB,WAAnC,EAAgD7F,WAAhD,EAAmE;AACjE,MAAIuF,KAAK,GAAGM,WAAW,GAAG7F,WAA1B;;AACA,OAAK,MAAMuB,KAAX,IAAoBqD,MAApB,EAA4B;AAC1BgB,IAAAA,KAAK,CAACf,GAAN,CAAUtD,KAAV,EAAiBgE,KAAjB;AACAA,IAAAA,KAAK,IAAIvF,WAAT;AACD;AACF;;AAGD,SAASyB,OAAT,CAAiBqE,MAAjB,EAAqC;AACnC,SAAO,GAAGC,MAAH,CAAU,GAAGD,MAAb,CAAP;AACD;;AAED,SAAS9D,SAAT,CAAmBgE,CAAnB,EAAoC;AAClC,SAAOC,MAAM,CAACC,QAAP,CAAgBF,CAAhB,CAAP;AACD","sourcesContent":["import {Feature, GeoJsonProperties} from '@loaders.gl/schema';\nimport type {BinaryFeatures} from '@loaders.gl/schema';\n\nexport type GeojsonToBinaryOptions = {\n coordLength?: number;\n numericPropKeys?: string[];\n PositionDataType?: Function;\n};\n\n/** Convert GeoJSON features to flat binary arrays */\nexport function geojsonToBinary(\n features: Feature[],\n options: GeojsonToBinaryOptions = {}\n): BinaryFeatures {\n const firstPassData = firstPass(features);\n return secondPass(features, firstPassData, {\n coordLength: options.coordLength || firstPassData.coordLength,\n numericPropKeys: options.numericPropKeys || firstPassData.numericPropKeys,\n PositionDataType: options.PositionDataType || Float32Array\n });\n}\n\nexport const TEST_EXPORTS = {\n firstPass,\n secondPass\n};\n\ntype FirstPassData = {\n coordLength: number;\n numericPropKeys: string[];\n\n pointPositionsCount: number;\n pointFeaturesCount: number;\n linePositionsCount: number;\n linePathsCount: number;\n lineFeaturesCount: number;\n polygonPositionsCount: number;\n polygonObjectsCount: number;\n polygonRingsCount: number;\n polygonFeaturesCount: number;\n};\n\n/**\n * Initial scan over GeoJSON features\n * Counts number of coordinates of each geometry type and\n * keeps track of the max coordinate dimensions\n */\n// eslint-disable-next-line complexity, max-statements\nfunction firstPass(features: Feature[]): FirstPassData {\n // Counts the number of _positions_, so [x, y, z] counts as one\n let pointPositionsCount = 0;\n let pointFeaturesCount = 0;\n let linePositionsCount = 0;\n let linePathsCount = 0;\n let lineFeaturesCount = 0;\n let polygonPositionsCount = 0;\n let polygonObjectsCount = 0;\n let polygonRingsCount = 0;\n let polygonFeaturesCount = 0;\n const coordLengths = new Set<number>();\n const numericPropKeys = {};\n\n for (const feature of features) {\n const geometry = feature.geometry;\n switch (geometry.type) {\n case 'Point':\n pointFeaturesCount++;\n pointPositionsCount++;\n coordLengths.add(geometry.coordinates.length);\n break;\n case 'MultiPoint':\n pointFeaturesCount++;\n pointPositionsCount += geometry.coordinates.length;\n for (const point of geometry.coordinates) {\n coordLengths.add(point.length);\n }\n break;\n case 'LineString':\n lineFeaturesCount++;\n linePositionsCount += geometry.coordinates.length;\n linePathsCount++;\n\n for (const coord of geometry.coordinates) {\n coordLengths.add(coord.length);\n }\n break;\n case 'MultiLineString':\n lineFeaturesCount++;\n for (const line of geometry.coordinates) {\n linePositionsCount += line.length;\n linePathsCount++;\n\n // eslint-disable-next-line max-depth\n for (const coord of line) {\n coordLengths.add(coord.length);\n }\n }\n break;\n case 'Polygon':\n polygonFeaturesCount++;\n polygonObjectsCount++;\n polygonRingsCount += geometry.coordinates.length;\n polygonPositionsCount += flatten(geometry.coordinates).length;\n\n for (const coord of flatten(geometry.coordinates)) {\n coordLengths.add(coord.length);\n }\n break;\n case 'MultiPolygon':\n polygonFeaturesCount++;\n for (const polygon of geometry.coordinates) {\n polygonObjectsCount++;\n polygonRingsCount += polygon.length;\n polygonPositionsCount += flatten(polygon).length;\n\n // eslint-disable-next-line max-depth\n for (const coord of flatten(polygon)) {\n coordLengths.add(coord.length);\n }\n }\n break;\n default:\n throw new Error(`Unsupported geometry type: ${geometry.type}`);\n }\n\n if (feature.properties) {\n for (const key in feature.properties) {\n const val = feature.properties[key];\n\n // If property has not been seen before, or if property has been numeric\n // in all previous features, check if numeric in this feature\n // If not numeric, false is stored to prevent rechecking in the future\n numericPropKeys[key] =\n numericPropKeys[key] || numericPropKeys[key] === undefined\n ? isNumeric(val)\n : numericPropKeys[key];\n }\n }\n }\n\n return {\n coordLength: coordLengths.size > 0 ? Math.max(...coordLengths) : 2,\n\n pointPositionsCount,\n pointFeaturesCount,\n linePositionsCount,\n linePathsCount,\n lineFeaturesCount,\n polygonPositionsCount,\n polygonObjectsCount,\n polygonRingsCount,\n polygonFeaturesCount,\n\n // Array of keys whose values are always numeric\n numericPropKeys: Object.keys(numericPropKeys).filter((k) => numericPropKeys[k])\n };\n}\n\n/**\n * Second scan over GeoJSON features\n * Fills coordinates into pre-allocated typed arrays\n */\n// eslint-disable-next-line complexity\nfunction secondPass(\n features,\n firstPassData: FirstPassData,\n options: Required<GeojsonToBinaryOptions>\n) {\n const {\n pointPositionsCount,\n pointFeaturesCount,\n linePositionsCount,\n linePathsCount,\n lineFeaturesCount,\n polygonPositionsCount,\n polygonObjectsCount,\n polygonRingsCount,\n polygonFeaturesCount\n } = firstPassData;\n const {coordLength, numericPropKeys, PositionDataType = Float32Array} = options;\n const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;\n const points = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(pointPositionsCount * coordLength),\n globalFeatureIds: new GlobalFeatureIdsDataType(pointPositionsCount),\n featureIds:\n pointFeaturesCount > 65535\n ? new Uint32Array(pointPositionsCount)\n : new Uint16Array(pointPositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n const lines = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(linePositionsCount * coordLength),\n pathIndices:\n linePositionsCount > 65535\n ? new Uint32Array(linePathsCount + 1)\n : new Uint16Array(linePathsCount + 1),\n globalFeatureIds: new GlobalFeatureIdsDataType(linePositionsCount),\n featureIds:\n lineFeaturesCount > 65535\n ? new Uint32Array(linePositionsCount)\n : new Uint16Array(linePositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n const polygons = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(polygonPositionsCount * coordLength),\n polygonIndices:\n polygonPositionsCount > 65535\n ? new Uint32Array(polygonObjectsCount + 1)\n : new Uint16Array(polygonObjectsCount + 1),\n primitivePolygonIndices:\n polygonPositionsCount > 65535\n ? new Uint32Array(polygonRingsCount + 1)\n : new Uint16Array(polygonRingsCount + 1),\n globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),\n featureIds:\n polygonFeaturesCount > 65535\n ? new Uint32Array(polygonPositionsCount)\n : new Uint16Array(polygonPositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n\n // Instantiate numeric properties arrays; one value per vertex\n for (const object of [points, lines, polygons]) {\n for (const propName of numericPropKeys || []) {\n // If property has been numeric in all previous features in which the property existed, check\n // if numeric in this feature\n object.numericProps[propName] = new Float32Array(object.positions.length / coordLength);\n }\n }\n\n // Set last element of path/polygon indices as positions length\n lines.pathIndices[linePathsCount] = linePositionsCount;\n polygons.polygonIndices[polygonObjectsCount] = polygonPositionsCount;\n polygons.primitivePolygonIndices[polygonRingsCount] = polygonPositionsCount;\n\n const indexMap = {\n pointPosition: 0,\n pointFeature: 0,\n linePosition: 0,\n linePath: 0,\n lineFeature: 0,\n polygonPosition: 0,\n polygonObject: 0,\n polygonRing: 0,\n polygonFeature: 0,\n feature: 0\n };\n\n for (const feature of features) {\n const geometry = feature.geometry;\n const properties: GeoJsonProperties = feature.properties || {};\n\n switch (geometry.type) {\n case 'Point':\n handlePoint(geometry.coordinates, points, indexMap, coordLength, properties);\n points.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.pointFeature++;\n break;\n case 'MultiPoint':\n handleMultiPoint(geometry.coordinates, points, indexMap, coordLength, properties);\n points.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.pointFeature++;\n break;\n case 'LineString':\n handleLineString(geometry.coordinates, lines, indexMap, coordLength, properties);\n lines.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.lineFeature++;\n break;\n case 'MultiLineString':\n handleMultiLineString(geometry.coordinates, lines, indexMap, coordLength, properties);\n lines.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.lineFeature++;\n break;\n case 'Polygon':\n handlePolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);\n polygons.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.polygonFeature++;\n break;\n case 'MultiPolygon':\n handleMultiPolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);\n polygons.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.polygonFeature++;\n break;\n default:\n throw new Error('Invalid geometry type');\n }\n\n indexMap.feature++;\n }\n\n // Wrap each array in an accessor object with value and size keys\n return makeAccessorObjects(points, lines, polygons, coordLength);\n}\n\n/** Fills Point coordinates into points object of arrays */\nfunction handlePoint(coords, points, indexMap, coordLength, properties) {\n points.positions.set(coords, indexMap.pointPosition * coordLength);\n points.globalFeatureIds[indexMap.pointPosition] = indexMap.feature;\n points.featureIds[indexMap.pointPosition] = indexMap.pointFeature;\n\n fillNumericProperties(points, properties, indexMap.pointPosition, 1);\n indexMap.pointPosition++;\n}\n\n/** Fills MultiPoint coordinates into points object of arrays */\nfunction handleMultiPoint(coords, points, indexMap, coordLength, properties) {\n for (const point of coords) {\n handlePoint(point, points, indexMap, coordLength, properties);\n }\n}\n\n/** Fills LineString coordinates into lines object of arrays */\nfunction handleLineString(coords, lines, indexMap, coordLength, properties) {\n lines.pathIndices[indexMap.linePath] = indexMap.linePosition;\n indexMap.linePath++;\n\n fillCoords(lines.positions, coords, indexMap.linePosition, coordLength);\n\n const nPositions = coords.length;\n fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);\n\n lines.globalFeatureIds.set(\n new Uint32Array(nPositions).fill(indexMap.feature),\n indexMap.linePosition\n );\n lines.featureIds.set(\n new Uint32Array(nPositions).fill(indexMap.lineFeature),\n indexMap.linePosition\n );\n indexMap.linePosition += nPositions;\n}\n\n/** Fills MultiLineString coordinates into lines object of arrays */\nfunction handleMultiLineString(coords, lines, indexMap, coordLength, properties) {\n for (const line of coords) {\n handleLineString(line, lines, indexMap, coordLength, properties);\n }\n}\n\n/** Fills Polygon coordinates into polygons object of arrays */\nfunction handlePolygon(coords, polygons, indexMap, coordLength, properties) {\n polygons.polygonIndices[indexMap.polygonObject] = indexMap.polygonPosition;\n indexMap.polygonObject++;\n\n for (const ring of coords) {\n polygons.primitivePolygonIndices[indexMap.polygonRing] = indexMap.polygonPosition;\n indexMap.polygonRing++;\n\n fillCoords(polygons.positions, ring, indexMap.polygonPosition, coordLength);\n\n const nPositions = ring.length;\n fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);\n\n polygons.globalFeatureIds.set(\n new Uint32Array(nPositions).fill(indexMap.feature),\n indexMap.polygonPosition\n );\n polygons.featureIds.set(\n new Uint32Array(nPositions).fill(indexMap.polygonFeature),\n indexMap.polygonPosition\n );\n indexMap.polygonPosition += nPositions;\n }\n}\n\n/** Fills MultiPolygon coordinates into polygons object of arrays */\nfunction handleMultiPolygon(coords, polygons, indexMap, coordLength, properties) {\n for (const polygon of coords) {\n handlePolygon(polygon, polygons, indexMap, coordLength, properties);\n }\n}\n\n/** Wrap each array in an accessor object with value and size keys */\nfunction makeAccessorObjects(points, lines, polygons, coordLength): BinaryFeatures {\n const returnObj = {\n points: {\n ...points,\n positions: {value: points.positions, size: coordLength},\n globalFeatureIds: {value: points.globalFeatureIds, size: 1},\n featureIds: {value: points.featureIds, size: 1},\n type: 'Point'\n },\n lines: {\n ...lines,\n pathIndices: {value: lines.pathIndices, size: 1},\n positions: {value: lines.positions, size: coordLength},\n globalFeatureIds: {value: lines.globalFeatureIds, size: 1},\n featureIds: {value: lines.featureIds, size: 1},\n type: 'LineString'\n },\n polygons: {\n ...polygons,\n polygonIndices: {value: polygons.polygonIndices, size: 1},\n primitivePolygonIndices: {value: polygons.primitivePolygonIndices, size: 1},\n positions: {value: polygons.positions, size: coordLength},\n globalFeatureIds: {value: polygons.globalFeatureIds, size: 1},\n featureIds: {value: polygons.featureIds, size: 1},\n type: 'Polygon'\n }\n };\n\n for (const geomType in returnObj) {\n for (const numericProp in returnObj[geomType].numericProps) {\n returnObj[geomType].numericProps[numericProp] = {\n value: returnObj[geomType].numericProps[numericProp],\n size: 1\n };\n }\n }\n\n return returnObj as unknown as BinaryFeatures;\n}\n\n/** Add numeric properties to object */\nfunction fillNumericProperties(object, properties, index, length) {\n for (const numericPropName in object.numericProps) {\n if (numericPropName in properties) {\n object.numericProps[numericPropName].set(\n new Array(length).fill(properties[numericPropName]),\n index\n );\n }\n }\n}\n\n/** Keep string properties in object */\nfunction keepStringProperties(properties, numericKeys: string[]): GeoJsonProperties {\n const props = {};\n for (const key in properties) {\n if (!numericKeys.includes(key)) {\n props[key] = properties[key];\n }\n }\n return props;\n}\n\n/** @param coords is expected to be a list of arrays, each with length 2-3 */\nfunction fillCoords(array, coords, startVertex, coordLength): void {\n let index = startVertex * coordLength;\n for (const coord of coords) {\n array.set(coord, index);\n index += coordLength;\n }\n}\n\n// TODO - how does this work? Different `coordinates` have different nesting\nfunction flatten(arrays): number[][] {\n return [].concat(...arrays);\n}\n\nfunction isNumeric(x: any): boolean {\n return Number.isFinite(x);\n}\n"],"file":"geojson-to-binary.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/geojson-to-binary.ts"],"names":["geojsonToBinary","features","options","firstPassData","firstPass","secondPass","coordLength","numericPropKeys","PositionDataType","Float32Array","TEST_EXPORTS","pointPositionsCount","pointFeaturesCount","linePositionsCount","linePathsCount","lineFeaturesCount","polygonPositionsCount","polygonObjectsCount","polygonRingsCount","polygonFeaturesCount","coordLengths","Set","propArrayTypes","feature","geometry","type","add","coordinates","length","point","coord","line","flatten","polygon","Error","properties","key","val","deduceArrayType","size","Math","max","Object","keys","filter","k","Array","GlobalFeatureIdsDataType","Uint32Array","Uint16Array","points","positions","globalFeatureIds","featureIds","numericProps","fields","lines","pathIndices","polygons","polygonIndices","primitivePolygonIndices","object","propName","TypedArray","indexMap","pointPosition","pointFeature","linePosition","linePath","lineFeature","polygonPosition","polygonObject","polygonRing","polygonFeature","handlePoint","push","keepStringProperties","handleMultiPoint","handleLineString","handleMultiLineString","handlePolygon","handleMultiPolygon","makeAccessorObjects","coords","set","fillNumericProperties","fillCoords","nPositions","fill","ring","returnObj","value","geomType","numericProp","index","numericPropName","numericKeys","props","includes","array","startVertex","arrays","concat","x","constructor","Number","isFinite","Float64Array","fround"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAUO,SAASA,eAAT,CACLC,QADK,EAGW;AAAA,MADhBC,OACgB,uEADkB,EAClB;AAChB,MAAMC,aAAa,GAAGC,SAAS,CAACH,QAAD,CAA/B;AACA,SAAOI,UAAU,CAACJ,QAAD,EAAWE,aAAX,EAA0B;AACzCG,IAAAA,WAAW,EAAEJ,OAAO,CAACI,WAAR,IAAuBH,aAAa,CAACG,WADT;AAEzCC,IAAAA,eAAe,EAAEL,OAAO,CAACK,eAAR,IAA2BJ,aAAa,CAACI,eAFjB;AAGzCC,IAAAA,gBAAgB,EAAEN,OAAO,CAACM,gBAAR,IAA4BC;AAHL,GAA1B,CAAjB;AAKD;;AAEM,IAAMC,YAAY,GAAG;AAC1BN,EAAAA,S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B,MAA3B,EAAmCiB,WAAnC,EAAgD9F,WAAhD,EAAmE;AACjE,MAAIwF,KAAK,GAAGM,WAAW,GAAG9F,WAA1B;;AADiE,+CAE7C6E,MAF6C;AAAA;;AAAA;AAEjE,8DAA4B;AAAA,UAAjBrD,KAAiB;AAC1BqE,MAAAA,KAAK,CAACf,GAAN,CAAUtD,KAAV,EAAiBgE,KAAjB;AACAA,MAAAA,KAAK,IAAIxF,WAAT;AACD;AALgE;AAAA;AAAA;AAAA;AAAA;AAMlE;;AAGD,SAAS0B,OAAT,CAAiBqE,MAAjB,EAAqC;AAAA;;AACnC,SAAO,YAAGC,MAAH,8CAAaD,MAAb,EAAP;AACD;;AAED,SAAS/D,eAAT,CAAyBiE,CAAzB,EAAiCC,WAAjC,EAA0F;AACxF,MAAIA,WAAW,KAAK1D,KAAhB,IAAyB,CAAC2D,MAAM,CAACC,QAAP,CAAgBH,CAAhB,CAA9B,EAAkD;AAChD,WAAOzD,KAAP;AACD;;AAGD,SAAO0D,WAAW,KAAKG,YAAhB,IAAgCnE,IAAI,CAACoE,MAAL,CAAYL,CAAZ,MAAmBA,CAAnD,GAAuDI,YAAvD,GAAsElG,YAA7E;AACD","sourcesContent":["import {Feature, GeoJsonProperties} from '@loaders.gl/schema';\nimport type {BinaryFeatures} from '@loaders.gl/schema';\n\nexport type GeojsonToBinaryOptions = {\n coordLength?: number;\n numericPropKeys?: string[];\n PositionDataType?: Function;\n};\n\n/** Convert GeoJSON features to flat binary arrays */\nexport function geojsonToBinary(\n features: Feature[],\n options: GeojsonToBinaryOptions = {}\n): BinaryFeatures {\n const firstPassData = firstPass(features);\n return secondPass(features, firstPassData, {\n coordLength: options.coordLength || firstPassData.coordLength,\n numericPropKeys: options.numericPropKeys || firstPassData.numericPropKeys,\n PositionDataType: options.PositionDataType || Float32Array\n });\n}\n\nexport const TEST_EXPORTS = {\n firstPass,\n secondPass\n};\n\ntype PropArrayConstructor = Float32ArrayConstructor | Float64ArrayConstructor | ArrayConstructor;\n\ntype FirstPassData = {\n coordLength: number;\n numericPropKeys: string[];\n propArrayTypes: {[key: string]: PropArrayConstructor};\n\n pointPositionsCount: number;\n pointFeaturesCount: number;\n linePositionsCount: number;\n linePathsCount: number;\n lineFeaturesCount: number;\n polygonPositionsCount: number;\n polygonObjectsCount: number;\n polygonRingsCount: number;\n polygonFeaturesCount: number;\n};\n\n/**\n * Initial scan over GeoJSON features\n * Counts number of coordinates of each geometry type and\n * keeps track of the max coordinate dimensions\n */\n// eslint-disable-next-line complexity, max-statements\nfunction firstPass(features: Feature[]): FirstPassData {\n // Counts the number of _positions_, so [x, y, z] counts as one\n let pointPositionsCount = 0;\n let pointFeaturesCount = 0;\n let linePositionsCount = 0;\n let linePathsCount = 0;\n let lineFeaturesCount = 0;\n let polygonPositionsCount = 0;\n let polygonObjectsCount = 0;\n let polygonRingsCount = 0;\n let polygonFeaturesCount = 0;\n const coordLengths = new Set<number>();\n const propArrayTypes = {};\n\n for (const feature of features) {\n const geometry = feature.geometry;\n switch (geometry.type) {\n case 'Point':\n pointFeaturesCount++;\n pointPositionsCount++;\n coordLengths.add(geometry.coordinates.length);\n break;\n case 'MultiPoint':\n pointFeaturesCount++;\n pointPositionsCount += geometry.coordinates.length;\n for (const point of geometry.coordinates) {\n coordLengths.add(point.length);\n }\n break;\n case 'LineString':\n lineFeaturesCount++;\n linePositionsCount += geometry.coordinates.length;\n linePathsCount++;\n\n for (const coord of geometry.coordinates) {\n coordLengths.add(coord.length);\n }\n break;\n case 'MultiLineString':\n lineFeaturesCount++;\n for (const line of geometry.coordinates) {\n linePositionsCount += line.length;\n linePathsCount++;\n\n // eslint-disable-next-line max-depth\n for (const coord of line) {\n coordLengths.add(coord.length);\n }\n }\n break;\n case 'Polygon':\n polygonFeaturesCount++;\n polygonObjectsCount++;\n polygonRingsCount += geometry.coordinates.length;\n polygonPositionsCount += flatten(geometry.coordinates).length;\n\n for (const coord of flatten(geometry.coordinates)) {\n coordLengths.add(coord.length);\n }\n break;\n case 'MultiPolygon':\n polygonFeaturesCount++;\n for (const polygon of geometry.coordinates) {\n polygonObjectsCount++;\n polygonRingsCount += polygon.length;\n polygonPositionsCount += flatten(polygon).length;\n\n // eslint-disable-next-line max-depth\n for (const coord of flatten(polygon)) {\n coordLengths.add(coord.length);\n }\n }\n break;\n default:\n throw new Error(`Unsupported geometry type: ${geometry.type}`);\n }\n\n if (feature.properties) {\n for (const key in feature.properties) {\n const val = feature.properties[key];\n\n // If property has not been seen before, or if property has been numeric\n // in all previous features, check if numeric in this feature\n // If not numeric, Array is stored to prevent rechecking in the future\n // Additionally, detects if 64 bit precision is required\n propArrayTypes[key] = deduceArrayType(val, propArrayTypes[key]);\n }\n }\n }\n\n return {\n coordLength: coordLengths.size > 0 ? Math.max(...coordLengths) : 2,\n\n pointPositionsCount,\n pointFeaturesCount,\n linePositionsCount,\n linePathsCount,\n lineFeaturesCount,\n polygonPositionsCount,\n polygonObjectsCount,\n polygonRingsCount,\n polygonFeaturesCount,\n\n // Array of keys whose values are always numeric\n numericPropKeys: Object.keys(propArrayTypes).filter((k) => propArrayTypes[k] !== Array),\n propArrayTypes\n };\n}\n\n/**\n * Second scan over GeoJSON features\n * Fills coordinates into pre-allocated typed arrays\n */\n// eslint-disable-next-line complexity\nfunction secondPass(\n features,\n firstPassData: FirstPassData,\n options: Required<GeojsonToBinaryOptions>\n) {\n const {\n pointPositionsCount,\n pointFeaturesCount,\n linePositionsCount,\n linePathsCount,\n lineFeaturesCount,\n polygonPositionsCount,\n polygonObjectsCount,\n polygonRingsCount,\n propArrayTypes,\n polygonFeaturesCount\n } = firstPassData;\n const {coordLength, numericPropKeys, PositionDataType = Float32Array} = options;\n const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;\n const points = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(pointPositionsCount * coordLength),\n globalFeatureIds: new GlobalFeatureIdsDataType(pointPositionsCount),\n featureIds:\n pointFeaturesCount > 65535\n ? new Uint32Array(pointPositionsCount)\n : new Uint16Array(pointPositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n const lines = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(linePositionsCount * coordLength),\n pathIndices:\n linePositionsCount > 65535\n ? new Uint32Array(linePathsCount + 1)\n : new Uint16Array(linePathsCount + 1),\n globalFeatureIds: new GlobalFeatureIdsDataType(linePositionsCount),\n featureIds:\n lineFeaturesCount > 65535\n ? new Uint32Array(linePositionsCount)\n : new Uint16Array(linePositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n const polygons = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(polygonPositionsCount * coordLength),\n polygonIndices:\n polygonPositionsCount > 65535\n ? new Uint32Array(polygonObjectsCount + 1)\n : new Uint16Array(polygonObjectsCount + 1),\n primitivePolygonIndices:\n polygonPositionsCount > 65535\n ? new Uint32Array(polygonRingsCount + 1)\n : new Uint16Array(polygonRingsCount + 1),\n globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),\n featureIds:\n polygonFeaturesCount > 65535\n ? new Uint32Array(polygonPositionsCount)\n : new Uint16Array(polygonPositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n\n // Instantiate numeric properties arrays; one value per vertex\n for (const object of [points, lines, polygons]) {\n for (const propName of numericPropKeys || []) {\n // If property has been numeric in all previous features in which the property existed, check\n // if numeric in this feature\n const TypedArray = propArrayTypes[propName];\n object.numericProps[propName] = new TypedArray(object.positions.length / coordLength);\n }\n }\n\n // Set last element of path/polygon indices as positions length\n lines.pathIndices[linePathsCount] = linePositionsCount;\n polygons.polygonIndices[polygonObjectsCount] = polygonPositionsCount;\n polygons.primitivePolygonIndices[polygonRingsCount] = polygonPositionsCount;\n\n const indexMap = {\n pointPosition: 0,\n pointFeature: 0,\n linePosition: 0,\n linePath: 0,\n lineFeature: 0,\n polygonPosition: 0,\n polygonObject: 0,\n polygonRing: 0,\n polygonFeature: 0,\n feature: 0\n };\n\n for (const feature of features) {\n const geometry = feature.geometry;\n const properties: GeoJsonProperties = feature.properties || {};\n\n switch (geometry.type) {\n case 'Point':\n handlePoint(geometry.coordinates, points, indexMap, coordLength, properties);\n points.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.pointFeature++;\n break;\n case 'MultiPoint':\n handleMultiPoint(geometry.coordinates, points, indexMap, coordLength, properties);\n points.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.pointFeature++;\n break;\n case 'LineString':\n handleLineString(geometry.coordinates, lines, indexMap, coordLength, properties);\n lines.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.lineFeature++;\n break;\n case 'MultiLineString':\n handleMultiLineString(geometry.coordinates, lines, indexMap, coordLength, properties);\n lines.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.lineFeature++;\n break;\n case 'Polygon':\n handlePolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);\n polygons.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.polygonFeature++;\n break;\n case 'MultiPolygon':\n handleMultiPolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);\n polygons.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.polygonFeature++;\n break;\n default:\n throw new Error('Invalid geometry type');\n }\n\n indexMap.feature++;\n }\n\n // Wrap each array in an accessor object with value and size keys\n return makeAccessorObjects(points, lines, polygons, coordLength);\n}\n\n/** Fills Point coordinates into points object of arrays */\nfunction handlePoint(coords, points, indexMap, coordLength, properties) {\n points.positions.set(coords, indexMap.pointPosition * coordLength);\n points.globalFeatureIds[indexMap.pointPosition] = indexMap.feature;\n points.featureIds[indexMap.pointPosition] = indexMap.pointFeature;\n\n fillNumericProperties(points, properties, indexMap.pointPosition, 1);\n indexMap.pointPosition++;\n}\n\n/** Fills MultiPoint coordinates into points object of arrays */\nfunction handleMultiPoint(coords, points, indexMap, coordLength, properties) {\n for (const point of coords) {\n handlePoint(point, points, indexMap, coordLength, properties);\n }\n}\n\n/** Fills LineString coordinates into lines object of arrays */\nfunction handleLineString(coords, lines, indexMap, coordLength, properties) {\n lines.pathIndices[indexMap.linePath] = indexMap.linePosition;\n indexMap.linePath++;\n\n fillCoords(lines.positions, coords, indexMap.linePosition, coordLength);\n\n const nPositions = coords.length;\n fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);\n\n lines.globalFeatureIds.set(\n new Uint32Array(nPositions).fill(indexMap.feature),\n indexMap.linePosition\n );\n lines.featureIds.set(\n new Uint32Array(nPositions).fill(indexMap.lineFeature),\n indexMap.linePosition\n );\n indexMap.linePosition += nPositions;\n}\n\n/** Fills MultiLineString coordinates into lines object of arrays */\nfunction handleMultiLineString(coords, lines, indexMap, coordLength, properties) {\n for (const line of coords) {\n handleLineString(line, lines, indexMap, coordLength, properties);\n }\n}\n\n/** Fills Polygon coordinates into polygons object of arrays */\nfunction handlePolygon(coords, polygons, indexMap, coordLength, properties) {\n polygons.polygonIndices[indexMap.polygonObject] = indexMap.polygonPosition;\n indexMap.polygonObject++;\n\n for (const ring of coords) {\n polygons.primitivePolygonIndices[indexMap.polygonRing] = indexMap.polygonPosition;\n indexMap.polygonRing++;\n\n fillCoords(polygons.positions, ring, indexMap.polygonPosition, coordLength);\n\n const nPositions = ring.length;\n fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);\n\n polygons.globalFeatureIds.set(\n new Uint32Array(nPositions).fill(indexMap.feature),\n indexMap.polygonPosition\n );\n polygons.featureIds.set(\n new Uint32Array(nPositions).fill(indexMap.polygonFeature),\n indexMap.polygonPosition\n );\n indexMap.polygonPosition += nPositions;\n }\n}\n\n/** Fills MultiPolygon coordinates into polygons object of arrays */\nfunction handleMultiPolygon(coords, polygons, indexMap, coordLength, properties) {\n for (const polygon of coords) {\n handlePolygon(polygon, polygons, indexMap, coordLength, properties);\n }\n}\n\n/** Wrap each array in an accessor object with value and size keys */\nfunction makeAccessorObjects(points, lines, polygons, coordLength): BinaryFeatures {\n const returnObj = {\n points: {\n ...points,\n positions: {value: points.positions, size: coordLength},\n globalFeatureIds: {value: points.globalFeatureIds, size: 1},\n featureIds: {value: points.featureIds, size: 1},\n type: 'Point'\n },\n lines: {\n ...lines,\n pathIndices: {value: lines.pathIndices, size: 1},\n positions: {value: lines.positions, size: coordLength},\n globalFeatureIds: {value: lines.globalFeatureIds, size: 1},\n featureIds: {value: lines.featureIds, size: 1},\n type: 'LineString'\n },\n polygons: {\n ...polygons,\n polygonIndices: {value: polygons.polygonIndices, size: 1},\n primitivePolygonIndices: {value: polygons.primitivePolygonIndices, size: 1},\n positions: {value: polygons.positions, size: coordLength},\n globalFeatureIds: {value: polygons.globalFeatureIds, size: 1},\n featureIds: {value: polygons.featureIds, size: 1},\n type: 'Polygon'\n }\n };\n\n for (const geomType in returnObj) {\n for (const numericProp in returnObj[geomType].numericProps) {\n returnObj[geomType].numericProps[numericProp] = {\n value: returnObj[geomType].numericProps[numericProp],\n size: 1\n };\n }\n }\n\n return returnObj as unknown as BinaryFeatures;\n}\n\n/** Add numeric properties to object */\nfunction fillNumericProperties(object, properties, index, length) {\n for (const numericPropName in object.numericProps) {\n if (numericPropName in properties) {\n object.numericProps[numericPropName].set(\n new Array(length).fill(properties[numericPropName]),\n index\n );\n }\n }\n}\n\n/** Keep string properties in object */\nfunction keepStringProperties(properties, numericKeys: string[]): GeoJsonProperties {\n const props = {};\n for (const key in properties) {\n if (!numericKeys.includes(key)) {\n props[key] = properties[key];\n }\n }\n return props;\n}\n\n/** @param coords is expected to be a list of arrays, each with length 2-3 */\nfunction fillCoords(array, coords, startVertex, coordLength): void {\n let index = startVertex * coordLength;\n for (const coord of coords) {\n array.set(coord, index);\n index += coordLength;\n }\n}\n\n// TODO - how does this work? Different `coordinates` have different nesting\nfunction flatten(arrays): number[][] {\n return [].concat(...arrays);\n}\n\nfunction deduceArrayType(x: any, constructor: PropArrayConstructor): PropArrayConstructor {\n if (constructor === Array || !Number.isFinite(x)) {\n return Array;\n }\n\n // If this or previous value required 64bits use Float64Array\n return constructor === Float64Array || Math.fround(x) !== x ? Float64Array : Float32Array;\n}\n"],"file":"geojson-to-binary.js"}
|
|
@@ -6,6 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.transformBinaryCoords = transformBinaryCoords;
|
|
7
7
|
exports.transformGeoJsonCoords = transformGeoJsonCoords;
|
|
8
8
|
|
|
9
|
+
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; } } }; }
|
|
10
|
+
|
|
11
|
+
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); }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
9
15
|
function transformBinaryCoords(binaryFeatures, transformCoordinate) {
|
|
10
16
|
if (binaryFeatures.points) {
|
|
11
17
|
transformBinaryGeometryPositions(binaryFeatures.points, transformCoordinate);
|
|
@@ -23,20 +29,29 @@ function transformBinaryCoords(binaryFeatures, transformCoordinate) {
|
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
function transformBinaryGeometryPositions(binaryGeometry, fn) {
|
|
26
|
-
|
|
27
|
-
positions
|
|
28
|
-
} = binaryGeometry;
|
|
32
|
+
var positions = binaryGeometry.positions;
|
|
29
33
|
|
|
30
|
-
for (
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
for (var i = 0; i < positions.value.length; i += positions.size) {
|
|
35
|
+
var _coord = Array.from(positions.value.subarray(i, i + positions.size));
|
|
36
|
+
|
|
37
|
+
var transformedCoord = fn(_coord);
|
|
33
38
|
positions.value.set(transformedCoord, i);
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
function transformGeoJsonCoords(features, fn) {
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
var _iterator = _createForOfIteratorHelper(features),
|
|
44
|
+
_step;
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
48
|
+
var feature = _step.value;
|
|
49
|
+
feature.geometry.coordinates = coordMap(feature.geometry.coordinates, fn);
|
|
50
|
+
}
|
|
51
|
+
} catch (err) {
|
|
52
|
+
_iterator.e(err);
|
|
53
|
+
} finally {
|
|
54
|
+
_iterator.f();
|
|
40
55
|
}
|
|
41
56
|
|
|
42
57
|
return features;
|
|
@@ -47,7 +62,7 @@ function coordMap(array, fn) {
|
|
|
47
62
|
return fn(array);
|
|
48
63
|
}
|
|
49
64
|
|
|
50
|
-
return array.map(item
|
|
65
|
+
return array.map(function (item) {
|
|
51
66
|
return coordMap(item, fn);
|
|
52
67
|
});
|
|
53
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/transform.ts"],"names":["transformBinaryCoords","binaryFeatures","transformCoordinate","points","transformBinaryGeometryPositions","lines","polygons","binaryGeometry","fn","positions","i","value","length","size","coord","Array","from","subarray","transformedCoord","set","transformGeoJsonCoords","features","feature","geometry","coordinates","coordMap","array","isCoord","map","item","Number","isFinite"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/transform.ts"],"names":["transformBinaryCoords","binaryFeatures","transformCoordinate","points","transformBinaryGeometryPositions","lines","polygons","binaryGeometry","fn","positions","i","value","length","size","coord","Array","from","subarray","transformedCoord","set","transformGeoJsonCoords","features","feature","geometry","coordinates","coordMap","array","isCoord","map","item","Number","isFinite"],"mappings":";;;;;;;;;;;;;;AAUO,SAASA,qBAAT,CACLC,cADK,EAELC,mBAFK,EAGW;AAChB,MAAID,cAAc,CAACE,MAAnB,EAA2B;AACzBC,IAAAA,gCAAgC,CAACH,cAAc,CAACE,MAAhB,EAAwBD,mBAAxB,CAAhC;AACD;;AACD,MAAID,cAAc,CAACI,KAAnB,EAA0B;AACxBD,IAAAA,gCAAgC,CAACH,cAAc,CAACI,KAAhB,EAAuBH,mBAAvB,CAAhC;AACD;;AACD,MAAID,cAAc,CAACK,QAAnB,EAA6B;AAC3BF,IAAAA,gCAAgC,CAACH,cAAc,CAACK,QAAhB,EAA0BJ,mBAA1B,CAAhC;AACD;;AACD,SAAOD,cAAP;AACD;;AAGD,SAASG,gCAAT,CAA0CG,cAA1C,EAA0EC,EAA1E,EAAmG;AACjG,MAAOC,SAAP,GAAoBF,cAApB,CAAOE,SAAP;;AACA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,SAAS,CAACE,KAAV,CAAgBC,MAApC,EAA4CF,CAAC,IAAID,SAAS,CAACI,IAA3D,EAAiE;AAE/D,QAAMC,MAAoB,GAAGC,KAAK,CAACC,IAAN,CAAWP,SAAS,CAACE,KAAV,CAAgBM,QAAhB,CAAyBP,CAAzB,EAA4BA,CAAC,GAAGD,SAAS,CAACI,IAA1C,CAAX,CAA7B;;AACA,QAAMK,gBAAgB,GAAGV,EAAE,CAACM,MAAD,CAA3B;AAEAL,IAAAA,SAAS,CAACE,KAAV,CAAgBQ,GAAhB,CAAoBD,gBAApB,EAAsCR,CAAtC;AACD;AACF;;AASM,SAASU,sBAAT,CACLC,QADK,EAELb,EAFK,EAGK;AAAA,6CACYa,QADZ;AAAA;;AAAA;AACV,wDAAgC;AAAA,UAArBC,OAAqB;AAE9BA,MAAAA,OAAO,CAACC,QAAR,CAAiBC,WAAjB,GAA+BC,QAAQ,CAACH,OAAO,CAACC,QAAR,CAAiBC,WAAlB,EAA+BhB,EAA/B,CAAvC;AACD;AAJS;AAAA;AAAA;AAAA;AAAA;;AAKV,SAAOa,QAAP;AACD;;AAED,SAASI,QAAT,CAAkBC,KAAlB,EAAyBlB,EAAzB,EAA6B;AAC3B,MAAImB,OAAO,CAACD,KAAD,CAAX,EAAoB;AAClB,WAAOlB,EAAE,CAACkB,KAAD,CAAT;AACD;;AAED,SAAOA,KAAK,CAACE,GAAN,CAAU,UAACC,IAAD,EAAU;AACzB,WAAOJ,QAAQ,CAACI,IAAD,EAAOrB,EAAP,CAAf;AACD,GAFM,CAAP;AAGD;;AAED,SAASmB,OAAT,CAAiBD,KAAjB,EAAwB;AACtB,SAAOI,MAAM,CAACC,QAAP,CAAgBL,KAAK,CAAC,CAAD,CAArB,KAA6BI,MAAM,CAACC,QAAP,CAAgBL,KAAK,CAAC,CAAD,CAArB,CAApC;AACD","sourcesContent":["import type {BinaryFeatures, BinaryGeometry} from '@loaders.gl/schema';\n\ntype TransformCoordinate = (coord: number[]) => number[];\n\n/**\n * Apply transformation to every coordinate of binary features\n * @param binaryFeatures binary features\n * @param transformCoordinate Function to call on each coordinate\n * @return Transformed binary features\n */\nexport function transformBinaryCoords(\n binaryFeatures: BinaryFeatures,\n transformCoordinate: TransformCoordinate\n): BinaryFeatures {\n if (binaryFeatures.points) {\n transformBinaryGeometryPositions(binaryFeatures.points, transformCoordinate);\n }\n if (binaryFeatures.lines) {\n transformBinaryGeometryPositions(binaryFeatures.lines, transformCoordinate);\n }\n if (binaryFeatures.polygons) {\n transformBinaryGeometryPositions(binaryFeatures.polygons, transformCoordinate);\n }\n return binaryFeatures;\n}\n\n/** Transform one binary geometry */\nfunction transformBinaryGeometryPositions(binaryGeometry: BinaryGeometry, fn: TransformCoordinate) {\n const {positions} = binaryGeometry;\n for (let i = 0; i < positions.value.length; i += positions.size) {\n // @ts-ignore inclusion of bigint causes problems\n const coord: Array<number> = Array.from(positions.value.subarray(i, i + positions.size));\n const transformedCoord = fn(coord);\n // @ts-ignore typescript typing for .set seems to require bigint?\n positions.value.set(transformedCoord, i);\n }\n}\n\n/**\n * Apply transformation to every coordinate of GeoJSON features\n *\n * @param features Array of GeoJSON features\n * @param fn Function to call on each coordinate\n * @return Transformed GeoJSON features\n */\nexport function transformGeoJsonCoords(\n features: object[],\n fn: (coord: number[]) => number[]\n): object[] {\n for (const feature of features) {\n // @ts-ignore\n feature.geometry.coordinates = coordMap(feature.geometry.coordinates, fn);\n }\n return features;\n}\n\nfunction coordMap(array, fn) {\n if (isCoord(array)) {\n return fn(array);\n }\n\n return array.map((item) => {\n return coordMap(item, fn);\n });\n}\n\nfunction isCoord(array) {\n return Number.isFinite(array[0]) && Number.isFinite(array[1]);\n}\n"],"file":"transform.js"}
|
|
@@ -22,7 +22,7 @@ function firstPass(features) {
|
|
|
22
22
|
let polygonRingsCount = 0;
|
|
23
23
|
let polygonFeaturesCount = 0;
|
|
24
24
|
const coordLengths = new Set();
|
|
25
|
-
const
|
|
25
|
+
const propArrayTypes = {};
|
|
26
26
|
|
|
27
27
|
for (const feature of features) {
|
|
28
28
|
const geometry = feature.geometry;
|
|
@@ -103,7 +103,7 @@ function firstPass(features) {
|
|
|
103
103
|
if (feature.properties) {
|
|
104
104
|
for (const key in feature.properties) {
|
|
105
105
|
const val = feature.properties[key];
|
|
106
|
-
|
|
106
|
+
propArrayTypes[key] = deduceArrayType(val, propArrayTypes[key]);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -119,7 +119,8 @@ function firstPass(features) {
|
|
|
119
119
|
polygonObjectsCount,
|
|
120
120
|
polygonRingsCount,
|
|
121
121
|
polygonFeaturesCount,
|
|
122
|
-
numericPropKeys: Object.keys(
|
|
122
|
+
numericPropKeys: Object.keys(propArrayTypes).filter(k => propArrayTypes[k] !== Array),
|
|
123
|
+
propArrayTypes
|
|
123
124
|
};
|
|
124
125
|
}
|
|
125
126
|
|
|
@@ -133,6 +134,7 @@ function secondPass(features, firstPassData, options) {
|
|
|
133
134
|
polygonPositionsCount,
|
|
134
135
|
polygonObjectsCount,
|
|
135
136
|
polygonRingsCount,
|
|
137
|
+
propArrayTypes,
|
|
136
138
|
polygonFeaturesCount
|
|
137
139
|
} = firstPassData;
|
|
138
140
|
const {
|
|
@@ -171,7 +173,8 @@ function secondPass(features, firstPassData, options) {
|
|
|
171
173
|
|
|
172
174
|
for (const object of [points, lines, polygons]) {
|
|
173
175
|
for (const propName of numericPropKeys || []) {
|
|
174
|
-
|
|
176
|
+
const TypedArray = propArrayTypes[propName];
|
|
177
|
+
object.numericProps[propName] = new TypedArray(object.positions.length / coordLength);
|
|
175
178
|
}
|
|
176
179
|
}
|
|
177
180
|
|
|
@@ -401,7 +404,11 @@ function flatten(arrays) {
|
|
|
401
404
|
return [].concat(...arrays);
|
|
402
405
|
}
|
|
403
406
|
|
|
404
|
-
function
|
|
405
|
-
|
|
407
|
+
function deduceArrayType(x, constructor) {
|
|
408
|
+
if (constructor === Array || !Number.isFinite(x)) {
|
|
409
|
+
return Array;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
return constructor === Float64Array || Math.fround(x) !== x ? Float64Array : Float32Array;
|
|
406
413
|
}
|
|
407
414
|
//# sourceMappingURL=geojson-to-binary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/geojson-to-binary.ts"],"names":["geojsonToBinary","features","options","firstPassData","firstPass","secondPass","coordLength","numericPropKeys","PositionDataType","Float32Array","TEST_EXPORTS","pointPositionsCount","pointFeaturesCount","linePositionsCount","linePathsCount","lineFeaturesCount","polygonPositionsCount","polygonObjectsCount","polygonRingsCount","polygonFeaturesCount","coordLengths","Set","feature","geometry","type","add","coordinates","length","point","coord","line","flatten","polygon","Error","properties","key","val","undefined","isNumeric","size","Math","max","Object","keys","filter","k","GlobalFeatureIdsDataType","Uint32Array","Uint16Array","points","positions","globalFeatureIds","featureIds","numericProps","Array","fields","lines","pathIndices","polygons","polygonIndices","primitivePolygonIndices","object","propName","indexMap","pointPosition","pointFeature","linePosition","linePath","lineFeature","polygonPosition","polygonObject","polygonRing","polygonFeature","handlePoint","push","keepStringProperties","handleMultiPoint","handleLineString","handleMultiLineString","handlePolygon","handleMultiPolygon","makeAccessorObjects","coords","set","fillNumericProperties","fillCoords","nPositions","fill","ring","returnObj","value","geomType","numericProp","index","numericPropName","numericKeys","props","includes","array","startVertex","arrays","concat","x","Number","isFinite"],"mappings":"AAUA,OAAO,SAASA,eAAT,CACLC,QADK,EAELC,OAA+B,GAAG,EAF7B,EAGW;AAChB,QAAMC,aAAa,GAAGC,SAAS,CAACH,QAAD,CAA/B;AACA,SAAOI,UAAU,CAACJ,QAAD,EAAWE,aAAX,EAA0B;AACzCG,IAAAA,WAAW,EAAEJ,OAAO,CAACI,WAAR,IAAuBH,aAAa,CAACG,WADT;AAEzCC,IAAAA,eAAe,EAAEL,OAAO,CAACK,eAAR,IAA2BJ,aAAa,CAACI,eAFjB;AAGzCC,IAAAA,gBAAgB,EAAEN,OAAO,CAACM,gBAAR,IAA4BC;AAHL,GAA1B,CAAjB;AAKD;AAED,OAAO,MAAMC,YAAY,GAAG;AAC1BN,EAAAA,SAD0B;AAE1BC,EAAAA;AAF0B,CAArB;;AA0BP,SAASD,SAAT,CAAmBH,QAAnB,EAAuD;AAErD,MAAIU,mBAAmB,GAAG,CAA1B;AACA,MAAIC,kBAAkB,GAAG,CAAzB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SAASyB,OAAT,CAAiBqE,MAAjB,EAAqC;AACnC,SAAO,GAAGC,MAAH,CAAU,GAAGD,MAAb,CAAP;AACD;;AAED,SAAS9D,SAAT,CAAmBgE,CAAnB,EAAoC;AAClC,SAAOC,MAAM,CAACC,QAAP,CAAgBF,CAAhB,CAAP;AACD","sourcesContent":["import {Feature, GeoJsonProperties} from '@loaders.gl/schema';\nimport type {BinaryFeatures} from '@loaders.gl/schema';\n\nexport type GeojsonToBinaryOptions = {\n coordLength?: number;\n numericPropKeys?: string[];\n PositionDataType?: Function;\n};\n\n/** Convert GeoJSON features to flat binary arrays */\nexport function geojsonToBinary(\n features: Feature[],\n options: GeojsonToBinaryOptions = {}\n): BinaryFeatures {\n const firstPassData = firstPass(features);\n return secondPass(features, firstPassData, {\n coordLength: options.coordLength || firstPassData.coordLength,\n numericPropKeys: options.numericPropKeys || firstPassData.numericPropKeys,\n PositionDataType: options.PositionDataType || Float32Array\n });\n}\n\nexport const TEST_EXPORTS = {\n firstPass,\n secondPass\n};\n\ntype FirstPassData = {\n coordLength: number;\n numericPropKeys: string[];\n\n pointPositionsCount: number;\n pointFeaturesCount: number;\n linePositionsCount: number;\n linePathsCount: number;\n lineFeaturesCount: number;\n polygonPositionsCount: number;\n polygonObjectsCount: number;\n polygonRingsCount: number;\n polygonFeaturesCount: number;\n};\n\n/**\n * Initial scan over GeoJSON features\n * Counts number of coordinates of each geometry type and\n * keeps track of the max coordinate dimensions\n */\n// eslint-disable-next-line complexity, max-statements\nfunction firstPass(features: Feature[]): FirstPassData {\n // Counts the number of _positions_, so [x, y, z] counts as one\n let pointPositionsCount = 0;\n let pointFeaturesCount = 0;\n let linePositionsCount = 0;\n let linePathsCount = 0;\n let lineFeaturesCount = 0;\n let polygonPositionsCount = 0;\n let polygonObjectsCount = 0;\n let polygonRingsCount = 0;\n let polygonFeaturesCount = 0;\n const coordLengths = new Set<number>();\n const numericPropKeys = {};\n\n for (const feature of features) {\n const geometry = feature.geometry;\n switch (geometry.type) {\n case 'Point':\n pointFeaturesCount++;\n pointPositionsCount++;\n coordLengths.add(geometry.coordinates.length);\n break;\n case 'MultiPoint':\n pointFeaturesCount++;\n pointPositionsCount += geometry.coordinates.length;\n for (const point of geometry.coordinates) {\n coordLengths.add(point.length);\n }\n break;\n case 'LineString':\n lineFeaturesCount++;\n linePositionsCount += geometry.coordinates.length;\n linePathsCount++;\n\n for (const coord of geometry.coordinates) {\n coordLengths.add(coord.length);\n }\n break;\n case 'MultiLineString':\n lineFeaturesCount++;\n for (const line of geometry.coordinates) {\n linePositionsCount += line.length;\n linePathsCount++;\n\n // eslint-disable-next-line max-depth\n for (const coord of line) {\n coordLengths.add(coord.length);\n }\n }\n break;\n case 'Polygon':\n polygonFeaturesCount++;\n polygonObjectsCount++;\n polygonRingsCount += geometry.coordinates.length;\n polygonPositionsCount += flatten(geometry.coordinates).length;\n\n for (const coord of flatten(geometry.coordinates)) {\n coordLengths.add(coord.length);\n }\n break;\n case 'MultiPolygon':\n polygonFeaturesCount++;\n for (const polygon of geometry.coordinates) {\n polygonObjectsCount++;\n polygonRingsCount += polygon.length;\n polygonPositionsCount += flatten(polygon).length;\n\n // eslint-disable-next-line max-depth\n for (const coord of flatten(polygon)) {\n coordLengths.add(coord.length);\n }\n }\n break;\n default:\n throw new Error(`Unsupported geometry type: ${geometry.type}`);\n }\n\n if (feature.properties) {\n for (const key in feature.properties) {\n const val = feature.properties[key];\n\n // If property has not been seen before, or if property has been numeric\n // in all previous features, check if numeric in this feature\n // If not numeric, false is stored to prevent rechecking in the future\n numericPropKeys[key] =\n numericPropKeys[key] || numericPropKeys[key] === undefined\n ? isNumeric(val)\n : numericPropKeys[key];\n }\n }\n }\n\n return {\n coordLength: coordLengths.size > 0 ? Math.max(...coordLengths) : 2,\n\n pointPositionsCount,\n pointFeaturesCount,\n linePositionsCount,\n linePathsCount,\n lineFeaturesCount,\n polygonPositionsCount,\n polygonObjectsCount,\n polygonRingsCount,\n polygonFeaturesCount,\n\n // Array of keys whose values are always numeric\n numericPropKeys: Object.keys(numericPropKeys).filter((k) => numericPropKeys[k])\n };\n}\n\n/**\n * Second scan over GeoJSON features\n * Fills coordinates into pre-allocated typed arrays\n */\n// eslint-disable-next-line complexity\nfunction secondPass(\n features,\n firstPassData: FirstPassData,\n options: Required<GeojsonToBinaryOptions>\n) {\n const {\n pointPositionsCount,\n pointFeaturesCount,\n linePositionsCount,\n linePathsCount,\n lineFeaturesCount,\n polygonPositionsCount,\n polygonObjectsCount,\n polygonRingsCount,\n polygonFeaturesCount\n } = firstPassData;\n const {coordLength, numericPropKeys, PositionDataType = Float32Array} = options;\n const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;\n const points = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(pointPositionsCount * coordLength),\n globalFeatureIds: new GlobalFeatureIdsDataType(pointPositionsCount),\n featureIds:\n pointFeaturesCount > 65535\n ? new Uint32Array(pointPositionsCount)\n : new Uint16Array(pointPositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n const lines = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(linePositionsCount * coordLength),\n pathIndices:\n linePositionsCount > 65535\n ? new Uint32Array(linePathsCount + 1)\n : new Uint16Array(linePathsCount + 1),\n globalFeatureIds: new GlobalFeatureIdsDataType(linePositionsCount),\n featureIds:\n lineFeaturesCount > 65535\n ? new Uint32Array(linePositionsCount)\n : new Uint16Array(linePositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n const polygons = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(polygonPositionsCount * coordLength),\n polygonIndices:\n polygonPositionsCount > 65535\n ? new Uint32Array(polygonObjectsCount + 1)\n : new Uint16Array(polygonObjectsCount + 1),\n primitivePolygonIndices:\n polygonPositionsCount > 65535\n ? new Uint32Array(polygonRingsCount + 1)\n : new Uint16Array(polygonRingsCount + 1),\n globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),\n featureIds:\n polygonFeaturesCount > 65535\n ? new Uint32Array(polygonPositionsCount)\n : new Uint16Array(polygonPositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n\n // Instantiate numeric properties arrays; one value per vertex\n for (const object of [points, lines, polygons]) {\n for (const propName of numericPropKeys || []) {\n // If property has been numeric in all previous features in which the property existed, check\n // if numeric in this feature\n object.numericProps[propName] = new Float32Array(object.positions.length / coordLength);\n }\n }\n\n // Set last element of path/polygon indices as positions length\n lines.pathIndices[linePathsCount] = linePositionsCount;\n polygons.polygonIndices[polygonObjectsCount] = polygonPositionsCount;\n polygons.primitivePolygonIndices[polygonRingsCount] = polygonPositionsCount;\n\n const indexMap = {\n pointPosition: 0,\n pointFeature: 0,\n linePosition: 0,\n linePath: 0,\n lineFeature: 0,\n polygonPosition: 0,\n polygonObject: 0,\n polygonRing: 0,\n polygonFeature: 0,\n feature: 0\n };\n\n for (const feature of features) {\n const geometry = feature.geometry;\n const properties: GeoJsonProperties = feature.properties || {};\n\n switch (geometry.type) {\n case 'Point':\n handlePoint(geometry.coordinates, points, indexMap, coordLength, properties);\n points.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.pointFeature++;\n break;\n case 'MultiPoint':\n handleMultiPoint(geometry.coordinates, points, indexMap, coordLength, properties);\n points.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.pointFeature++;\n break;\n case 'LineString':\n handleLineString(geometry.coordinates, lines, indexMap, coordLength, properties);\n lines.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.lineFeature++;\n break;\n case 'MultiLineString':\n handleMultiLineString(geometry.coordinates, lines, indexMap, coordLength, properties);\n lines.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.lineFeature++;\n break;\n case 'Polygon':\n handlePolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);\n polygons.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.polygonFeature++;\n break;\n case 'MultiPolygon':\n handleMultiPolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);\n polygons.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.polygonFeature++;\n break;\n default:\n throw new Error('Invalid geometry type');\n }\n\n indexMap.feature++;\n }\n\n // Wrap each array in an accessor object with value and size keys\n return makeAccessorObjects(points, lines, polygons, coordLength);\n}\n\n/** Fills Point coordinates into points object of arrays */\nfunction handlePoint(coords, points, indexMap, coordLength, properties) {\n points.positions.set(coords, indexMap.pointPosition * coordLength);\n points.globalFeatureIds[indexMap.pointPosition] = indexMap.feature;\n points.featureIds[indexMap.pointPosition] = indexMap.pointFeature;\n\n fillNumericProperties(points, properties, indexMap.pointPosition, 1);\n indexMap.pointPosition++;\n}\n\n/** Fills MultiPoint coordinates into points object of arrays */\nfunction handleMultiPoint(coords, points, indexMap, coordLength, properties) {\n for (const point of coords) {\n handlePoint(point, points, indexMap, coordLength, properties);\n }\n}\n\n/** Fills LineString coordinates into lines object of arrays */\nfunction handleLineString(coords, lines, indexMap, coordLength, properties) {\n lines.pathIndices[indexMap.linePath] = indexMap.linePosition;\n indexMap.linePath++;\n\n fillCoords(lines.positions, coords, indexMap.linePosition, coordLength);\n\n const nPositions = coords.length;\n fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);\n\n lines.globalFeatureIds.set(\n new Uint32Array(nPositions).fill(indexMap.feature),\n indexMap.linePosition\n );\n lines.featureIds.set(\n new Uint32Array(nPositions).fill(indexMap.lineFeature),\n indexMap.linePosition\n );\n indexMap.linePosition += nPositions;\n}\n\n/** Fills MultiLineString coordinates into lines object of arrays */\nfunction handleMultiLineString(coords, lines, indexMap, coordLength, properties) {\n for (const line of coords) {\n handleLineString(line, lines, indexMap, coordLength, properties);\n }\n}\n\n/** Fills Polygon coordinates into polygons object of arrays */\nfunction handlePolygon(coords, polygons, indexMap, coordLength, properties) {\n polygons.polygonIndices[indexMap.polygonObject] = indexMap.polygonPosition;\n indexMap.polygonObject++;\n\n for (const ring of coords) {\n polygons.primitivePolygonIndices[indexMap.polygonRing] = indexMap.polygonPosition;\n indexMap.polygonRing++;\n\n fillCoords(polygons.positions, ring, indexMap.polygonPosition, coordLength);\n\n const nPositions = ring.length;\n fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);\n\n polygons.globalFeatureIds.set(\n new Uint32Array(nPositions).fill(indexMap.feature),\n indexMap.polygonPosition\n );\n polygons.featureIds.set(\n new Uint32Array(nPositions).fill(indexMap.polygonFeature),\n indexMap.polygonPosition\n );\n indexMap.polygonPosition += nPositions;\n }\n}\n\n/** Fills MultiPolygon coordinates into polygons object of arrays */\nfunction handleMultiPolygon(coords, polygons, indexMap, coordLength, properties) {\n for (const polygon of coords) {\n handlePolygon(polygon, polygons, indexMap, coordLength, properties);\n }\n}\n\n/** Wrap each array in an accessor object with value and size keys */\nfunction makeAccessorObjects(points, lines, polygons, coordLength): BinaryFeatures {\n const returnObj = {\n points: {\n ...points,\n positions: {value: points.positions, size: coordLength},\n globalFeatureIds: {value: points.globalFeatureIds, size: 1},\n featureIds: {value: points.featureIds, size: 1},\n type: 'Point'\n },\n lines: {\n ...lines,\n pathIndices: {value: lines.pathIndices, size: 1},\n positions: {value: lines.positions, size: coordLength},\n globalFeatureIds: {value: lines.globalFeatureIds, size: 1},\n featureIds: {value: lines.featureIds, size: 1},\n type: 'LineString'\n },\n polygons: {\n ...polygons,\n polygonIndices: {value: polygons.polygonIndices, size: 1},\n primitivePolygonIndices: {value: polygons.primitivePolygonIndices, size: 1},\n positions: {value: polygons.positions, size: coordLength},\n globalFeatureIds: {value: polygons.globalFeatureIds, size: 1},\n featureIds: {value: polygons.featureIds, size: 1},\n type: 'Polygon'\n }\n };\n\n for (const geomType in returnObj) {\n for (const numericProp in returnObj[geomType].numericProps) {\n returnObj[geomType].numericProps[numericProp] = {\n value: returnObj[geomType].numericProps[numericProp],\n size: 1\n };\n }\n }\n\n return returnObj as unknown as BinaryFeatures;\n}\n\n/** Add numeric properties to object */\nfunction fillNumericProperties(object, properties, index, length) {\n for (const numericPropName in object.numericProps) {\n if (numericPropName in properties) {\n object.numericProps[numericPropName].set(\n new Array(length).fill(properties[numericPropName]),\n index\n );\n }\n }\n}\n\n/** Keep string properties in object */\nfunction keepStringProperties(properties, numericKeys: string[]): GeoJsonProperties {\n const props = {};\n for (const key in properties) {\n if (!numericKeys.includes(key)) {\n props[key] = properties[key];\n }\n }\n return props;\n}\n\n/** @param coords is expected to be a list of arrays, each with length 2-3 */\nfunction fillCoords(array, coords, startVertex, coordLength): void {\n let index = startVertex * coordLength;\n for (const coord of coords) {\n array.set(coord, index);\n index += coordLength;\n }\n}\n\n// TODO - how does this work? Different `coordinates` have different nesting\nfunction flatten(arrays): number[][] {\n return [].concat(...arrays);\n}\n\nfunction isNumeric(x: any): boolean {\n return Number.isFinite(x);\n}\n"],"file":"geojson-to-binary.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/geojson-to-binary.ts"],"names":["geojsonToBinary","features","options","firstPassData","firstPass","secondPass","coordLength","numericPropKeys","PositionDataType","Float32Array","TEST_EXPORTS","pointPositionsCount","pointFeaturesCount","linePositionsCount","linePathsCount","lineFeaturesCount","polygonPositionsCount","polygonObjectsCount","polygonRingsCount","polygonFeaturesCount","coordLengths","Set","propArrayTypes","feature","geometry","type","add","coordinates","length","point","coord","line","flatten","polygon","Error","properties","key","val","deduceArrayType","size","Math","max","Object","keys","filter","k","Array","GlobalFeatureIdsDataType","Uint32Array","Uint16Array","points","positions","globalFeatureIds","featureIds","numericProps","fields","lines","pathIndices","polygons","polygonIndices","primitivePolygonIndices","object","propName","TypedArray","indexMap","pointPosition","pointFeature","linePosition","linePath","lineFeature","polygonPosition","polygonObject","polygonRing","polygonFeature","handlePoint","push","keepStringProperties","handleMultiPoint","handleLineString","handleMultiLineString","handlePolygon","handleMultiPolygon","makeAccessorObjects","coords","set","fillNumericProperties","fillCoords","nPositions","fill","ring","returnObj","value","geomType","numericProp","index","numericPropName","numericKeys","props","includes","array","startVertex","arrays","concat","x","constructor","Number","isFinite","Float64Array","fround"],"mappings":"AAUA,OAAO,SAASA,eAAT,CACLC,QADK,EAELC,OAA+B,GAAG,EAF7B,EAGW;AAChB,QAAMC,aAAa,GAAGC,SAAS,CAACH,QAAD,CAA/B;AACA,SAAOI,UAAU,CAACJ,QAAD,EAAWE,aAAX,EAA0B;AACzCG,IAAAA,WAAW,EAAEJ,OAAO,CAACI,WAAR,IAAuBH,aAAa,CAACG,WADT;AAEzCC,IAAAA,eAAe,EAAEL,OAAO,CAACK,eAAR,IAA2BJ,aAAa,CAACI,eAFjB;AAGzCC,IAAAA,gBAAgB,EAAEN,OAAO,CAACM,gBAAR,IAA4BC;AAHL,GAA1B,CAAjB;AAKD;AAED,OAAO,MAAMC,YAAY,GAAG;AAC1BN,EAAAA,SAD0B;AAE1BC,EAAAA;AAF0B,CAArB;;AA6BP,SAASD,SAAT,CAAmBH,QAAnB,EAAuD;AAErD,MAAIU,mBAAmB,GAAG,CAA1B;AACA,MAAIC,kBAAkB,GAAG,CAAzB;AACA,MAAIC,kBAAkB,GAAG,CAAzB;AACA,MAAIC,cAAc,GAAG,CAArB;AACA,MAAIC,iBAAiB,GAAG,CAAxB;AACA,MAAIC,qBAAqB,GAAG,CAA5B;AACA,MAAIC,mBAAmB,GAAG,CAA1B;AACA,MAAIC,iBAAiB,GAAG,CAAxB;AACA,MAAIC,oBAAoB,GAAG,CAA3B;AACA,QAAMC,YAAY,GAAG,IAAIC,GAAJ,EAArB;AACA,QAAMC,cAAc,GAAG,EAAvB;;AAEA,OAAK,MAAMC,OAAX,IAAsBtB,QAAtB,EAAgC;AAC9B,UAAMuB,QAAQ,GAAGD,OAAO,CAACC,QAAzB;;AACA,YAAQA,QAAQ,CAACC,IAAjB;AACE,WAAK,OAAL;AACEb,QAAAA,kBAAkB;AAClBD,QAAAA,mBAAmB;AACnBS,QAAAA,YAAY,CAACM,GAAb,CAAiBF,QAAQ,CAACG,WAAT,CAAqBC,MAA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CAAC4D,eAAD,CAAjC,CADF,EAEED,KAFF;AAID;AACF;AACF;;AAGD,SAASlB,oBAAT,CAA8BzC,UAA9B,EAA0C6D,WAA1C,EAAoF;AAClF,QAAMC,KAAK,GAAG,EAAd;;AACA,OAAK,MAAM7D,GAAX,IAAkBD,UAAlB,EAA8B;AAC5B,QAAI,CAAC6D,WAAW,CAACE,QAAZ,CAAqB9D,GAArB,CAAL,EAAgC;AAC9B6D,MAAAA,KAAK,CAAC7D,GAAD,CAAL,GAAaD,UAAU,CAACC,GAAD,CAAvB;AACD;AACF;;AACD,SAAO6D,KAAP;AACD;;AAGD,SAASX,UAAT,CAAoBa,KAApB,EAA2BhB,MAA3B,EAAmCiB,WAAnC,EAAgD9F,WAAhD,EAAmE;AACjE,MAAIwF,KAAK,GAAGM,WAAW,GAAG9F,WAA1B;;AACA,OAAK,MAAMwB,KAAX,IAAoBqD,MAApB,EAA4B;AAC1BgB,IAAAA,KAAK,CAACf,GAAN,CAAUtD,KAAV,EAAiBgE,KAAjB;AACAA,IAAAA,KAAK,IAAIxF,WAAT;AACD;AACF;;AAGD,SAAS0B,OAAT,CAAiBqE,MAAjB,EAAqC;AACnC,SAAO,GAAGC,MAAH,CAAU,GAAGD,MAAb,CAAP;AACD;;AAED,SAAS/D,eAAT,CAAyBiE,CAAzB,EAAiCC,WAAjC,EAA0F;AACxF,MAAIA,WAAW,KAAK1D,KAAhB,IAAyB,CAAC2D,MAAM,CAACC,QAAP,CAAgBH,CAAhB,CAA9B,EAAkD;AAChD,WAAOzD,KAAP;AACD;;AAGD,SAAO0D,WAAW,KAAKG,YAAhB,IAAgCnE,IAAI,CAACoE,MAAL,CAAYL,CAAZ,MAAmBA,CAAnD,GAAuDI,YAAvD,GAAsElG,YAA7E;AACD","sourcesContent":["import {Feature, GeoJsonProperties} from '@loaders.gl/schema';\nimport type {BinaryFeatures} from '@loaders.gl/schema';\n\nexport type GeojsonToBinaryOptions = {\n coordLength?: number;\n numericPropKeys?: string[];\n PositionDataType?: Function;\n};\n\n/** Convert GeoJSON features to flat binary arrays */\nexport function geojsonToBinary(\n features: Feature[],\n options: GeojsonToBinaryOptions = {}\n): BinaryFeatures {\n const firstPassData = firstPass(features);\n return secondPass(features, firstPassData, {\n coordLength: options.coordLength || firstPassData.coordLength,\n numericPropKeys: options.numericPropKeys || firstPassData.numericPropKeys,\n PositionDataType: options.PositionDataType || Float32Array\n });\n}\n\nexport const TEST_EXPORTS = {\n firstPass,\n secondPass\n};\n\ntype PropArrayConstructor = Float32ArrayConstructor | Float64ArrayConstructor | ArrayConstructor;\n\ntype FirstPassData = {\n coordLength: number;\n numericPropKeys: string[];\n propArrayTypes: {[key: string]: PropArrayConstructor};\n\n pointPositionsCount: number;\n pointFeaturesCount: number;\n linePositionsCount: number;\n linePathsCount: number;\n lineFeaturesCount: number;\n polygonPositionsCount: number;\n polygonObjectsCount: number;\n polygonRingsCount: number;\n polygonFeaturesCount: number;\n};\n\n/**\n * Initial scan over GeoJSON features\n * Counts number of coordinates of each geometry type and\n * keeps track of the max coordinate dimensions\n */\n// eslint-disable-next-line complexity, max-statements\nfunction firstPass(features: Feature[]): FirstPassData {\n // Counts the number of _positions_, so [x, y, z] counts as one\n let pointPositionsCount = 0;\n let pointFeaturesCount = 0;\n let linePositionsCount = 0;\n let linePathsCount = 0;\n let lineFeaturesCount = 0;\n let polygonPositionsCount = 0;\n let polygonObjectsCount = 0;\n let polygonRingsCount = 0;\n let polygonFeaturesCount = 0;\n const coordLengths = new Set<number>();\n const propArrayTypes = {};\n\n for (const feature of features) {\n const geometry = feature.geometry;\n switch (geometry.type) {\n case 'Point':\n pointFeaturesCount++;\n pointPositionsCount++;\n coordLengths.add(geometry.coordinates.length);\n break;\n case 'MultiPoint':\n pointFeaturesCount++;\n pointPositionsCount += geometry.coordinates.length;\n for (const point of geometry.coordinates) {\n coordLengths.add(point.length);\n }\n break;\n case 'LineString':\n lineFeaturesCount++;\n linePositionsCount += geometry.coordinates.length;\n linePathsCount++;\n\n for (const coord of geometry.coordinates) {\n coordLengths.add(coord.length);\n }\n break;\n case 'MultiLineString':\n lineFeaturesCount++;\n for (const line of geometry.coordinates) {\n linePositionsCount += line.length;\n linePathsCount++;\n\n // eslint-disable-next-line max-depth\n for (const coord of line) {\n coordLengths.add(coord.length);\n }\n }\n break;\n case 'Polygon':\n polygonFeaturesCount++;\n polygonObjectsCount++;\n polygonRingsCount += geometry.coordinates.length;\n polygonPositionsCount += flatten(geometry.coordinates).length;\n\n for (const coord of flatten(geometry.coordinates)) {\n coordLengths.add(coord.length);\n }\n break;\n case 'MultiPolygon':\n polygonFeaturesCount++;\n for (const polygon of geometry.coordinates) {\n polygonObjectsCount++;\n polygonRingsCount += polygon.length;\n polygonPositionsCount += flatten(polygon).length;\n\n // eslint-disable-next-line max-depth\n for (const coord of flatten(polygon)) {\n coordLengths.add(coord.length);\n }\n }\n break;\n default:\n throw new Error(`Unsupported geometry type: ${geometry.type}`);\n }\n\n if (feature.properties) {\n for (const key in feature.properties) {\n const val = feature.properties[key];\n\n // If property has not been seen before, or if property has been numeric\n // in all previous features, check if numeric in this feature\n // If not numeric, Array is stored to prevent rechecking in the future\n // Additionally, detects if 64 bit precision is required\n propArrayTypes[key] = deduceArrayType(val, propArrayTypes[key]);\n }\n }\n }\n\n return {\n coordLength: coordLengths.size > 0 ? Math.max(...coordLengths) : 2,\n\n pointPositionsCount,\n pointFeaturesCount,\n linePositionsCount,\n linePathsCount,\n lineFeaturesCount,\n polygonPositionsCount,\n polygonObjectsCount,\n polygonRingsCount,\n polygonFeaturesCount,\n\n // Array of keys whose values are always numeric\n numericPropKeys: Object.keys(propArrayTypes).filter((k) => propArrayTypes[k] !== Array),\n propArrayTypes\n };\n}\n\n/**\n * Second scan over GeoJSON features\n * Fills coordinates into pre-allocated typed arrays\n */\n// eslint-disable-next-line complexity\nfunction secondPass(\n features,\n firstPassData: FirstPassData,\n options: Required<GeojsonToBinaryOptions>\n) {\n const {\n pointPositionsCount,\n pointFeaturesCount,\n linePositionsCount,\n linePathsCount,\n lineFeaturesCount,\n polygonPositionsCount,\n polygonObjectsCount,\n polygonRingsCount,\n propArrayTypes,\n polygonFeaturesCount\n } = firstPassData;\n const {coordLength, numericPropKeys, PositionDataType = Float32Array} = options;\n const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;\n const points = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(pointPositionsCount * coordLength),\n globalFeatureIds: new GlobalFeatureIdsDataType(pointPositionsCount),\n featureIds:\n pointFeaturesCount > 65535\n ? new Uint32Array(pointPositionsCount)\n : new Uint16Array(pointPositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n const lines = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(linePositionsCount * coordLength),\n pathIndices:\n linePositionsCount > 65535\n ? new Uint32Array(linePathsCount + 1)\n : new Uint16Array(linePathsCount + 1),\n globalFeatureIds: new GlobalFeatureIdsDataType(linePositionsCount),\n featureIds:\n lineFeaturesCount > 65535\n ? new Uint32Array(linePositionsCount)\n : new Uint16Array(linePositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n const polygons = {\n // @ts-ignore Typescript doesn't like dynamic constructors\n positions: new PositionDataType(polygonPositionsCount * coordLength),\n polygonIndices:\n polygonPositionsCount > 65535\n ? new Uint32Array(polygonObjectsCount + 1)\n : new Uint16Array(polygonObjectsCount + 1),\n primitivePolygonIndices:\n polygonPositionsCount > 65535\n ? new Uint32Array(polygonRingsCount + 1)\n : new Uint16Array(polygonRingsCount + 1),\n globalFeatureIds: new GlobalFeatureIdsDataType(polygonPositionsCount),\n featureIds:\n polygonFeaturesCount > 65535\n ? new Uint32Array(polygonPositionsCount)\n : new Uint16Array(polygonPositionsCount),\n numericProps: {},\n properties: Array<any>(),\n fields: Array<any>()\n };\n\n // Instantiate numeric properties arrays; one value per vertex\n for (const object of [points, lines, polygons]) {\n for (const propName of numericPropKeys || []) {\n // If property has been numeric in all previous features in which the property existed, check\n // if numeric in this feature\n const TypedArray = propArrayTypes[propName];\n object.numericProps[propName] = new TypedArray(object.positions.length / coordLength);\n }\n }\n\n // Set last element of path/polygon indices as positions length\n lines.pathIndices[linePathsCount] = linePositionsCount;\n polygons.polygonIndices[polygonObjectsCount] = polygonPositionsCount;\n polygons.primitivePolygonIndices[polygonRingsCount] = polygonPositionsCount;\n\n const indexMap = {\n pointPosition: 0,\n pointFeature: 0,\n linePosition: 0,\n linePath: 0,\n lineFeature: 0,\n polygonPosition: 0,\n polygonObject: 0,\n polygonRing: 0,\n polygonFeature: 0,\n feature: 0\n };\n\n for (const feature of features) {\n const geometry = feature.geometry;\n const properties: GeoJsonProperties = feature.properties || {};\n\n switch (geometry.type) {\n case 'Point':\n handlePoint(geometry.coordinates, points, indexMap, coordLength, properties);\n points.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.pointFeature++;\n break;\n case 'MultiPoint':\n handleMultiPoint(geometry.coordinates, points, indexMap, coordLength, properties);\n points.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.pointFeature++;\n break;\n case 'LineString':\n handleLineString(geometry.coordinates, lines, indexMap, coordLength, properties);\n lines.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.lineFeature++;\n break;\n case 'MultiLineString':\n handleMultiLineString(geometry.coordinates, lines, indexMap, coordLength, properties);\n lines.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.lineFeature++;\n break;\n case 'Polygon':\n handlePolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);\n polygons.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.polygonFeature++;\n break;\n case 'MultiPolygon':\n handleMultiPolygon(geometry.coordinates, polygons, indexMap, coordLength, properties);\n polygons.properties.push(keepStringProperties(properties, numericPropKeys));\n indexMap.polygonFeature++;\n break;\n default:\n throw new Error('Invalid geometry type');\n }\n\n indexMap.feature++;\n }\n\n // Wrap each array in an accessor object with value and size keys\n return makeAccessorObjects(points, lines, polygons, coordLength);\n}\n\n/** Fills Point coordinates into points object of arrays */\nfunction handlePoint(coords, points, indexMap, coordLength, properties) {\n points.positions.set(coords, indexMap.pointPosition * coordLength);\n points.globalFeatureIds[indexMap.pointPosition] = indexMap.feature;\n points.featureIds[indexMap.pointPosition] = indexMap.pointFeature;\n\n fillNumericProperties(points, properties, indexMap.pointPosition, 1);\n indexMap.pointPosition++;\n}\n\n/** Fills MultiPoint coordinates into points object of arrays */\nfunction handleMultiPoint(coords, points, indexMap, coordLength, properties) {\n for (const point of coords) {\n handlePoint(point, points, indexMap, coordLength, properties);\n }\n}\n\n/** Fills LineString coordinates into lines object of arrays */\nfunction handleLineString(coords, lines, indexMap, coordLength, properties) {\n lines.pathIndices[indexMap.linePath] = indexMap.linePosition;\n indexMap.linePath++;\n\n fillCoords(lines.positions, coords, indexMap.linePosition, coordLength);\n\n const nPositions = coords.length;\n fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);\n\n lines.globalFeatureIds.set(\n new Uint32Array(nPositions).fill(indexMap.feature),\n indexMap.linePosition\n );\n lines.featureIds.set(\n new Uint32Array(nPositions).fill(indexMap.lineFeature),\n indexMap.linePosition\n );\n indexMap.linePosition += nPositions;\n}\n\n/** Fills MultiLineString coordinates into lines object of arrays */\nfunction handleMultiLineString(coords, lines, indexMap, coordLength, properties) {\n for (const line of coords) {\n handleLineString(line, lines, indexMap, coordLength, properties);\n }\n}\n\n/** Fills Polygon coordinates into polygons object of arrays */\nfunction handlePolygon(coords, polygons, indexMap, coordLength, properties) {\n polygons.polygonIndices[indexMap.polygonObject] = indexMap.polygonPosition;\n indexMap.polygonObject++;\n\n for (const ring of coords) {\n polygons.primitivePolygonIndices[indexMap.polygonRing] = indexMap.polygonPosition;\n indexMap.polygonRing++;\n\n fillCoords(polygons.positions, ring, indexMap.polygonPosition, coordLength);\n\n const nPositions = ring.length;\n fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);\n\n polygons.globalFeatureIds.set(\n new Uint32Array(nPositions).fill(indexMap.feature),\n indexMap.polygonPosition\n );\n polygons.featureIds.set(\n new Uint32Array(nPositions).fill(indexMap.polygonFeature),\n indexMap.polygonPosition\n );\n indexMap.polygonPosition += nPositions;\n }\n}\n\n/** Fills MultiPolygon coordinates into polygons object of arrays */\nfunction handleMultiPolygon(coords, polygons, indexMap, coordLength, properties) {\n for (const polygon of coords) {\n handlePolygon(polygon, polygons, indexMap, coordLength, properties);\n }\n}\n\n/** Wrap each array in an accessor object with value and size keys */\nfunction makeAccessorObjects(points, lines, polygons, coordLength): BinaryFeatures {\n const returnObj = {\n points: {\n ...points,\n positions: {value: points.positions, size: coordLength},\n globalFeatureIds: {value: points.globalFeatureIds, size: 1},\n featureIds: {value: points.featureIds, size: 1},\n type: 'Point'\n },\n lines: {\n ...lines,\n pathIndices: {value: lines.pathIndices, size: 1},\n positions: {value: lines.positions, size: coordLength},\n globalFeatureIds: {value: lines.globalFeatureIds, size: 1},\n featureIds: {value: lines.featureIds, size: 1},\n type: 'LineString'\n },\n polygons: {\n ...polygons,\n polygonIndices: {value: polygons.polygonIndices, size: 1},\n primitivePolygonIndices: {value: polygons.primitivePolygonIndices, size: 1},\n positions: {value: polygons.positions, size: coordLength},\n globalFeatureIds: {value: polygons.globalFeatureIds, size: 1},\n featureIds: {value: polygons.featureIds, size: 1},\n type: 'Polygon'\n }\n };\n\n for (const geomType in returnObj) {\n for (const numericProp in returnObj[geomType].numericProps) {\n returnObj[geomType].numericProps[numericProp] = {\n value: returnObj[geomType].numericProps[numericProp],\n size: 1\n };\n }\n }\n\n return returnObj as unknown as BinaryFeatures;\n}\n\n/** Add numeric properties to object */\nfunction fillNumericProperties(object, properties, index, length) {\n for (const numericPropName in object.numericProps) {\n if (numericPropName in properties) {\n object.numericProps[numericPropName].set(\n new Array(length).fill(properties[numericPropName]),\n index\n );\n }\n }\n}\n\n/** Keep string properties in object */\nfunction keepStringProperties(properties, numericKeys: string[]): GeoJsonProperties {\n const props = {};\n for (const key in properties) {\n if (!numericKeys.includes(key)) {\n props[key] = properties[key];\n }\n }\n return props;\n}\n\n/** @param coords is expected to be a list of arrays, each with length 2-3 */\nfunction fillCoords(array, coords, startVertex, coordLength): void {\n let index = startVertex * coordLength;\n for (const coord of coords) {\n array.set(coord, index);\n index += coordLength;\n }\n}\n\n// TODO - how does this work? Different `coordinates` have different nesting\nfunction flatten(arrays): number[][] {\n return [].concat(...arrays);\n}\n\nfunction deduceArrayType(x: any, constructor: PropArrayConstructor): PropArrayConstructor {\n if (constructor === Array || !Number.isFinite(x)) {\n return Array;\n }\n\n // If this or previous value required 64bits use Float64Array\n return constructor === Float64Array || Math.fround(x) !== x ? Float64Array : Float32Array;\n}\n"],"file":"geojson-to-binary.js"}
|
|
@@ -11,9 +11,13 @@ export declare const TEST_EXPORTS: {
|
|
|
11
11
|
firstPass: typeof firstPass;
|
|
12
12
|
secondPass: typeof secondPass;
|
|
13
13
|
};
|
|
14
|
+
declare type PropArrayConstructor = Float32ArrayConstructor | Float64ArrayConstructor | ArrayConstructor;
|
|
14
15
|
declare type FirstPassData = {
|
|
15
16
|
coordLength: number;
|
|
16
17
|
numericPropKeys: string[];
|
|
18
|
+
propArrayTypes: {
|
|
19
|
+
[key: string]: PropArrayConstructor;
|
|
20
|
+
};
|
|
17
21
|
pointPositionsCount: number;
|
|
18
22
|
pointFeaturesCount: number;
|
|
19
23
|
linePositionsCount: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson-to-binary.d.ts","sourceRoot":"","sources":["../../src/lib/geojson-to-binary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAoB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAEvD,oBAAY,sBAAsB,GAAG;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,CAA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AC;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;GAIG;AAEH,iBAAS,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,aAAa,CA2GrD;AAED;;;GAGG;AAEH,iBAAS,UAAU,CACjB,QAAQ,KAAA,EACR,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,QAAQ,CAAC,sBAAsB,CAAC,kBAyI1C"}
|
|
@@ -33,7 +33,7 @@ function firstPass(features) {
|
|
|
33
33
|
let polygonRingsCount = 0;
|
|
34
34
|
let polygonFeaturesCount = 0;
|
|
35
35
|
const coordLengths = new Set();
|
|
36
|
-
const
|
|
36
|
+
const propArrayTypes = {};
|
|
37
37
|
for (const feature of features) {
|
|
38
38
|
const geometry = feature.geometry;
|
|
39
39
|
switch (geometry.type) {
|
|
@@ -97,11 +97,9 @@ function firstPass(features) {
|
|
|
97
97
|
const val = feature.properties[key];
|
|
98
98
|
// If property has not been seen before, or if property has been numeric
|
|
99
99
|
// in all previous features, check if numeric in this feature
|
|
100
|
-
// If not numeric,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
? isNumeric(val)
|
|
104
|
-
: numericPropKeys[key];
|
|
100
|
+
// If not numeric, Array is stored to prevent rechecking in the future
|
|
101
|
+
// Additionally, detects if 64 bit precision is required
|
|
102
|
+
propArrayTypes[key] = deduceArrayType(val, propArrayTypes[key]);
|
|
105
103
|
}
|
|
106
104
|
}
|
|
107
105
|
}
|
|
@@ -117,7 +115,8 @@ function firstPass(features) {
|
|
|
117
115
|
polygonRingsCount,
|
|
118
116
|
polygonFeaturesCount,
|
|
119
117
|
// Array of keys whose values are always numeric
|
|
120
|
-
numericPropKeys: Object.keys(
|
|
118
|
+
numericPropKeys: Object.keys(propArrayTypes).filter((k) => propArrayTypes[k] !== Array),
|
|
119
|
+
propArrayTypes
|
|
121
120
|
};
|
|
122
121
|
}
|
|
123
122
|
/**
|
|
@@ -126,7 +125,7 @@ function firstPass(features) {
|
|
|
126
125
|
*/
|
|
127
126
|
// eslint-disable-next-line complexity
|
|
128
127
|
function secondPass(features, firstPassData, options) {
|
|
129
|
-
const { pointPositionsCount, pointFeaturesCount, linePositionsCount, linePathsCount, lineFeaturesCount, polygonPositionsCount, polygonObjectsCount, polygonRingsCount, polygonFeaturesCount } = firstPassData;
|
|
128
|
+
const { pointPositionsCount, pointFeaturesCount, linePositionsCount, linePathsCount, lineFeaturesCount, polygonPositionsCount, polygonObjectsCount, polygonRingsCount, propArrayTypes, polygonFeaturesCount } = firstPassData;
|
|
130
129
|
const { coordLength, numericPropKeys, PositionDataType = Float32Array } = options;
|
|
131
130
|
const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
|
|
132
131
|
const points = {
|
|
@@ -176,7 +175,8 @@ function secondPass(features, firstPassData, options) {
|
|
|
176
175
|
for (const propName of numericPropKeys || []) {
|
|
177
176
|
// If property has been numeric in all previous features in which the property existed, check
|
|
178
177
|
// if numeric in this feature
|
|
179
|
-
|
|
178
|
+
const TypedArray = propArrayTypes[propName];
|
|
179
|
+
object.numericProps[propName] = new TypedArray(object.positions.length / coordLength);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
// Set last element of path/polygon indices as positions length
|
|
@@ -357,6 +357,10 @@ function fillCoords(array, coords, startVertex, coordLength) {
|
|
|
357
357
|
function flatten(arrays) {
|
|
358
358
|
return [].concat(...arrays);
|
|
359
359
|
}
|
|
360
|
-
function
|
|
361
|
-
|
|
360
|
+
function deduceArrayType(x, constructor) {
|
|
361
|
+
if (constructor === Array || !Number.isFinite(x)) {
|
|
362
|
+
return Array;
|
|
363
|
+
}
|
|
364
|
+
// If this or previous value required 64bits use Float64Array
|
|
365
|
+
return constructor === Float64Array || Math.fround(x) !== x ? Float64Array : Float32Array;
|
|
362
366
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/gis",
|
|
3
3
|
"description": "Helpers for GIS category data",
|
|
4
|
-
"version": "3.1.0
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@loaders.gl/loader-utils": "3.1.0
|
|
28
|
-
"@loaders.gl/schema": "3.1.0
|
|
27
|
+
"@loaders.gl/loader-utils": "3.1.0",
|
|
28
|
+
"@loaders.gl/schema": "3.1.0",
|
|
29
29
|
"@mapbox/vector-tile": "^1.3.1",
|
|
30
30
|
"pbf": "^3.2.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@math.gl/proj4": "^3.5.1"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "b02a011b5a6d6aa6c5870819045c70db168cb930"
|
|
36
36
|
}
|