Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loaders.gl/gis

Package Overview
Dependencies
Maintainers
9
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/gis - npm Package Compare versions

Comparing version 3.4.14 to 3.4.15

2

dist/es5/bundle.js
"use strict";
var moduleExports = require('./index');
const moduleExports = require('./index');
globalThis.loaders = globalThis.loaders || {};
module.exports = Object.assign(globalThis.loaders, moduleExports);
//# sourceMappingURL=bundle.js.map

@@ -8,3 +8,3 @@ "use strict";

enumerable: true,
get: function get() {
get: function () {
return _binaryToGeojson.binaryToGeoJson;

@@ -15,3 +15,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _binaryToGeojson.binaryToGeojson;

@@ -22,3 +22,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _binaryToGeojson.binaryToGeometry;

@@ -29,3 +29,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _flatGeojsonToBinary.flatGeojsonToBinary;

@@ -36,3 +36,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _geojsonToBinary.geojsonToBinary;

@@ -43,3 +43,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _geojsonToFlatGeojson.geojsonToFlatGeojson;

@@ -50,3 +50,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _transform.transformBinaryCoords;

@@ -57,3 +57,3 @@ }

enumerable: true,
get: function get() {
get: function () {
return _transform.transformGeoJsonCoords;

@@ -60,0 +60,0 @@ }

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -10,10 +9,4 @@ value: true

exports.binaryToGeometry = binaryToGeometry;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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; } } }; }
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); }
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; }
function binaryToGeojson(data, options) {
var globalFeatureId = options === null || options === void 0 ? void 0 : options.globalFeatureId;
const globalFeatureId = options === null || options === void 0 ? void 0 : options.globalFeatureId;
if (globalFeatureId !== undefined) {

@@ -25,3 +18,3 @@ return getSingleFeature(data, globalFeatureId);

function binaryToGeoJson(data, type) {
var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'feature';
let format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'feature';
switch (format) {

@@ -37,29 +30,20 @@ case 'feature':

function getSingleFeature(data, globalFeatureId) {
var dataArray = normalizeInput(data);
var _iterator = _createForOfIteratorHelper(dataArray),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var _data = _step.value;
var lastIndex = 0;
var lastValue = _data.featureIds.value[0];
for (var i = 0; i < _data.featureIds.value.length; i++) {
var currValue = _data.featureIds.value[i];
if (currValue === lastValue) {
continue;
}
if (globalFeatureId === _data.globalFeatureIds.value[lastIndex]) {
return parseFeature(_data, lastIndex, i);
}
lastIndex = i;
lastValue = currValue;
const dataArray = normalizeInput(data);
for (const data of dataArray) {
let lastIndex = 0;
let lastValue = data.featureIds.value[0];
for (let i = 0; i < data.featureIds.value.length; i++) {
const currValue = data.featureIds.value[i];
if (currValue === lastValue) {
continue;
}
if (globalFeatureId === _data.globalFeatureIds.value[lastIndex]) {
return parseFeature(_data, lastIndex, _data.featureIds.value.length);
if (globalFeatureId === data.globalFeatureIds.value[lastIndex]) {
return parseFeature(data, lastIndex, i);
}
lastIndex = i;
lastValue = currValue;
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
if (globalFeatureId === data.globalFeatureIds.value[lastIndex]) {
return parseFeature(data, lastIndex, data.featureIds.value.length);
}
}

@@ -69,3 +53,3 @@ throw new Error("featureId:".concat(globalFeatureId, " not found"));

function parseFeatures(data, type) {
var dataArray = normalizeInput(data, type);
const dataArray = normalizeInput(data, type);
return parseFeatureCollection(dataArray);

@@ -82,3 +66,3 @@ }

default:
var unexpectedInput = data;
const unexpectedInput = data;
throw new Error("Unsupported geometry type: ".concat(unexpectedInput === null || unexpectedInput === void 0 ? void 0 : unexpectedInput.type));

@@ -88,3 +72,3 @@ }

function normalizeInput(data, type) {
var isHeterogeneousType = Boolean(data.points || data.lines || data.polygons);
const isHeterogeneousType = Boolean(data.points || data.lines || data.polygons);
if (!isHeterogeneousType) {

@@ -94,3 +78,3 @@ data.type = type || parseType(data);

}
var features = [];
const features = [];
if (data.points) {

@@ -111,28 +95,19 @@ data.points.type = 'Point';

function parseFeatureCollection(dataArray) {
var features = [];
var _iterator2 = _createForOfIteratorHelper(dataArray),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var data = _step2.value;
if (data.featureIds.value.length === 0) {
const features = [];
for (const data of dataArray) {
if (data.featureIds.value.length === 0) {
continue;
}
let lastIndex = 0;
let lastValue = data.featureIds.value[0];
for (let i = 0; i < data.featureIds.value.length; i++) {
const currValue = data.featureIds.value[i];
if (currValue === lastValue) {
continue;
}
var lastIndex = 0;
var lastValue = data.featureIds.value[0];
for (var i = 0; i < data.featureIds.value.length; i++) {
var currValue = data.featureIds.value[i];
if (currValue === lastValue) {
continue;
}
features.push(parseFeature(data, lastIndex, i));
lastIndex = i;
lastValue = currValue;
}
features.push(parseFeature(data, lastIndex, data.featureIds.value.length));
features.push(parseFeature(data, lastIndex, i));
lastIndex = i;
lastValue = currValue;
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
features.push(parseFeature(data, lastIndex, data.featureIds.value.length));
}

@@ -142,21 +117,22 @@ return features;

function parseFeature(data, startIndex, endIndex) {
var geometry = binaryToGeometry(data, startIndex, endIndex);
var properties = parseProperties(data, startIndex, endIndex);
var fields = parseFields(data, startIndex, endIndex);
return _objectSpread({
const geometry = binaryToGeometry(data, startIndex, endIndex);
const properties = parseProperties(data, startIndex, endIndex);
const fields = parseFields(data, startIndex, endIndex);
return {
type: 'Feature',
geometry: geometry,
properties: properties
}, fields);
geometry,
properties,
...fields
};
}
function parseFields(data) {
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var endIndex = arguments.length > 2 ? arguments[2] : undefined;
let startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
let endIndex = arguments.length > 2 ? arguments[2] : undefined;
return data.fields && data.fields[data.featureIds.value[startIndex]];
}
function parseProperties(data) {
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var endIndex = arguments.length > 2 ? arguments[2] : undefined;
var properties = Object.assign({}, data.properties[data.featureIds.value[startIndex]]);
for (var key in data.numericProps) {
let startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
let endIndex = arguments.length > 2 ? arguments[2] : undefined;
const properties = Object.assign({}, data.properties[data.featureIds.value[startIndex]]);
for (const key in data.numericProps) {
properties[key] = data.numericProps[key].value[startIndex];

@@ -167,30 +143,28 @@ }

function polygonToGeoJson(data) {
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -Infinity;
var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Infinity;
var positions = data.positions;
var polygonIndices = data.polygonIndices.value.filter(function (x) {
return x >= startIndex && x <= endIndex;
});
var primitivePolygonIndices = data.primitivePolygonIndices.value.filter(function (x) {
return x >= startIndex && x <= endIndex;
});
var multi = polygonIndices.length > 2;
let startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -Infinity;
let endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Infinity;
const {
positions
} = data;
const polygonIndices = data.polygonIndices.value.filter(x => x >= startIndex && x <= endIndex);
const primitivePolygonIndices = data.primitivePolygonIndices.value.filter(x => x >= startIndex && x <= endIndex);
const multi = polygonIndices.length > 2;
if (!multi) {
var _coordinates = [];
for (var i = 0; i < primitivePolygonIndices.length - 1; i++) {
var startRingIndex = primitivePolygonIndices[i];
var endRingIndex = primitivePolygonIndices[i + 1];
var ringCoordinates = ringToGeoJson(positions, startRingIndex, endRingIndex);
_coordinates.push(ringCoordinates);
const coordinates = [];
for (let i = 0; i < primitivePolygonIndices.length - 1; i++) {
const startRingIndex = primitivePolygonIndices[i];
const endRingIndex = primitivePolygonIndices[i + 1];
const ringCoordinates = ringToGeoJson(positions, startRingIndex, endRingIndex);
coordinates.push(ringCoordinates);
}
return {
type: 'Polygon',
coordinates: _coordinates
coordinates
};
}
var coordinates = [];
for (var _i = 0; _i < polygonIndices.length - 1; _i++) {
var startPolygonIndex = polygonIndices[_i];
var endPolygonIndex = polygonIndices[_i + 1];
var polygonCoordinates = polygonToGeoJson(data, startPolygonIndex, endPolygonIndex).coordinates;
const coordinates = [];
for (let i = 0; i < polygonIndices.length - 1; i++) {
const startPolygonIndex = polygonIndices[i];
const endPolygonIndex = polygonIndices[i + 1];
const polygonCoordinates = polygonToGeoJson(data, startPolygonIndex, endPolygonIndex).coordinates;
coordinates.push(polygonCoordinates);

@@ -200,23 +174,23 @@ }

type: 'MultiPolygon',
coordinates: coordinates
coordinates
};
}
function lineStringToGeoJson(data) {
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -Infinity;
var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Infinity;
var positions = data.positions;
var pathIndices = data.pathIndices.value.filter(function (x) {
return x >= startIndex && x <= endIndex;
});
var multi = pathIndices.length > 2;
let startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -Infinity;
let endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Infinity;
const {
positions
} = data;
const pathIndices = data.pathIndices.value.filter(x => x >= startIndex && x <= endIndex);
const multi = pathIndices.length > 2;
if (!multi) {
var _coordinates2 = ringToGeoJson(positions, pathIndices[0], pathIndices[1]);
const coordinates = ringToGeoJson(positions, pathIndices[0], pathIndices[1]);
return {
type: 'LineString',
coordinates: _coordinates2
coordinates
};
}
var coordinates = [];
for (var i = 0; i < pathIndices.length - 1; i++) {
var ringCoordinates = ringToGeoJson(positions, pathIndices[i], pathIndices[i + 1]);
const coordinates = [];
for (let i = 0; i < pathIndices.length - 1; i++) {
const ringCoordinates = ringToGeoJson(positions, pathIndices[i], pathIndices[i + 1]);
coordinates.push(ringCoordinates);

@@ -226,13 +200,15 @@ }

type: 'MultiLineString',
coordinates: coordinates
coordinates
};
}
function pointToGeoJson(data, startIndex, endIndex) {
var positions = data.positions;
var coordinates = ringToGeoJson(positions, startIndex, endIndex);
var multi = coordinates.length > 1;
const {
positions
} = data;
const coordinates = ringToGeoJson(positions, startIndex, endIndex);
const multi = coordinates.length > 1;
if (multi) {
return {
type: 'MultiPoint',
coordinates: coordinates
coordinates
};

@@ -248,6 +224,6 @@ }

endIndex = endIndex || positions.value.length / positions.size;
var ringCoordinates = [];
for (var j = startIndex; j < endIndex; j++) {
var coord = Array();
for (var k = j * positions.size; k < (j + 1) * positions.size; k++) {
const ringCoordinates = [];
for (let j = startIndex; j < endIndex; j++) {
const coord = Array();
for (let k = j * positions.size; k < (j + 1) * positions.size; k++) {
coord.push(Number(positions.value[k]));

@@ -254,0 +230,0 @@ }

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,161 +7,85 @@ value: true

exports.extractGeometryInfo = extractGeometryInfo;
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
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; } } }; }
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); }
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; }
function extractGeometryInfo(features) {
var pointPositionsCount = 0;
var pointFeaturesCount = 0;
var linePositionsCount = 0;
var linePathsCount = 0;
var lineFeaturesCount = 0;
var polygonPositionsCount = 0;
var polygonObjectsCount = 0;
var polygonRingsCount = 0;
var polygonFeaturesCount = 0;
var coordLengths = new Set();
var _iterator = _createForOfIteratorHelper(features),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var feature = _step.value;
var geometry = feature.geometry;
switch (geometry.type) {
case 'Point':
pointFeaturesCount++;
pointPositionsCount++;
coordLengths.add(geometry.coordinates.length);
break;
case 'MultiPoint':
pointFeaturesCount++;
pointPositionsCount += geometry.coordinates.length;
var _iterator2 = _createForOfIteratorHelper(geometry.coordinates),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var point = _step2.value;
coordLengths.add(point.length);
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
break;
case 'LineString':
lineFeaturesCount++;
linePositionsCount += geometry.coordinates.length;
let pointPositionsCount = 0;
let pointFeaturesCount = 0;
let linePositionsCount = 0;
let linePathsCount = 0;
let lineFeaturesCount = 0;
let polygonPositionsCount = 0;
let polygonObjectsCount = 0;
let polygonRingsCount = 0;
let polygonFeaturesCount = 0;
const coordLengths = new Set();
for (const feature of features) {
const geometry = feature.geometry;
switch (geometry.type) {
case 'Point':
pointFeaturesCount++;
pointPositionsCount++;
coordLengths.add(geometry.coordinates.length);
break;
case 'MultiPoint':
pointFeaturesCount++;
pointPositionsCount += geometry.coordinates.length;
for (const point of geometry.coordinates) {
coordLengths.add(point.length);
}
break;
case 'LineString':
lineFeaturesCount++;
linePositionsCount += geometry.coordinates.length;
linePathsCount++;
for (const coord of geometry.coordinates) {
coordLengths.add(coord.length);
}
break;
case 'MultiLineString':
lineFeaturesCount++;
for (const line of geometry.coordinates) {
linePositionsCount += line.length;
linePathsCount++;
var _iterator3 = _createForOfIteratorHelper(geometry.coordinates),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var coord = _step3.value;
coordLengths.add(coord.length);
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
for (const coord of line) {
coordLengths.add(coord.length);
}
break;
case 'MultiLineString':
lineFeaturesCount++;
var _iterator4 = _createForOfIteratorHelper(geometry.coordinates),
_step4;
try {
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
var line = _step4.value;
linePositionsCount += line.length;
linePathsCount++;
var _iterator5 = _createForOfIteratorHelper(line),
_step5;
try {
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
var _coord = _step5.value;
coordLengths.add(_coord.length);
}
} catch (err) {
_iterator5.e(err);
} finally {
_iterator5.f();
}
}
} catch (err) {
_iterator4.e(err);
} finally {
_iterator4.f();
}
break;
case 'Polygon':
polygonFeaturesCount++;
}
break;
case 'Polygon':
polygonFeaturesCount++;
polygonObjectsCount++;
polygonRingsCount += geometry.coordinates.length;
const flattened = geometry.coordinates.flat();
polygonPositionsCount += flattened.length;
for (const coord of flattened) {
coordLengths.add(coord.length);
}
break;
case 'MultiPolygon':
polygonFeaturesCount++;
for (const polygon of geometry.coordinates) {
polygonObjectsCount++;
polygonRingsCount += geometry.coordinates.length;
var flattened = geometry.coordinates.flat();
polygonRingsCount += polygon.length;
const flattened = polygon.flat();
polygonPositionsCount += flattened.length;
var _iterator6 = _createForOfIteratorHelper(flattened),
_step6;
try {
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
var _coord2 = _step6.value;
coordLengths.add(_coord2.length);
}
} catch (err) {
_iterator6.e(err);
} finally {
_iterator6.f();
for (const coord of flattened) {
coordLengths.add(coord.length);
}
break;
case 'MultiPolygon':
polygonFeaturesCount++;
var _iterator7 = _createForOfIteratorHelper(geometry.coordinates),
_step7;
try {
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
var polygon = _step7.value;
polygonObjectsCount++;
polygonRingsCount += polygon.length;
var _flattened = polygon.flat();
polygonPositionsCount += _flattened.length;
var _iterator8 = _createForOfIteratorHelper(_flattened),
_step8;
try {
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
var _coord3 = _step8.value;
coordLengths.add(_coord3.length);
}
} catch (err) {
_iterator8.e(err);
} finally {
_iterator8.f();
}
}
} catch (err) {
_iterator7.e(err);
} finally {
_iterator7.f();
}
break;
default:
throw new Error("Unsupported geometry type: ".concat(geometry.type));
}
}
break;
default:
throw new Error("Unsupported geometry type: ".concat(geometry.type));
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return {
coordLength: coordLengths.size > 0 ? Math.max.apply(Math, (0, _toConsumableArray2.default)(coordLengths)) : 2,
pointPositionsCount: pointPositionsCount,
pointFeaturesCount: pointFeaturesCount,
linePositionsCount: linePositionsCount,
linePathsCount: linePathsCount,
lineFeaturesCount: lineFeaturesCount,
polygonPositionsCount: polygonPositionsCount,
polygonObjectsCount: polygonObjectsCount,
polygonRingsCount: polygonRingsCount,
polygonFeaturesCount: polygonFeaturesCount
coordLength: coordLengths.size > 0 ? Math.max(...coordLengths) : 2,
pointPositionsCount,
pointFeaturesCount,
linePositionsCount,
linePathsCount,
lineFeaturesCount,
polygonPositionsCount,
polygonObjectsCount,
polygonRingsCount,
polygonFeaturesCount
};
}
//# sourceMappingURL=extract-geometry-info.js.map
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,17 +8,10 @@ value: true

exports.flatGeojsonToBinary = flatGeojsonToBinary;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _polygon = require("@math.gl/polygon");
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; } } }; }
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); }
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; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function flatGeojsonToBinary(features, geometryInfo, options) {
var propArrayTypes = extractNumericPropTypes(features);
var numericPropKeys = Object.keys(propArrayTypes).filter(function (k) {
return propArrayTypes[k] !== Array;
});
return fillArrays(features, _objectSpread({
propArrayTypes: propArrayTypes
}, geometryInfo), {
const propArrayTypes = extractNumericPropTypes(features);
const numericPropKeys = Object.keys(propArrayTypes).filter(k => propArrayTypes[k] !== Array);
return fillArrays(features, {
propArrayTypes,
...geometryInfo
}, {
numericPropKeys: options && options.numericPropKeys || numericPropKeys,

@@ -30,24 +22,15 @@ PositionDataType: options ? options.PositionDataType : Float32Array,

}
var TEST_EXPORTS = {
extractNumericPropTypes: extractNumericPropTypes
const TEST_EXPORTS = {
extractNumericPropTypes
};
exports.TEST_EXPORTS = TEST_EXPORTS;
function extractNumericPropTypes(features) {
var propArrayTypes = {};
var _iterator = _createForOfIteratorHelper(features),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var feature = _step.value;
if (feature.properties) {
for (var _key in feature.properties) {
var val = feature.properties[_key];
propArrayTypes[_key] = deduceArrayType(val, propArrayTypes[_key]);
}
const propArrayTypes = {};
for (const feature of features) {
if (feature.properties) {
for (const key in feature.properties) {
const val = feature.properties[key];
propArrayTypes[key] = deduceArrayType(val, propArrayTypes[key]);
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}

@@ -57,22 +40,23 @@ return propArrayTypes;

function fillArrays(features, geometryInfo, options) {
var pointPositionsCount = geometryInfo.pointPositionsCount,
pointFeaturesCount = geometryInfo.pointFeaturesCount,
linePositionsCount = geometryInfo.linePositionsCount,
linePathsCount = geometryInfo.linePathsCount,
lineFeaturesCount = geometryInfo.lineFeaturesCount,
polygonPositionsCount = geometryInfo.polygonPositionsCount,
polygonObjectsCount = geometryInfo.polygonObjectsCount,
polygonRingsCount = geometryInfo.polygonRingsCount,
polygonFeaturesCount = geometryInfo.polygonFeaturesCount,
propArrayTypes = geometryInfo.propArrayTypes,
coordLength = geometryInfo.coordLength;
var _options$numericPropK = options.numericPropKeys,
numericPropKeys = _options$numericPropK === void 0 ? [] : _options$numericPropK,
_options$PositionData = options.PositionDataType,
PositionDataType = _options$PositionData === void 0 ? Float32Array : _options$PositionData,
_options$triangulate = options.triangulate,
triangulate = _options$triangulate === void 0 ? true : _options$triangulate;
var hasGlobalId = features[0] && 'id' in features[0];
var GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
var points = {
const {
pointPositionsCount,
pointFeaturesCount,
linePositionsCount,
linePathsCount,
lineFeaturesCount,
polygonPositionsCount,
polygonObjectsCount,
polygonRingsCount,
polygonFeaturesCount,
propArrayTypes,
coordLength
} = geometryInfo;
const {
numericPropKeys = [],
PositionDataType = Float32Array,
triangulate = true
} = options;
const hasGlobalId = features[0] && 'id' in features[0];
const GlobalFeatureIdsDataType = features.length > 65535 ? Uint32Array : Uint16Array;
const points = {
type: 'Point',

@@ -86,3 +70,3 @@ positions: new PositionDataType(pointPositionsCount * coordLength),

};
var lines = {
const lines = {
type: 'LineString',

@@ -97,3 +81,3 @@ pathIndices: linePositionsCount > 65535 ? new Uint32Array(linePathsCount + 1) : new Uint16Array(linePathsCount + 1),

};
var polygons = {
const polygons = {
type: 'Polygon',

@@ -112,16 +96,6 @@ polygonIndices: polygonPositionsCount > 65535 ? new Uint32Array(polygonObjectsCount + 1) : new Uint16Array(polygonObjectsCount + 1),

}
for (var _i = 0, _arr = [points, lines, polygons]; _i < _arr.length; _i++) {
var object = _arr[_i];
var _iterator2 = _createForOfIteratorHelper(numericPropKeys),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var propName = _step2.value;
var T = propArrayTypes[propName];
object.numericProps[propName] = new T(object.positions.length / coordLength);
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
for (const object of [points, lines, polygons]) {
for (const propName of numericPropKeys) {
const T = propArrayTypes[propName];
object.numericProps[propName] = new T(object.positions.length / coordLength);
}

@@ -132,3 +106,3 @@ }

polygons.primitivePolygonIndices[polygonRingsCount] = polygonPositionsCount;
var indexMap = {
const indexMap = {
pointPosition: 0,

@@ -145,49 +119,40 @@ pointFeature: 0,

};
var _iterator3 = _createForOfIteratorHelper(features),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var feature = _step3.value;
var geometry = feature.geometry;
var properties = feature.properties || {};
switch (geometry.type) {
case 'Point':
handlePoint(geometry, points, indexMap, coordLength, properties);
points.properties.push(keepStringProperties(properties, numericPropKeys));
if (hasGlobalId) {
points.fields.push({
id: feature.id
});
}
indexMap.pointFeature++;
break;
case 'LineString':
handleLineString(geometry, lines, indexMap, coordLength, properties);
lines.properties.push(keepStringProperties(properties, numericPropKeys));
if (hasGlobalId) {
lines.fields.push({
id: feature.id
});
}
indexMap.lineFeature++;
break;
case 'Polygon':
handlePolygon(geometry, polygons, indexMap, coordLength, properties);
polygons.properties.push(keepStringProperties(properties, numericPropKeys));
if (hasGlobalId) {
polygons.fields.push({
id: feature.id
});
}
indexMap.polygonFeature++;
break;
default:
throw new Error('Invalid geometry type');
}
indexMap.feature++;
for (const feature of features) {
const geometry = feature.geometry;
const properties = feature.properties || {};
switch (geometry.type) {
case 'Point':
handlePoint(geometry, points, indexMap, coordLength, properties);
points.properties.push(keepStringProperties(properties, numericPropKeys));
if (hasGlobalId) {
points.fields.push({
id: feature.id
});
}
indexMap.pointFeature++;
break;
case 'LineString':
handleLineString(geometry, lines, indexMap, coordLength, properties);
lines.properties.push(keepStringProperties(properties, numericPropKeys));
if (hasGlobalId) {
lines.fields.push({
id: feature.id
});
}
indexMap.lineFeature++;
break;
case 'Polygon':
handlePolygon(geometry, polygons, indexMap, coordLength, properties);
polygons.properties.push(keepStringProperties(properties, numericPropKeys));
if (hasGlobalId) {
polygons.fields.push({
id: feature.id
});
}
indexMap.polygonFeature++;
break;
default:
throw new Error('Invalid geometry type');
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
indexMap.feature++;
}

@@ -198,3 +163,3 @@ return makeAccessorObjects(points, lines, polygons, coordLength);

points.positions.set(geometry.data, indexMap.pointPosition * coordLength);
var nPositions = geometry.data.length / coordLength;
const nPositions = geometry.data.length / coordLength;
fillNumericProperties(points, properties, indexMap.pointPosition, nPositions);

@@ -207,9 +172,9 @@ points.globalFeatureIds.fill(indexMap.feature, indexMap.pointPosition, indexMap.pointPosition + nPositions);

lines.positions.set(geometry.data, indexMap.linePosition * coordLength);
var nPositions = geometry.data.length / coordLength;
const nPositions = geometry.data.length / coordLength;
fillNumericProperties(lines, properties, indexMap.linePosition, nPositions);
lines.globalFeatureIds.fill(indexMap.feature, indexMap.linePosition, indexMap.linePosition + nPositions);
lines.featureIds.fill(indexMap.lineFeature, indexMap.linePosition, indexMap.linePosition + nPositions);
for (var i = 0, il = geometry.indices.length; i < il; ++i) {
var start = geometry.indices[i];
var end = i === il - 1 ? geometry.data.length : geometry.indices[i + 1];
for (let i = 0, il = geometry.indices.length; i < il; ++i) {
const start = geometry.indices[i];
const end = i === il - 1 ? geometry.data.length : geometry.indices[i + 1];
lines.pathIndices[indexMap.linePath++] = indexMap.linePosition;

@@ -221,23 +186,23 @@ indexMap.linePosition += (end - start) / coordLength;

polygons.positions.set(geometry.data, indexMap.polygonPosition * coordLength);
var nPositions = geometry.data.length / coordLength;
const nPositions = geometry.data.length / coordLength;
fillNumericProperties(polygons, properties, indexMap.polygonPosition, nPositions);
polygons.globalFeatureIds.fill(indexMap.feature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);
polygons.featureIds.fill(indexMap.polygonFeature, indexMap.polygonPosition, indexMap.polygonPosition + nPositions);
for (var l = 0, ll = geometry.indices.length; l < ll; ++l) {
var startPosition = indexMap.polygonPosition;
for (let l = 0, ll = geometry.indices.length; l < ll; ++l) {
const startPosition = indexMap.polygonPosition;
polygons.polygonIndices[indexMap.polygonObject++] = startPosition;
var areas = geometry.areas[l];
var indices = geometry.indices[l];
var nextIndices = geometry.indices[l + 1];
for (var i = 0, il = indices.length; i < il; ++i) {
var start = indices[i];
var end = i === il - 1 ? nextIndices === undefined ? geometry.data.length : nextIndices[0] : indices[i + 1];
const areas = geometry.areas[l];
const indices = geometry.indices[l];
const nextIndices = geometry.indices[l + 1];
for (let i = 0, il = indices.length; i < il; ++i) {
const start = indices[i];
const end = i === il - 1 ? nextIndices === undefined ? geometry.data.length : nextIndices[0] : indices[i + 1];
polygons.primitivePolygonIndices[indexMap.polygonRing++] = indexMap.polygonPosition;
indexMap.polygonPosition += (end - start) / coordLength;
}
var endPosition = indexMap.polygonPosition;
const endPosition = indexMap.polygonPosition;
triangulatePolygon(polygons, areas, indices, {
startPosition: startPosition,
endPosition: endPosition,
coordLength: coordLength
startPosition,
endPosition,
coordLength
});

@@ -247,17 +212,17 @@ }

function triangulatePolygon(polygons, areas, indices, _ref) {
var startPosition = _ref.startPosition,
endPosition = _ref.endPosition,
coordLength = _ref.coordLength;
let {
startPosition,
endPosition,
coordLength
} = _ref;
if (!polygons.triangles) {
return;
}
var start = startPosition * coordLength;
var end = endPosition * coordLength;
var polygonPositions = polygons.positions.subarray(start, end);
var offset = indices[0];
var holes = indices.slice(1).map(function (n) {
return (n - offset) / coordLength;
});
var triangles = (0, _polygon.earcut)(polygonPositions, holes, coordLength, areas);
for (var t = 0, tl = triangles.length; t < tl; ++t) {
const start = startPosition * coordLength;
const end = endPosition * coordLength;
const polygonPositions = polygons.positions.subarray(start, end);
const offset = indices[0];
const holes = indices.slice(1).map(n => (n - offset) / coordLength);
const triangles = (0, _polygon.earcut)(polygonPositions, holes, coordLength, areas);
for (let t = 0, tl = triangles.length; t < tl; ++t) {
polygons.triangles.push(startPosition + triangles[t]);

@@ -267,7 +232,7 @@ }

function wrapProps(obj, size) {
var returnObj = {};
for (var _key2 in obj) {
returnObj[_key2] = {
value: obj[_key2],
size: size
const returnObj = {};
for (const key in obj) {
returnObj[key] = {
value: obj[key],
size
};

@@ -278,4 +243,5 @@ }

function makeAccessorObjects(points, lines, polygons, coordLength) {
var binaryFeatures = {
points: _objectSpread(_objectSpread({}, points), {}, {
const binaryFeatures = {
points: {
...points,
positions: {

@@ -294,4 +260,5 @@ value: points.positions,

numericProps: wrapProps(points.numericProps, 1)
}),
lines: _objectSpread(_objectSpread({}, lines), {}, {
},
lines: {
...lines,
positions: {

@@ -314,4 +281,5 @@ value: lines.positions,

numericProps: wrapProps(lines.numericProps, 1)
}),
polygons: _objectSpread(_objectSpread({}, polygons), {}, {
},
polygons: {
...polygons,
positions: {

@@ -338,3 +306,3 @@ value: polygons.positions,

numericProps: wrapProps(polygons.numericProps, 1)
})
}
};

@@ -350,5 +318,5 @@ if (polygons.triangles) {

function fillNumericProperties(object, properties, index, length) {
for (var numericPropName in object.numericProps) {
for (const numericPropName in object.numericProps) {
if (numericPropName in properties) {
var value = properties[numericPropName];
const value = properties[numericPropName];
object.numericProps[numericPropName].fill(value, index, index + length);

@@ -359,6 +327,6 @@ }

function keepStringProperties(properties, numericKeys) {
var props = {};
for (var _key3 in properties) {
if (!numericKeys.includes(_key3)) {
props[_key3] = properties[_key3];
const props = {};
for (const key in properties) {
if (!numericKeys.includes(key)) {
props[key] = properties[key];
}

@@ -365,0 +333,0 @@ }

@@ -11,12 +11,14 @@ "use strict";

function geojsonToBinary(features) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
fixRingWinding: true,
triangulate: true
};
var geometryInfo = (0, _extractGeometryInfo.extractGeometryInfo)(features);
var coordLength = geometryInfo.coordLength;
var fixRingWinding = options.fixRingWinding;
var flatFeatures = (0, _geojsonToFlatGeojson.geojsonToFlatGeojson)(features, {
coordLength: coordLength,
fixRingWinding: fixRingWinding
const geometryInfo = (0, _extractGeometryInfo.extractGeometryInfo)(features);
const coordLength = geometryInfo.coordLength;
const {
fixRingWinding
} = options;
const flatFeatures = (0, _geojsonToFlatGeojson.geojsonToFlatGeojson)(features, {
coordLength,
fixRingWinding
});

@@ -23,0 +25,0 @@ return (0, _flatGeojsonToBinary.flatGeojsonToBinary)(flatFeatures, geometryInfo, {

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -8,23 +7,14 @@ value: true

exports.geojsonToFlatGeojson = geojsonToFlatGeojson;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _polygon = require("@math.gl/polygon");
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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; } } }; }
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); }
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; }
function geojsonToFlatGeojson(features) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
coordLength: 2,
fixRingWinding: true
};
return features.map(function (feature) {
return flattenFeature(feature, options);
});
return features.map(feature => flattenFeature(feature, options));
}
function flattenPoint(coordinates, data, indices, options) {
indices.push(data.length);
data.push.apply(data, (0, _toConsumableArray2.default)(coordinates));
for (var i = coordinates.length; i < options.coordLength; i++) {
data.push(...coordinates);
for (let i = coordinates.length; i < options.coordLength; i++) {
data.push(0);

@@ -35,44 +25,24 @@ }

indices.push(data.length);
var _iterator = _createForOfIteratorHelper(coordinates),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var c = _step.value;
data.push.apply(data, (0, _toConsumableArray2.default)(c));
for (var i = c.length; i < options.coordLength; i++) {
data.push(0);
}
for (const c of coordinates) {
data.push(...c);
for (let i = c.length; i < options.coordLength; i++) {
data.push(0);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
}
function flattenPolygon(coordinates, data, indices, areas, options) {
var count = 0;
var ringAreas = [];
var polygons = [];
var _iterator2 = _createForOfIteratorHelper(coordinates),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var lineString = _step2.value;
var lineString2d = lineString.map(function (p) {
return p.slice(0, 2);
});
var area = (0, _polygon.getPolygonSignedArea)(lineString2d.flat());
var ccw = area < 0;
if (options.fixRingWinding && (count === 0 && !ccw || count > 0 && ccw)) {
lineString.reverse();
area = -area;
}
ringAreas.push(area);
flattenLineString(lineString, data, polygons, options);
count++;
let count = 0;
const ringAreas = [];
const polygons = [];
for (const lineString of coordinates) {
const lineString2d = lineString.map(p => p.slice(0, 2));
let area = (0, _polygon.getPolygonSignedArea)(lineString2d.flat());
const ccw = area < 0;
if (options.fixRingWinding && (count === 0 && !ccw || count > 0 && ccw)) {
lineString.reverse();
area = -area;
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
ringAreas.push(area);
flattenLineString(lineString, data, polygons, options);
count++;
}

@@ -85,10 +55,12 @@ if (count > 0) {

function flattenFeature(feature, options) {
var geometry = feature.geometry;
const {
geometry
} = feature;
if (geometry.type === 'GeometryCollection') {
throw new Error('GeometryCollection type not supported');
}
var data = [];
var indices = [];
var areas;
var type;
const data = [];
const indices = [];
let areas;
let type;
switch (geometry.type) {

@@ -101,5 +73,3 @@ case 'Point':

type = 'Point';
geometry.coordinates.map(function (c) {
return flattenPoint(c, data, indices, options);
});
geometry.coordinates.map(c => flattenPoint(c, data, indices, options));
break;

@@ -112,5 +82,3 @@ case 'LineString':

type = 'LineString';
geometry.coordinates.map(function (c) {
return flattenLineString(c, data, indices, options);
});
geometry.coordinates.map(c => flattenLineString(c, data, indices, options));
break;

@@ -125,5 +93,3 @@ case 'Polygon':

areas = [];
geometry.coordinates.map(function (c) {
return flattenPolygon(c, data, indices, areas, options);
});
geometry.coordinates.map(c => flattenPolygon(c, data, indices, areas, options));
break;

@@ -133,11 +99,12 @@ default:

}
return _objectSpread(_objectSpread({}, feature), {}, {
return {
...feature,
geometry: {
type: type,
indices: indices,
data: data,
areas: areas
type,
indices,
data,
areas
}
});
};
}
//# sourceMappingURL=geojson-to-flat-geojson.js.map

@@ -8,5 +8,2 @@ "use strict";

exports.transformGeoJsonCoords = transformGeoJsonCoords;
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; } } }; }
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); }
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; }
function transformBinaryCoords(binaryFeatures, transformCoordinate) {

@@ -25,6 +22,8 @@ if (binaryFeatures.points) {

function transformBinaryGeometryPositions(binaryGeometry, fn) {
var positions = binaryGeometry.positions;
for (var i = 0; i < positions.value.length; i += positions.size) {
var _coord = Array.from(positions.value.subarray(i, i + positions.size));
var transformedCoord = fn(_coord);
const {
positions
} = binaryGeometry;
for (let i = 0; i < positions.value.length; i += positions.size) {
const coord = Array.from(positions.value.subarray(i, i + positions.size));
const transformedCoord = fn(coord);
positions.value.set(transformedCoord, i);

@@ -34,13 +33,4 @@ }

function transformGeoJsonCoords(features, fn) {
var _iterator = _createForOfIteratorHelper(features),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var feature = _step.value;
feature.geometry.coordinates = coordMap(feature.geometry.coordinates, fn);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
for (const feature of features) {
feature.geometry.coordinates = coordMap(feature.geometry.coordinates, fn);
}

@@ -53,3 +43,3 @@ return features;

}
return array.map(function (item) {
return array.map(item => {
return coordMap(item, fn);

@@ -56,0 +46,0 @@ });

{
"name": "@loaders.gl/gis",
"description": "Helpers for GIS category data",
"version": "3.4.14",
"version": "3.4.15",
"license": "MIT",

@@ -27,4 +27,4 @@ "publishConfig": {

"dependencies": {
"@loaders.gl/loader-utils": "3.4.14",
"@loaders.gl/schema": "3.4.14",
"@loaders.gl/loader-utils": "3.4.15",
"@loaders.gl/schema": "3.4.15",
"@mapbox/vector-tile": "^1.3.1",

@@ -37,3 +37,3 @@ "@math.gl/polygon": "^3.5.1",

},
"gitHead": "dffa197c6ae79bac5277d5e8a132f4cd274e74e5"
"gitHead": "19e941d5805568e449ef9092490d6568a4853298"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc