@maplibre/geojson-vt 5.0.3 → 5.0.4
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/clip.d.ts +3 -0
- package/dist/clip.d.ts.map +1 -0
- package/dist/clip.test.d.ts +2 -0
- package/dist/clip.test.d.ts.map +1 -0
- package/dist/convert.d.ts +9 -0
- package/dist/convert.d.ts.map +1 -0
- package/dist/definitions.d.ts +85 -0
- package/dist/definitions.d.ts.map +1 -0
- package/dist/difference.d.ts +67 -0
- package/dist/difference.d.ts.map +1 -0
- package/dist/difference.test.d.ts +2 -0
- package/dist/difference.test.d.ts.map +1 -0
- package/dist/feature.d.ts +12 -0
- package/dist/feature.d.ts.map +1 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/simplify.d.ts +9 -0
- package/dist/simplify.d.ts.map +1 -0
- package/dist/simplify.test.d.ts +2 -0
- package/dist/simplify.test.d.ts.map +1 -0
- package/dist/tile.d.ts +40 -0
- package/dist/tile.d.ts.map +1 -0
- package/dist/transform.d.ts +27 -0
- package/dist/transform.d.ts.map +1 -0
- package/dist/wrap.d.ts +3 -0
- package/dist/wrap.d.ts.map +1 -0
- package/package.json +9 -3
package/dist/clip.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { GeoJSONVTInternalFeature, GeoJSONVTOptions } from './definitions';
|
|
2
|
+
export declare function clip(features: GeoJSONVTInternalFeature[], scale: number, k1: number, k2: number, axis: number, minAll: number, maxAll: number, options: GeoJSONVTOptions): GeoJSONVTInternalFeature[] | null;
|
|
3
|
+
//# 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,EAAE,gBAAgB,EAAqB,MAAM,eAAe,CAAC;AAYnG,wBAAgB,IAAI,CAAC,QAAQ,EAAE,wBAAwB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,wBAAwB,EAAE,GAAG,IAAI,CAqG5M"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clip.test.d.ts","sourceRoot":"","sources":["../src/clip.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GeoJSONVTInternalFeature, GeoJSONVTOptions } from './definitions';
|
|
2
|
+
/**
|
|
3
|
+
* converts GeoJSON feature into an intermediate projected JSON vector format with simplification data
|
|
4
|
+
* @param data
|
|
5
|
+
* @param options
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare function convert(data: GeoJSON.GeoJSON, options: GeoJSONVTOptions): GeoJSONVTInternalFeature[];
|
|
9
|
+
//# 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,EAAE,wBAAwB,EAAE,gBAAgB,EAAqB,MAAM,eAAe,CAAC;AAEnG;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,wBAAwB,EAAE,CAiBpG"}
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
export type StartEndSizeArray = number[] & {
|
|
58
|
+
start?: number;
|
|
59
|
+
end?: number;
|
|
60
|
+
size?: number;
|
|
61
|
+
};
|
|
62
|
+
export type PartialGeoJSONVTFeature = {
|
|
63
|
+
id?: number | string | undefined;
|
|
64
|
+
tags: GeoJSON.GeoJsonProperties;
|
|
65
|
+
minX: number;
|
|
66
|
+
minY: number;
|
|
67
|
+
maxX: number;
|
|
68
|
+
maxY: number;
|
|
69
|
+
};
|
|
70
|
+
export type GeometryTypeMap = {
|
|
71
|
+
Point: number[];
|
|
72
|
+
MultiPoint: number[];
|
|
73
|
+
LineString: StartEndSizeArray;
|
|
74
|
+
MultiLineString: StartEndSizeArray[];
|
|
75
|
+
Polygon: StartEndSizeArray[];
|
|
76
|
+
MultiPolygon: StartEndSizeArray[][];
|
|
77
|
+
};
|
|
78
|
+
export type GeometryType = "Point" | "MultiPoint" | "LineString" | "MultiLineString" | "Polygon" | "MultiPolygon";
|
|
79
|
+
export type GeoJSONVTInternalFeature = {
|
|
80
|
+
[K in GeometryType]: PartialGeoJSONVTFeature & {
|
|
81
|
+
type: K;
|
|
82
|
+
geometry: GeometryTypeMap[K];
|
|
83
|
+
};
|
|
84
|
+
}[GeometryType];
|
|
85
|
+
//# 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,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;CAClB,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG,MAAM,EAAE,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3F,MAAM,MAAM,uBAAuB,GAAG;IAClC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,OAAO,CAAC,iBAAiB,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,eAAe,EAAE,iBAAiB,EAAE,CAAC;IACrC,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,YAAY,EAAE,iBAAiB,EAAE,EAAE,CAAC;CACvC,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,YAAY,GAAG,YAAY,GAAG,iBAAiB,GAAG,SAAS,GAAG,cAAc,CAAC;AAElH,MAAM,MAAM,wBAAwB,GAAG;KAClC,CAAC,IAAI,YAAY,GAAG,uBAAuB,GAAG;QAC3C,IAAI,EAAE,CAAC,CAAC;QACR,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;KAChC;CACJ,CAAC,YAAY,CAAC,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 @@
|
|
|
1
|
+
{"version":3,"file":"difference.test.d.ts","sourceRoot":"","sources":["../src/difference.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GeoJSONVTInternalFeature, GeometryType, GeometryTypeMap } from "./definitions";
|
|
2
|
+
export type SupportedGeometries = GeoJSON.Point | GeoJSON.MultiPoint | GeoJSON.LineString | GeoJSON.MultiLineString | GeoJSON.Polygon | GeoJSON.MultiPolygon;
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param id - the feature's ID
|
|
6
|
+
* @param type - the feature's type
|
|
7
|
+
* @param geom - the feature's geometry
|
|
8
|
+
* @param tags - the feature's properties
|
|
9
|
+
* @returns the created feature
|
|
10
|
+
*/
|
|
11
|
+
export declare function createFeature<T extends GeometryType>(id: number | string | undefined, type: T, geom: GeometryTypeMap[T], tags: GeoJSON.GeoJsonProperties): GeoJSONVTInternalFeature;
|
|
12
|
+
//# 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,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE7F,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC;AAE7J;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,YAAY,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,iBAAiB,GAAG,wBAAwB,CA0CnL"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type GeoJSONVTFeature, type GeoJSONVTFeatureNonPoint, type GeoJSONVTFeaturePoint, type GeoJSONVTTile } from './transform';
|
|
2
|
+
import { type GeoJSONVTInternalTile, type GeoJSONVTInternalTileFeature, type GeoJSONVTInternalTileFeaturePoint, type GeoJSONVTInternalTileFeaturNonPoint } from './tile';
|
|
3
|
+
import { type GeoJSONVTFeatureDiff, type GeoJSONVTSourceDiff } from './difference';
|
|
4
|
+
import type { GeoJSONVTInternalFeature, GeoJSONVTOptions, GeometryType, GeometryTypeMap, PartialGeoJSONVTFeature, StartEndSizeArray } from './definitions';
|
|
5
|
+
/**
|
|
6
|
+
* Main class for creating and managing a vector tile index from GeoJSON data.
|
|
7
|
+
*/
|
|
8
|
+
declare class GeoJSONVT {
|
|
9
|
+
private options;
|
|
10
|
+
/** @internal */
|
|
11
|
+
tiles: {
|
|
12
|
+
[key: string]: GeoJSONVTInternalTile;
|
|
13
|
+
};
|
|
14
|
+
private tileCoords;
|
|
15
|
+
/** @internal */
|
|
16
|
+
stats: {
|
|
17
|
+
[key: string]: number;
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
total: number;
|
|
21
|
+
private source?;
|
|
22
|
+
constructor(data: GeoJSON.GeoJSON, options: GeoJSONVTOptions);
|
|
23
|
+
/**
|
|
24
|
+
* splits features from a parent tile to sub-tiles.
|
|
25
|
+
* z, x, and y are the coordinates of the parent tile
|
|
26
|
+
* cz, cx, and cy are the coordinates of the target tile
|
|
27
|
+
*
|
|
28
|
+
* If no target tile is specified, splitting stops when we reach the maximum
|
|
29
|
+
* zoom or the number of points is low as specified in the options.
|
|
30
|
+
* @internal
|
|
31
|
+
* @param features - features to split
|
|
32
|
+
* @param z - tile zoom level
|
|
33
|
+
* @param x - tile x coordinate
|
|
34
|
+
* @param y - tile y coordinate
|
|
35
|
+
* @param cz - target tile zoom level
|
|
36
|
+
* @param cx - target tile x coordinate
|
|
37
|
+
* @param cy - target tile y coordinate
|
|
38
|
+
*/
|
|
39
|
+
splitTile(features: GeoJSONVTInternalFeature[], z: number, x: number, y: number, cz?: number, cx?: number, cy?: number): void;
|
|
40
|
+
/**
|
|
41
|
+
* Given z, x, and y tile coordinates, returns the corresponding tile with geometries in tile coordinates, much like MVT data is stored.
|
|
42
|
+
* @param z - tile zoom level
|
|
43
|
+
* @param x - tile x coordinate
|
|
44
|
+
* @param y - tile y coordinate
|
|
45
|
+
* @returns the transformed tile or null if not found
|
|
46
|
+
*/
|
|
47
|
+
getTile(z: number | string, x: number | string, y: number | string): GeoJSONVTTile | null;
|
|
48
|
+
/**
|
|
49
|
+
* Invalidates (removes) tiles affected by the provided features
|
|
50
|
+
* @internal
|
|
51
|
+
* @param features
|
|
52
|
+
*/
|
|
53
|
+
invalidateTiles(features: GeoJSONVTInternalFeature[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Updates the tile index by adding and/or removing geojson features
|
|
56
|
+
* invalidates tiles that are affected by the update for regeneration on next getTile call.
|
|
57
|
+
* @param diff - the source diff object
|
|
58
|
+
*/
|
|
59
|
+
updateData(diff: GeoJSONVTSourceDiff): void;
|
|
60
|
+
}
|
|
61
|
+
export default function geojsonvt(data: GeoJSON.GeoJSON, options?: GeoJSONVTOptions): GeoJSONVT;
|
|
62
|
+
export type { GeoJSONVTInternalFeature, GeoJSONVTOptions, GeoJSONVTInternalTile, GeoJSONVTInternalTileFeature, GeometryType, PartialGeoJSONVTFeature, GeoJSONVT, GeometryTypeMap, StartEndSizeArray, GeoJSONVTTile, GeoJSONVTFeature, GeoJSONVTSourceDiff, GeoJSONVTFeatureDiff, GeoJSONVTFeaturePoint, GeoJSONVTFeatureNonPoint, GeoJSONVTInternalTileFeaturePoint, GeoJSONVTInternalTileFeaturNonPoint };
|
|
63
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,KAAK,qBAAqB,EAAE,KAAK,aAAa,EAAC,MAAM,aAAa,CAAC;AAChJ,OAAO,EAAa,KAAK,qBAAqB,EAAE,KAAK,4BAA4B,EAAE,KAAK,iCAAiC,EAAE,KAAK,mCAAmC,EAAC,MAAM,QAAQ,CAAC;AACnL,OAAO,EAAkB,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAClG,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,YAAY,EAAE,eAAe,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAgB3J;;GAEG;AACH,cAAM,SAAS;IACX,OAAO,CAAC,OAAO,CAAmB;IAClC,gBAAgB;IACT,KAAK,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAA;KAAC,CAAC;IACrD,OAAO,CAAC,UAAU,CAAkD;IACpE,gBAAgB;IACT,KAAK,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,CAAM;IAC3C,gBAAgB;IACT,KAAK,EAAE,MAAM,CAAK;IACzB,OAAO,CAAC,MAAM,CAAC,CAA6B;gBAEhC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB;IA6C5D;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,QAAQ,EAAE,wBAAwB,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM;IA4FtH;;;;;;OAMG;IACH,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,GAAG,IAAI;IA+CzF;;;;OAIG;IACH,eAAe,CAAC,QAAQ,EAAE,wBAAwB,EAAE;IAuEpD;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,mBAAmB;CAwCvC;AAMD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,gBAAgB,aAElF;AAED,YAAY,EACR,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,EAC5B,YAAY,EACZ,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,iCAAiC,EACjC,mCAAmC,EACtC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* calculate simplification data using optimized Douglas-Peucker algorithm
|
|
3
|
+
* @param coords - flat array of coordinates
|
|
4
|
+
* @param first - index of the first coordinate in the segment
|
|
5
|
+
* @param last - index of the last coordinate in the segment
|
|
6
|
+
* @param sqTolerance - square tolerance value
|
|
7
|
+
*/
|
|
8
|
+
export declare function simplify(coords: number[], first: number, last: number, sqTolerance: number): void;
|
|
9
|
+
//# sourceMappingURL=simplify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simplify.d.ts","sourceRoot":"","sources":["../src/simplify.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,QAqC1F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simplify.test.d.ts","sourceRoot":"","sources":["../src/simplify.test.ts"],"names":[],"mappings":""}
|
package/dist/tile.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { GeoJSONVTInternalFeature, GeoJSONVTOptions } from "./definitions";
|
|
2
|
+
export type GeoJSONVTInternalTileFeaturePoint = {
|
|
3
|
+
id?: number | string | undefined;
|
|
4
|
+
type: 1;
|
|
5
|
+
tags: GeoJSON.GeoJsonProperties | null;
|
|
6
|
+
geometry: number[];
|
|
7
|
+
};
|
|
8
|
+
export type GeoJSONVTInternalTileFeaturNonPoint = {
|
|
9
|
+
id?: number | string | undefined;
|
|
10
|
+
type: 2 | 3;
|
|
11
|
+
tags: GeoJSON.GeoJsonProperties | null;
|
|
12
|
+
geometry: number[][];
|
|
13
|
+
};
|
|
14
|
+
export type GeoJSONVTInternalTileFeature = GeoJSONVTInternalTileFeaturePoint | GeoJSONVTInternalTileFeaturNonPoint;
|
|
15
|
+
export type GeoJSONVTInternalTile = {
|
|
16
|
+
features: GeoJSONVTInternalTileFeature[];
|
|
17
|
+
numPoints: number;
|
|
18
|
+
numSimplified: number;
|
|
19
|
+
numFeatures: number;
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
z: number;
|
|
23
|
+
transformed: boolean;
|
|
24
|
+
minX: number;
|
|
25
|
+
minY: number;
|
|
26
|
+
maxX: number;
|
|
27
|
+
maxY: number;
|
|
28
|
+
source: GeoJSONVTInternalFeature[] | null;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Creates a tile object from the given features
|
|
32
|
+
* @param features - the features to include in the tile
|
|
33
|
+
* @param z
|
|
34
|
+
* @param tx
|
|
35
|
+
* @param ty
|
|
36
|
+
* @param options - the options object
|
|
37
|
+
* @returns the created tile
|
|
38
|
+
*/
|
|
39
|
+
export declare function createTile(features: GeoJSONVTInternalFeature[], z: number, tx: number, ty: number, options: GeoJSONVTOptions): GeoJSONVTInternalTile;
|
|
40
|
+
//# sourceMappingURL=tile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tile.d.ts","sourceRoot":"","sources":["../src/tile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAqB,MAAM,eAAe,CAAC;AAEnG,MAAM,MAAM,iCAAiC,GAAG;IAC5C,EAAE,CAAC,EAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB,CAAA;AAED,MAAM,MAAM,mCAAmC,GAAG;IAC9C,EAAE,CAAC,EAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC;CACxB,CAAA;AACD,MAAM,MAAM,4BAA4B,GAAG,iCAAiC,GAAG,mCAAmC,CAAC;AAEnH,MAAM,MAAM,qBAAqB,GAAG;IAChC,QAAQ,EAAE,4BAA4B,EAAE,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,wBAAwB,EAAE,GAAG,IAAI,CAAC;CAC7C,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,wBAAwB,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,qBAAqB,CAwBpJ"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { GeoJSONVTInternalTile } from "./tile";
|
|
2
|
+
export type GeoJSONVTFeaturePoint = {
|
|
3
|
+
id?: number | string | undefined;
|
|
4
|
+
type: 1;
|
|
5
|
+
tags: GeoJSON.GeoJsonProperties | null;
|
|
6
|
+
geometry: [number, number][];
|
|
7
|
+
};
|
|
8
|
+
export type GeoJSONVTFeatureNonPoint = {
|
|
9
|
+
id?: number | string | undefined;
|
|
10
|
+
type: 2 | 3;
|
|
11
|
+
tags: GeoJSON.GeoJsonProperties | null;
|
|
12
|
+
geometry: [number, number][][];
|
|
13
|
+
};
|
|
14
|
+
export type GeoJSONVTFeature = GeoJSONVTFeaturePoint | GeoJSONVTFeatureNonPoint;
|
|
15
|
+
export type GeoJSONVTTile = GeoJSONVTInternalTile & {
|
|
16
|
+
transformed: true;
|
|
17
|
+
features: GeoJSONVTFeature[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Transforms the coordinates of each feature in the given tile from
|
|
21
|
+
* mercator-projected space into (extent x extent) tile space.
|
|
22
|
+
* @param tile - the tile to transform, this gets modified in place
|
|
23
|
+
* @param extent - the tile extent (usually 4096)
|
|
24
|
+
* @returns the transformed tile
|
|
25
|
+
*/
|
|
26
|
+
export declare function transformTile(tile: GeoJSONVTInternalTile, extent: number): GeoJSONVTTile;
|
|
27
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAEpD,MAAM,MAAM,qBAAqB,GAAG;IAChC,EAAE,CAAC,EAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IACvC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,EAAE,CAAC,EAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;IACZ,IAAI,EAAE,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IACvC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,wBAAwB,CAAC;AAEhF,MAAM,MAAM,aAAa,GAAG,qBAAqB,GAAG;IAChD,WAAW,EAAE,IAAI,CAAC;IAClB,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAC/B,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAgCxF"}
|
package/dist/wrap.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../src/wrap.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB,EAAqB,MAAM,eAAe,CAAC;AAGnG,wBAAgB,IAAI,CAAC,QAAQ,EAAE,wBAAwB,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,wBAAwB,EAAE,CAehH"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maplibre/geojson-vt",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"description": "Slice GeoJSON data into vector tiles efficiently",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"exports":
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/geojson-vt.mjs",
|
|
10
|
+
"default": "./dist/geojson-vt.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
7
13
|
"sideEffects": false,
|
|
8
14
|
"keywords": [
|
|
9
15
|
"spatial",
|
|
@@ -13,7 +19,7 @@
|
|
|
13
19
|
],
|
|
14
20
|
"author": "Vladimir Agafonkin",
|
|
15
21
|
"module": "dist/geojson-vt.mjs",
|
|
16
|
-
"main": "dist/geojson-vt
|
|
22
|
+
"main": "dist/geojson-vt.js",
|
|
17
23
|
"typings": "dist/index.d.ts",
|
|
18
24
|
"jsdelivr": "dist/geojson-vt.js",
|
|
19
25
|
"unpkg": "dist/geojson-vt.js",
|