@maplibre/geojson-vt 5.0.3 → 6.0.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.
Files changed (65) hide show
  1. package/README.md +3 -13
  2. package/dist/clip.d.ts +22 -0
  3. package/dist/clip.d.ts.map +1 -0
  4. package/dist/clip.test.d.ts +2 -0
  5. package/dist/clip.test.d.ts.map +1 -0
  6. package/dist/cluster-tile-index.d.ts +76 -0
  7. package/dist/cluster-tile-index.d.ts.map +1 -0
  8. package/dist/cluster-tile-index.test.d.ts +2 -0
  9. package/dist/cluster-tile-index.test.d.ts.map +1 -0
  10. package/dist/convert.d.ts +17 -0
  11. package/dist/convert.d.ts.map +1 -0
  12. package/dist/deconvert.d.ts +19 -0
  13. package/dist/deconvert.d.ts.map +1 -0
  14. package/dist/deconvert.test.d.ts +2 -0
  15. package/dist/deconvert.test.d.ts.map +1 -0
  16. package/dist/definitions.d.ts +241 -0
  17. package/dist/definitions.d.ts.map +1 -0
  18. package/dist/difference.d.ts +67 -0
  19. package/dist/difference.d.ts.map +1 -0
  20. package/dist/difference.test.d.ts +2 -0
  21. package/dist/difference.test.d.ts.map +1 -0
  22. package/dist/feature.d.ts +20 -0
  23. package/dist/feature.d.ts.map +1 -0
  24. package/dist/geojson-to-tile.d.ts +35 -0
  25. package/dist/geojson-to-tile.d.ts.map +1 -0
  26. package/dist/geojson-vt-dev.js +1582 -478
  27. package/dist/geojson-vt.js +1 -1
  28. package/dist/geojson-vt.mjs +1250 -473
  29. package/dist/geojson-vt.mjs.map +1 -1
  30. package/dist/geojsonvt.d.ts +76 -0
  31. package/dist/geojsonvt.d.ts.map +1 -0
  32. package/dist/geojsonvt.test.d.ts +2 -0
  33. package/dist/geojsonvt.test.d.ts.map +1 -0
  34. package/dist/index.d.ts +9 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/simplify.d.ts +9 -0
  37. package/dist/simplify.d.ts.map +1 -0
  38. package/dist/simplify.test.d.ts +2 -0
  39. package/dist/simplify.test.d.ts.map +1 -0
  40. package/dist/tile-index.d.ts +51 -0
  41. package/dist/tile-index.d.ts.map +1 -0
  42. package/dist/tile.d.ts +12 -0
  43. package/dist/tile.d.ts.map +1 -0
  44. package/dist/transform.d.ts +10 -0
  45. package/dist/transform.d.ts.map +1 -0
  46. package/dist/wrap.d.ts +3 -0
  47. package/dist/wrap.d.ts.map +1 -0
  48. package/package.json +26 -12
  49. package/src/clip.ts +119 -81
  50. package/src/cluster-tile-index.test.ts +205 -0
  51. package/src/cluster-tile-index.ts +513 -0
  52. package/src/convert.ts +97 -75
  53. package/src/deconvert.test.ts +153 -0
  54. package/src/deconvert.ts +92 -0
  55. package/src/definitions.ts +196 -18
  56. package/src/difference.ts +3 -3
  57. package/src/feature.ts +11 -4
  58. package/src/geojson-to-tile.ts +58 -0
  59. package/src/geojsonvt.test.ts +39 -0
  60. package/src/geojsonvt.ts +209 -0
  61. package/src/index.ts +27 -378
  62. package/src/tile-index.ts +310 -0
  63. package/src/tile.ts +92 -103
  64. package/src/transform.ts +41 -39
  65. package/src/wrap.ts +4 -4
package/README.md CHANGED
@@ -39,7 +39,7 @@ Just drag any GeoJSON on the page, watching the console.
39
39
 
40
40
  ```js
41
41
  // build an initial index of tiles
42
- var tileIndex = geojsonvt(geoJSON);
42
+ var tileIndex = new GeoJSONVT(geoJSON);
43
43
 
44
44
  // request a particular tile
45
45
  var features = tileIndex.getTile(z, x, y).features;
@@ -54,7 +54,7 @@ You can fine-tune the results with an options object,
54
54
  although the defaults are sensible and work well for most use cases.
55
55
 
56
56
  ```js
57
- var tileIndex = geojsonvt(data, {
57
+ var tileIndex = new GeoJSONVT(data, {
58
58
  maxZoom: 14, // max zoom to preserve detail on; can't be higher than 24
59
59
  tolerance: 3, // simplification tolerance (higher means simpler)
60
60
  extent: 4096, // tile extent (both width and height)
@@ -110,17 +110,7 @@ To use `updateData`, the index must be created with the `updateable: true` optio
110
110
  Install using NPM (`npm install @maplibre/geojson-vt`), then:
111
111
 
112
112
  ```js
113
- // import as a ES module
114
- import geojsonvt from '@maplibre/geojson-vt';
115
-
116
- // import from a CDN in the browser:
117
- import geojsonvt from 'https://esm.run/@maplibre/geojson-vt';
118
- ```
119
-
120
- Or use a browser build directly:
121
-
122
- ```html
123
- <script src="https://unpkg.com/@maplibre/geojson-vt/geojson-vt.js"></script>
113
+ import {GeoJSONVT} from '@maplibre/geojson-vt';
124
114
  ```
125
115
 
126
116
  ### Getting Involved
package/dist/clip.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type { GeoJSONVTInternalFeature, GeoJSONVTOptions } from './definitions';
2
+ export declare const enum AxisType {
3
+ X = 0,
4
+ Y = 1
5
+ }
6
+ /**
7
+ * clip features between two vertical or horizontal axis-parallel lines:
8
+ * | |
9
+ * ___|___ | /
10
+ * / | \____|____/
11
+ * | |
12
+ *
13
+ * @param features - the features to clip
14
+ * @param scale - the scale to divide start and end inputs
15
+ * @param start - the start of the clip range
16
+ * @param end - the end of the clip range
17
+ * @param axis - which axis to clip against
18
+ * @param minAll - the minimum for all features in the relevant axis
19
+ * @param maxAll - the maximum for all features in the relevant axis
20
+ */
21
+ export declare function clip(features: GeoJSONVTInternalFeature[], scale: number, start: number, end: number, axis: AxisType, minAll: number, maxAll: number, options: GeoJSONVTOptions): GeoJSONVTInternalFeature[] | null;
22
+ //# sourceMappingURL=clip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clip.d.ts","sourceRoot":"","sources":["../src/clip.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAyN,gBAAgB,EAAqB,MAAM,eAAe,CAAC;AAE1T,0BAAkB,QAAQ;IACtB,CAAC,IAAI;IACL,CAAC,IAAI;CACR;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,QAAQ,EAAE,wBAAwB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,wBAAwB,EAAE,GAAG,IAAI,CA2DlN"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=clip.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clip.test.d.ts","sourceRoot":"","sources":["../src/clip.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,76 @@
1
+ import KDBush from 'kdbush';
2
+ import type { ClusterOrPointFeature, GeoJSONVTTileIndex, GeoJSONVTInternalFeature, GeoJSONVTInternalPointFeature, GeoJSONVTOptions, GeoJSONVTTile, SuperclusterOptions } from './definitions';
3
+ /** @internal */
4
+ export type KDBushWithData = KDBush & {
5
+ flatData: number[];
6
+ };
7
+ export declare const defaultClusterOptions: Required<SuperclusterOptions>;
8
+ /**
9
+ * This class allow clustering of geojson points.
10
+ */
11
+ export declare class ClusterTileIndex implements GeoJSONVTTileIndex {
12
+ options: Required<SuperclusterOptions>;
13
+ trees: KDBushWithData[];
14
+ stride: number;
15
+ clusterProps: Record<string, unknown>[];
16
+ points: GeoJSONVTInternalPointFeature[];
17
+ constructor(options?: SuperclusterOptions);
18
+ /**
19
+ * Loads GeoJSON point features and builds the internal clustering index.
20
+ * @param points - GeoJSON point features to cluster.
21
+ */
22
+ load(points: GeoJSON.Feature<GeoJSON.Point>[]): void;
23
+ /**
24
+ * @internal
25
+ * Loads internal GeoJSONVT point features from a data source and builds the clustering index.
26
+ * @param features - {@link GeoJSONVTInternalFeature} data source features to filter and cluster.
27
+ */
28
+ initialize(features: GeoJSONVTInternalFeature[]): void;
29
+ /**
30
+ * @internal
31
+ * Updates the cluster data by rebuilding.
32
+ * @param features
33
+ */
34
+ updateIndex(features: GeoJSONVTInternalFeature[], _affected: GeoJSONVTInternalFeature[], options: GeoJSONVTOptions): void;
35
+ private createIndex;
36
+ /**
37
+ * 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.
39
+ * @param zoom - Zoom level to query.
40
+ */
41
+ getClusters(bbox: [number, number, number, number], zoom: number): ClusterOrPointFeature[];
42
+ private getClustersInternal;
43
+ /**
44
+ * Returns the immediate children (clusters or points) of a cluster as GeoJSON.
45
+ * @param clusterId - The target cluster id.
46
+ */
47
+ getChildren(clusterId: number): ClusterOrPointFeature[];
48
+ /**
49
+ * Returns leaf point features under a cluster, paginated by `limit` and `offset`.
50
+ * @param clusterId - The target cluster id.
51
+ * @param limit - Maximum number of points to return (defaults to `10`).
52
+ * @param offset - Number of points to skip before collecting results (defaults to `0`).
53
+ */
54
+ getLeaves(clusterId: number, limit?: number, offset?: number): GeoJSON.Feature<GeoJSON.Point>[];
55
+ /**
56
+ * Generates a vector-tile-like representation of a single tile.
57
+ * @param z - Tile zoom.
58
+ * @param x - Tile x coordinate.
59
+ * @param y - Tile y coordinate.
60
+ */
61
+ getTile(z: number, x: number, y: number): GeoJSONVTTile | null;
62
+ /**
63
+ * Returns the zoom level at which a cluster expands into multiple children.
64
+ * @param clusterId - The target cluster id.
65
+ */
66
+ getClusterExpansionZoom(clusterId: number): number;
67
+ private appendLeaves;
68
+ private createTree;
69
+ private addTileFeatures;
70
+ private limitZoom;
71
+ private cluster;
72
+ private getOriginId;
73
+ private getOriginZoom;
74
+ private map;
75
+ }
76
+ //# sourceMappingURL=cluster-tile-index.d.ts.map
@@ -0,0 +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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CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI;IAmC9D;;;OAGG;IACH,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIlD,OAAO,CAAC,YAAY;IA4BpB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,eAAe;IA2CvB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,OAAO;IAmFf,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,GAAG;CASd"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cluster-tile-index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cluster-tile-index.test.d.ts","sourceRoot":"","sources":["../src/cluster-tile-index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import type { GeoJSONVTInternalFeature, GeoJSONVTOptions } from './definitions';
2
+ /**
3
+ * converts GeoJSON to internal source features (an intermediate projected JSON vector format with simplification data)
4
+ * @param data
5
+ * @param options
6
+ * @returns
7
+ */
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;
17
+ //# sourceMappingURL=convert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../src/convert.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,wBAAwB,EAAE,gBAAgB,EAAoB,MAAM,eAAe,CAAC;AAEjG;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,wBAAwB,EAAE,CAiB9G;AA6JD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,UAEjC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,UAIjC"}
@@ -0,0 +1,19 @@
1
+ import type { GeoJSONVTInternalFeature } from './definitions';
2
+ /**
3
+ * Converts internal source features back to GeoJSON format.
4
+ */
5
+ export declare function convertToGeoJSON(source: GeoJSONVTInternalFeature[]): GeoJSON.GeoJSON;
6
+ /**
7
+ * Converts a single internal feature to GeoJSON format.
8
+ */
9
+ export declare function featureToGeoJSON(feature: GeoJSONVTInternalFeature): GeoJSON.Feature;
10
+ export declare function unprojectPoints(coords: number[]): 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;
19
+ //# sourceMappingURL=deconvert.d.ts.map
@@ -0,0 +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,CAOpF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAWnF;AAoCD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAQpE;AAMD;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAG5C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=deconvert.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deconvert.test.d.ts","sourceRoot":"","sources":["../src/deconvert.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,241 @@
1
+ export type GeoJSONVTOptions = {
2
+ /**
3
+ * Max zoom to preserve detail on
4
+ * @default 14
5
+ */
6
+ maxZoom?: number;
7
+ /**
8
+ * Max zoom in the tile index
9
+ * @default 5
10
+ */
11
+ indexMaxZoom?: number;
12
+ /**
13
+ * Max number of points per tile in the tile index
14
+ * @default 100000
15
+ */
16
+ indexMaxPoints?: number;
17
+ /**
18
+ * Simplification tolerance (higher means simpler)
19
+ * @default 3
20
+ */
21
+ tolerance?: number;
22
+ /**
23
+ * Tile extent
24
+ * @default 4096
25
+ */
26
+ extent?: number;
27
+ /**
28
+ * Tile buffer on each side
29
+ * @default 64
30
+ */
31
+ buffer?: number;
32
+ /**
33
+ * Whether to calculate line metrics
34
+ * @default false
35
+ */
36
+ lineMetrics?: boolean;
37
+ /**
38
+ * Name of a feature property to be promoted to feature.id
39
+ */
40
+ promoteId?: string | null;
41
+ /**
42
+ * Whether to generate feature ids. Cannot be used with promoteId
43
+ * @default false
44
+ */
45
+ generateId?: boolean;
46
+ /**
47
+ * Whether geojson can be updated (with caveat of a stored simplified copy)
48
+ * @default false
49
+ */
50
+ updateable?: boolean;
51
+ /**
52
+ * Logging level (0, 1 or 2)
53
+ * @default 0
54
+ */
55
+ debug?: number;
56
+ /**
57
+ * Enable Supercluster for point features.
58
+ * @default false
59
+ */
60
+ cluster?: boolean;
61
+ /**
62
+ * Options for the Supercluster point clustering algorithm.
63
+ * @see {@link SuperclusterOptions}
64
+ */
65
+ clusterOptions?: SuperclusterOptions;
66
+ };
67
+ export type GeoJSONToTileOptions = GeoJSONVTOptions & {
68
+ /**
69
+ * Whether to wrap features around the antimeridian
70
+ * @default false
71
+ */
72
+ wrap?: boolean;
73
+ /**
74
+ * Whether to clip features to the tile boundary
75
+ * @default false
76
+ */
77
+ clip?: boolean;
78
+ };
79
+ export type StartEndSizeArray = number[] & {
80
+ start?: number;
81
+ end?: number;
82
+ size?: number;
83
+ };
84
+ export type PartialGeoJSONVTFeature = {
85
+ id?: number | string | undefined;
86
+ tags: GeoJSON.GeoJsonProperties;
87
+ minX?: number;
88
+ minY?: number;
89
+ maxX?: number;
90
+ maxY?: number;
91
+ };
92
+ export type GeoJSONVTInternalPointFeature = PartialGeoJSONVTFeature & {
93
+ type: 'Point';
94
+ geometry: number[];
95
+ };
96
+ export type GeoJSONVTInternalMultiPointFeature = PartialGeoJSONVTFeature & {
97
+ type: 'MultiPoint';
98
+ geometry: number[];
99
+ };
100
+ export type GeoJSONVTInternalLineStringFeature = PartialGeoJSONVTFeature & {
101
+ type: 'LineString';
102
+ geometry: StartEndSizeArray;
103
+ };
104
+ export type GeoJSONVTInternalMultiLineStringFeature = PartialGeoJSONVTFeature & {
105
+ type: 'MultiLineString';
106
+ geometry: StartEndSizeArray[];
107
+ };
108
+ export type GeoJSONVTInternalPolygonFeature = PartialGeoJSONVTFeature & {
109
+ type: 'Polygon';
110
+ geometry: StartEndSizeArray[];
111
+ };
112
+ export type GeoJSONVTInternalMultiPolygonFeature = PartialGeoJSONVTFeature & {
113
+ type: 'MultiPolygon';
114
+ geometry: StartEndSizeArray[][];
115
+ };
116
+ export type GeoJSONVTInternalFeature = GeoJSONVTInternalPointFeature | GeoJSONVTInternalMultiPointFeature | GeoJSONVTInternalLineStringFeature | GeoJSONVTInternalMultiLineStringFeature | GeoJSONVTInternalPolygonFeature | GeoJSONVTInternalMultiPolygonFeature;
117
+ /**
118
+ * The geojson properies related to a cluster.
119
+ */
120
+ export type ClusterProperties = {
121
+ cluster: true;
122
+ cluster_id: number;
123
+ point_count: number;
124
+ point_count_abbreviated: string | number;
125
+ [key: string]: unknown;
126
+ };
127
+ /**
128
+ * A geojson point with cluster properties, see {@link ClusterProperties}.
129
+ */
130
+ export type ClusterFeature = GeoJSON.Feature<GeoJSON.Point, ClusterProperties>;
131
+ /**
132
+ * A geojson point that is either a regular point or a cluster, which is a point with cluster properties.
133
+ * See {@link ClusterFeature} for more information
134
+ */
135
+ export type ClusterOrPointFeature = ClusterFeature | GeoJSON.Feature<GeoJSON.Point>;
136
+ export type GeoJSONVTInternalTileFeaturePoint = {
137
+ id?: number | string | undefined;
138
+ type: 1;
139
+ tags: GeoJSON.GeoJsonProperties | null;
140
+ geometry: number[];
141
+ };
142
+ export type GeoJSONVTInternalTileFeatureNonPoint = {
143
+ id?: number | string | undefined;
144
+ type: 2 | 3;
145
+ tags: GeoJSON.GeoJsonProperties | null;
146
+ geometry: number[][];
147
+ };
148
+ export type GeoJSONVTInternalTileFeature = GeoJSONVTInternalTileFeaturePoint | GeoJSONVTInternalTileFeatureNonPoint;
149
+ export type GeoJSONVTInternalTile = {
150
+ transformed: boolean;
151
+ features: GeoJSONVTInternalTileFeature[];
152
+ source: GeoJSONVTInternalFeature[] | null;
153
+ x: number;
154
+ y: number;
155
+ z: number;
156
+ minX?: number;
157
+ minY?: number;
158
+ maxX?: number;
159
+ maxY?: number;
160
+ numPoints?: number;
161
+ numSimplified?: number;
162
+ numFeatures?: number;
163
+ };
164
+ export type GeoJSONVTFeaturePoint = {
165
+ id?: number | string | undefined;
166
+ type: 1;
167
+ tags: GeoJSON.GeoJsonProperties | null;
168
+ geometry: [number, number][];
169
+ };
170
+ export type GeoJSONVTFeatureNonPoint = {
171
+ id?: number | string | undefined;
172
+ type: 2 | 3;
173
+ tags: GeoJSON.GeoJsonProperties | null;
174
+ geometry: [number, number][][];
175
+ };
176
+ export type GeoJSONVTFeature = GeoJSONVTFeaturePoint | GeoJSONVTFeatureNonPoint;
177
+ export type GeoJSONVTTile = GeoJSONVTInternalTile & {
178
+ transformed: true;
179
+ features: GeoJSONVTFeature[];
180
+ };
181
+ export interface GeoJSONVTTileIndex {
182
+ initialize(features: GeoJSONVTInternalFeature[]): void;
183
+ updateIndex(source: GeoJSONVTInternalFeature[], affected: GeoJSONVTInternalFeature[], options: GeoJSONVTOptions): void;
184
+ getClusterExpansionZoom(clusterId: number): number | null;
185
+ getChildren(clusterId: number): ClusterOrPointFeature[] | null;
186
+ getLeaves(clusterId: number, limit?: number, offset?: number): GeoJSON.Feature<GeoJSON.Point>[] | null;
187
+ getTile(z: number, x: number, y: number): GeoJSONVTTile | null;
188
+ }
189
+ export type SuperclusterOptions = {
190
+ /**
191
+ * Min zoom to generate clusters on
192
+ * @default 0
193
+ */
194
+ minZoom?: number;
195
+ /**
196
+ * Max zoom level to cluster the points on
197
+ * @default 16
198
+ */
199
+ maxZoom?: number;
200
+ /**
201
+ * Minimum points to form a cluster
202
+ * @default 2
203
+ */
204
+ minPoints?: number;
205
+ /**
206
+ * Cluster radius in pixels
207
+ * @default 40
208
+ */
209
+ radius?: number;
210
+ /**
211
+ * Tile extent (radius is calculated relative to it)
212
+ * @default 512
213
+ */
214
+ extent?: number;
215
+ /**
216
+ * Size of the KD-tree leaf node, affects performance
217
+ * @default 64
218
+ */
219
+ nodeSize?: number;
220
+ /**
221
+ * Whether to log timing info
222
+ * @default false
223
+ */
224
+ log?: boolean;
225
+ /**
226
+ * Whether to generate numeric ids for input features (in vector tiles)
227
+ * @default false
228
+ */
229
+ generateId?: boolean;
230
+ /**
231
+ * A reduce function for calculating custom cluster properties
232
+ * @default null
233
+ */
234
+ reduce?: ((accumulated: Record<string, unknown>, props: Record<string, unknown>) => void) | null;
235
+ /**
236
+ * Properties to use for individual points when running the reducer
237
+ * @default props => props
238
+ */
239
+ map?: (props: GeoJSON.GeoJsonProperties) => Record<string, unknown>;
240
+ };
241
+ //# sourceMappingURL=definitions.d.ts.map
@@ -0,0 +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,EAA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G,aAAa,GAAG,IAAI,CAAA;CACjE;AAED,MAAM,MAAM,mBAAmB,GAAG;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;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,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACjG;;;OAGG;IACH,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,iBAAiB,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvE,CAAC"}
@@ -0,0 +1,67 @@
1
+ import type { GeoJSONVTInternalFeature, GeoJSONVTOptions } from './definitions';
2
+ export type GeoJSONVTSourceDiff = {
3
+ /**
4
+ * If true, clear all existing features
5
+ */
6
+ removeAll?: boolean;
7
+ /**
8
+ * Array of feature IDs to remove
9
+ */
10
+ remove?: (string | number)[];
11
+ /**
12
+ * Array of GeoJSON features to add
13
+ */
14
+ add?: GeoJSON.Feature[];
15
+ /**
16
+ * Array of per-feature updates
17
+ */
18
+ update?: GeoJSONVTFeatureDiff[];
19
+ };
20
+ export type GeoJSONVTFeatureDiff = {
21
+ /**
22
+ * ID of the feature being updated
23
+ */
24
+ id: string | number;
25
+ /**
26
+ * Optional new geometry
27
+ */
28
+ newGeometry?: GeoJSON.Geometry;
29
+ /**
30
+ * Remove all properties if true
31
+ */
32
+ removeAllProperties?: boolean;
33
+ /**
34
+ * Specific properties to delete
35
+ */
36
+ removeProperties?: string[];
37
+ /**
38
+ * Properties to add or update
39
+ */
40
+ addOrUpdateProperties?: {
41
+ key: string;
42
+ value: unknown;
43
+ }[];
44
+ };
45
+ type HashedGeoJSONVTSourceDiff = {
46
+ removeAll?: boolean | undefined;
47
+ remove: Set<string | number>;
48
+ add: Map<string | number | undefined, GeoJSON.Feature>;
49
+ update: Map<string | number, GeoJSONVTFeatureDiff>;
50
+ };
51
+ /**
52
+ * Applies a GeoJSON Source Diff to an existing set of simplified features
53
+ * @param source
54
+ * @param dataDiff
55
+ * @param options
56
+ * @returns
57
+ */
58
+ export declare function applySourceDiff(source: GeoJSONVTInternalFeature[], dataDiff: GeoJSONVTSourceDiff, options: GeoJSONVTOptions): {
59
+ affected: GeoJSONVTInternalFeature[];
60
+ source: GeoJSONVTInternalFeature[];
61
+ };
62
+ /**
63
+ * Convert a GeoJSON Source Diff to an idempotent hashed representation using Sets and Maps
64
+ */
65
+ export declare function diffToHashed(diff: GeoJSONVTSourceDiff): HashedGeoJSONVTSourceDiff;
66
+ export {};
67
+ //# sourceMappingURL=difference.d.ts.map
@@ -0,0 +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;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC;IAC/B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B;;OAEG;IACH,qBAAqB,CAAC,EAAE;QACpB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,OAAO,CAAC;KAClB,EAAE,CAAC;CACP,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC7B,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC7B,GAAG,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,oBAAoB,CAAC,CAAC;CACtD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,wBAAwB,EAAE,EAAE,QAAQ,EAAE,mBAAmB,EAAE,OAAO,EAAE,gBAAgB;;;EAwE3H;AAgED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,yBAAyB,CAejF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=difference.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"difference.test.d.ts","sourceRoot":"","sources":["../src/difference.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import type { GeoJSONVTInternalFeature, GeoJSONVTInternalLineStringFeature, GeoJSONVTInternalMultiLineStringFeature, GeoJSONVTInternalMultiPointFeature, GeoJSONVTInternalMultiPolygonFeature, GeoJSONVTInternalPointFeature, GeoJSONVTInternalPolygonFeature } from "./definitions";
2
+ type FeatureTypeMap = {
3
+ Point: GeoJSONVTInternalPointFeature["geometry"];
4
+ MultiPoint: GeoJSONVTInternalMultiPointFeature["geometry"];
5
+ LineString: GeoJSONVTInternalLineStringFeature["geometry"];
6
+ MultiLineString: GeoJSONVTInternalMultiLineStringFeature["geometry"];
7
+ Polygon: GeoJSONVTInternalPolygonFeature["geometry"];
8
+ MultiPolygon: GeoJSONVTInternalMultiPolygonFeature["geometry"];
9
+ };
10
+ /**
11
+ *
12
+ * @param id - the feature's ID
13
+ * @param type - the feature's type
14
+ * @param geom - the feature's geometry
15
+ * @param tags - the feature's properties
16
+ * @returns the created feature
17
+ */
18
+ export declare function createFeature<T extends GeoJSONVTInternalFeature["type"]>(id: number | string | undefined, type: T, geom: FeatureTypeMap[T], tags: GeoJSON.GeoJsonProperties): GeoJSONVTInternalFeature;
19
+ export {};
20
+ //# sourceMappingURL=feature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,kCAAkC,EAAE,uCAAuC,EAAE,kCAAkC,EAAE,oCAAoC,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAErR,KAAK,cAAc,GAAG;IAClB,KAAK,EAAE,6BAA6B,CAAC,UAAU,CAAC,CAAC;IACjD,UAAU,EAAE,kCAAkC,CAAC,UAAU,CAAC,CAAC;IAC3D,UAAU,EAAE,kCAAkC,CAAC,UAAU,CAAC,CAAC;IAC3D,eAAe,EAAE,uCAAuC,CAAC,UAAU,CAAC,CAAC;IACrE,OAAO,EAAE,+BAA+B,CAAC,UAAU,CAAC,CAAC;IACrD,YAAY,EAAE,oCAAoC,CAAC,UAAU,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,wBAAwB,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,iBAAiB,GAAG,wBAAwB,CA0CtM"}
@@ -0,0 +1,35 @@
1
+ import type { GeoJSONToTileOptions, GeoJSONVTTile } from './definitions';
2
+ /**
3
+ * Converts GeoJSON data directly to a single vector tile without building a tile index.
4
+ *
5
+ * Unlike the {@link GeoJSONVT} class which builds a hierarchical tile index for efficient
6
+ * repeated tile access, this function generates a single tile on-demand. This is useful when:
7
+ * - You only need one specific tile and don't need to query multiple tiles
8
+ * - The source data is already spatially filtered to the tile's bounding box
9
+ * - You want to avoid the overhead of building a full tile index
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import {geoJSONToTile} from '@maplibre/geojson-vt';
14
+ *
15
+ * const geojson = {
16
+ * type: 'FeatureCollection',
17
+ * features: [{
18
+ * type: 'Feature',
19
+ * geometry: { type: 'Point', coordinates: [-77.03, 38.90] },
20
+ * properties: { name: 'Washington, D.C.' }
21
+ * }]
22
+ * };
23
+ *
24
+ * const tile = geoJSONToTile(geojson, 10, 292, 391, { extent: 4096 });
25
+ * ```
26
+ *
27
+ * @param data - GeoJSON data (Feature, FeatureCollection, or Geometry)
28
+ * @param z - Tile zoom level
29
+ * @param x - Tile x coordinate
30
+ * @param y - Tile y coordinate
31
+ * @param options - Optional configuration for tile generation
32
+ * @returns The generated tile with geometries in tile coordinates, or null if no features
33
+ */
34
+ export declare function geoJSONToTile(data: GeoJSON.GeoJSON, z: number, x: number, y: number, options?: GeoJSONToTileOptions): GeoJSONVTTile;
35
+ //# sourceMappingURL=geojson-to-tile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geojson-to-tile.d.ts","sourceRoot":"","sources":["../src/geojson-to-tile.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,oBAAoB,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAgBvI"}