@versatiles/png-renderer 2.3.0 → 2.4.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.
- package/dist/index.d.ts +18 -5
- package/dist/index.js +5710 -131
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -3071,11 +3071,19 @@ interface FetchResponse {
|
|
|
3071
3071
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
3072
3072
|
json(): Promise<unknown>;
|
|
3073
3073
|
}
|
|
3074
|
+
/**
|
|
3075
|
+
* The part of `fetch`'s `RequestInit` the renderer passes. It sends request headers only
|
|
3076
|
+
* to read part of a file: a `Range` header for a PMTiles archive.
|
|
3077
|
+
*/
|
|
3078
|
+
interface FetchRequestInit {
|
|
3079
|
+
headers?: Record<string, string>;
|
|
3080
|
+
}
|
|
3074
3081
|
/**
|
|
3075
3082
|
* Loads a URL, like `fetch`: the renderer loads tiles, sprites, TileJSON documents and GeoJSON data through it. It is called
|
|
3076
|
-
* with the URL
|
|
3083
|
+
* with the URL, and for part of a file with request headers as well, and should resolve to
|
|
3084
|
+
* a `Response`.
|
|
3077
3085
|
*/
|
|
3078
|
-
type FetchFunction = (url: string) => Promise<FetchResponse>;
|
|
3086
|
+
type FetchFunction = (url: string, init?: FetchRequestInit) => Promise<FetchResponse>;
|
|
3079
3087
|
|
|
3080
3088
|
/** Options for {@link SVGMapRenderer}: what stays the same for every view of the map. */
|
|
3081
3089
|
interface SVGMapRendererOptions {
|
|
@@ -3086,7 +3094,9 @@ interface SVGMapRendererOptions {
|
|
|
3086
3094
|
* (`url: '.../tiles.json'`), which is fetched once, like the sprite, with
|
|
3087
3095
|
* {@link SVGMapRendererOptions.fetch}. As in MapLibre GL JS, `tiles`, `minzoom`,
|
|
3088
3096
|
* `maxzoom` and the like come from the document unless the style sets them, and
|
|
3089
|
-
* relative tile URLs are resolved against the document's URL. A
|
|
3097
|
+
* relative tile URLs are resolved against the document's URL. A PMTiles archive
|
|
3098
|
+
* (`url: 'pmtiles://https://.../tiles.pmtiles'`) is read as with the `pmtiles` protocol in
|
|
3099
|
+
* MapLibre GL JS, which needs no setup here. A GeoJSON source's `data`
|
|
3090
3100
|
* may be a URL too. A source whose TileJSON or GeoJSON cannot be loaded is left out, and
|
|
3091
3101
|
* the next render tries again.
|
|
3092
3102
|
*/
|
|
@@ -3133,6 +3143,9 @@ interface SVGMapRendererOptions {
|
|
|
3133
3143
|
* Loads tiles, sprites, TileJSON documents and GeoJSON data, like `fetch`, which is the default. Pass your own to send
|
|
3134
3144
|
* headers, go through a proxy, or keep tiles in a cache on disk.
|
|
3135
3145
|
*
|
|
3146
|
+
* It is called with the URL only, except to read part of a file, a PMTiles archive: then
|
|
3147
|
+
* also with `{ headers: { Range: 'bytes=…' } }`, which it should pass on.
|
|
3148
|
+
*
|
|
3136
3149
|
* It must return a real `Response`, and its status matters: a 404 or 204 means the
|
|
3137
3150
|
* server has no such tile, which is remembered (see {@link SVGMapRendererOptions.tileCacheSize}); any other
|
|
3138
3151
|
* error status, or a rejected promise, counts as failed, and the next render tries
|
|
@@ -3242,7 +3255,7 @@ declare class SVGMapRenderer {
|
|
|
3242
3255
|
*/
|
|
3243
3256
|
renderSVG(view?: ViewOptions): Promise<string>;
|
|
3244
3257
|
/**
|
|
3245
|
-
* Forgets the fetched tiles, sprite, TileJSON documents and GeoJSON data, so the next render fetches them again, e.g.
|
|
3258
|
+
* Forgets the fetched tiles, sprite, TileJSON documents, PMTiles directories and GeoJSON data, so the next render fetches them again, e.g.
|
|
3246
3259
|
* after they were updated on the server, or to free their memory.
|
|
3247
3260
|
*/
|
|
3248
3261
|
clearCache(): void;
|
|
@@ -3505,4 +3518,4 @@ declare class PNGMapRenderer extends SVGMapRenderer {
|
|
|
3505
3518
|
}
|
|
3506
3519
|
|
|
3507
3520
|
export { PNGMapRenderer, SVGMapRenderer, renderToCanvas, renderToPNG, renderToSVG };
|
|
3508
|
-
export type { FetchFunction, FetchResponse, GlobalState, PNGMapRendererOptions, PNGViewOptions, RenderToPNGOptions, RenderToSVGOptions, SVGMapRendererOptions, ViewOptions };
|
|
3521
|
+
export type { FetchFunction, FetchRequestInit, FetchResponse, GlobalState, PNGMapRendererOptions, PNGViewOptions, RenderToPNGOptions, RenderToSVGOptions, SVGMapRendererOptions, ViewOptions };
|