isard 0.5.1 → 0.6.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/index.d.ts CHANGED
@@ -30,14 +30,15 @@ export type { CustomFrame, CustomLayerInterface, GroundOptions, GroundTexture, M
30
30
  export { CustomLayer, GroundLayer, Layer, ModelLayer, NetworkLayer, RasterLayer, Tiles3dLayer, } from './layers.ts';
31
31
  export { GeoMap } from './map.ts';
32
32
  export { type Anchor, Marker, type MarkerEvent, type MarkerEvents, type MarkerOptions, Popup, type PopupEvents, type PopupOptions, } from './overlay.ts';
33
+ export { PMTiles, type PmtilesEntry, type PmtilesHeader, type PmtilesTileType, tileIdToZxy, zxyToTileId, } from './pmtiles.ts';
33
34
  export type { ClassStyle, PointCloudOptions, PointCloudStyle, PointColor } from './pointclouds.ts';
34
35
  export { CLASSIFICATIONS, ELEVATION_RAMP, PointCloudLayer } from './pointclouds.ts';
35
36
  export type { Overlap, SymbolOptions, SymbolStyle } from './symbols.ts';
36
37
  export { SymbolLayer } from './symbols.ts';
37
38
  export { parseTopoJson, type TopoGeometry, type Topology } from './topojson.ts';
38
- export type { AnimationOptions, AtmosphereOptions, Basemap, BasemapName, BodyOptions, CelestialBody, FeatureHit, FlyToOptions, GeoMapOptions, LegacyBasemap, LoadingMode, LonLat, MapEvents, MapHoverFeatureEvent, MapPointerEvent, NetworkOptions, NetworkStyle, Point, Projection, RasterGrid, RasterOptions, RasterStyle, TerrainEncoding, TerrainModel, TerrainOptions, Tiles3dOptions, Tiles3dStyle, } from './types.ts';
39
+ export type { AnimationOptions, AtmosphereOptions, Basemap, BasemapName, BodyOptions, CelestialBody, FeatureHit, FlyToOptions, GeoMapOptions, LegacyBasemap, LoadingMode, LonLat, MapEvents, MapHoverFeatureEvent, MapPointerEvent, NetworkOptions, NetworkStyle, Point, Projection, RasterGrid, RasterOptions, RasterStyle, TerrainEncoding, TerrainModel, TerrainOptions, Tiles3dOptions, Tiles3dStyle, ViewshedOptions, } from './types.ts';
39
40
  export type { CandidateIcon, CandidateOverlap, Json, LabelCandidate, RasterSource, Style, StyleLayer, } from './vectorstyle.ts';
40
- export type { VectorTilesOptions } from './vectortiles.ts';
41
- export { OPENFREEMAP_STYLES, PLAN_STYLES, VectorTiles } from './vectortiles.ts';
41
+ export type { PmtilesOptions, VectorTilesOptions } from './vectortiles.ts';
42
+ export { basicStyle, OPENFREEMAP_STYLES, PLAN_STYLES, VectorTiles } from './vectortiles.ts';
42
43
  export type { Camera, NetworkStats, PickHit, PickResult, PointCloudInfo, PointCloudPoint, PointCloudStats, RasterLayerStats, Tiles3dStats, } from './wasm/isard.js';
43
44
  export { parseWmtsGrid, wmtsGrid } from './wmts.ts';
package/dist/index.js CHANGED
@@ -23,9 +23,10 @@ export { parseKml } from "./kml.js";
23
23
  export { CustomLayer, GroundLayer, Layer, ModelLayer, NetworkLayer, RasterLayer, Tiles3dLayer, } from "./layers.js";
24
24
  export { GeoMap } from "./map.js";
25
25
  export { Marker, Popup, } from "./overlay.js";
26
+ export { PMTiles, tileIdToZxy, zxyToTileId, } from "./pmtiles.js";
26
27
  export { CLASSIFICATIONS, ELEVATION_RAMP, PointCloudLayer } from "./pointclouds.js";
27
28
  export { SymbolLayer } from "./symbols.js";
28
29
  export { parseTopoJson } from "./topojson.js";
29
- export { OPENFREEMAP_STYLES, PLAN_STYLES, VectorTiles } from "./vectortiles.js";
30
+ export { basicStyle, OPENFREEMAP_STYLES, PLAN_STYLES, VectorTiles } from "./vectortiles.js";
30
31
  export { parseWmtsGrid, wmtsGrid } from "./wmts.js";
31
32
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EACL,kBAAkB,EAIlB,mBAAmB,EACnB,iBAAiB,GAElB,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAqBjD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE5G,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AASpC,OAAO,EACL,WAAW,EACX,WAAW,EACX,KAAK,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAEL,MAAM,EAIN,KAAK,GAGN,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEpF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAoC,MAAM,eAAe,CAAC;AAwChF,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAYhF,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC","sourcesContent":["/**\n * isard: a WebGL2 map engine for large, interactive data layers, labels and 3D Tiles.\n *\n * ```ts\n * import { GeoMap } from 'isard';\n * const map = await GeoMap.create(container, { center: [2.4246, 48.8457], zoom: 13 });\n * const network = map.addNetwork({ nodes, edges, max: 1800, contour: 300 });\n * map.on('hover', ({ lonLat }) => lonLat && network.setValues(travelTimes(lonLat)));\n * map.addTiles3d({ url: 'https://…/tileset.json' });\n * map.addControl(new NavigationControl());\n * new Marker().setLonLat([2.4246, 48.8457]).setPopup(new Popup({ offset: [0, -34] }).setText('Here')).addTo(map);\n * ```\n */\nexport { OPENFREEMAP_ATTRIBUTION, TERRAIN_TILES_ATTRIBUTION } from './basemaps.ts';\nexport {\n AttributionControl,\n type AttributionOptions,\n type Control,\n type ControlPosition,\n DEFAULT_ATTRIBUTION,\n NavigationControl,\n type NavigationOptions,\n} from './controls.ts';\nexport {\n type Crs,\n type CrsLike,\n getCrs,\n lambertConformalConic,\n registerCrs,\n reproject,\n transverseMercator,\n} from './crs.ts';\nexport type { DecoderUrls } from './decoders.ts';\nexport type { ExtrusionOptions, ExtrusionStyle, PolygonArrays, TileKey } from './extrusions.ts';\nexport { ExtrusionLayer } from './extrusions.ts';\nexport type {\n CircleOptions,\n CircleStyle,\n Feature,\n FeatureCollection,\n FeatureData,\n FeatureLayerStyle,\n FillOptions,\n FillStyle,\n Geometry,\n LineOptions,\n LineStyle,\n Placement,\n Position,\n Properties,\n Ramp,\n Size,\n Stops,\n Styled,\n} from './features.ts';\nexport { CircleLayer, FeatureLayer, FillLayer, interpolate, LineLayer, parseColor } from './features.ts';\nexport { geoplateformeWfs, geoplateformeWms, geoplateformeWmts, IGN_ATTRIBUTION } from './geoplateforme.ts';\nexport type { TextPart } from './glyphs.ts';\nexport { DEFAULT_FONT, GLYPHS_URL } from './glyphs.ts';\nexport { parseGpx } from './gpx.ts';\nexport type { TileGrid, TileMatrix } from './grid.ts';\nexport type { ImageOptions, Pixels, SpriteIcon } from './icons.ts';\nexport { parseKml } from './kml.ts';\nexport type {\n CustomFrame,\n CustomLayerInterface,\n GroundOptions,\n GroundTexture,\n ModelInstance,\n ModelOptions,\n} from './layers.ts';\nexport {\n CustomLayer,\n GroundLayer,\n Layer,\n ModelLayer,\n NetworkLayer,\n RasterLayer,\n Tiles3dLayer,\n} from './layers.ts';\nexport { GeoMap } from './map.ts';\nexport {\n type Anchor,\n Marker,\n type MarkerEvent,\n type MarkerEvents,\n type MarkerOptions,\n Popup,\n type PopupEvents,\n type PopupOptions,\n} from './overlay.ts';\nexport type { ClassStyle, PointCloudOptions, PointCloudStyle, PointColor } from './pointclouds.ts';\nexport { CLASSIFICATIONS, ELEVATION_RAMP, PointCloudLayer } from './pointclouds.ts';\nexport type { Overlap, SymbolOptions, SymbolStyle } from './symbols.ts';\nexport { SymbolLayer } from './symbols.ts';\nexport { parseTopoJson, type TopoGeometry, type Topology } from './topojson.ts';\nexport type {\n AnimationOptions,\n AtmosphereOptions,\n Basemap,\n BasemapName,\n BodyOptions,\n CelestialBody,\n FeatureHit,\n FlyToOptions,\n GeoMapOptions,\n LegacyBasemap,\n LoadingMode,\n LonLat,\n MapEvents,\n MapHoverFeatureEvent,\n MapPointerEvent,\n NetworkOptions,\n NetworkStyle,\n Point,\n Projection,\n RasterGrid,\n RasterOptions,\n RasterStyle,\n TerrainEncoding,\n TerrainModel,\n TerrainOptions,\n Tiles3dOptions,\n Tiles3dStyle,\n} from './types.ts';\nexport type {\n CandidateIcon,\n CandidateOverlap,\n Json,\n LabelCandidate,\n RasterSource,\n Style,\n StyleLayer,\n} from './vectorstyle.ts';\nexport type { VectorTilesOptions } from './vectortiles.ts';\nexport { OPENFREEMAP_STYLES, PLAN_STYLES, VectorTiles } from './vectortiles.ts';\nexport type {\n Camera,\n NetworkStats,\n PickHit,\n PickResult,\n PointCloudInfo,\n PointCloudPoint,\n PointCloudStats,\n RasterLayerStats,\n Tiles3dStats,\n} from './wasm/isard.js';\nexport { parseWmtsGrid, wmtsGrid } from './wmts.ts';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EACL,kBAAkB,EAIlB,mBAAmB,EACnB,iBAAiB,GAElB,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAqBjD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE5G,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AASpC,OAAO,EACL,WAAW,EACX,WAAW,EACX,KAAK,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAEL,MAAM,EAIN,KAAK,GAGN,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,OAAO,EAIP,WAAW,EACX,WAAW,GACZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEpF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAoC,MAAM,eAAe,CAAC;AAyChF,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAY5F,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC","sourcesContent":["/**\n * isard: a WebGL2 map engine for large, interactive data layers, labels and 3D Tiles.\n *\n * ```ts\n * import { GeoMap } from 'isard';\n * const map = await GeoMap.create(container, { center: [2.4246, 48.8457], zoom: 13 });\n * const network = map.addNetwork({ nodes, edges, max: 1800, contour: 300 });\n * map.on('hover', ({ lonLat }) => lonLat && network.setValues(travelTimes(lonLat)));\n * map.addTiles3d({ url: 'https://…/tileset.json' });\n * map.addControl(new NavigationControl());\n * new Marker().setLonLat([2.4246, 48.8457]).setPopup(new Popup({ offset: [0, -34] }).setText('Here')).addTo(map);\n * ```\n */\nexport { OPENFREEMAP_ATTRIBUTION, TERRAIN_TILES_ATTRIBUTION } from './basemaps.ts';\nexport {\n AttributionControl,\n type AttributionOptions,\n type Control,\n type ControlPosition,\n DEFAULT_ATTRIBUTION,\n NavigationControl,\n type NavigationOptions,\n} from './controls.ts';\nexport {\n type Crs,\n type CrsLike,\n getCrs,\n lambertConformalConic,\n registerCrs,\n reproject,\n transverseMercator,\n} from './crs.ts';\nexport type { DecoderUrls } from './decoders.ts';\nexport type { ExtrusionOptions, ExtrusionStyle, PolygonArrays, TileKey } from './extrusions.ts';\nexport { ExtrusionLayer } from './extrusions.ts';\nexport type {\n CircleOptions,\n CircleStyle,\n Feature,\n FeatureCollection,\n FeatureData,\n FeatureLayerStyle,\n FillOptions,\n FillStyle,\n Geometry,\n LineOptions,\n LineStyle,\n Placement,\n Position,\n Properties,\n Ramp,\n Size,\n Stops,\n Styled,\n} from './features.ts';\nexport { CircleLayer, FeatureLayer, FillLayer, interpolate, LineLayer, parseColor } from './features.ts';\nexport { geoplateformeWfs, geoplateformeWms, geoplateformeWmts, IGN_ATTRIBUTION } from './geoplateforme.ts';\nexport type { TextPart } from './glyphs.ts';\nexport { DEFAULT_FONT, GLYPHS_URL } from './glyphs.ts';\nexport { parseGpx } from './gpx.ts';\nexport type { TileGrid, TileMatrix } from './grid.ts';\nexport type { ImageOptions, Pixels, SpriteIcon } from './icons.ts';\nexport { parseKml } from './kml.ts';\nexport type {\n CustomFrame,\n CustomLayerInterface,\n GroundOptions,\n GroundTexture,\n ModelInstance,\n ModelOptions,\n} from './layers.ts';\nexport {\n CustomLayer,\n GroundLayer,\n Layer,\n ModelLayer,\n NetworkLayer,\n RasterLayer,\n Tiles3dLayer,\n} from './layers.ts';\nexport { GeoMap } from './map.ts';\nexport {\n type Anchor,\n Marker,\n type MarkerEvent,\n type MarkerEvents,\n type MarkerOptions,\n Popup,\n type PopupEvents,\n type PopupOptions,\n} from './overlay.ts';\nexport {\n PMTiles,\n type PmtilesEntry,\n type PmtilesHeader,\n type PmtilesTileType,\n tileIdToZxy,\n zxyToTileId,\n} from './pmtiles.ts';\nexport type { ClassStyle, PointCloudOptions, PointCloudStyle, PointColor } from './pointclouds.ts';\nexport { CLASSIFICATIONS, ELEVATION_RAMP, PointCloudLayer } from './pointclouds.ts';\nexport type { Overlap, SymbolOptions, SymbolStyle } from './symbols.ts';\nexport { SymbolLayer } from './symbols.ts';\nexport { parseTopoJson, type TopoGeometry, type Topology } from './topojson.ts';\nexport type {\n AnimationOptions,\n AtmosphereOptions,\n Basemap,\n BasemapName,\n BodyOptions,\n CelestialBody,\n FeatureHit,\n FlyToOptions,\n GeoMapOptions,\n LegacyBasemap,\n LoadingMode,\n LonLat,\n MapEvents,\n MapHoverFeatureEvent,\n MapPointerEvent,\n NetworkOptions,\n NetworkStyle,\n Point,\n Projection,\n RasterGrid,\n RasterOptions,\n RasterStyle,\n TerrainEncoding,\n TerrainModel,\n TerrainOptions,\n Tiles3dOptions,\n Tiles3dStyle,\n ViewshedOptions,\n} from './types.ts';\nexport type {\n CandidateIcon,\n CandidateOverlap,\n Json,\n LabelCandidate,\n RasterSource,\n Style,\n StyleLayer,\n} from './vectorstyle.ts';\nexport type { PmtilesOptions, VectorTilesOptions } from './vectortiles.ts';\nexport { basicStyle, OPENFREEMAP_STYLES, PLAN_STYLES, VectorTiles } from './vectortiles.ts';\nexport type {\n Camera,\n NetworkStats,\n PickHit,\n PickResult,\n PointCloudInfo,\n PointCloudPoint,\n PointCloudStats,\n RasterLayerStats,\n Tiles3dStats,\n} from './wasm/isard.js';\nexport { parseWmtsGrid, wmtsGrid } from './wmts.ts';\n"]}
Binary file
Binary file
package/dist/map.d.ts CHANGED
@@ -5,8 +5,8 @@ import { type ImageOptions, type Pixels } from './icons.ts';
5
5
  import { CustomLayer, type CustomLayerInterface, GroundLayer, type GroundOptions, type Layer, ModelLayer, type ModelOptions, NetworkLayer, RasterLayer, Tiles3dLayer } from './layers.ts';
6
6
  import { PointCloudLayer, type PointCloudOptions } from './pointclouds.ts';
7
7
  import { SymbolLayer, type SymbolOptions } from './symbols.ts';
8
- import type { AnimationOptions, AtmosphereOptions, Basemap, FeatureHit, FlyToOptions, GeoMapOptions, LoadingMode, LonLat, MapEvents, NetworkOptions, Point, Projection, RasterOptions, TerrainModel, TerrainOptions, Tiles3dOptions } from './types.ts';
9
- import { VectorTiles, type VectorTilesOptions } from './vectortiles.ts';
8
+ import type { AnimationOptions, AtmosphereOptions, Basemap, FeatureHit, FlyToOptions, GeoMapOptions, LoadingMode, LonLat, MapEvents, NetworkOptions, Point, Projection, RasterOptions, TerrainModel, TerrainOptions, Tiles3dOptions, ViewshedOptions } from './types.ts';
9
+ import { type PmtilesOptions, VectorTiles, type VectorTilesOptions } from './vectortiles.ts';
10
10
  import type { Camera, PickHit, RasterLayerStats } from './wasm/isard.js';
11
11
  /** A map (see `GeoMap.create`); layers take it as their host */
12
12
  export declare class GeoMap {
@@ -136,6 +136,11 @@ export declare class GeoMap {
136
136
  setLoading(mode: LoadingMode): void;
137
137
  /** Space behind the globe (stars, atmosphere halo) */
138
138
  setSky(enabled: boolean): void;
139
+ /** Tints what can be seen from a point and what is hidden from it, within a range, all around or within a cone
140
+ * (`direction`): the relief, extrusions, 3D Tiles and models hide what lies behind them (only what the map has
141
+ * loaded for its view). Several observers (16 at most): what any of them sees is seen, what is hidden from all those
142
+ * that reach it is hidden, in the colors and opacity of the first. Undefined or none removes it */
143
+ setViewshed(options: ViewshedOptions | readonly ViewshedOptions[] | undefined): void;
139
144
  /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles, NASA's
140
145
  * on the Moon and Mars), one of the Earth's models by name (`'ign'`), its options, or false; on another body, its
141
146
  * options with a `url` */
@@ -181,6 +186,13 @@ export declare class GeoMap {
181
186
  addRaster(options: RasterOptions & {
182
187
  before?: Layer;
183
188
  }): RasterLayer;
189
+ /**
190
+ * A PMTiles archive (v3) read by range requests: a raster layer of its images, or vector tiles drawn with `style` (by
191
+ * default a plain style of the archive's layers) with their labels. Its header decides which unless `kind` says;
192
+ * `url` with or without `pmtiles://`, relative to the page, or a `blob:` URL. `addRaster({ url: 'pmtiles://…' })` and
193
+ * a style source `pmtiles://…` in `vectorTiles` read archives too
194
+ */
195
+ addPmtiles(url: string, options?: PmtilesOptions): Promise<RasterLayer | VectorTiles>;
184
196
  /** Line network colored by a value per node; `layer.setValues` recolors it in one texture upload */
185
197
  addNetwork(options: NetworkOptions): NetworkLayer;
186
198
  /** Lines from GeoJSON (line strings, and polygon outlines), styled per feature */
package/dist/map.js CHANGED
@@ -20,7 +20,7 @@ import { atmosphereSettings, bodySettings, haloSettings, rgb, terrainSettings, }
20
20
  import { injectStyle } from "./style.js";
21
21
  import { SymbolLayer, symbolStyle } from "./symbols.js";
22
22
  import { encodedTerrainLoader } from "./terrain.js";
23
- import { BasemapWorkers, defaultWorkerCount, defaultWorkerUrl, VECTOR_BASEMAPS, VectorTiles, } from "./vectortiles.js";
23
+ import { BasemapWorkers, defaultWorkerCount, defaultWorkerUrl, pmtilesLayer, pmtilesRasterLoader, VECTOR_BASEMAPS, VectorTiles, } from "./vectortiles.js";
24
24
  /** Reports an error without throwing it here: the console shows it, as an uncaught one */
25
25
  function report(error) {
26
26
  if (typeof reportError === 'function')
@@ -511,6 +511,30 @@ export class GeoMap {
511
511
  this.engine.setSky(enabled);
512
512
  this.requestRender();
513
513
  }
514
+ /** Tints what can be seen from a point and what is hidden from it, within a range, all around or within a cone
515
+ * (`direction`): the relief, extrusions, 3D Tiles and models hide what lies behind them (only what the map has
516
+ * loaded for its view). Several observers (16 at most): what any of them sees is seen, what is hidden from all those
517
+ * that reach it is hidden, in the colors and opacity of the first. Undefined or none removes it */
518
+ setViewshed(options) {
519
+ let observers = [];
520
+ if (options)
521
+ observers = 'position' in options ? [options] : options;
522
+ const [first] = observers;
523
+ if (!first) {
524
+ this.engine.clearViewshed();
525
+ return;
526
+ }
527
+ this.engine.setViewshed(new Float64Array(observers.flatMap((o) => [
528
+ o.position[0],
529
+ o.position[1],
530
+ o.height ?? 1.7,
531
+ o.range ?? 1000,
532
+ ...(o.direction === undefined
533
+ ? [Number.NaN, 0, 0, 0]
534
+ : [o.direction, o.tilt ?? 0, o.fov ?? 60, o.verticalFov ?? 40]),
535
+ ])), new Float32Array(rgb(first.visibleColor ?? '#2f9e44')), new Float32Array(rgb(first.hiddenColor ?? '#e03131')), first.opacity ?? 0.55);
536
+ this.requestRender();
537
+ }
514
538
  /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles, NASA's
515
539
  * on the Moon and Mars), one of the Earth's models by name (`'ign'`), its options, or false; on another body, its
516
540
  * options with a `url` */
@@ -698,7 +722,8 @@ export class GeoMap {
698
722
  addRaster(options) {
699
723
  const { url, grid = 'mercator', opacity = 1, saturation = 1, size, before } = options;
700
724
  let { minZoom = 0, maxZoom = 19 } = options;
701
- let loader = options.loader;
725
+ // A PMTiles archive (`pmtiles://…`): its tiles read by range requests
726
+ let loader = options.loader ?? pmtilesRasterLoader(url, size ?? 256);
702
727
  if (grid !== 'mercator' && !loader) {
703
728
  if (grid === 'equirectangular') {
704
729
  // `minZoom` and `maxZoom` are levels of the source: its level n has the pixel size of Mercator level n + 1 at
@@ -722,6 +747,15 @@ export class GeoMap {
722
747
  }
723
748
  return layer;
724
749
  }
750
+ /**
751
+ * A PMTiles archive (v3) read by range requests: a raster layer of its images, or vector tiles drawn with `style` (by
752
+ * default a plain style of the archive's layers) with their labels. Its header decides which unless `kind` says;
753
+ * `url` with or without `pmtiles://`, relative to the page, or a `blob:` URL. `addRaster({ url: 'pmtiles://…' })` and
754
+ * a style source `pmtiles://…` in `vectorTiles` read archives too
755
+ */
756
+ addPmtiles(url, options = {}) {
757
+ return pmtilesLayer(this, url, options);
758
+ }
725
759
  /** Line network colored by a value per node; `layer.setValues` recolors it in one texture upload */
726
760
  addNetwork(options) {
727
761
  const { nodes, edges, lines, costs, edgeWidths, width = 2, max = 1800, contour = 0, opacity = 1 } = options;