cartoj.core

Map component and view-state helpers for cartoj.

Wraps the react-map-gl/maplibre Map component as a Reagent component.

Usage:
  [cartoj/interactive-map
      {:initial-view-state {:longitude 0 :latitude 16 :zoom 1}
       :map-style "https://tiles.openfreemap.org/styles/bright";}]

interactive-map

(interactive-map & args)
Reagent component wrapping react-map-gl Map.

Props are a CLJS map with kebab-case keyword keys; they are converted to a
camelCase JS object before being passed to the underlying React component.
Callback values (e.g. :on-click, :on-move) are passed through unchanged.
Children are appended after the props in the hiccup vector.

:class-name is intercepted and applied to a wrapper div, because the
underlying react-map-gl Map only forwards :id, :ref, and :style to its
container element.

view-state->clj

(view-state->clj js-vs)
Convert a JS viewState object (from a react-map-gl onMove event) to a
CLJS map with keyword keys.

Only the standard view-state keys are extracted:
:longitude :latitude :zoom :bearing :pitch :padding

view-state->js

(view-state->js vs)
Convert a CLJS view-state map to a plain JS object.
Converts keyword keys to camelCase strings.