HoloMap.Layer.ColorRelief (HoloMap v0.4.0)

Copy Markdown View Source

Elevation drawn as colour, from a HoloMap.Source.RasterDEM.

<HoloMap.Source.RasterDEM id="dem" url={@dem} encoding="terrarium" />

<HoloMap.Layer.ColorRelief
  id="relief"
  source="dem"
  paint={%{
    color_relief_color: [
      "interpolate", ["linear"], ["elevation"],
      0, "#2b83ba", 1500, "#ffffbf", 3000, "#d7191c"
    ]
  }}
/>

A HoloMap.Layer locked to type: "color-relief", MapLibre GL JS 5.6.0 and later. See that module for the full prop list and ordering rules. Everything here is identical apart from the layer type, which is fixed and cannot be overridden.

color_relief_color maps the elevation, read with the ["elevation"] expression, in metres, to a colour, with an interpolate or a step on it. MapLibre takes the expression's stops as a colour ramp and draws every elevation between them, so a change to it is a new ramp, applied in place with setPaintProperty. A ramp with more stops than the device's graphics can hold is thinned out, with a console warning. Without color_relief_color the layer draws nothing.

Like HoloMap.Layer.Hillshade, the layer needs a raster-dem source, and MapLibre refuses it on any other kind. It draws pixels rather than features, so MapLibre reports no layer event for it, and queryRenderedFeatures finds nothing on it.

Paint properties

color_relief_color, color_relief_opacity, resampling.

Layout properties

visibility.

Property names may be written as atoms in Elixir style (:color_relief_color) or as MapLibre specification names ("color-relief-color"); both reach MapLibre as the latter. The full reference lives in the MapLibre style specification.

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.