datasette-leaflet-geojson by simonw

262 downloads this week        Star

README source code

datasette-leaflet-geojson

PyPI Changelog Tests License

Datasette plugin that replaces any GeoJSON column values with a Leaflet map

Installation

Install this plugin in the same environment as Datasette.

$ datasette install datasette-leaflet-geojson

Usage

Any columns containing valid GeoJSON strings will have their contents replaced with a Leaflet map when they are displayed in the Datasette interface.

Demo

You can try this plugin out at https://calands.datasettes.com/calands/superunits_with_maps

datasette-leaflet-geojson in action

Configuration

By default this plugin displays maps for the first ten rows, and shows a "Click to load map" prompt for rows past the first ten.

You can change this limit using the default_maps_to_load plugin configuration setting. Add this to your metadata.json:

{
    "plugins": {
        "datasette-leaflet-geojson": {
            "default_maps_to_load": 20
        }
    }
}

Then run Datasette with datasette mydb.db -m metadata.json.