@duoquote/polytini 0.1.0 → 0.1.1
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/LICENSE +21 -21
- package/README.md +120 -120
- package/dist/types/cli.d.cts +2 -2
- package/dist/types/deckgl.d.cts +72 -60
- package/dist/types/flexible.d.cts +92 -80
- package/dist/types/geojson.jsr.d.cts +111 -0
- package/dist/types/google.d.cts +48 -48
- package/dist/types/google.jsr.d.cts +72 -60
- package/dist/types/index.d.cts +109 -87
- package/dist/types/leaflet-auto.d.cts +4 -4
- package/dist/types/leaflet-auto.jsr.d.cts +2 -2
- package/dist/types/leaflet.d.cts +39 -39
- package/dist/types/leaflet.jsr.d.cts +15 -13
- package/dist/types/mapbox.d.cts +50 -50
- package/dist/types/mapbox.jsr.d.cts +5 -0
- package/dist/types/maplibre.d.cts +54 -54
- package/dist/types/maplibre.jsr.d.cts +92 -0
- package/dist/types/openlayers.d.cts +23 -23
- package/dist/types/openlayers.jsr.d.cts +42 -0
- package/dist/types/presets.d.cts +70 -66
- package/dist/types/turf.d.cts +33 -33
- package/dist/types/turf.jsr.d.cts +46 -0
- package/dist/types/wasm.d.cts +42 -33
- package/package.json +200 -200
- package/src/browser.js +15 -15
- package/src/bun.js +4 -4
- package/src/cli-lib.js +160 -160
- package/src/cli.js +7 -7
- package/src/core.js +268 -268
- package/src/deckgl.js +176 -176
- package/src/deno.js +12 -12
- package/src/error.js +15 -15
- package/src/fast.js +179 -179
- package/src/flexible.js +283 -283
- package/src/google.js +70 -70
- package/src/leaflet-auto.js +11 -11
- package/src/leaflet.js +44 -44
- package/src/mapbox.js +10 -10
- package/src/maplibre.js +57 -57
- package/src/node.js +17 -17
- package/src/openlayers.js +172 -172
- package/src/presets.js +242 -242
- package/src/text.js +111 -111
- package/src/turf.js +80 -80
- package/src/wasm-bytes.js +2 -2
- package/src/wasm.js +235 -235
- package/src/web.js +9 -9
- package/types/cli.d.ts +2 -2
- package/types/deckgl.d.ts +72 -60
- package/types/flexible.d.ts +92 -80
- package/types/geojson.jsr.d.ts +111 -0
- package/types/google.d.ts +48 -48
- package/types/google.jsr.d.ts +72 -60
- package/types/index.d.ts +109 -87
- package/types/leaflet-auto.d.ts +4 -4
- package/types/leaflet-auto.jsr.d.ts +2 -2
- package/types/leaflet.d.ts +39 -39
- package/types/leaflet.jsr.d.ts +15 -13
- package/types/mapbox.d.ts +50 -50
- package/types/mapbox.jsr.d.ts +5 -0
- package/types/maplibre.d.ts +54 -54
- package/types/maplibre.jsr.d.ts +92 -0
- package/types/openlayers.d.ts +23 -23
- package/types/openlayers.jsr.d.ts +42 -0
- package/types/presets.d.ts +70 -66
- package/types/turf.d.ts +33 -33
- package/types/turf.jsr.d.ts +46 -0
- package/types/wasm.d.ts +42 -33
package/types/openlayers.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
// Types for @duoquote/polytini/openlayers. Type-only imports: nothing from
|
|
2
|
-
// ol is loaded at runtime, you pass its classes to createPolylineFormat.
|
|
3
|
-
import type OlPolyline from 'ol/format/Polyline.js';
|
|
4
|
-
import type { Options } from 'ol/format/Polyline.js';
|
|
5
|
-
import type OlLineString from 'ol/geom/LineString.js';
|
|
6
|
-
|
|
7
|
-
export type { Options };
|
|
8
|
-
|
|
9
|
-
/** ol's classes, as imported from ol/format/Polyline.js and ol/geom/LineString.js. */
|
|
10
|
-
export interface OpenLayersClasses {
|
|
11
|
-
Polyline: typeof OlPolyline;
|
|
12
|
-
LineString: typeof OlLineString;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Makes a drop-in for ol/format/Polyline: the same constructor options
|
|
17
|
-
* (factor, geometryLayout), methods and output, faster. Unlike ol's,
|
|
18
|
-
* writeGeometry never changes the geometry it is given. Also takes the `ol`
|
|
19
|
-
* namespace of the full build ({ format: { Polyline }, geom: { LineString } }).
|
|
20
|
-
*/
|
|
21
|
-
export function createPolylineFormat(
|
|
22
|
-
ol: OpenLayersClasses | { format: { Polyline: typeof OlPolyline }; geom: { LineString: typeof OlLineString } },
|
|
23
|
-
): typeof OlPolyline;
|
|
1
|
+
// Types for @duoquote/polytini/openlayers. Type-only imports: nothing from
|
|
2
|
+
// ol is loaded at runtime, you pass its classes to createPolylineFormat.
|
|
3
|
+
import type OlPolyline from 'ol/format/Polyline.js';
|
|
4
|
+
import type { Options } from 'ol/format/Polyline.js';
|
|
5
|
+
import type OlLineString from 'ol/geom/LineString.js';
|
|
6
|
+
|
|
7
|
+
export type { Options };
|
|
8
|
+
|
|
9
|
+
/** ol's classes, as imported from ol/format/Polyline.js and ol/geom/LineString.js. */
|
|
10
|
+
export interface OpenLayersClasses {
|
|
11
|
+
Polyline: typeof OlPolyline;
|
|
12
|
+
LineString: typeof OlLineString;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Makes a drop-in for ol/format/Polyline: the same constructor options
|
|
17
|
+
* (factor, geometryLayout), methods and output, faster. Unlike ol's,
|
|
18
|
+
* writeGeometry never changes the geometry it is given. Also takes the `ol`
|
|
19
|
+
* namespace of the full build ({ format: { Polyline }, geom: { LineString } }).
|
|
20
|
+
*/
|
|
21
|
+
export function createPolylineFormat(
|
|
22
|
+
ol: OpenLayersClasses | { format: { Polyline: typeof OlPolyline }; geom: { LineString: typeof OlLineString } },
|
|
23
|
+
): typeof OlPolyline;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// JSR copy of openlayers.d.ts. JSR builds its docs without node_modules, so
|
|
2
|
+
// ol's classes are described structurally: the factory takes your Polyline
|
|
3
|
+
// and LineString classes and returns a subclass of the Polyline class you
|
|
4
|
+
// passed, with its type. The npm package's openlayers.d.ts uses ol's own
|
|
5
|
+
// types.
|
|
6
|
+
|
|
7
|
+
/** ol/format/Polyline's constructor options. */
|
|
8
|
+
export interface Options {
|
|
9
|
+
/** The factor the coordinates were multiplied by. Default 1e5. */
|
|
10
|
+
factor?: number;
|
|
11
|
+
/** The geometry layout. Default "XY". */
|
|
12
|
+
geometryLayout?: 'XY' | 'XYZ' | 'XYM' | 'XYZM';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** A Polyline format class: ol/format/Polyline or a subclass. */
|
|
16
|
+
export type PolylineClass = new (options?: Options) => object;
|
|
17
|
+
|
|
18
|
+
/** A LineString geometry class: ol/geom/LineString. */
|
|
19
|
+
export type LineStringClass = new (...args: never[]) => object;
|
|
20
|
+
|
|
21
|
+
/** ol's classes, as imported from ol/format/Polyline.js and ol/geom/LineString.js. */
|
|
22
|
+
export interface OpenLayersClasses<T extends PolylineClass> {
|
|
23
|
+
/** ol/format/Polyline's default export. */
|
|
24
|
+
Polyline: T;
|
|
25
|
+
/** ol/geom/LineString's default export. */
|
|
26
|
+
LineString: LineStringClass;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The full build's `ol` namespace. */
|
|
30
|
+
export interface OpenLayersNamespace<T extends PolylineClass> {
|
|
31
|
+
/** ol.format, with Polyline. */
|
|
32
|
+
format: { Polyline: T };
|
|
33
|
+
/** ol.geom, with LineString. */
|
|
34
|
+
geom: { LineString: LineStringClass };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Makes a drop-in for ol/format/Polyline: the same constructor options
|
|
39
|
+
* (factor, geometryLayout), methods and output, faster. Unlike ol's,
|
|
40
|
+
* writeGeometry never changes the geometry it is given.
|
|
41
|
+
*/
|
|
42
|
+
export function createPolylineFormat<T extends PolylineClass>(ol: OpenLayersClasses<T> | OpenLayersNamespace<T>): T;
|
package/types/presets.d.ts
CHANGED
|
@@ -1,66 +1,70 @@
|
|
|
1
|
-
// Option presets for routing engines that use the Google encoded polyline
|
|
2
|
-
// format. Each one is a plain options object for encode, decode,
|
|
3
|
-
// encodeFlat, decodeFlat, toGeoJSON and fromGeoJSON. See src/presets.js for
|
|
4
|
-
// the sources behind every value.
|
|
5
|
-
|
|
6
|
-
/** A 2D preset: precision and the order of the tuples you pass and get back. */
|
|
7
|
-
export interface Preset2D<P extends number = number, O extends 'latlng' | 'lnglat' = 'latlng' | 'lnglat'> {
|
|
8
|
-
|
|
9
|
-
readonly
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
export declare const
|
|
24
|
-
/**
|
|
25
|
-
export declare const
|
|
26
|
-
/**
|
|
27
|
-
export declare const
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export declare const
|
|
37
|
-
/**
|
|
38
|
-
export declare const
|
|
39
|
-
/**
|
|
40
|
-
export declare const
|
|
41
|
-
/**
|
|
42
|
-
export declare const
|
|
43
|
-
/**
|
|
44
|
-
export declare const
|
|
45
|
-
/**
|
|
46
|
-
export declare const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
readonly
|
|
55
|
-
readonly
|
|
56
|
-
readonly
|
|
57
|
-
readonly
|
|
58
|
-
readonly
|
|
59
|
-
readonly
|
|
60
|
-
readonly
|
|
61
|
-
readonly
|
|
62
|
-
readonly
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
1
|
+
// Option presets for routing engines that use the Google encoded polyline
|
|
2
|
+
// format. Each one is a plain options object for encode, decode,
|
|
3
|
+
// encodeFlat, decodeFlat, toGeoJSON and fromGeoJSON. See src/presets.js for
|
|
4
|
+
// the sources behind every value.
|
|
5
|
+
|
|
6
|
+
/** A 2D preset: precision and the order of the tuples you pass and get back. */
|
|
7
|
+
export interface Preset2D<P extends number = number, O extends 'latlng' | 'lnglat' = 'latlng' | 'lnglat'> {
|
|
8
|
+
/** Decimal places. */
|
|
9
|
+
readonly precision: P;
|
|
10
|
+
/** The tuple order. */
|
|
11
|
+
readonly order: O;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** A preset with a third value per point, scaled by `zFactor`. */
|
|
15
|
+
export interface Preset3D<P extends number = number, O extends 'latlng' | 'lnglat' = 'latlng' | 'lnglat'> extends Preset2D<P, O> {
|
|
16
|
+
/** Three values per point. */
|
|
17
|
+
readonly dimensions: 3;
|
|
18
|
+
/** The factor of the third value. */
|
|
19
|
+
readonly zFactor: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Google Maps Platform: precision 5, [lat, lng]. */
|
|
23
|
+
export declare const google: Preset2D<5, 'latlng'>;
|
|
24
|
+
/** OSRM geometries=polyline: precision 5, [lng, lat] like its GeoJSON. */
|
|
25
|
+
export declare const osrm: Preset2D<5, 'lnglat'>;
|
|
26
|
+
/** OSRM geometries=polyline6: precision 6, [lng, lat]. */
|
|
27
|
+
export declare const osrm6: Preset2D<6, 'lnglat'>;
|
|
28
|
+
/** Valhalla shapes: precision 6, [lng, lat] like its format=osrm GeoJSON. */
|
|
29
|
+
export declare const valhalla: Preset2D<6, 'lnglat'>;
|
|
30
|
+
/** Stadia Maps routing (Valhalla): precision 6, [lng, lat]. */
|
|
31
|
+
export declare const stadia: Preset2D<6, 'lnglat'>;
|
|
32
|
+
/**
|
|
33
|
+
* GraphHopper points_encoded=true: precision 5 (the default
|
|
34
|
+
* points_encoded_multiplier), [lng, lat] like points_encoded=false.
|
|
35
|
+
*/
|
|
36
|
+
export declare const graphhopper: Preset2D<5, 'lnglat'>;
|
|
37
|
+
/** GraphHopper with elevation=true: [lng, lat, elevation in meters], elevation stored in centimeters. */
|
|
38
|
+
export declare const graphhopper3d: Preset3D<5, 'lnglat'>;
|
|
39
|
+
/** openrouteservice JSON geometry: precision 5, [lng, lat] like its GeoJSON. */
|
|
40
|
+
export declare const openrouteservice: Preset2D<5, 'lnglat'>;
|
|
41
|
+
/** openrouteservice with elevation=true: [lng, lat, elevation in meters], elevation stored in centimeters. */
|
|
42
|
+
export declare const openrouteservice3d: Preset3D<5, 'lnglat'>;
|
|
43
|
+
/** Mapbox Directions geometries=polyline: precision 5, [lng, lat]. */
|
|
44
|
+
export declare const mapbox: Preset2D<5, 'lnglat'>;
|
|
45
|
+
/** Mapbox Directions geometries=polyline6: precision 6, [lng, lat]. */
|
|
46
|
+
export declare const mapbox6: Preset2D<6, 'lnglat'>;
|
|
47
|
+
/** Strava map.polyline and summary_polyline: precision 5, [lat, lng] like its latlng stream. */
|
|
48
|
+
export declare const strava: Preset2D<5, 'latlng'>;
|
|
49
|
+
/** OpenTripPlanner legGeometry.points: precision 5, [lat, lng]. */
|
|
50
|
+
export declare const otp: Preset2D<5, 'latlng'>;
|
|
51
|
+
|
|
52
|
+
/** Every preset, keyed by its export name. */
|
|
53
|
+
export declare const presets: {
|
|
54
|
+
readonly google: typeof google;
|
|
55
|
+
readonly osrm: typeof osrm;
|
|
56
|
+
readonly osrm6: typeof osrm6;
|
|
57
|
+
readonly valhalla: typeof valhalla;
|
|
58
|
+
readonly stadia: typeof stadia;
|
|
59
|
+
readonly graphhopper: typeof graphhopper;
|
|
60
|
+
readonly graphhopper3d: typeof graphhopper3d;
|
|
61
|
+
readonly openrouteservice: typeof openrouteservice;
|
|
62
|
+
readonly openrouteservice3d: typeof openrouteservice3d;
|
|
63
|
+
readonly mapbox: typeof mapbox;
|
|
64
|
+
readonly mapbox6: typeof mapbox6;
|
|
65
|
+
readonly strava: typeof strava;
|
|
66
|
+
readonly otp: typeof otp;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** The name of a preset in `presets`. */
|
|
70
|
+
export type PresetName = keyof typeof presets;
|
package/types/turf.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
// Types for @duoquote/polytini/turf, using Turf's and GeoJSON's own types.
|
|
2
|
-
import type { Feature, FeatureCollection, LineString, Polygon, GeoJsonProperties } from 'geojson';
|
|
3
|
-
import type { AllGeoJSON, Id } from '@turf/helpers';
|
|
4
|
-
import type { Options } from './index.d.ts';
|
|
5
|
-
|
|
6
|
-
export interface FeatureOptions<P = GeoJsonProperties> extends Options {
|
|
7
|
-
/** Feature properties. Default {}. */
|
|
8
|
-
properties?: P;
|
|
9
|
-
/** Feature id. */
|
|
10
|
-
id?: Id;
|
|
11
|
-
/** Add a [west, south, east, north] bbox. Default false. */
|
|
12
|
-
bbox?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface CollectionOptions<P = GeoJsonProperties> extends Options {
|
|
16
|
-
/** Shared properties, or one object per line. */
|
|
17
|
-
properties?: P | P[];
|
|
18
|
-
/** One id per line, or the same for all. */
|
|
19
|
-
id?: Id | Id[];
|
|
20
|
-
bbox?: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/** A Feature<LineString> ([lng, lat], like Turf) from one encoded line. */
|
|
24
|
-
export function toFeature<P = GeoJsonProperties>(encoded: string, options?: number | FeatureOptions<P>): Feature<LineString, P>;
|
|
25
|
-
|
|
26
|
-
/** A FeatureCollection<LineString>, one Feature per string. */
|
|
27
|
-
export function toFeatureCollection<P = GeoJsonProperties>(encoded: string[], options?: number | CollectionOptions<P>): FeatureCollection<LineString, P>;
|
|
28
|
-
|
|
29
|
-
/** A Feature<Polygon> from encoded rings: outer first, then holes. */
|
|
30
|
-
export function toPolygonFeature<P = GeoJsonProperties>(rings: string[], options?: number | FeatureOptions<P>): Feature<Polygon, P>;
|
|
31
|
-
|
|
32
|
-
/** Every line in any GeoJSON: LineStrings, MultiLineString parts and polygon rings, in document order. Points are skipped. */
|
|
33
|
-
export function fromGeoJSON(geojson: AllGeoJSON, options?: number | Options): string[];
|
|
1
|
+
// Types for @duoquote/polytini/turf, using Turf's and GeoJSON's own types.
|
|
2
|
+
import type { Feature, FeatureCollection, LineString, Polygon, GeoJsonProperties } from 'geojson';
|
|
3
|
+
import type { AllGeoJSON, Id } from '@turf/helpers';
|
|
4
|
+
import type { Options } from './index.d.ts';
|
|
5
|
+
|
|
6
|
+
export interface FeatureOptions<P = GeoJsonProperties> extends Options {
|
|
7
|
+
/** Feature properties. Default {}. */
|
|
8
|
+
properties?: P;
|
|
9
|
+
/** Feature id. */
|
|
10
|
+
id?: Id;
|
|
11
|
+
/** Add a [west, south, east, north] bbox. Default false. */
|
|
12
|
+
bbox?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface CollectionOptions<P = GeoJsonProperties> extends Options {
|
|
16
|
+
/** Shared properties, or one object per line. */
|
|
17
|
+
properties?: P | P[];
|
|
18
|
+
/** One id per line, or the same for all. */
|
|
19
|
+
id?: Id | Id[];
|
|
20
|
+
bbox?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** A Feature<LineString> ([lng, lat], like Turf) from one encoded line. */
|
|
24
|
+
export function toFeature<P = GeoJsonProperties>(encoded: string, options?: number | FeatureOptions<P>): Feature<LineString, P>;
|
|
25
|
+
|
|
26
|
+
/** A FeatureCollection<LineString>, one Feature per string. */
|
|
27
|
+
export function toFeatureCollection<P = GeoJsonProperties>(encoded: string[], options?: number | CollectionOptions<P>): FeatureCollection<LineString, P>;
|
|
28
|
+
|
|
29
|
+
/** A Feature<Polygon> from encoded rings: outer first, then holes. */
|
|
30
|
+
export function toPolygonFeature<P = GeoJsonProperties>(rings: string[], options?: number | FeatureOptions<P>): Feature<Polygon, P>;
|
|
31
|
+
|
|
32
|
+
/** Every line in any GeoJSON: LineStrings, MultiLineString parts and polygon rings, in document order. Points are skipped. */
|
|
33
|
+
export function fromGeoJSON(geojson: AllGeoJSON, options?: number | Options): string[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// JSR copy of turf.d.ts. JSR builds its docs without node_modules, so the
|
|
2
|
+
// GeoJSON types come from geojson.jsr.d.ts and Turf's Id and AllGeoJSON are
|
|
3
|
+
// written out here. They have the same shapes as @types/geojson's and
|
|
4
|
+
// @turf/helpers', which the npm package's turf.d.ts uses.
|
|
5
|
+
import type { Options } from './index.d.ts';
|
|
6
|
+
import type { Feature, FeatureCollection, Geometry, LineString, Polygon, GeoJsonProperties } from './geojson.jsr.d.ts';
|
|
7
|
+
|
|
8
|
+
export type { Feature, FeatureCollection, Geometry, GeometryCollection, Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, Position, BBox, GeoJsonProperties } from './geojson.jsr.d.ts';
|
|
9
|
+
|
|
10
|
+
/** A feature id, like Turf's Id. */
|
|
11
|
+
export type Id = string | number;
|
|
12
|
+
|
|
13
|
+
/** Any GeoJSON object, like Turf's AllGeoJSON. */
|
|
14
|
+
export type AllGeoJSON = Feature<Geometry | null> | FeatureCollection<Geometry | null> | Geometry;
|
|
15
|
+
|
|
16
|
+
/** Options for toFeature and toPolygonFeature. */
|
|
17
|
+
export interface FeatureOptions<P = GeoJsonProperties> extends Options {
|
|
18
|
+
/** Feature properties. Default {}. */
|
|
19
|
+
properties?: P;
|
|
20
|
+
/** Feature id. */
|
|
21
|
+
id?: Id;
|
|
22
|
+
/** Add a [west, south, east, north] bbox. Default false. */
|
|
23
|
+
bbox?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Options for toFeatureCollection. */
|
|
27
|
+
export interface CollectionOptions<P = GeoJsonProperties> extends Options {
|
|
28
|
+
/** Shared properties, or one object per line. */
|
|
29
|
+
properties?: P | P[];
|
|
30
|
+
/** One id per line, or the same for all. */
|
|
31
|
+
id?: Id | Id[];
|
|
32
|
+
/** Add a bbox to each feature. Default false. */
|
|
33
|
+
bbox?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A Feature<LineString> ([lng, lat], like Turf) from one encoded line. */
|
|
37
|
+
export function toFeature<P = GeoJsonProperties>(encoded: string, options?: number | FeatureOptions<P>): Feature<LineString, P>;
|
|
38
|
+
|
|
39
|
+
/** A FeatureCollection<LineString>, one Feature per string. */
|
|
40
|
+
export function toFeatureCollection<P = GeoJsonProperties>(encoded: string[], options?: number | CollectionOptions<P>): FeatureCollection<LineString, P>;
|
|
41
|
+
|
|
42
|
+
/** A Feature<Polygon> from encoded rings: outer first, then holes. */
|
|
43
|
+
export function toPolygonFeature<P = GeoJsonProperties>(rings: string[], options?: number | FeatureOptions<P>): Feature<Polygon, P>;
|
|
44
|
+
|
|
45
|
+
/** Every line in any GeoJSON: LineStrings, MultiLineString parts and polygon rings, in document order. Points are skipped. */
|
|
46
|
+
export function fromGeoJSON(geojson: AllGeoJSON, options?: number | Options): string[];
|
package/types/wasm.d.ts
CHANGED
|
@@ -1,33 +1,42 @@
|
|
|
1
|
-
// The /wasm entry: the same API as the main entry, after init.
|
|
2
|
-
import type * as P from './index.d.ts';
|
|
3
|
-
|
|
4
|
-
export type { Point, LatLngLike, Options, OptionsArg, ErrorCode, LineString, LineStringFeature } from './index.d.ts';
|
|
5
|
-
|
|
6
|
-
export declare const
|
|
7
|
-
|
|
8
|
-
export declare const
|
|
9
|
-
|
|
10
|
-
export declare const
|
|
11
|
-
|
|
12
|
-
export declare const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
|
|
1
|
+
// The /wasm entry: the same API as the main entry, after init.
|
|
2
|
+
import type * as P from './index.d.ts';
|
|
3
|
+
|
|
4
|
+
export type { Point, LatLngLike, Options, OptionsArg, ErrorCode, LineString, LineStringFeature } from './index.d.ts';
|
|
5
|
+
/** The main entry's encode. */
|
|
6
|
+
export declare const encode: typeof P.encode;
|
|
7
|
+
/** The main entry's decode. */
|
|
8
|
+
export declare const decode: typeof P.decode;
|
|
9
|
+
/** The main entry's encodeFlat. */
|
|
10
|
+
export declare const encodeFlat: typeof P.encodeFlat;
|
|
11
|
+
/** The main entry's decodeFlat. */
|
|
12
|
+
export declare const decodeFlat: typeof P.decodeFlat;
|
|
13
|
+
/** The main entry's decodeLatLng. */
|
|
14
|
+
export declare const decodeLatLng: typeof P.decodeLatLng;
|
|
15
|
+
/** The main entry's toGeoJSON. */
|
|
16
|
+
export declare const toGeoJSON: typeof P.toGeoJSON;
|
|
17
|
+
/** The main entry's fromGeoJSON. */
|
|
18
|
+
export declare const fromGeoJSON: typeof P.fromGeoJSON;
|
|
19
|
+
/** The main entry's PolylineError. */
|
|
20
|
+
export declare const PolylineError: typeof P.PolylineError;
|
|
21
|
+
/** The main entry's PolylineError type. */
|
|
22
|
+
export type PolylineError = P.PolylineError;
|
|
23
|
+
|
|
24
|
+
/** Compiles and instantiates the WASM module. Call once before anything else; repeat calls are free. */
|
|
25
|
+
export function init(): Promise<void>;
|
|
26
|
+
|
|
27
|
+
/** The same, synchronously. Fine here because the module is under 1 KB. */
|
|
28
|
+
export function initSync(): void;
|
|
29
|
+
|
|
30
|
+
/** Many lines decoded in one call: all points in one array, plus where each line starts. */
|
|
31
|
+
export interface ManyLines {
|
|
32
|
+
/** lat, lng pairs (lng, lat with order 'lnglat') of every line, back to back. */
|
|
33
|
+
coords: Float64Array;
|
|
34
|
+
/** The first point index of each line, then the total point count (length + 1 entries), as deck.gl's binary paths expect. */
|
|
35
|
+
starts: Uint32Array;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Decodes many lines in one WASM call. Strict mode throws on the first bad line. */
|
|
39
|
+
export function decodeMany(lines: readonly string[], options?: P.OptionsArg): ManyLines;
|
|
40
|
+
|
|
41
|
+
/** Encodes many lines in one WASM call: arrays of points, or the { coords, starts } shape decodeMany returns. */
|
|
42
|
+
export function encodeMany(lines: readonly (readonly P.Point[])[] | ManyLines, options?: P.OptionsArg): string[];
|