@versatiles/png-renderer 2.3.0 → 2.4.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +25 -5
  2. package/dist/index.js +5793 -144
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -2741,6 +2741,12 @@ declare class Feature implements Feature$1 {
2741
2741
  * clipped edges along the tile border are not part of the outline.
2742
2742
  */
2743
2743
  readonly outline?: Geometry;
2744
+ /**
2745
+ * The polygon as an opaque fill draws it — when it differs from the polygon's rings, i.e.
2746
+ * when the polygon was clipped to its tile: clipped a little beyond the tile instead, so
2747
+ * that it overlaps its continuation in the next tile, and no seam shows between them.
2748
+ */
2749
+ readonly fillGeometry?: Geometry;
2744
2750
  /**
2745
2751
  * For each line of the geometry, how far along the line in its tile it starts, in pixels
2746
2752
  * — where the line was clipped to its tile, which cut off its start. A dash pattern
@@ -2754,6 +2760,7 @@ declare class Feature implements Feature$1 {
2754
2760
  patterns?: Patterns;
2755
2761
  geometry: Geometry;
2756
2762
  outline?: Geometry;
2763
+ fillGeometry?: Geometry;
2757
2764
  lineStarts?: number[];
2758
2765
  });
2759
2766
  getBbox(): Bbox;
@@ -3071,11 +3078,19 @@ interface FetchResponse {
3071
3078
  arrayBuffer(): Promise<ArrayBuffer>;
3072
3079
  json(): Promise<unknown>;
3073
3080
  }
3081
+ /**
3082
+ * The part of `fetch`'s `RequestInit` the renderer passes. It sends request headers only
3083
+ * to read part of a file: a `Range` header for a PMTiles archive.
3084
+ */
3085
+ interface FetchRequestInit {
3086
+ headers?: Record<string, string>;
3087
+ }
3074
3088
  /**
3075
3089
  * Loads a URL, like `fetch`: the renderer loads tiles, sprites, TileJSON documents and GeoJSON data through it. It is called
3076
- * with the URL only, and should resolve to a `Response`.
3090
+ * with the URL, and for part of a file with request headers as well, and should resolve to
3091
+ * a `Response`.
3077
3092
  */
3078
- type FetchFunction = (url: string) => Promise<FetchResponse>;
3093
+ type FetchFunction = (url: string, init?: FetchRequestInit) => Promise<FetchResponse>;
3079
3094
 
3080
3095
  /** Options for {@link SVGMapRenderer}: what stays the same for every view of the map. */
3081
3096
  interface SVGMapRendererOptions {
@@ -3086,7 +3101,9 @@ interface SVGMapRendererOptions {
3086
3101
  * (`url: '.../tiles.json'`), which is fetched once, like the sprite, with
3087
3102
  * {@link SVGMapRendererOptions.fetch}. As in MapLibre GL JS, `tiles`, `minzoom`,
3088
3103
  * `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 GeoJSON source's `data`
3104
+ * relative tile URLs are resolved against the document's URL. A PMTiles archive
3105
+ * (`url: 'pmtiles://https://.../tiles.pmtiles'`) is read as with the `pmtiles` protocol in
3106
+ * MapLibre GL JS, which needs no setup here. A GeoJSON source's `data`
3090
3107
  * may be a URL too. A source whose TileJSON or GeoJSON cannot be loaded is left out, and
3091
3108
  * the next render tries again.
3092
3109
  */
@@ -3133,6 +3150,9 @@ interface SVGMapRendererOptions {
3133
3150
  * Loads tiles, sprites, TileJSON documents and GeoJSON data, like `fetch`, which is the default. Pass your own to send
3134
3151
  * headers, go through a proxy, or keep tiles in a cache on disk.
3135
3152
  *
3153
+ * It is called with the URL only, except to read part of a file, a PMTiles archive: then
3154
+ * also with `{ headers: { Range: 'bytes=…' } }`, which it should pass on.
3155
+ *
3136
3156
  * It must return a real `Response`, and its status matters: a 404 or 204 means the
3137
3157
  * server has no such tile, which is remembered (see {@link SVGMapRendererOptions.tileCacheSize}); any other
3138
3158
  * error status, or a rejected promise, counts as failed, and the next render tries
@@ -3242,7 +3262,7 @@ declare class SVGMapRenderer {
3242
3262
  */
3243
3263
  renderSVG(view?: ViewOptions): Promise<string>;
3244
3264
  /**
3245
- * Forgets the fetched tiles, sprite, TileJSON documents and GeoJSON data, so the next render fetches them again, e.g.
3265
+ * Forgets the fetched tiles, sprite, TileJSON documents, PMTiles directories and GeoJSON data, so the next render fetches them again, e.g.
3246
3266
  * after they were updated on the server, or to free their memory.
3247
3267
  */
3248
3268
  clearCache(): void;
@@ -3505,4 +3525,4 @@ declare class PNGMapRenderer extends SVGMapRenderer {
3505
3525
  }
3506
3526
 
3507
3527
  export { PNGMapRenderer, SVGMapRenderer, renderToCanvas, renderToPNG, renderToSVG };
3508
- export type { FetchFunction, FetchResponse, GlobalState, PNGMapRendererOptions, PNGViewOptions, RenderToPNGOptions, RenderToSVGOptions, SVGMapRendererOptions, ViewOptions };
3528
+ export type { FetchFunction, FetchRequestInit, FetchResponse, GlobalState, PNGMapRendererOptions, PNGViewOptions, RenderToPNGOptions, RenderToSVGOptions, SVGMapRendererOptions, ViewOptions };