@maplibre/geojson-vt 6.1.2 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/cluster-tile-index.d.ts +43 -5
- package/dist/cluster-tile-index.d.ts.map +1 -1
- package/dist/convert.d.ts +2 -9
- package/dist/convert.d.ts.map +1 -1
- package/dist/deconvert.d.ts +4 -11
- package/dist/deconvert.d.ts.map +1 -1
- package/dist/definitions.d.ts +47 -7
- package/dist/definitions.d.ts.map +1 -1
- package/dist/difference.d.ts +2 -1
- package/dist/difference.d.ts.map +1 -1
- package/dist/geojson-vt-dev.js +462 -181
- package/dist/geojson-vt.js +1 -1
- package/dist/geojson-vt.mjs +459 -180
- package/dist/geojson-vt.mjs.map +1 -1
- package/dist/geojsonvt.d.ts +8 -4
- package/dist/geojsonvt.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/tile-index.d.ts +7 -0
- package/dist/tile-index.d.ts.map +1 -1
- package/dist/world-coordinate-helper.d.ts +13 -0
- package/dist/world-coordinate-helper.d.ts.map +1 -0
- package/dist/wrap.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/clip.ts +2 -2
- package/src/cluster-tile-index.test.ts +123 -0
- package/src/cluster-tile-index.ts +270 -99
- package/src/convert.ts +49 -44
- package/src/deconvert.test.ts +4 -4
- package/src/deconvert.ts +15 -29
- package/src/definitions.ts +48 -7
- package/src/difference.test.ts +71 -0
- package/src/difference.ts +50 -21
- package/src/geojson-to-tile.ts +2 -2
- package/src/geojsonvt.test.ts +387 -1
- package/src/geojsonvt.ts +25 -10
- package/src/index.ts +2 -1
- package/src/tile-index.ts +19 -3
- package/src/world-coordinate-helper.ts +63 -0
- package/src/wrap.ts +2 -0
package/README.md
CHANGED
|
@@ -64,6 +64,8 @@ var tileIndex = new GeoJSONVT(data, {
|
|
|
64
64
|
promoteId: null, // name of a feature property to promote to feature.id. Cannot be used with `generateId`
|
|
65
65
|
generateId: false, // whether to generate feature ids. Cannot be used with `promoteId`
|
|
66
66
|
updateable: false, // whether the tile index can be updated (with the caveat of a stored simplified copy)
|
|
67
|
+
coordinates: 'lngLat', // 'lngLat', projected with web mercator, or 'unitSquare', x and y from 0 to 1 taken as they are
|
|
68
|
+
wrap: true, // whether the world wraps around the antimeridian
|
|
67
69
|
indexMaxZoom: 5, // max zoom in the initial tile index
|
|
68
70
|
indexMaxPoints: 100000 // max number of points per tile in the index
|
|
69
71
|
});
|
|
@@ -73,6 +75,12 @@ By default, tiles at zoom levels above `indexMaxZoom` are generated on the fly,
|
|
|
73
75
|
|
|
74
76
|
The `promoteId` and `generateId` options ignore existing `id` values on the feature objects.
|
|
75
77
|
|
|
78
|
+
With `coordinates: 'unitSquare'`, positions are x and y from 0 to 1 across the square tile 0/0/0 covers, y growing downward, instead of lng/lat, for data in another projection. They are taken as they are, neither projected nor clamped, and `getData` and the cluster methods return them in the same square.
|
|
79
|
+
|
|
80
|
+
With `wrap: false`, the world is that square and ends at its edges. Nothing is copied across the antimeridian, features are cut at the tile buffer around the square, points outside it are left out of the clusters, and `getTile` returns `null` for tiles outside it. A map projection that is not repeated around the world, for example, uses `coordinates: 'unitSquare'` and `wrap: false`.
|
|
81
|
+
|
|
82
|
+
`coordinates` and `wrap` are experimental, so they can still change in a minor release.
|
|
83
|
+
|
|
76
84
|
GeoJSON-VT only operates on zoom levels up to 24.
|
|
77
85
|
|
|
78
86
|
### Update
|
|
@@ -2,7 +2,14 @@ import KDBush from 'kdbush';
|
|
|
2
2
|
import type { ClusterOrPointFeature, GeoJSONVTTileIndex, GeoJSONVTInternalFeature, GeoJSONVTInternalPointFeature, GeoJSONVTOptions, GeoJSONVTTile, SuperclusterOptions } from './definitions';
|
|
3
3
|
/** @internal */
|
|
4
4
|
export type KDBushWithData = KDBush & {
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The projected x and y of each point or cluster, as integers, see `encode`.
|
|
7
|
+
*/
|
|
8
|
+
flatCoords: Int32Array;
|
|
9
|
+
/**
|
|
10
|
+
* The other values of each point or cluster, at the `OFFSET_` positions.
|
|
11
|
+
*/
|
|
12
|
+
flatData: Int32Array;
|
|
6
13
|
};
|
|
7
14
|
export declare const defaultClusterOptions: Required<SuperclusterOptions>;
|
|
8
15
|
/**
|
|
@@ -10,19 +17,25 @@ export declare const defaultClusterOptions: Required<SuperclusterOptions>;
|
|
|
10
17
|
*/
|
|
11
18
|
export declare class ClusterTileIndex implements GeoJSONVTTileIndex {
|
|
12
19
|
options: Required<SuperclusterOptions>;
|
|
20
|
+
/**
|
|
21
|
+
* A tree per zoom level. A zoom level where no clusters form shares the tree of the zoom level above it.
|
|
22
|
+
*/
|
|
13
23
|
trees: KDBushWithData[];
|
|
14
24
|
stride: number;
|
|
15
25
|
clusterProps: Record<string, unknown>[];
|
|
16
26
|
points: GeoJSONVTInternalPointFeature[];
|
|
27
|
+
private worldCoordinateHelper;
|
|
17
28
|
constructor(options?: SuperclusterOptions);
|
|
18
29
|
/**
|
|
19
|
-
* Loads GeoJSON
|
|
20
|
-
*
|
|
30
|
+
* Loads GeoJSON Point and MultiPoint features and builds the internal clustering index.
|
|
31
|
+
* Each position of a MultiPoint is clustered as a point of its own, with the id and properties of its feature.
|
|
32
|
+
* @param points - GeoJSON Point and MultiPoint features to cluster.
|
|
21
33
|
*/
|
|
22
|
-
load(points: GeoJSON.Feature<GeoJSON.Point>[]): void;
|
|
34
|
+
load(points: GeoJSON.Feature<GeoJSON.Point | GeoJSON.MultiPoint>[]): void;
|
|
23
35
|
/**
|
|
24
36
|
* @internal
|
|
25
37
|
* Loads internal GeoJSONVT point features from a data source and builds the clustering index.
|
|
38
|
+
* Each position of a MultiPoint feature becomes a point of its own, with the id and properties of its feature.
|
|
26
39
|
* @param features - {@link GeoJSONVTInternalFeature} data source features to filter and cluster.
|
|
27
40
|
*/
|
|
28
41
|
initialize(features: GeoJSONVTInternalFeature[]): void;
|
|
@@ -32,14 +45,31 @@ export declare class ClusterTileIndex implements GeoJSONVTTileIndex {
|
|
|
32
45
|
* @param features
|
|
33
46
|
*/
|
|
34
47
|
updateIndex(features: GeoJSONVTInternalFeature[], _affected: GeoJSONVTInternalFeature[], options: GeoJSONVTOptions): void;
|
|
48
|
+
/**
|
|
49
|
+
* Builds a tree per zoom level from the points. A point whose position does not fit in an integer is left out,
|
|
50
|
+
* see `fitsInteger`.
|
|
51
|
+
*/
|
|
35
52
|
private createIndex;
|
|
36
53
|
/**
|
|
37
54
|
* Returns clusters and/or points within a bounding box at a given zoom level.
|
|
38
|
-
* @param bbox - Bounding box in `[westLng, southLat, eastLng, northLat]` order
|
|
55
|
+
* @param bbox - Bounding box in `[westLng, southLat, eastLng, northLat]` order, or `[minX, minY, maxX, maxY]` in the unit square with `coordinates: 'unitSquare'`.
|
|
56
|
+
* In a world that wraps, the box can reach across the antimeridian. In one that doesn't, only its part inside the world counts.
|
|
39
57
|
* @param zoom - Zoom level to query.
|
|
40
58
|
*/
|
|
41
59
|
getClusters(bbox: [number, number, number, number], zoom: number): ClusterOrPointFeature[];
|
|
60
|
+
/**
|
|
61
|
+
* The clusters and points in the part of a box inside a world that ends at its edges.
|
|
62
|
+
*/
|
|
63
|
+
private getClustersInWorld;
|
|
64
|
+
/**
|
|
65
|
+
* The clusters and points in a box of a unit square that wraps, where the box can reach across its left or right edge.
|
|
66
|
+
*/
|
|
67
|
+
private getClustersAcrossEdge;
|
|
42
68
|
private getClustersInternal;
|
|
69
|
+
/**
|
|
70
|
+
* The clusters and points in a box of the internal coordinates, `[minX, minY, maxX, maxY]`.
|
|
71
|
+
*/
|
|
72
|
+
private getClustersInRange;
|
|
43
73
|
/**
|
|
44
74
|
* Returns the immediate children (clusters or points) of a cluster as GeoJSON.
|
|
45
75
|
* @param clusterId - The target cluster id.
|
|
@@ -66,8 +96,16 @@ export declare class ClusterTileIndex implements GeoJSONVTTileIndex {
|
|
|
66
96
|
getClusterExpansionZoom(clusterId: number): number;
|
|
67
97
|
private appendLeaves;
|
|
68
98
|
private createTree;
|
|
99
|
+
/**
|
|
100
|
+
* Whether clustering a tree left all its points and clusters as they were, in the same order.
|
|
101
|
+
*/
|
|
102
|
+
private isSameAsTree;
|
|
69
103
|
private addTileFeatures;
|
|
70
104
|
private limitZoom;
|
|
105
|
+
/**
|
|
106
|
+
* Clusters the points of a tree on a zoom level, writing the result to `nextCoords` and `nextData`.
|
|
107
|
+
* @returns the number of points and clusters written
|
|
108
|
+
*/
|
|
71
109
|
private cluster;
|
|
72
110
|
private getOriginId;
|
|
73
111
|
private getOriginZoom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cluster-tile-index.d.ts","sourceRoot":"","sources":["../src/cluster-tile-index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,OAAO,KAAK,EAAiB,qBAAqB,EAAqB,kBAAkB,EAAoB,wBAAwB,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,aAAa,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAQjP,gBAAgB;AAChB,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IAClC,
|
|
1
|
+
{"version":3,"file":"cluster-tile-index.d.ts","sourceRoot":"","sources":["../src/cluster-tile-index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,OAAO,KAAK,EAAiB,qBAAqB,EAAqB,kBAAkB,EAAoB,wBAAwB,EAAE,6BAA6B,EAAE,gBAAgB,EAAE,aAAa,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAQjP,gBAAgB;AAChB,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IAClC;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,mBAAmB,CAa/D,CAAC;AA2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O,CAAC,KAAK,CAAC,EAAE;IAU/F;;;;;OAKG;IACH,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAuC9D;;;OAGG;IACH,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIlD,OAAO,CAAC,YAAY;IA4BpB,OAAO,CAAC,UAAU;IAUlB;;OAEG;IACH,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,eAAe;IA6CvB,OAAO,CAAC,SAAS;IAIjB;;;OAGG;IACH,OAAO,CAAC,OAAO;IAsGf,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,GAAG;CASd"}
|
package/dist/convert.d.ts
CHANGED
|
@@ -3,15 +3,8 @@ import type { GeoJSONVTInternalFeature, GeoJSONVTOptions } from './definitions';
|
|
|
3
3
|
* converts GeoJSON to internal source features (an intermediate projected JSON vector format with simplification data)
|
|
4
4
|
* @param data
|
|
5
5
|
* @param options
|
|
6
|
+
* @param unlocated - the features without coordinates, by id: a feature with an id that converts to nothing is set in it, and one that converts to something is deleted from it
|
|
6
7
|
* @returns
|
|
7
8
|
*/
|
|
8
|
-
export declare function convertToInternal(data: GeoJSON.GeoJSON, options: GeoJSONVTOptions): GeoJSONVTInternalFeature[];
|
|
9
|
-
/**
|
|
10
|
-
* Convert longitude to spherical mercator in [0..1] range
|
|
11
|
-
*/
|
|
12
|
-
export declare function projectX(x: number): number;
|
|
13
|
-
/**
|
|
14
|
-
* Convert latitude to spherical mercator in [0..1] range
|
|
15
|
-
*/
|
|
16
|
-
export declare function projectY(y: number): number;
|
|
9
|
+
export declare function convertToInternal(data: GeoJSON.GeoJSON, options: GeoJSONVTOptions, unlocated?: Map<string | number, GeoJSON.Feature>): GeoJSONVTInternalFeature[];
|
|
17
10
|
//# sourceMappingURL=convert.d.ts.map
|
package/dist/convert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,wBAAwB,EAAE,gBAAgB,EAAa,MAAM,eAAe,CAAC;AAI1F;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,wBAAwB,EAAE,CAiBjK"}
|
package/dist/deconvert.d.ts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
+
import { type WorldCoordinateHelper } from './world-coordinate-helper';
|
|
1
2
|
import type { GeoJSONVTInternalFeature } from './definitions';
|
|
2
3
|
/**
|
|
3
4
|
* Converts internal source features back to GeoJSON format.
|
|
4
5
|
*/
|
|
5
|
-
export declare function convertToGeoJSON(source: GeoJSONVTInternalFeature[]): GeoJSON.GeoJSON;
|
|
6
|
+
export declare function convertToGeoJSON(source: GeoJSONVTInternalFeature[], worldCoordinateHelper?: WorldCoordinateHelper): GeoJSON.GeoJSON;
|
|
6
7
|
/**
|
|
7
8
|
* Converts a single internal feature to GeoJSON format.
|
|
8
9
|
*/
|
|
9
|
-
export declare function featureToGeoJSON(feature: GeoJSONVTInternalFeature): GeoJSON.Feature;
|
|
10
|
-
export declare function unprojectPoints(coords: number[] | Float64Array): GeoJSON.Position[];
|
|
11
|
-
/**
|
|
12
|
-
* Convert spherical mercator in [0..1] range to longitude
|
|
13
|
-
*/
|
|
14
|
-
export declare function unprojectX(x: number): number;
|
|
15
|
-
/**
|
|
16
|
-
* Convert spherical mercator in [0..1] range to latitude
|
|
17
|
-
*/
|
|
18
|
-
export declare function unprojectY(y: number): number;
|
|
10
|
+
export declare function featureToGeoJSON(feature: GeoJSONVTInternalFeature, worldCoordinateHelper?: WorldCoordinateHelper): GeoJSON.Feature;
|
|
11
|
+
export declare function unprojectPoints(coords: number[] | Float64Array, worldCoordinateHelper?: WorldCoordinateHelper): GeoJSON.Position[];
|
|
19
12
|
//# sourceMappingURL=deconvert.d.ts.map
|
package/dist/deconvert.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deconvert.d.ts","sourceRoot":"","sources":["../src/deconvert.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,eAAe,CAAC;AAE5D;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,wBAAwB,EAAE,GAAG,OAAO,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"deconvert.d.ts","sourceRoot":"","sources":["../src/deconvert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,qBAAqB,EAAC,MAAM,2BAA2B,CAAC;AACpG,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,eAAe,CAAC;AAE5D;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,wBAAwB,EAAE,EAAE,qBAAqB,GAAE,qBAAqD,GAAG,OAAO,CAAC,OAAO,CAOlK;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,GAAE,qBAAqD,GAAG,OAAO,CAAC,OAAO,CAWjK;AAwCD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,qBAAqB,GAAE,qBAAqD,GAAG,OAAO,CAAC,QAAQ,EAAE,CAQjK"}
|
package/dist/definitions.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The space positions are given in, see `coordinates` in {@link GeoJSONVTOptions}.
|
|
3
|
+
* @experimental
|
|
4
|
+
*/
|
|
5
|
+
export type GeoJSONVTCoordinatesType = 'lngLat' | 'unitSquare';
|
|
1
6
|
export type GeoJSONVTOptions = {
|
|
2
7
|
/**
|
|
3
8
|
* Max zoom to preserve detail on
|
|
@@ -54,19 +59,38 @@ export type GeoJSONVTOptions = {
|
|
|
54
59
|
*/
|
|
55
60
|
debug?: number;
|
|
56
61
|
/**
|
|
57
|
-
*
|
|
62
|
+
* The space the positions are in. `'lngLat'` is longitude and latitude, which web mercator puts in the square from 0
|
|
63
|
+
* to 1 that tile 0/0/0 covers, with latitudes beyond ~85.05 degrees clamped onto its top and bottom. `'unitSquare'`
|
|
64
|
+
* is x and y in that square already, y growing downward, taken as they are, for data in another projection.
|
|
65
|
+
* `getData` and the cluster methods return positions in the same space.
|
|
66
|
+
* @experimental
|
|
67
|
+
* @default 'lngLat'
|
|
68
|
+
*/
|
|
69
|
+
coordinates?: GeoJSONVTCoordinatesType;
|
|
70
|
+
/**
|
|
71
|
+
* Whether the world wraps around the antimeridian. With `true`, features near the left or right edge are copied
|
|
72
|
+
* across it, and the tiles at either edge include what lies past it. With `false`, the world is the square and ends
|
|
73
|
+
* at its edges. Features are cut at the tile buffer around it, points outside it are left out of the clusters, and
|
|
74
|
+
* `getTile` returns `null` outside it. `geoJSONToTile` doesn't wrap unless this is `true`.
|
|
75
|
+
* @experimental
|
|
76
|
+
* @default true
|
|
77
|
+
*/
|
|
78
|
+
wrap?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Enable Supercluster for point features. Each position of a MultiPoint feature is clustered as a point of its own.
|
|
81
|
+
* Other geometry types are left out.
|
|
58
82
|
* @default false
|
|
59
83
|
*/
|
|
60
84
|
cluster?: boolean;
|
|
61
85
|
/**
|
|
62
|
-
* Options for the Supercluster point clustering algorithm.
|
|
86
|
+
* Options for the Supercluster point clustering algorithm. `coordinates` and `wrap` come from the options above.
|
|
63
87
|
* @see {@link SuperclusterOptions}
|
|
64
88
|
*/
|
|
65
|
-
clusterOptions?: SuperclusterOptions
|
|
89
|
+
clusterOptions?: Omit<SuperclusterOptions, 'coordinates' | 'wrap'>;
|
|
66
90
|
};
|
|
67
91
|
export type GeoJSONToTileOptions = GeoJSONVTOptions & {
|
|
68
92
|
/**
|
|
69
|
-
* Whether to wrap features around the antimeridian
|
|
93
|
+
* Whether to wrap features around the antimeridian, see `wrap` in {@link GeoJSONVTOptions}.
|
|
70
94
|
* @default false
|
|
71
95
|
*/
|
|
72
96
|
wrap?: boolean;
|
|
@@ -195,12 +219,12 @@ export interface GeoJSONVTTileIndex {
|
|
|
195
219
|
}
|
|
196
220
|
export type SuperclusterOptions = {
|
|
197
221
|
/**
|
|
198
|
-
* Min zoom to generate clusters on
|
|
222
|
+
* Min zoom to generate clusters on. A value above 30 is limited to 30.
|
|
199
223
|
* @default 0
|
|
200
224
|
*/
|
|
201
225
|
minZoom?: number;
|
|
202
226
|
/**
|
|
203
|
-
* Max zoom level to cluster the points on
|
|
227
|
+
* Max zoom level to cluster the points on. A value above 30 is limited to 30.
|
|
204
228
|
* @default 16
|
|
205
229
|
*/
|
|
206
230
|
maxZoom?: number;
|
|
@@ -230,7 +254,8 @@ export type SuperclusterOptions = {
|
|
|
230
254
|
*/
|
|
231
255
|
log?: boolean;
|
|
232
256
|
/**
|
|
233
|
-
* Whether to generate numeric ids for input features (in vector tiles)
|
|
257
|
+
* Whether to generate numeric ids for input features (in vector tiles). Each position of a MultiPoint feature
|
|
258
|
+
* gets an id of its own.
|
|
234
259
|
* @default false
|
|
235
260
|
*/
|
|
236
261
|
generateId?: boolean;
|
|
@@ -244,5 +269,20 @@ export type SuperclusterOptions = {
|
|
|
244
269
|
* @default props => props
|
|
245
270
|
*/
|
|
246
271
|
map?: (props: GeoJSON.GeoJsonProperties) => Record<string, unknown>;
|
|
272
|
+
/**
|
|
273
|
+
* The space the points are in, see `coordinates` in {@link GeoJSONVTOptions}. The bounding box of `getClusters` is
|
|
274
|
+
* in the same space.
|
|
275
|
+
* @experimental
|
|
276
|
+
* @default 'lngLat'
|
|
277
|
+
*/
|
|
278
|
+
coordinates?: GeoJSONVTCoordinatesType;
|
|
279
|
+
/**
|
|
280
|
+
* Whether the world wraps around the antimeridian, see `wrap` in {@link GeoJSONVTOptions}. With `false`, points
|
|
281
|
+
* outside the square are left out of the clusters, the tiles at an edge get no points from the opposite one, and
|
|
282
|
+
* `getTile` returns `null` outside the square.
|
|
283
|
+
* @experimental
|
|
284
|
+
* @default true
|
|
285
|
+
*/
|
|
286
|
+
wrap?: boolean;
|
|
247
287
|
};
|
|
248
288
|
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../src/definitions.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../src/definitions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GAAG;IAC3B;;;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AAW,CAAC,EAAE,wBAAwB,CAAC;IACvC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
package/dist/difference.d.ts
CHANGED
|
@@ -63,9 +63,10 @@ type HashedGeoJSONVTSourceDiff = {
|
|
|
63
63
|
* @param source
|
|
64
64
|
* @param dataDiff
|
|
65
65
|
* @param options
|
|
66
|
+
* @param unlocated - the features without coordinates, by id, so that an update can give them some
|
|
66
67
|
* @returns
|
|
67
68
|
*/
|
|
68
|
-
export declare function applySourceDiff(source: GeoJSONVTInternalFeature[], dataDiff: GeoJSONVTSourceDiff, options: GeoJSONVTOptions): ApplySourceDiffResult;
|
|
69
|
+
export declare function applySourceDiff(source: GeoJSONVTInternalFeature[], dataDiff: GeoJSONVTSourceDiff, options: GeoJSONVTOptions, unlocated?: Map<string | number, GeoJSON.Feature>): ApplySourceDiffResult;
|
|
69
70
|
/**
|
|
70
71
|
* Convert a GeoJSON Source Diff to an idempotent hashed representation using Sets and Maps
|
|
71
72
|
*/
|
package/dist/difference.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"difference.d.ts","sourceRoot":"","sources":["../src/difference.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEhF,MAAM,MAAM,mBAAmB,GAAG;IAC9B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC7B;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B;;OAEG;IACH,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB;;OAEG;I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