isard 0.5.0 → 0.6.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 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,10 @@ 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). Undefined removes it */
142
+ setViewshed(options: ViewshedOptions | undefined): void;
139
143
  /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles, NASA's
140
144
  * on the Moon and Mars), one of the Earth's models by name (`'ign'`), its options, or false; on another body, its
141
145
  * options with a `url` */
@@ -181,6 +185,13 @@ export declare class GeoMap {
181
185
  addRaster(options: RasterOptions & {
182
186
  before?: Layer;
183
187
  }): RasterLayer;
188
+ /**
189
+ * A PMTiles archive (v3) read by range requests: a raster layer of its images, or vector tiles drawn with `style` (by
190
+ * default a plain style of the archive's layers) with their labels. Its header decides which unless `kind` says;
191
+ * `url` with or without `pmtiles://`, relative to the page, or a `blob:` URL. `addRaster({ url: 'pmtiles://…' })` and
192
+ * a style source `pmtiles://…` in `vectorTiles` read archives too
193
+ */
194
+ addPmtiles(url: string, options?: PmtilesOptions): Promise<RasterLayer | VectorTiles>;
184
195
  /** Line network colored by a value per node; `layer.setValues` recolors it in one texture upload */
185
196
  addNetwork(options: NetworkOptions): NetworkLayer;
186
197
  /** 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,20 @@ 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). Undefined removes it */
517
+ setViewshed(options) {
518
+ if (!options) {
519
+ this.engine.clearViewshed();
520
+ return;
521
+ }
522
+ const [lon, lat] = options.position;
523
+ this.engine.setViewshed(lon, lat, options.height ?? 1.7, options.range ?? 1000, new Float32Array(rgb(options.visibleColor ?? '#2f9e44')), new Float32Array(rgb(options.hiddenColor ?? '#e03131')), options.opacity ?? 0.55, new Float64Array(options.direction === undefined
524
+ ? []
525
+ : [options.direction, options.tilt ?? 0, options.fov ?? 60, options.verticalFov ?? 40]));
526
+ this.requestRender();
527
+ }
514
528
  /** Relief under the basemap: true for the body's terrain model (on the Earth the worldwide Terrain Tiles, NASA's
515
529
  * on the Moon and Mars), one of the Earth's models by name (`'ign'`), its options, or false; on another body, its
516
530
  * options with a `url` */
@@ -698,7 +712,8 @@ export class GeoMap {
698
712
  addRaster(options) {
699
713
  const { url, grid = 'mercator', opacity = 1, saturation = 1, size, before } = options;
700
714
  let { minZoom = 0, maxZoom = 19 } = options;
701
- let loader = options.loader;
715
+ // A PMTiles archive (`pmtiles://…`): its tiles read by range requests
716
+ let loader = options.loader ?? pmtilesRasterLoader(url, size ?? 256);
702
717
  if (grid !== 'mercator' && !loader) {
703
718
  if (grid === 'equirectangular') {
704
719
  // `minZoom` and `maxZoom` are levels of the source: its level n has the pixel size of Mercator level n + 1 at
@@ -722,6 +737,15 @@ export class GeoMap {
722
737
  }
723
738
  return layer;
724
739
  }
740
+ /**
741
+ * A PMTiles archive (v3) read by range requests: a raster layer of its images, or vector tiles drawn with `style` (by
742
+ * default a plain style of the archive's layers) with their labels. Its header decides which unless `kind` says;
743
+ * `url` with or without `pmtiles://`, relative to the page, or a `blob:` URL. `addRaster({ url: 'pmtiles://…' })` and
744
+ * a style source `pmtiles://…` in `vectorTiles` read archives too
745
+ */
746
+ addPmtiles(url, options = {}) {
747
+ return pmtilesLayer(this, url, options);
748
+ }
725
749
  /** Line network colored by a value per node; `layer.setValues` recolors it in one texture upload */
726
750
  addNetwork(options) {
727
751
  const { nodes, edges, lines, costs, edgeWidths, width = 2, max = 1800, contour = 0, opacity = 1 } = options;