Skip to content

cigar-factory/lektor-leaflet-geojson

Repository files navigation

lektor-leaflet-geojson

Run tests codecov PyPI Version License Python Compatibility Code style: black

Lektor template filter to convert geojson objects to Leaflet maps

Installation

pip install lektor-leaflet-geojson

Usage

Import the leaflet JS and CSS. You can skip this step if you are managing Leaflet yourself (e.g: with NPM)

{{ import_leaflet('1.7.1') }} {# using a specified version #}
{{ import_leaflet() }} {# default to "latest" #}

The |map() filter can be used to render a GeoJSON feature on a map. Pass some inline CSS to style the map div.

{{
  '{"type": "Feature", "geometry": {"type": "Point", "coordinates": [125.6, 10.1]}}' | map("height: 300px; width: 300px;")
}}