@versatiles/container 1.2.2 → 1.2.3
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 +6 -6
- package/dist/index.d.ts +35 -0
- package/dist/index.js +35 -0
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -28,11 +28,11 @@ fs.writeFileSync('tile.' + header.tile_format, tile);
|
|
|
28
28
|
### Class: `Container`<a id="class_container"></a>
|
|
29
29
|
|
|
30
30
|
The `VersaTiles` class is a wrapper around a `.versatiles` container file. It provides methods\
|
|
31
|
-
to access tile data, metadata, and other properties within the container. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/
|
|
31
|
+
to access tile data, metadata, and other properties within the container. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/ca58c3578fd471796f01f5af73b174e3a7f48b4e/src/index.ts#L73">\[src]</a></sup>
|
|
32
32
|
|
|
33
33
|
#### Constructor: `new Container(source, options)`
|
|
34
34
|
|
|
35
|
-
Constructs a new instance of the VersaTiles class. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/
|
|
35
|
+
Constructs a new instance of the VersaTiles class. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/ca58c3578fd471796f01f5af73b174e3a7f48b4e/src/index.ts#L94">\[src]</a></sup>
|
|
36
36
|
|
|
37
37
|
**Parameters:**
|
|
38
38
|
|
|
@@ -44,7 +44,7 @@ Constructs a new instance of the VersaTiles class. <sup><a href="https://github.
|
|
|
44
44
|
|
|
45
45
|
#### Method: `getHeader()`
|
|
46
46
|
|
|
47
|
-
Asynchronously retrieves the header information from the `.versatiles` container. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/
|
|
47
|
+
Asynchronously retrieves the header information from the `.versatiles` container. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/ca58c3578fd471796f01f5af73b174e3a7f48b4e/src/index.ts#L116">\[src]</a></sup>
|
|
48
48
|
|
|
49
49
|
**Returns:** <code>Promise<[Header](#interface_header)></code>
|
|
50
50
|
|
|
@@ -52,7 +52,7 @@ Asynchronously retrieves the header information from the `.versatiles` container
|
|
|
52
52
|
|
|
53
53
|
Asynchronously retrieves the metadata associated with the `.versatiles` container.\
|
|
54
54
|
Metadata typically includes information about `vector_layers` for vector tiles.
|
|
55
|
-
If the container does not include metadata, this method returns `null`. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/
|
|
55
|
+
If the container does not include metadata, this method returns `null`. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/ca58c3578fd471796f01f5af73b174e3a7f48b4e/src/index.ts#L163">\[src]</a></sup>
|
|
56
56
|
|
|
57
57
|
**Returns:** <code>Promise\<undefined | string></code>
|
|
58
58
|
|
|
@@ -61,7 +61,7 @@ If the container does not include metadata, this method returns `null`. <sup><a
|
|
|
61
61
|
Asynchronously retrieves a specific tile's data as a Buffer. If the tile data is compressed as\
|
|
62
62
|
defined in the container header, the returned Buffer will contain the compressed data.
|
|
63
63
|
To obtain uncompressed data, use the `getTileUncompressed` method.
|
|
64
|
-
If the specified tile does not exist, the method returns `null`. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/
|
|
64
|
+
If the specified tile does not exist, the method returns `null`. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/ca58c3578fd471796f01f5af73b174e3a7f48b4e/src/index.ts#L190">\[src]</a></sup>
|
|
65
65
|
|
|
66
66
|
**Parameters:**
|
|
67
67
|
|
|
@@ -79,7 +79,7 @@ If the specified tile does not exist, the method returns `null`. <sup><a href="h
|
|
|
79
79
|
Asynchronously retrieves a specific tile's uncompressed data as a Buffer. This method first\
|
|
80
80
|
retrieves the compressed tile data using `getTile` and then decompresses it based on the
|
|
81
81
|
compression setting in the container header.
|
|
82
|
-
If the specified tile does not exist, the method returns `null`. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/
|
|
82
|
+
If the specified tile does not exist, the method returns `null`. <sup><a href="https://github.com/versatiles-org/node-versatiles-container/blob/ca58c3578fd471796f01f5af73b174e3a7f48b4e/src/index.ts#L238">\[src]</a></sup>
|
|
83
83
|
|
|
84
84
|
**Parameters:**
|
|
85
85
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
*
|
|
4
|
+
* This module provides functionality to interact with and retrieve tile data from `.versatiles` container files,
|
|
5
|
+
* typically used for storing geospatial tile data in a compressed, optimized format. The module supports
|
|
6
|
+
* multiple file and compression formats.
|
|
7
|
+
*
|
|
8
|
+
* Dependencies:
|
|
9
|
+
* - `HttpReader` and `FileReader`: Adapters for reading data from HTTP/HTTPS URLs or local files, respectively.
|
|
10
|
+
* - `decompress`: Utility for decompressing tile data in supported formats.
|
|
11
|
+
* - Type definitions (`Block`, `Compression`, `Format`, `Header`, `OpenOptions`, `Reader`, and `TileIndex`)
|
|
12
|
+
* from the module's `interfaces.js` file to ensure type safety and consistency.
|
|
13
|
+
*
|
|
14
|
+
* Exported Constants:
|
|
15
|
+
* - `FORMATS`: Supported formats organized by version for different tile data, including image formats (e.g., PNG, JPG)
|
|
16
|
+
* and vector formats (e.g., PBF).
|
|
17
|
+
* - `COMPRESSIONS`: Available compression types, including 'raw' (no compression), 'gzip', and 'br' (Brotli).
|
|
18
|
+
* - `MIMETYPES`: Maps supported tile formats to their respective MIME types for handling and delivery.
|
|
19
|
+
*
|
|
20
|
+
* Exported Types:
|
|
21
|
+
* - The module re-exports `Compression`, `Format`, `Header`, `OpenOptions`, and `Reader` types for use in other modules.
|
|
22
|
+
*
|
|
23
|
+
* Primary Class:
|
|
24
|
+
* - `Container`: A main wrapper class that provides methods to access tile data, metadata, and configuration settings
|
|
25
|
+
* for `.versatiles` containers. Methods include `getHeader`, `getMetadata`, `getTile`, and `getTileUncompressed`,
|
|
26
|
+
* which enable detailed control and retrieval of tile information, metadata, and decompressed content.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { Container } from '@versatiles/container';
|
|
31
|
+
* const container = new Container('path/to/versatiles-file');
|
|
32
|
+
* const tile = await container.getTile(12, 2200, 1343);
|
|
33
|
+
* const metadata = await container.getMetadata();
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
1
36
|
import type { Block, Header, OpenOptions, Reader, TileIndex } from './lib/interfaces.js';
|
|
2
37
|
export type { Compression, Format, Header, OpenOptions, Reader } from './lib/interfaces.js';
|
|
3
38
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module
|
|
3
|
+
*
|
|
4
|
+
* This module provides functionality to interact with and retrieve tile data from `.versatiles` container files,
|
|
5
|
+
* typically used for storing geospatial tile data in a compressed, optimized format. The module supports
|
|
6
|
+
* multiple file and compression formats.
|
|
7
|
+
*
|
|
8
|
+
* Dependencies:
|
|
9
|
+
* - `HttpReader` and `FileReader`: Adapters for reading data from HTTP/HTTPS URLs or local files, respectively.
|
|
10
|
+
* - `decompress`: Utility for decompressing tile data in supported formats.
|
|
11
|
+
* - Type definitions (`Block`, `Compression`, `Format`, `Header`, `OpenOptions`, `Reader`, and `TileIndex`)
|
|
12
|
+
* from the module's `interfaces.js` file to ensure type safety and consistency.
|
|
13
|
+
*
|
|
14
|
+
* Exported Constants:
|
|
15
|
+
* - `FORMATS`: Supported formats organized by version for different tile data, including image formats (e.g., PNG, JPG)
|
|
16
|
+
* and vector formats (e.g., PBF).
|
|
17
|
+
* - `COMPRESSIONS`: Available compression types, including 'raw' (no compression), 'gzip', and 'br' (Brotli).
|
|
18
|
+
* - `MIMETYPES`: Maps supported tile formats to their respective MIME types for handling and delivery.
|
|
19
|
+
*
|
|
20
|
+
* Exported Types:
|
|
21
|
+
* - The module re-exports `Compression`, `Format`, `Header`, `OpenOptions`, and `Reader` types for use in other modules.
|
|
22
|
+
*
|
|
23
|
+
* Primary Class:
|
|
24
|
+
* - `Container`: A main wrapper class that provides methods to access tile data, metadata, and configuration settings
|
|
25
|
+
* for `.versatiles` containers. Methods include `getHeader`, `getMetadata`, `getTile`, and `getTileUncompressed`,
|
|
26
|
+
* which enable detailed control and retrieval of tile information, metadata, and decompressed content.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { Container } from '@versatiles/container';
|
|
31
|
+
* const container = new Container('path/to/versatiles-file');
|
|
32
|
+
* const tile = await container.getTile(12, 2200, 1343);
|
|
33
|
+
* const metadata = await container.getMetadata();
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
1
36
|
import HttpReader from './lib/reader_http.js';
|
|
2
37
|
import FileReader from './lib/reader_file.js';
|
|
3
38
|
import { decompress } from './lib/decompress.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versatiles/container",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "A client library for reading VersaTiles containers",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
@@ -49,18 +49,18 @@
|
|
|
49
49
|
"versatiles"
|
|
50
50
|
],
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@types/jest": "^29.5.
|
|
53
|
-
"@types/node": "^22.
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
55
|
-
"@typescript-eslint/parser": "^8.
|
|
52
|
+
"@types/jest": "^29.5.14",
|
|
53
|
+
"@types/node": "^22.8.1",
|
|
54
|
+
"@typescript-eslint/eslint-plugin": "^8.11.0",
|
|
55
|
+
"@typescript-eslint/parser": "^8.11.0",
|
|
56
56
|
"@versatiles/release-tool": "^1.2.6",
|
|
57
|
-
"eslint": "^9.
|
|
57
|
+
"eslint": "^9.13.0",
|
|
58
58
|
"jest": "^29.7.0",
|
|
59
|
-
"npm-check-updates": "^17.1.
|
|
59
|
+
"npm-check-updates": "^17.1.6",
|
|
60
60
|
"ts-jest": "^29.2.5",
|
|
61
61
|
"ts-node": "^10.9.2",
|
|
62
|
-
"tsx": "^4.19.
|
|
63
|
-
"typescript": "^5.6.
|
|
64
|
-
"typescript-eslint": "^8.
|
|
62
|
+
"tsx": "^4.19.2",
|
|
63
|
+
"typescript": "^5.6.3",
|
|
64
|
+
"typescript-eslint": "^8.11.0"
|
|
65
65
|
}
|
|
66
66
|
}
|