Namespace for the data sources a map can draw from.
A source says where the data comes from; a layer says how it looks. They are separate components because the relationship is one-to-many. One source routinely feeds a fill, an outline and a label layer, and re-declaring the data three times would mean fetching it three times.
<HoloMap.Source.GeoJSON id="parcels" data={@parcels} />
<HoloMap.Layer.Fill id="parcels-fill" source="parcels" paint={%{fill_color: "#3b82f6"}} />
<HoloMap.Layer.Line id="parcels-line" source="parcels" paint={%{line_color: "#1e40af"}} />Layers reference a source by its id. Declare the source before the layers
that use it. The reconciler applies definitions in document order, and a
layer whose source is not there yet is dropped by MapLibre.
Available sources
HoloMap.Source.GeoJSON: inline features or a URL, with clusteringHoloMap.Source.Vector: vector tilesHoloMap.Source.Raster: raster tilesHoloMap.Source.RasterDEM: elevation tiles, for terrain and hillshadeHoloMap.Source.Image: a single image pinned to four corners
Updating a source
How a source is updated depends on what changed:
- A GeoJSON source whose
datachanged is updated in place withsetData. No layer is disturbed and nothing flickers. - An image source whose
urlorcoordinateschanged usesupdateImage. - Any other change is structural. MapLibre refuses to remove a source that still has layers attached, so the reconciler detaches the layers it owns, swaps the source, and puts them back in their declared order.
Frequently-changing data therefore belongs in a GeoJSON source's data
prop, which is the one path with no teardown.