@loaders.gl/mvt 3.1.8 → 3.2.0-alpha.3

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.
@@ -1,28 +1,69 @@
1
- export declare type MvtOptions = {
2
- coordinates: string | number[];
1
+ import type { LoaderOptions } from '@loaders.gl/loader-utils';
2
+ /** For local coordinates, the tileIndex is not required */
3
+ declare type MVTLocalCoordinatesOptions = {
4
+ /**
5
+ * When set to `local`, the parser will return a flat array of GeoJSON objects with local coordinates decoded from tile origin.
6
+ */
7
+ coordinates: 'local';
8
+ tileIndex: null;
9
+ };
10
+ /** In WGS84 coordinates, the tileIndex is required */
11
+ declare type MVTWgs84CoordinatesOptions = {
12
+ /**
13
+ * When set to `wgs84`, the parser will return a flat array of GeoJSON objects with coordinates in longitude, latitude decoded from the provided tile index.
14
+ */
15
+ coordinates: 'wgs84';
16
+ /**
17
+ * Mandatory with `wgs84` coordinates option. An object containing tile index values (`x`, `y`,
18
+ * `z`) to reproject features' coordinates into WGS84.
19
+ */
3
20
  tileIndex: {
4
21
  x: number;
5
22
  y: number;
6
23
  z: number;
7
24
  };
8
- layerProperty: string | number;
9
- layerName: string;
10
25
  };
11
- export declare type MvtMapboxGeometry = {
26
+ export declare type MVTOptions = (MVTLocalCoordinatesOptions | MVTWgs84CoordinatesOptions) & {
27
+ /**
28
+ * When non-`null`, the layer name of each feature is added to
29
+ * `feature.properties[layerProperty]`. (A `feature.properties` object is created if the feature
30
+ * has no existing properties). If set to `null`, a layer name property will not be added.
31
+ */
32
+ layerProperty?: string | number;
33
+ /**
34
+ * Optional list of layer names. If not `null`, only features belonging to the named layers will
35
+ * be included in the output. If `null`, features from all layers are returned.
36
+ */
37
+ layers?: string[];
38
+ shape?: 'geojson-row-table' | 'columnar-table' | 'geojson' | 'binary' | 'binary-geometry';
39
+ };
40
+ export declare type MVTMapboxGeometry = {
12
41
  type?: string;
13
42
  id?: number;
14
43
  length: number;
15
44
  coordinates?: any[];
16
45
  };
17
- export declare type MvtMapboxCoordinates = {
46
+ export declare type MVTMapboxCoordinates = {
18
47
  type: string;
19
48
  geometry: {
20
49
  type: string;
21
- coordinates: MvtMapboxGeometry;
50
+ coordinates: MVTMapboxGeometry;
22
51
  };
23
52
  properties: {
24
53
  [x: string]: string | number | boolean | null;
25
54
  };
26
55
  id?: number;
27
56
  };
57
+ export declare type MVTLoaderOptions = LoaderOptions & {
58
+ mvt?: MVTOptions;
59
+ gis?: {
60
+ /**
61
+ * When set to `true`, the parser will output the data in binary format. This is equivalent to loading the data as GeoJSON and then applying [geojsonToBinary](https://loaders.gl/modules/gis/docs/api-reference/geojson-to-binary).
62
+ */
63
+ binary?: boolean;
64
+ /** @deprecated. Use options.mvt.shape */
65
+ format?: 'geojson-row-table' | 'columnar-table' | 'geojson' | 'binary' | 'binary-geometry';
66
+ };
67
+ };
68
+ export {};
28
69
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/B,SAAS,EAAE;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAC7C,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,oBAAY,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC;CACrB,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QAC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EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,iBAAiB,CAAC;KAChC,CAAC;IACF,UAAU,EAAE;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;KAAC,CAAC;IAC5D,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,oBAAY,gBAAgB,GAAG,aAAa,GAAG;IAC7C,GAAG,CAAC,EAAE,UAAU,CAAC;IACjB,GAAG,CAAC,EAAE;QACJ;;WAEG;QACH,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,yCAAyC;QACzC,MAAM,CAAC,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,iBAAiB,CAAC;KAC5F,CAAC;CACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mvt-loader.d.ts","sourceRoot":"","sources":["../src/mvt-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAOvE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAsB7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAKvB,CAAC"}
1
+ {"version":3,"file":"mvt-loader.d.ts","sourceRoot":"","sources":["../src/mvt-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,0BAA0B,CAAC;AAkBvE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAe7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBAKvB,CAAC"}
@@ -8,6 +8,15 @@ const parse_mvt_1 = __importDefault(require("./lib/parse-mvt"));
8
8
  // __VERSION__ is injected by babel-plugin-version-inline
9
9
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
10
10
  const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
11
+ const DEFAULT_MVT_LOADER_OPTIONS = {
12
+ mvt: {
13
+ shape: 'geojson',
14
+ coordinates: 'local',
15
+ layerProperty: 'layerName',
16
+ layers: undefined,
17
+ tileIndex: null
18
+ }
19
+ };
11
20
  /**
12
21
  * Worker loader for the Mapbox Vector Tile format
13
22
  */
@@ -25,14 +34,7 @@ exports.MVTWorkerLoader = {
25
34
  ],
26
35
  worker: true,
27
36
  category: 'geometry',
28
- options: {
29
- mvt: {
30
- coordinates: 'local',
31
- layerProperty: 'layerName',
32
- layers: null,
33
- tileIndex: null
34
- }
35
- }
37
+ options: DEFAULT_MVT_LOADER_OPTIONS
36
38
  };
37
39
  /**
38
40
  * Loader for the Mapbox Vector Tile format