HoloMap.Source.Vector (HoloMap v0.3.0)

Copy Markdown View Source

Vector tiles, from a TileJSON endpoint or an explicit tile URL template.

<HoloMap.Source.Vector id="basemap" url="https://tiles.example.com/basemap.json" />

<HoloMap.Source.Vector
  id="parcels"
  tiles={["https://tiles.example.com/parcels/{z}/{x}/{y}.pbf"]}
  min_zoom={8}
  max_zoom={14}
/>

Layers reading from a vector source must set source_layer. A vector tile carries several named layers and MapLibre has no way to guess which one is meant:

<HoloMap.Layer.Fill id="water" source="basemap" source_layer="water"
                    paint={%{fill_color: "#a5d8ff"}} />

Props

PropTypeNotes
idstringRequired. Referenced by layers' source prop
urlstringTileJSON endpoint. Supply this or tiles
tileslistTile URL templates containing {z}, {x}, {y}
min_zoom / max_zoomnumberZoom range the tiles exist at
boundslist[west, south, east, north] extent of the data
schemestring"xyz" (default) or "tms"
promote_idstring or mapProperty to use as the feature id
volatilebooleanSkip the tile cache
attributionstringAttribution text
encodingstring"mvt" (default), Mapbox Vector Tiles, or "mlt", MapLibre Tiles
sparsebooleanExperimental in MapLibre. A missing tile is drawn from a lower zoom. See below

Encoding and sparse tilesets

encoding says how the tiles are encoded: Mapbox Vector Tiles unless told otherwise, or MapLibre Tiles (MLT), a newer columnar encoding MapLibre GL JS reads since 5.12.0, with encoding="mlt". The prop wins over an encoding the TileJSON at url names.

sparse is marked experimental in MapLibre's style specification. It is for a tileset that leaves out tiles where a lower zoom already says all there is. With it, MapLibre GL JS loads a tile the server answers with a 404 from the nearest lower zoom that has one, a few zoom levels up at most, and cuts it to size, as it does for a tile beyond the tileset's max_zoom. Without it, such a tile draws nothing. The prop wins over a sparse the TileJSON names.

Updating the source

A change to tiles or url applies in place, with MapLibre's setTiles and setUrl: the source requests its tiles again and the layers on top of it stay. Changing any other prop, or taking tiles or url away, is a structural update: the source is torn down and rebuilt, and the layers on top of it are detached and re-added around that.

Summary

Functions

Returns true to indicate that the callee module is a component module (has "use Hologram.Component" directive).

Returns the list of property definitions for the compiled component.

Functions

__is_hologram_component__()

@spec __is_hologram_component__() :: boolean()

Returns true to indicate that the callee module is a component module (has "use Hologram.Component" directive).

Examples

iex> __is_hologram_component__()
true

__props__()

@spec __props__() :: [{atom(), atom(), keyword()}]

Returns the list of property definitions for the compiled component.