@loaders.gl/gis
Advanced tools
Comparing version 2.3.0-alpha.11 to 2.3.0-alpha.12
@@ -1,6 +0,15 @@ | ||
import {BinaryGeometryData} from '../types'; | ||
import {BinaryGeometryData, BinaryFeaturesData, BinaryGeometryType} from '../types'; | ||
/** | ||
* Binary to GeoJSON | ||
* Convert binary geometry representation to GeoJSON | ||
* | ||
* @param data geometry data in binary representation | ||
* @param {string?} type Input data type: Point, LineString, or Polygon | ||
* @param {string?} format Output format, either geometry or feature | ||
* @return GeoJSON objects | ||
*/ | ||
export function binaryToGeoJson(data: BinaryGeometryData, type?, format?): object[]; | ||
export function binaryToGeoJson( | ||
data: BinaryGeometryData | BinaryFeaturesData, | ||
type?: BinaryGeometryType, | ||
format?: 'geometry' | 'feature' | ||
): object[]; |
@@ -148,3 +148,5 @@ "use strict"; | ||
function polygonToGeoJson(data, startIndex, endIndex) { | ||
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; | ||
@@ -187,3 +189,5 @@ var polygonIndices = data.polygonIndices.value.filter(function (x) { | ||
function lineStringToGeoJson(data, startIndex, endIndex) { | ||
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; | ||
@@ -190,0 +194,0 @@ var pathIndices = data.pathIndices.value.filter(function (x) { |
@@ -1,4 +0,4 @@ | ||
import {BinaryGeometryData} from '../types'; | ||
import {BinaryFeaturesData} from '../types'; | ||
export function geojsonToBinary(features: object[], options?: object): BinaryGeometryData; | ||
export function geojsonToBinary(features: object[], options?: object): BinaryFeaturesData; | ||
export const TEST_EXPORTS: object; |
@@ -1,2 +0,2 @@ | ||
import {BinaryGeometryData} from '../types'; | ||
import {BinaryFeaturesData} from '../types'; | ||
@@ -11,5 +11,5 @@ /** | ||
export function transformBinaryCoords( | ||
binaryFeatures: BinaryGeometryData, | ||
binaryFeatures: BinaryFeaturesData, | ||
fn: (coord: number[]) => number[] | ||
): BinaryGeometryData; | ||
): BinaryFeaturesData; | ||
@@ -16,0 +16,0 @@ /** |
@@ -13,4 +13,23 @@ type TypedArray = | ||
export type BinaryAttribute = {value: TypedArray; size: number}; | ||
export type BinaryGeometryType = 'Point' | 'LineString' | 'Polygon'; | ||
type NumericProps = {[key: string]: BinaryAttribute}; | ||
type Properties = object[]; | ||
/** | ||
* Represent a single Geometry, similar to a GeoJSON Geometry | ||
*/ | ||
export type BinaryGeometryData = { | ||
positions: BinaryAttribute; | ||
pathIndices?: BinaryAttribute; | ||
polygonIndices?: BinaryAttribute; | ||
primitivePolygonIndices?: BinaryAttribute; | ||
// Can be passed separately | ||
type?: BinaryGeometryType; | ||
}; | ||
/** | ||
* Represent a collection of Features, similar to a GeoJSON FeatureCollection | ||
*/ | ||
export type BinaryFeaturesData = { | ||
points?: { | ||
@@ -20,2 +39,4 @@ positions: BinaryAttribute; | ||
globalFeatureIds: BinaryAttribute; | ||
numericProps: NumericProps; | ||
properties: Properties; | ||
}; | ||
@@ -27,2 +48,4 @@ lines?: { | ||
globalFeatureIds: BinaryAttribute; | ||
numericProps: NumericProps; | ||
properties: Properties; | ||
}; | ||
@@ -35,3 +58,5 @@ polygons?: { | ||
globalFeatureIds: BinaryAttribute; | ||
numericProps: NumericProps; | ||
properties: Properties; | ||
}; | ||
}; |
@@ -1,6 +0,15 @@ | ||
import {BinaryGeometryData} from '../types'; | ||
import {BinaryGeometryData, BinaryFeaturesData, BinaryGeometryType} from '../types'; | ||
/** | ||
* Binary to GeoJSON | ||
* Convert binary geometry representation to GeoJSON | ||
* | ||
* @param data geometry data in binary representation | ||
* @param {string?} type Input data type: Point, LineString, or Polygon | ||
* @param {string?} format Output format, either geometry or feature | ||
* @return GeoJSON objects | ||
*/ | ||
export function binaryToGeoJson(data: BinaryGeometryData, type?, format?): object[]; | ||
export function binaryToGeoJson( | ||
data: BinaryGeometryData | BinaryFeaturesData, | ||
type?: BinaryGeometryType, | ||
format?: 'geometry' | 'feature' | ||
): object[]; |
@@ -125,3 +125,3 @@ export function binaryToGeoJson(data, type, format) { | ||
function polygonToGeoJson(data, startIndex, endIndex) { | ||
function polygonToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) { | ||
const { | ||
@@ -162,3 +162,3 @@ positions | ||
function lineStringToGeoJson(data, startIndex, endIndex) { | ||
function lineStringToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) { | ||
const { | ||
@@ -165,0 +165,0 @@ positions |
@@ -1,4 +0,4 @@ | ||
import {BinaryGeometryData} from '../types'; | ||
import {BinaryFeaturesData} from '../types'; | ||
export function geojsonToBinary(features: object[], options?: object): BinaryGeometryData; | ||
export function geojsonToBinary(features: object[], options?: object): BinaryFeaturesData; | ||
export const TEST_EXPORTS: object; |
@@ -1,2 +0,2 @@ | ||
import {BinaryGeometryData} from '../types'; | ||
import {BinaryFeaturesData} from '../types'; | ||
@@ -11,5 +11,5 @@ /** | ||
export function transformBinaryCoords( | ||
binaryFeatures: BinaryGeometryData, | ||
binaryFeatures: BinaryFeaturesData, | ||
fn: (coord: number[]) => number[] | ||
): BinaryGeometryData; | ||
): BinaryFeaturesData; | ||
@@ -16,0 +16,0 @@ /** |
@@ -13,4 +13,23 @@ type TypedArray = | ||
export type BinaryAttribute = {value: TypedArray; size: number}; | ||
export type BinaryGeometryType = 'Point' | 'LineString' | 'Polygon'; | ||
type NumericProps = {[key: string]: BinaryAttribute}; | ||
type Properties = object[]; | ||
/** | ||
* Represent a single Geometry, similar to a GeoJSON Geometry | ||
*/ | ||
export type BinaryGeometryData = { | ||
positions: BinaryAttribute; | ||
pathIndices?: BinaryAttribute; | ||
polygonIndices?: BinaryAttribute; | ||
primitivePolygonIndices?: BinaryAttribute; | ||
// Can be passed separately | ||
type?: BinaryGeometryType; | ||
}; | ||
/** | ||
* Represent a collection of Features, similar to a GeoJSON FeatureCollection | ||
*/ | ||
export type BinaryFeaturesData = { | ||
points?: { | ||
@@ -20,2 +39,4 @@ positions: BinaryAttribute; | ||
globalFeatureIds: BinaryAttribute; | ||
numericProps: NumericProps; | ||
properties: Properties; | ||
}; | ||
@@ -27,2 +48,4 @@ lines?: { | ||
globalFeatureIds: BinaryAttribute; | ||
numericProps: NumericProps; | ||
properties: Properties; | ||
}; | ||
@@ -35,3 +58,5 @@ polygons?: { | ||
globalFeatureIds: BinaryAttribute; | ||
numericProps: NumericProps; | ||
properties: Properties; | ||
}; | ||
}; |
@@ -1,6 +0,15 @@ | ||
import {BinaryGeometryData} from '../types'; | ||
import {BinaryGeometryData, BinaryFeaturesData, BinaryGeometryType} from '../types'; | ||
/** | ||
* Binary to GeoJSON | ||
* Convert binary geometry representation to GeoJSON | ||
* | ||
* @param data geometry data in binary representation | ||
* @param {string?} type Input data type: Point, LineString, or Polygon | ||
* @param {string?} format Output format, either geometry or feature | ||
* @return GeoJSON objects | ||
*/ | ||
export function binaryToGeoJson(data: BinaryGeometryData, type?, format?): object[]; | ||
export function binaryToGeoJson( | ||
data: BinaryGeometryData | BinaryFeaturesData, | ||
type?: BinaryGeometryType, | ||
format?: 'geometry' | 'feature' | ||
): object[]; |
@@ -141,3 +141,5 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { 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 = o[Symbol.iterator](); }, 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 polygonToGeoJson(data, startIndex, endIndex) { | ||
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; | ||
@@ -180,3 +182,5 @@ var polygonIndices = data.polygonIndices.value.filter(function (x) { | ||
function lineStringToGeoJson(data, startIndex, endIndex) { | ||
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; | ||
@@ -183,0 +187,0 @@ var pathIndices = data.pathIndices.value.filter(function (x) { |
@@ -1,4 +0,4 @@ | ||
import {BinaryGeometryData} from '../types'; | ||
import {BinaryFeaturesData} from '../types'; | ||
export function geojsonToBinary(features: object[], options?: object): BinaryGeometryData; | ||
export function geojsonToBinary(features: object[], options?: object): BinaryFeaturesData; | ||
export const TEST_EXPORTS: object; |
@@ -1,2 +0,2 @@ | ||
import {BinaryGeometryData} from '../types'; | ||
import {BinaryFeaturesData} from '../types'; | ||
@@ -11,5 +11,5 @@ /** | ||
export function transformBinaryCoords( | ||
binaryFeatures: BinaryGeometryData, | ||
binaryFeatures: BinaryFeaturesData, | ||
fn: (coord: number[]) => number[] | ||
): BinaryGeometryData; | ||
): BinaryFeaturesData; | ||
@@ -16,0 +16,0 @@ /** |
@@ -13,4 +13,23 @@ type TypedArray = | ||
export type BinaryAttribute = {value: TypedArray; size: number}; | ||
export type BinaryGeometryType = 'Point' | 'LineString' | 'Polygon'; | ||
type NumericProps = {[key: string]: BinaryAttribute}; | ||
type Properties = object[]; | ||
/** | ||
* Represent a single Geometry, similar to a GeoJSON Geometry | ||
*/ | ||
export type BinaryGeometryData = { | ||
positions: BinaryAttribute; | ||
pathIndices?: BinaryAttribute; | ||
polygonIndices?: BinaryAttribute; | ||
primitivePolygonIndices?: BinaryAttribute; | ||
// Can be passed separately | ||
type?: BinaryGeometryType; | ||
}; | ||
/** | ||
* Represent a collection of Features, similar to a GeoJSON FeatureCollection | ||
*/ | ||
export type BinaryFeaturesData = { | ||
points?: { | ||
@@ -20,2 +39,4 @@ positions: BinaryAttribute; | ||
globalFeatureIds: BinaryAttribute; | ||
numericProps: NumericProps; | ||
properties: Properties; | ||
}; | ||
@@ -27,2 +48,4 @@ lines?: { | ||
globalFeatureIds: BinaryAttribute; | ||
numericProps: NumericProps; | ||
properties: Properties; | ||
}; | ||
@@ -35,3 +58,5 @@ polygons?: { | ||
globalFeatureIds: BinaryAttribute; | ||
numericProps: NumericProps; | ||
properties: Properties; | ||
}; | ||
}; |
{ | ||
"name": "@loaders.gl/gis", | ||
"description": "Helpers for GIS category data", | ||
"version": "2.3.0-alpha.11", | ||
"version": "2.3.0-alpha.12", | ||
"license": "MIT", | ||
@@ -28,3 +28,3 @@ "publishConfig": { | ||
"dependencies": { | ||
"@loaders.gl/loader-utils": "2.3.0-alpha.11", | ||
"@loaders.gl/loader-utils": "2.3.0-alpha.12", | ||
"@mapbox/vector-tile": "^1.3.1", | ||
@@ -36,3 +36,3 @@ "pbf": "^3.2.1" | ||
}, | ||
"gitHead": "b7dd32a44ae80a431b684e8de1afba050e90249a" | ||
"gitHead": "e404a6e9a313124ec9c2d918e5038843cc977c1e" | ||
} |
@@ -1,6 +0,15 @@ | ||
import {BinaryGeometryData} from '../types'; | ||
import {BinaryGeometryData, BinaryFeaturesData, BinaryGeometryType} from '../types'; | ||
/** | ||
* Binary to GeoJSON | ||
* Convert binary geometry representation to GeoJSON | ||
* | ||
* @param data geometry data in binary representation | ||
* @param {string?} type Input data type: Point, LineString, or Polygon | ||
* @param {string?} format Output format, either geometry or feature | ||
* @return GeoJSON objects | ||
*/ | ||
export function binaryToGeoJson(data: BinaryGeometryData, type?, format?): object[]; | ||
export function binaryToGeoJson( | ||
data: BinaryGeometryData | BinaryFeaturesData, | ||
type?: BinaryGeometryType, | ||
format?: 'geometry' | 'feature' | ||
): object[]; |
@@ -1,2 +0,1 @@ | ||
// Top-level function to convert input of binary arrays to GeoJSON | ||
export function binaryToGeoJson(data, type, format) { | ||
@@ -63,3 +62,3 @@ if (format === 'geometry') { | ||
// Parse input binary data and return an array of GeoJSON Features | ||
/** Parse input binary data and return an array of GeoJSON Features */ | ||
function parseFeatureCollection(dataArray) { | ||
@@ -90,3 +89,3 @@ const features = []; | ||
// Parse input binary data and return a single GeoJSON Feature | ||
/** Parse input binary data and return a single GeoJSON Feature */ | ||
function parseFeature(data, startIndex, endIndex) { | ||
@@ -98,3 +97,3 @@ const geometry = parseGeometry(data, startIndex, endIndex); | ||
// Parse input binary data and return an object of properties | ||
/** Parse input binary data and return an object of properties */ | ||
function parseProperties(data, startIndex, endIndex) { | ||
@@ -108,3 +107,3 @@ const properties = Object.assign(data.properties[data.featureIds.value[startIndex]]); | ||
// Parse input binary data and return a valid GeoJSON geometry object | ||
/** Parse input binary data and return a valid GeoJSON geometry object */ | ||
function parseGeometry(data, startIndex, endIndex) { | ||
@@ -123,4 +122,4 @@ switch (data.type) { | ||
// Parse binary data of type Polygon | ||
function polygonToGeoJson(data, startIndex, endIndex) { | ||
/** Parse binary data of type Polygon */ | ||
function polygonToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) { | ||
const {positions} = data; | ||
@@ -158,4 +157,4 @@ const polygonIndices = data.polygonIndices.value.filter(x => x >= startIndex && x <= endIndex); | ||
// Parse binary data of type LineString | ||
function lineStringToGeoJson(data, startIndex, endIndex) { | ||
/** Parse binary data of type LineString */ | ||
function lineStringToGeoJson(data, startIndex = -Infinity, endIndex = Infinity) { | ||
const {positions} = data; | ||
@@ -179,3 +178,3 @@ const pathIndices = data.pathIndices.value.filter(x => x >= startIndex && x <= endIndex); | ||
// Parse binary data of type Point | ||
/** Parse binary data of type Point */ | ||
function pointToGeoJson(data, startIndex, endIndex) { | ||
@@ -193,3 +192,10 @@ const {positions} = data; | ||
// Parse a linear ring of positions to a GeoJSON linear ring | ||
/** | ||
* Parse a linear ring of positions to a GeoJSON linear ring | ||
* | ||
* @param positions Positions TypedArray | ||
* @param {number?} startIndex Start index to include in ring | ||
* @param {number?} endIndex End index to include in ring | ||
* @return {number[][]} GeoJSON ring | ||
*/ | ||
function ringToGeoJson(positions, startIndex, endIndex) { | ||
@@ -196,0 +202,0 @@ startIndex = startIndex || 0; |
@@ -1,4 +0,4 @@ | ||
import {BinaryGeometryData} from '../types'; | ||
import {BinaryFeaturesData} from '../types'; | ||
export function geojsonToBinary(features: object[], options?: object): BinaryGeometryData; | ||
export function geojsonToBinary(features: object[], options?: object): BinaryFeaturesData; | ||
export const TEST_EXPORTS: object; |
@@ -1,2 +0,2 @@ | ||
import {BinaryGeometryData} from '../types'; | ||
import {BinaryFeaturesData} from '../types'; | ||
@@ -11,5 +11,5 @@ /** | ||
export function transformBinaryCoords( | ||
binaryFeatures: BinaryGeometryData, | ||
binaryFeatures: BinaryFeaturesData, | ||
fn: (coord: number[]) => number[] | ||
): BinaryGeometryData; | ||
): BinaryFeaturesData; | ||
@@ -16,0 +16,0 @@ /** |
@@ -13,4 +13,23 @@ type TypedArray = | ||
export type BinaryAttribute = {value: TypedArray; size: number}; | ||
export type BinaryGeometryType = 'Point' | 'LineString' | 'Polygon'; | ||
type NumericProps = {[key: string]: BinaryAttribute}; | ||
type Properties = object[]; | ||
/** | ||
* Represent a single Geometry, similar to a GeoJSON Geometry | ||
*/ | ||
export type BinaryGeometryData = { | ||
positions: BinaryAttribute; | ||
pathIndices?: BinaryAttribute; | ||
polygonIndices?: BinaryAttribute; | ||
primitivePolygonIndices?: BinaryAttribute; | ||
// Can be passed separately | ||
type?: BinaryGeometryType; | ||
}; | ||
/** | ||
* Represent a collection of Features, similar to a GeoJSON FeatureCollection | ||
*/ | ||
export type BinaryFeaturesData = { | ||
points?: { | ||
@@ -20,2 +39,4 @@ positions: BinaryAttribute; | ||
globalFeatureIds: BinaryAttribute; | ||
numericProps: NumericProps; | ||
properties: Properties; | ||
}; | ||
@@ -27,2 +48,4 @@ lines?: { | ||
globalFeatureIds: BinaryAttribute; | ||
numericProps: NumericProps; | ||
properties: Properties; | ||
}; | ||
@@ -35,3 +58,5 @@ polygons?: { | ||
globalFeatureIds: BinaryAttribute; | ||
numericProps: NumericProps; | ||
properties: Properties; | ||
}; | ||
}; |
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
267622
3123
+ Added@loaders.gl/loader-utils@2.3.0-alpha.12(transitive)
- Removed@loaders.gl/loader-utils@2.3.0-alpha.11(transitive)