MaplibreX.Components.CustomLayer (MaplibreX v0.1.0)

Copy Markdown View Source

Custom WebGL layer component for advanced visualizations.

Enables custom WebGL rendering with GLSL shaders for particle systems, vector fields, and other custom effects.

Usage

<.custom_layer
  id="ocean-currents"
  map_id="my-map"
  preset="ocean_currents"
  uniforms={%{
    u_color: [0.2, 0.6, 0.9],
    u_opacity: 0.8,
    u_point_size: 3.0
  }}
/>

Presets

  • ocean_currents - Ocean current visualization
  • wind_flow - Wind flow visualization

Custom Shaders

<.custom_layer
  id="custom"
  map_id="my-map"
  vertex_shader={@vertex_glsl}
  fragment_shader={@fragment_glsl}
  uniforms={%{...}}
/>

Summary

Functions

custom_layer(assigns)

Attributes

  • id (:string) (required)
  • map_id (:string) (required)
  • preset (:string) - Defaults to nil.
  • vertex_shader (:string) - Defaults to nil.
  • fragment_shader (:string) - Defaults to nil.
  • uniforms (:map) - Defaults to %{}.
  • before_id (:string) - Defaults to nil.
  • min_zoom (:integer) - Defaults to nil.
  • max_zoom (:integer) - Defaults to nil.
  • class (:string) - Defaults to "".