Leaflet GeoJSON powered map
Leaflet GeoJSON configuration screen

Leaflet GeoJSON is a set of modules for creating Leaflet maps backed by GeoJSON data and leverage a bounding box strategy.

Why use Leaflet GeoJSON?

The Leaflet javascript library and its Drupal integration module are great tools for providing mobile-friendly, interactive maps based on your data. One benefit of combining Leaflet with Views GeoJSON is that you can leverage a bounding box strategy. Here's a definition from the OpenLayers site:

The BBOX strategy requests data within a bounding box. When the previously requested data bounds are invalidated (by browsing to some area not covered by those bounds), another request for data is issued

A standard use case goes like

  1. Create a GeoJSON feed using the Views GeoJSON module.
  2. Add the bounding box argument to the GeoJSON view.
  3. Use a leaflet map preset defined by the Leaflet module, in code or one of the integration modules.
  4. Put them all together using the Map pane CTools content type plug-in (7.x) or Page Manager (8.x)

Architecture

Leaflet GeoJSON
Provides API functionality as defining GeoJSON sources and adding a Leaflet bounding box strategy.

Leaflet GeoJSON Bean (7.x option only)
Allows you to create leaflet map blocks based on GeoJSON data and will automatically extend them with the bounding box strategy if supported.
Custom blocks? Even better, we are using: Bean.

Requirements

  • Leaflet
  • (optional) Views GeoJSON for automatically discovered GeoJSON sources
  • (optional) Bean as a dependency for Leaflet GeoJSON Bean (7.x only)

Documentation

Implement custom GeoJSON sources using hook_leaflet_geojson_source_info()

References

  • Leaflet GeoJSON got kickstarted while working on Geocluster.

Project information

Releases