@loaders.gl/flatgeobuf 4.2.0-alpha.3 → 4.2.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +286 -241
- package/dist/dist.min.js +30 -0
- package/dist/flatgeobuf/3.27.2/column-meta.d.ts +1 -1
- package/dist/flatgeobuf/3.27.2/column-meta.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/column-meta.js +1 -2
- package/dist/flatgeobuf/3.27.2/config.js +16 -13
- package/dist/flatgeobuf/3.27.2/constants.js +3 -2
- package/dist/flatgeobuf/3.27.2/crs-meta.js +1 -2
- package/dist/flatgeobuf/3.27.2/dumptree.js +28 -23
- package/dist/flatgeobuf/3.27.2/feature.d.ts +1 -1
- package/dist/flatgeobuf/3.27.2/feature.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/feature.js +2 -3
- package/dist/flatgeobuf/3.27.2/flat-geobuf/column-type.js +19 -19
- package/dist/flatgeobuf/3.27.2/flat-geobuf/column.d.ts +1 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/column.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/column.js +117 -117
- package/dist/flatgeobuf/3.27.2/flat-geobuf/crs.js +76 -76
- package/dist/flatgeobuf/3.27.2/flat-geobuf/feature.d.ts +2 -2
- package/dist/flatgeobuf/3.27.2/flat-geobuf/feature.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/feature.js +96 -90
- package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry-type.js +22 -22
- package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry.d.ts +1 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry.js +224 -210
- package/dist/flatgeobuf/3.27.2/flat-geobuf/header.d.ts +3 -3
- package/dist/flatgeobuf/3.27.2/flat-geobuf/header.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/header.js +166 -160
- package/dist/flatgeobuf/3.27.2/flat-geobuf.d.ts +5 -5
- package/dist/flatgeobuf/3.27.2/flat-geobuf.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf.js +1 -1
- package/dist/flatgeobuf/3.27.2/generic/feature.d.ts +4 -4
- package/dist/flatgeobuf/3.27.2/generic/feature.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/generic/feature.js +195 -205
- package/dist/flatgeobuf/3.27.2/generic/featurecollection.d.ts +6 -6
- package/dist/flatgeobuf/3.27.2/generic/featurecollection.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/generic/featurecollection.js +150 -128
- package/dist/flatgeobuf/3.27.2/generic/geometry.d.ts +2 -2
- package/dist/flatgeobuf/3.27.2/generic/geometry.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/generic/geometry.js +78 -66
- package/dist/flatgeobuf/3.27.2/generic/header.d.ts +3 -3
- package/dist/flatgeobuf/3.27.2/generic/header.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/generic/header.js +18 -18
- package/dist/flatgeobuf/3.27.2/generic/index.d.ts +4 -4
- package/dist/flatgeobuf/3.27.2/generic/index.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/generic/index.js +2 -1
- package/dist/flatgeobuf/3.27.2/generic.d.ts +7 -7
- package/dist/flatgeobuf/3.27.2/generic.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/generic.js +11 -3
- package/dist/flatgeobuf/3.27.2/geojson/feature.d.ts +3 -3
- package/dist/flatgeobuf/3.27.2/geojson/feature.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/geojson/feature.js +8 -9
- package/dist/flatgeobuf/3.27.2/geojson/featurecollection.d.ts +2 -2
- package/dist/flatgeobuf/3.27.2/geojson/featurecollection.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/geojson/featurecollection.js +40 -38
- package/dist/flatgeobuf/3.27.2/geojson/geometry.d.ts +3 -3
- package/dist/flatgeobuf/3.27.2/geojson/geometry.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/geojson/geometry.js +107 -103
- package/dist/flatgeobuf/3.27.2/geojson/index.d.ts +3 -3
- package/dist/flatgeobuf/3.27.2/geojson/index.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/geojson/index.js +2 -1
- package/dist/flatgeobuf/3.27.2/geojson.d.ts +3 -3
- package/dist/flatgeobuf/3.27.2/geojson.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/geojson.js +17 -5
- package/dist/flatgeobuf/3.27.2/header-meta.d.ts +3 -3
- package/dist/flatgeobuf/3.27.2/header-meta.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/header-meta.js +46 -43
- package/dist/flatgeobuf/3.27.2/header.d.ts +1 -1
- package/dist/flatgeobuf/3.27.2/header.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/header.js +2 -3
- package/dist/flatgeobuf/3.27.2/http-reader.d.ts +3 -3
- package/dist/flatgeobuf/3.27.2/http-reader.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/http-reader.js +235 -171
- package/dist/flatgeobuf/3.27.2/index.d.ts +13 -13
- package/dist/flatgeobuf/3.27.2/index.d.ts.map +1 -1
- package/dist/flatgeobuf/3.27.2/index.js +5 -13
- package/dist/flatgeobuf/3.27.2/logger.js +37 -56
- package/dist/flatgeobuf/3.27.2/packedrtree.js +174 -123
- package/dist/flatgeobuf/3.27.2/streams/utils.js +59 -58
- package/dist/flatgeobuf-loader.js +29 -23
- package/dist/flatgeobuf-worker.js +1 -1
- package/dist/index.cjs +175 -199
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/binary-geometries.js +115 -117
- package/dist/lib/get-schema-from-fgb-header.js +110 -85
- package/dist/lib/parse-flatgeobuf.d.ts +1 -1
- package/dist/lib/parse-flatgeobuf.d.ts.map +1 -1
- package/dist/lib/parse-flatgeobuf.js +125 -109
- package/dist/workers/flatgeobuf-worker.js +3 -1
- package/package.json +10 -6
- package/src/flatgeobuf/3.27.2/.DS_Store +0 -0
- package/dist/LICENSE +0 -9
- package/dist/flatgeobuf/3.27.2/LICENSE +0 -29
- package/dist/flatgeobuf/3.27.2/README.md +0 -45
- package/dist/flatgeobuf/3.27.2/column-meta.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/config.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/constants.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/crs-meta.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/dumptree.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/feature.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/column-type.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/column.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/crs.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/feature.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry-type.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/geometry.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf/header.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/flat-geobuf.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/generic/feature.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/generic/featurecollection.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/generic/geometry.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/generic/header.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/generic/index.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/generic.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/geojson/feature.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/geojson/featurecollection.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/geojson/geometry.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/geojson/index.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/geojson.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/header-meta.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/header.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/http-reader.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/index.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/logger.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/packedrtree.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/streams/utils.js.map +0 -1
- package/dist/flatgeobuf/3.27.2/types/jsts.d.ts +0 -23
- package/dist/flatgeobuf/3.27.2/types/slice.d.ts +0 -16
- package/dist/flatgeobuf-loader.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/binary-geometries.js.map +0 -1
- package/dist/lib/get-schema-from-fgb-header.js.map +0 -1
- package/dist/lib/parse-flatgeobuf.js.map +0 -1
- package/dist/workers/flatgeobuf-worker.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../../src/flatgeobuf/3.27.2/geojson/feature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../../src/flatgeobuf/3.27.2/geojson/feature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,kCAA+B;AAE/C,OAAO,UAAU,0BAAuB;AAExC,OAAO,EAAC,QAAQ,EAAkB,8BAA2B;AAE7D,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,SAAS,CAAC;AAElD,MAAM,WAAW,eAAgB,SAAQ,QAAQ,EAAE,cAAc;CAAG;AAEpE,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,GAAG,eAAe,CASjF"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { fromGeometry } from "./geometry.js";
|
|
2
2
|
import { parseProperties } from "../generic/feature.js";
|
|
3
3
|
export function fromFeature(feature, header) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
const columns = header.columns;
|
|
5
|
+
const geometry = fromGeometry(feature.geometry(), header.geometryType);
|
|
6
|
+
const geoJsonfeature = {
|
|
7
|
+
type: 'Feature',
|
|
8
|
+
geometry,
|
|
9
|
+
properties: parseProperties(feature, columns)
|
|
10
|
+
};
|
|
11
|
+
return geoJsonfeature;
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=feature.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Rect } from
|
|
2
|
-
import { HeaderMetaFn } from
|
|
1
|
+
import { Rect } from "../packedrtree.js";
|
|
2
|
+
import { HeaderMetaFn } from "../generic.js";
|
|
3
3
|
import { FeatureCollection as GeoJsonFeatureCollection } from 'geojson';
|
|
4
4
|
export declare function serialize(featurecollection: GeoJsonFeatureCollection): Uint8Array;
|
|
5
5
|
export declare function deserialize(bytes: Uint8Array, headerMetaFn?: HeaderMetaFn): GeoJsonFeatureCollection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featurecollection.d.ts","sourceRoot":"","sources":["../../../../src/flatgeobuf/3.27.2/geojson/featurecollection.ts"],"names":[],"mappings":"AAYA,OAAO,EAAC,IAAI,EAAC,
|
|
1
|
+
{"version":3,"file":"featurecollection.d.ts","sourceRoot":"","sources":["../../../../src/flatgeobuf/3.27.2/geojson/featurecollection.ts"],"names":[],"mappings":"AAYA,OAAO,EAAC,IAAI,EAAC,0BAAuB;AAEpC,OAAO,EAAC,YAAY,EAAC,sBAAmB;AAIxC,OAAO,EACL,iBAAiB,IAAI,wBAAwB,EAQ9C,MAAM,SAAS,CAAC;AAEjB,wBAAgB,SAAS,CAAC,iBAAiB,EAAE,wBAAwB,GAAG,UAAU,CAsBjF;AAED,wBAAgB,WAAW,CACzB,KAAK,EAAE,UAAU,EACjB,YAAY,CAAC,EAAE,YAAY,GAC1B,wBAAwB,CAM1B;AAED,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,cAAc,EACtB,YAAY,CAAC,EAAE,YAAY,GAC1B,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAEpC;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,IAAI,EACV,YAAY,CAAC,EAAE,YAAY,GAC1B,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAEpC"}
|
|
@@ -5,50 +5,52 @@ import { buildFeature } from "../generic/feature.js";
|
|
|
5
5
|
import { magicbytes } from "../constants.js";
|
|
6
6
|
import { inferGeometryType } from "../generic/header.js";
|
|
7
7
|
export function serialize(featurecollection) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
const headerMeta = introspectHeaderMeta(featurecollection);
|
|
9
|
+
const header = buildHeader(headerMeta);
|
|
10
|
+
const features = featurecollection.features.map((f) => buildFeature(f.geometry.type === 'GeometryCollection'
|
|
11
|
+
? parseGC(f.geometry)
|
|
12
|
+
: parseGeometry(f.geometry), f.properties, headerMeta));
|
|
13
|
+
const featuresLength = features.map((f) => f.length).reduce((a, b) => a + b);
|
|
14
|
+
const uint8 = new Uint8Array(magicbytes.length + header.length + featuresLength);
|
|
15
|
+
uint8.set(header, magicbytes.length);
|
|
16
|
+
let offset = magicbytes.length + header.length;
|
|
17
|
+
for (const feature of features) {
|
|
18
|
+
uint8.set(feature, offset);
|
|
19
|
+
offset += feature.length;
|
|
20
|
+
}
|
|
21
|
+
uint8.set(magicbytes);
|
|
22
|
+
return uint8;
|
|
21
23
|
}
|
|
22
24
|
export function deserialize(bytes, headerMetaFn) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const features = genericDeserialize(bytes, fromFeature, headerMetaFn);
|
|
26
|
+
return {
|
|
27
|
+
type: 'FeatureCollection',
|
|
28
|
+
features
|
|
29
|
+
};
|
|
28
30
|
}
|
|
29
31
|
export function deserializeStream(stream, headerMetaFn) {
|
|
30
|
-
|
|
32
|
+
return genericDeserializeStream(stream, fromFeature, headerMetaFn);
|
|
31
33
|
}
|
|
32
34
|
export function deserializeFiltered(url, rect, headerMetaFn) {
|
|
33
|
-
|
|
35
|
+
return genericDeserializeFiltered(url, rect, fromFeature, headerMetaFn);
|
|
34
36
|
}
|
|
35
37
|
function introspectHeaderMeta(featurecollection) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
38
|
+
const feature = featurecollection.features[0];
|
|
39
|
+
const properties = feature.properties;
|
|
40
|
+
let columns = null;
|
|
41
|
+
if (properties)
|
|
42
|
+
columns = Object.keys(properties).map((k) => mapColumn(properties, k));
|
|
43
|
+
const geometryType = inferGeometryType(featurecollection.features);
|
|
44
|
+
const headerMeta = {
|
|
45
|
+
geometryType,
|
|
46
|
+
columns,
|
|
47
|
+
envelope: null,
|
|
48
|
+
featuresCount: featurecollection.features.length,
|
|
49
|
+
indexNodeSize: 0,
|
|
50
|
+
crs: null,
|
|
51
|
+
title: null,
|
|
52
|
+
description: null,
|
|
53
|
+
metadata: null
|
|
54
|
+
};
|
|
55
|
+
return headerMeta;
|
|
53
56
|
}
|
|
54
|
-
//# sourceMappingURL=featurecollection.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { GeometryType } from
|
|
2
|
-
import { Geometry } from
|
|
1
|
+
import { GeometryType } from "../flat-geobuf/geometry-type.js";
|
|
2
|
+
import { Geometry } from "../flat-geobuf/geometry.js";
|
|
3
3
|
import { Geometry as GeoJsonGeometry, Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection } from 'geojson';
|
|
4
|
-
import { IParsedGeometry } from
|
|
4
|
+
import { IParsedGeometry } from "../generic/geometry.js";
|
|
5
5
|
export interface IGeoJsonGeometry {
|
|
6
6
|
type: string;
|
|
7
7
|
coordinates: number[] | number[][] | number[][][] | number[][][][];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../../../src/flatgeobuf/3.27.2/geojson/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../../../src/flatgeobuf/3.27.2/geojson/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,wCAAqC;AAC1D,OAAO,EAAC,QAAQ,EAAC,mCAAgC;AAEjD,OAAO,EACL,QAAQ,IAAI,eAAe,EAC3B,KAAK,EACL,UAAU,EACV,UAAU,EACV,eAAe,EACf,OAAO,EACP,YAAY,EACZ,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAC,eAAe,EAA4C,+BAA4B;AAE/F,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC;IACnE,UAAU,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACjC;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,eAAe,GAAG,OAAO,GAAG,YAAY,GACnF,eAAe,CAwCjB;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,kBAAkB,GAAG,eAAe,CAYrE;AAiCD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,GAAG,eAAe,CA8B1F"}
|
|
@@ -1,118 +1,122 @@
|
|
|
1
1
|
import { GeometryType } from "../flat-geobuf/geometry-type.js";
|
|
2
2
|
import { flat, pairFlatCoordinates, toGeometryType } from "../generic/geometry.js";
|
|
3
3
|
export function parseGeometry(geometry) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
4
|
+
const cs = geometry.coordinates;
|
|
5
|
+
const xy = [];
|
|
6
|
+
const z = [];
|
|
7
|
+
let ends;
|
|
8
|
+
let parts;
|
|
9
|
+
const type = toGeometryType(geometry.type);
|
|
10
|
+
let end = 0;
|
|
11
|
+
switch (geometry.type) {
|
|
12
|
+
case 'Point':
|
|
13
|
+
flat(cs, xy, z);
|
|
14
|
+
break;
|
|
15
|
+
case 'MultiPoint':
|
|
16
|
+
case 'LineString':
|
|
17
|
+
flat(cs, xy, z);
|
|
18
|
+
break;
|
|
19
|
+
case 'MultiLineString':
|
|
20
|
+
case 'Polygon': {
|
|
21
|
+
const css = cs;
|
|
22
|
+
flat(css, xy, z);
|
|
23
|
+
if (css.length > 1)
|
|
24
|
+
ends = css.map((c) => (end += c.length));
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
case 'MultiPolygon': {
|
|
28
|
+
const csss = cs;
|
|
29
|
+
const geometries = csss.map((coordinates) => ({
|
|
30
|
+
type: 'Polygon',
|
|
31
|
+
coordinates
|
|
32
|
+
}));
|
|
33
|
+
parts = geometries.map(parseGeometry);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
xy,
|
|
39
|
+
z: z.length > 0 ? z : undefined,
|
|
40
|
+
ends,
|
|
41
|
+
type,
|
|
42
|
+
parts
|
|
43
|
+
};
|
|
45
44
|
}
|
|
46
45
|
export function parseGC(geometry) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
const type = toGeometryType(geometry.type);
|
|
47
|
+
const parts = [];
|
|
48
|
+
for (let i = 0; i < geometry.geometries.length; i++) {
|
|
49
|
+
const g = geometry.geometries[i];
|
|
50
|
+
if (g.type === 'GeometryCollection')
|
|
51
|
+
parts.push(parseGC(g));
|
|
52
|
+
else
|
|
53
|
+
parts.push(parseGeometry(g));
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
type,
|
|
57
|
+
parts
|
|
58
|
+
};
|
|
57
59
|
}
|
|
58
60
|
function extractParts(xy, z, ends) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
if (!ends || ends.length === 0)
|
|
62
|
+
return [pairFlatCoordinates(xy, z)];
|
|
63
|
+
let s = 0;
|
|
64
|
+
const xySlices = Array.from(ends).map((e) => xy.slice(s, (s = e << 1)));
|
|
65
|
+
let zSlices;
|
|
66
|
+
if (z) {
|
|
67
|
+
s = 0;
|
|
68
|
+
zSlices = Array.from(ends).map((e) => z.slice(s, (s = e)));
|
|
69
|
+
}
|
|
70
|
+
return xySlices.map((xy, i) => pairFlatCoordinates(xy, zSlices ? zSlices[i] : undefined));
|
|
68
71
|
}
|
|
69
72
|
function toGeoJsonCoordinates(geometry, type) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
73
|
+
const xy = geometry.xyArray();
|
|
74
|
+
const z = geometry.zArray();
|
|
75
|
+
switch (type) {
|
|
76
|
+
case GeometryType.Point: {
|
|
77
|
+
const a = Array.from(xy);
|
|
78
|
+
if (z)
|
|
79
|
+
a.push(z[0]);
|
|
80
|
+
return a;
|
|
81
|
+
}
|
|
82
|
+
case GeometryType.MultiPoint:
|
|
83
|
+
case GeometryType.LineString:
|
|
84
|
+
return pairFlatCoordinates(xy, z);
|
|
85
|
+
case GeometryType.MultiLineString:
|
|
86
|
+
return extractParts(xy, z, geometry.endsArray());
|
|
87
|
+
case GeometryType.Polygon:
|
|
88
|
+
return extractParts(xy, z, geometry.endsArray());
|
|
89
|
+
}
|
|
87
90
|
}
|
|
88
91
|
export function fromGeometry(geometry, headerType) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
if (type === GeometryType.GeometryCollection) {
|
|
94
|
-
const geometries = [];
|
|
95
|
-
for (let i = 0; i < geometry.partsLength(); i++) {
|
|
96
|
-
const part = geometry.parts(i);
|
|
97
|
-
const partType = part.type();
|
|
98
|
-
geometries.push(fromGeometry(part, partType));
|
|
92
|
+
let type = headerType;
|
|
93
|
+
if (type === GeometryType.Unknown) {
|
|
94
|
+
type = geometry.type();
|
|
99
95
|
}
|
|
96
|
+
if (type === GeometryType.GeometryCollection) {
|
|
97
|
+
const geometries = [];
|
|
98
|
+
for (let i = 0; i < geometry.partsLength(); i++) {
|
|
99
|
+
const part = geometry.parts(i);
|
|
100
|
+
const partType = part.type();
|
|
101
|
+
geometries.push(fromGeometry(part, partType));
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
type: GeometryType[type],
|
|
105
|
+
geometries
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
else if (type === GeometryType.MultiPolygon) {
|
|
109
|
+
const geometries = [];
|
|
110
|
+
for (let i = 0; i < geometry.partsLength(); i++)
|
|
111
|
+
geometries.push(fromGeometry(geometry.parts(i), GeometryType.Polygon));
|
|
112
|
+
return {
|
|
113
|
+
type: GeometryType[type],
|
|
114
|
+
coordinates: geometries.map((g) => g.coordinates)
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const coordinates = toGeoJsonCoordinates(geometry, type);
|
|
100
118
|
return {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
};
|
|
104
|
-
} else if (type === GeometryType.MultiPolygon) {
|
|
105
|
-
const geometries = [];
|
|
106
|
-
for (let i = 0; i < geometry.partsLength(); i++) geometries.push(fromGeometry(geometry.parts(i), GeometryType.Polygon));
|
|
107
|
-
return {
|
|
108
|
-
type: GeometryType[type],
|
|
109
|
-
coordinates: geometries.map(g => g.coordinates)
|
|
119
|
+
type: GeometryType[type],
|
|
120
|
+
coordinates
|
|
110
121
|
};
|
|
111
|
-
}
|
|
112
|
-
const coordinates = toGeoJsonCoordinates(geometry, type);
|
|
113
|
-
return {
|
|
114
|
-
type: GeometryType[type],
|
|
115
|
-
coordinates
|
|
116
|
-
};
|
|
117
122
|
}
|
|
118
|
-
//# sourceMappingURL=geometry.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./feature.js";
|
|
2
|
+
export * from "./featurecollection.js";
|
|
3
|
+
export * from "./geometry.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/flatgeobuf/3.27.2/geojson/index.ts"],"names":[],"mappings":"AAGA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/flatgeobuf/3.27.2/geojson/index.ts"],"names":[],"mappings":"AAGA,6BAA0B;AAC1B,uCAAoC;AACpC,8BAA2B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FeatureCollection as GeoJsonFeatureCollection } from 'geojson';
|
|
2
|
-
import { Rect } from
|
|
3
|
-
import { IGeoJsonFeature } from
|
|
4
|
-
import { HeaderMetaFn } from
|
|
2
|
+
import { Rect } from "./packedrtree.js";
|
|
3
|
+
import { IGeoJsonFeature } from "./geojson/feature.js";
|
|
4
|
+
import { HeaderMetaFn } from "./generic.js";
|
|
5
5
|
/**
|
|
6
6
|
* Serialize GeoJSON to FlatGeobuf
|
|
7
7
|
* @param geojson GeoJSON object to serialize
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geojson.d.ts","sourceRoot":"","sources":["../../../src/flatgeobuf/3.27.2/geojson.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,iBAAiB,IAAI,wBAAwB,EAAC,MAAM,SAAS,CAAC;AAEtE,OAAO,EAAC,IAAI,EAAC,
|
|
1
|
+
{"version":3,"file":"geojson.d.ts","sourceRoot":"","sources":["../../../src/flatgeobuf/3.27.2/geojson.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,iBAAiB,IAAI,wBAAwB,EAAC,MAAM,SAAS,CAAC;AAEtE,OAAO,EAAC,IAAI,EAAC,yBAAsB;AACnC,OAAO,EAAC,eAAe,EAAC,6BAA0B;AAClD,OAAO,EAAC,YAAY,EAAC,qBAAkB;AAEvC;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,wBAAwB,GAAG,UAAU,CAGvE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,UAAU,GAAG,cAAc,GAAG,MAAM,EAC3C,IAAI,CAAC,EAAE,IAAI,EACX,YAAY,CAAC,EAAE,YAAY,GAC1B,wBAAwB,GAAG,cAAc,CAAC,eAAe,CAAC,CAI5D"}
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { deserialize as fcDeserialize, deserializeStream as fcDeserializeStream, deserializeFiltered as fcDeserializeFiltered, serialize as fcSerialize } from "./geojson/featurecollection.js";
|
|
2
|
+
/**
|
|
3
|
+
* Serialize GeoJSON to FlatGeobuf
|
|
4
|
+
* @param geojson GeoJSON object to serialize
|
|
5
|
+
*/
|
|
2
6
|
export function serialize(geojson) {
|
|
3
|
-
|
|
4
|
-
|
|
7
|
+
const bytes = fcSerialize(geojson);
|
|
8
|
+
return bytes;
|
|
5
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Deserialize FlatGeobuf into GeoJSON
|
|
12
|
+
* @param input Input byte array, stream or string
|
|
13
|
+
* @param rect Filter rectangle
|
|
14
|
+
* @param headerMetaFn Callback that will recieve header metadata when available
|
|
15
|
+
*/
|
|
6
16
|
export function deserialize(input, rect, headerMetaFn) {
|
|
7
|
-
|
|
8
|
-
|
|
17
|
+
if (input instanceof Uint8Array)
|
|
18
|
+
return fcDeserialize(input, headerMetaFn);
|
|
19
|
+
else if (input instanceof ReadableStream)
|
|
20
|
+
return fcDeserializeStream(input, headerMetaFn);
|
|
21
|
+
return fcDeserializeFiltered(input, rect, headerMetaFn);
|
|
9
22
|
}
|
|
10
|
-
//# sourceMappingURL=geojson.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as flatbuffers from 'flatbuffers';
|
|
2
|
-
import ColumnMeta from
|
|
3
|
-
import CrsMeta from
|
|
4
|
-
import { GeometryType } from
|
|
2
|
+
import ColumnMeta from "./column-meta.js";
|
|
3
|
+
import CrsMeta from "./crs-meta.js";
|
|
4
|
+
import { GeometryType } from "./flat-geobuf/geometry-type.js";
|
|
5
5
|
export default interface HeaderMeta {
|
|
6
6
|
geometryType: GeometryType;
|
|
7
7
|
columns: ColumnMeta[] | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-meta.d.ts","sourceRoot":"","sources":["../../../src/flatgeobuf/3.27.2/header-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAE3C,OAAO,UAAU,
|
|
1
|
+
{"version":3,"file":"header-meta.d.ts","sourceRoot":"","sources":["../../../src/flatgeobuf/3.27.2/header-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAE3C,OAAO,UAAU,yBAAsB;AACvC,OAAO,OAAO,sBAAmB;AACjC,OAAO,EAAC,YAAY,EAAC,uCAAoC;AAGzD,MAAM,CAAC,OAAO,WAAW,UAAU;IACjC,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,WAAW,CAAC,UAAU,GAAG,UAAU,CA8CrE"}
|
|
@@ -1,46 +1,49 @@
|
|
|
1
1
|
import { Header } from "./flat-geobuf/header.js";
|
|
2
2
|
export function fromByteBuffer(bb) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
3
|
+
const header = Header.getRootAsHeader(bb);
|
|
4
|
+
const featuresCount = header.featuresCount();
|
|
5
|
+
const indexNodeSize = header.indexNodeSize();
|
|
6
|
+
const columns = [];
|
|
7
|
+
for (let j = 0; j < header.columnsLength(); j++) {
|
|
8
|
+
const column = header.columns(j);
|
|
9
|
+
if (!column)
|
|
10
|
+
throw new Error('Column unexpectedly missing');
|
|
11
|
+
if (!column.name())
|
|
12
|
+
throw new Error('Column name unexpectedly missing');
|
|
13
|
+
columns.push({
|
|
14
|
+
name: column.name(),
|
|
15
|
+
type: column.type(),
|
|
16
|
+
title: column.title(),
|
|
17
|
+
description: column.description(),
|
|
18
|
+
width: column.width(),
|
|
19
|
+
precision: column.precision(),
|
|
20
|
+
scale: column.scale(),
|
|
21
|
+
nullable: column.nullable(),
|
|
22
|
+
unique: column.unique(),
|
|
23
|
+
primary_key: column.primaryKey()
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const crs = header.crs();
|
|
27
|
+
const crsMeta = crs
|
|
28
|
+
? {
|
|
29
|
+
org: crs.org(),
|
|
30
|
+
code: crs.code(),
|
|
31
|
+
name: crs.name(),
|
|
32
|
+
description: crs.description(),
|
|
33
|
+
wkt: crs.wkt(),
|
|
34
|
+
code_string: crs.codeString()
|
|
35
|
+
}
|
|
36
|
+
: null;
|
|
37
|
+
const headerMeta = {
|
|
38
|
+
geometryType: header.geometryType(),
|
|
39
|
+
columns,
|
|
40
|
+
envelope: null,
|
|
41
|
+
featuresCount: Number(featuresCount),
|
|
42
|
+
indexNodeSize,
|
|
43
|
+
crs: crsMeta,
|
|
44
|
+
title: header.title(),
|
|
45
|
+
description: header.description(),
|
|
46
|
+
metadata: header.metadata()
|
|
47
|
+
};
|
|
48
|
+
return headerMeta;
|
|
45
49
|
}
|
|
46
|
-
//# sourceMappingURL=header-meta.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as FlatGeobuf from
|
|
1
|
+
export * as FlatGeobuf from "./flat-geobuf.js";
|
|
2
2
|
//# sourceMappingURL=header.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/flatgeobuf/3.27.2/header.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/flatgeobuf/3.27.2/header.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,UAAU,yBAAsB"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
//# sourceMappingURL=header.js.map
|
|
1
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
|
2
|
+
export * as FlatGeobuf from "./flat-geobuf.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Rect } from
|
|
2
|
-
import HeaderMeta from
|
|
3
|
-
import { Feature } from
|
|
1
|
+
import { Rect } from "./packedrtree.js";
|
|
2
|
+
import HeaderMeta from "./header-meta.js";
|
|
3
|
+
import { Feature } from "./flat-geobuf/feature.js";
|
|
4
4
|
export declare class HttpReader {
|
|
5
5
|
private headerClient;
|
|
6
6
|
header: HeaderMeta;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-reader.d.ts","sourceRoot":"","sources":["../../../src/flatgeobuf/3.27.2/http-reader.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,IAAI,EAKL,
|
|
1
|
+
{"version":3,"file":"http-reader.d.ts","sourceRoot":"","sources":["../../../src/flatgeobuf/3.27.2/http-reader.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,IAAI,EAKL,yBAAsB;AAIvB,OAAO,UAA4B,yBAAsB;AACzD,OAAO,EAAC,OAAO,EAAC,iCAA8B;AAE9C,qBAAa,UAAU;IACrB,OAAO,CAAC,YAAY,CAA0B;IACvC,MAAM,EAAE,UAAU,CAAC;IAC1B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,WAAW,CAAS;gBAG1B,YAAY,EAAE,uBAAuB,EACrC,MAAM,EAAE,UAAU,EAClB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM;WAWR,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAkE5C,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;IAoErE,gBAAgB,IAAI,MAAM;IAK1B,oBAAoB,IAAI,MAAM;IAI9B,kBAAkB,IAAI,uBAAuB;IAI7C;;;;OAIG;IACI,gBAAgB,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC;IAyBpF,WAAW,CACf,aAAa,EAAE,uBAAuB,EACtC,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,OAAO,CAAC;CAsBpB;AAED,cAAM,uBAAuB;IAC3B,UAAU,EAAE,eAAe,CAAC;IAC5B,aAAa,SAAK;IAClB,gBAAgB,SAAK;IAErB,OAAO,CAAC,MAAM,CAAmC;IAIjD,OAAO,CAAC,IAAI,CAAK;gBAEL,MAAM,EAAE,MAAM,GAAG,eAAe;IAUtC,QAAQ,CACZ,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,WAAW,CAAC;IAmBvB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAQhC;AAED,cAAM,eAAe;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,SAAK;IACrB,kBAAkB,SAAK;gBAEX,GAAG,EAAE,MAAM;IAIjB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;CA4CrF"}
|