@loaders.gl/wkt 4.2.0-alpha.6 → 4.2.0-beta.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/dist/dist.dev.js +15 -5
- package/dist/dist.min.js +2 -2
- package/dist/hex-wkb-loader.d.ts +23 -2
- package/dist/hex-wkb-loader.d.ts.map +1 -1
- package/dist/hex-wkb-loader.js +2 -0
- package/dist/index.cjs +16 -6
- package/dist/index.cjs.map +2 -2
- package/dist/lib/parse-wkb.js +4 -4
- package/dist/lib/utils/version.js +1 -1
- package/dist/twkb-loader.d.ts +41 -4
- package/dist/twkb-loader.d.ts.map +1 -1
- package/dist/twkb-loader.js +2 -0
- package/dist/twkb-writer.d.ts +16 -2
- package/dist/twkb-writer.d.ts.map +1 -1
- package/dist/wkb-loader.d.ts +41 -3
- package/dist/wkb-loader.d.ts.map +1 -1
- package/dist/wkb-loader.js +2 -0
- package/dist/wkb-writer.d.ts +16 -2
- package/dist/wkb-writer.d.ts.map +1 -1
- package/dist/wkt-crs-loader.d.ts +20 -3
- package/dist/wkt-crs-loader.d.ts.map +1 -1
- package/dist/wkt-crs-loader.js +2 -0
- package/dist/wkt-crs-writer.d.ts +17 -3
- package/dist/wkt-crs-writer.d.ts.map +1 -1
- package/dist/wkt-loader.d.ts +50 -4
- package/dist/wkt-loader.d.ts.map +1 -1
- package/dist/wkt-loader.js +3 -1
- package/dist/wkt-worker.js +4 -2
- package/dist/wkt-writer.d.ts +18 -2
- package/dist/wkt-writer.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/hex-wkb-loader.ts +4 -2
- package/src/lib/parse-wkb.ts +4 -4
- package/src/twkb-loader.ts +7 -4
- package/src/twkb-writer.ts +2 -2
- package/src/wkb-loader.ts +6 -4
- package/src/wkb-writer.ts +2 -2
- package/src/wkt-crs-loader.ts +4 -2
- package/src/wkt-crs-writer.ts +2 -2
- package/src/wkt-loader.ts +13 -7
- package/src/wkt-writer.ts +2 -2
package/src/wkt-crs-writer.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type WKTCRSWriterOptions = WriterOptions & {
|
|
|
18
18
|
* @see OGC Standard: https://www.ogc.org/standards/wkt-crs
|
|
19
19
|
* @see Wikipedia Page: https://en.wikipedia.org/wiki/Well-known_text_representation_of_coordinate_reference_systems
|
|
20
20
|
*/
|
|
21
|
-
export const WKTCRSWriter
|
|
21
|
+
export const WKTCRSWriter = {
|
|
22
22
|
name: 'WKT CRS (Well-Known Text Coordinate Reference System)',
|
|
23
23
|
id: 'wkt-crs',
|
|
24
24
|
module: 'wkt-crs',
|
|
@@ -36,4 +36,4 @@ export const WKTCRSWriter: WriterWithEncoder<WKTCRS, never, WKTCRSWriterOptions>
|
|
|
36
36
|
encodeSync: (wktcrs, options) =>
|
|
37
37
|
new TextEncoder().encode(encodeWKTCRS(wktcrs, options?.['wkt-crs'])),
|
|
38
38
|
encodeTextSync: (wktcrs, options) => encodeWKTCRS(wktcrs, options?.['wkt-crs'])
|
|
39
|
-
}
|
|
39
|
+
} as const satisfies WriterWithEncoder<WKTCRS, never, WKTCRSWriterOptions>;
|
package/src/wkt-loader.ts
CHANGED
|
@@ -9,18 +9,24 @@ import {Geometry} from '@loaders.gl/schema';
|
|
|
9
9
|
import {isWKT, WKT_MAGIC_STRINGS} from './lib/parse-wkt';
|
|
10
10
|
|
|
11
11
|
export type WKTLoaderOptions = LoaderOptions & {
|
|
12
|
-
/** Options for the
|
|
12
|
+
/** Options for the WKTLoader */
|
|
13
13
|
wkt?: {
|
|
14
|
+
/** Shape of returned geometry */
|
|
14
15
|
shape?: 'geojson-geometry'; // 'binary-geometry'
|
|
15
16
|
/** Whether to add any CRS, if found, as undocumented CRS property on the returned geometry */
|
|
16
17
|
crs?: boolean;
|
|
18
|
+
/** Override the URL to the worker bundle (by default loads from unpkg.com) */
|
|
19
|
+
workerUrl?: string;
|
|
17
20
|
};
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* Well-Known text worker loader
|
|
22
25
|
*/
|
|
23
|
-
export const WKTWorkerLoader
|
|
26
|
+
export const WKTWorkerLoader = {
|
|
27
|
+
dataType: null as unknown as Geometry,
|
|
28
|
+
batchType: null as never,
|
|
29
|
+
|
|
24
30
|
name: 'WKT (Well-Known Text)',
|
|
25
31
|
id: 'wkt',
|
|
26
32
|
module: 'wkt',
|
|
@@ -38,13 +44,13 @@ export const WKTWorkerLoader: Loader<Geometry, never, WKTLoaderOptions> = {
|
|
|
38
44
|
crs: true
|
|
39
45
|
}
|
|
40
46
|
}
|
|
41
|
-
}
|
|
47
|
+
} as const satisfies Loader<Geometry, never, WKTLoaderOptions>;
|
|
42
48
|
|
|
43
49
|
/**
|
|
44
50
|
* Well-Known text loader
|
|
45
51
|
*/
|
|
46
|
-
export const WKTLoader
|
|
52
|
+
export const WKTLoader = {
|
|
47
53
|
...WKTWorkerLoader,
|
|
48
|
-
parse: async (arrayBuffer, options) => parseWKT(new TextDecoder().decode(arrayBuffer), options),
|
|
49
|
-
parseTextSync: parseWKT
|
|
50
|
-
}
|
|
54
|
+
parse: async (arrayBuffer, options?) => parseWKT(new TextDecoder().decode(arrayBuffer), options),
|
|
55
|
+
parseTextSync: (string: string, options?) => parseWKT(string, options)
|
|
56
|
+
} as const satisfies LoaderWithParser<Geometry, never, WKTLoaderOptions>;
|
package/src/wkt-writer.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type WKTWriterOptions = WriterOptions & {
|
|
|
14
14
|
/**
|
|
15
15
|
* WKT exporter
|
|
16
16
|
*/
|
|
17
|
-
export const WKTWriter
|
|
17
|
+
export const WKTWriter = {
|
|
18
18
|
name: 'WKT (Well Known Text)',
|
|
19
19
|
id: 'wkt',
|
|
20
20
|
module: 'wkt',
|
|
@@ -27,7 +27,7 @@ export const WKTWriter: WriterWithEncoder<Geometry, never, WKTWriterOptions> = {
|
|
|
27
27
|
options: {
|
|
28
28
|
wkt: {}
|
|
29
29
|
}
|
|
30
|
-
}
|
|
30
|
+
} as const satisfies WriterWithEncoder<Geometry, never, WKTWriterOptions>;
|
|
31
31
|
|
|
32
32
|
function encodeWKTSync(geometry: Geometry): ArrayBuffer {
|
|
33
33
|
return new TextEncoder().encode(encodeWKT(geometry)).buffer;
|