Leaflet GeoJSON

Component ID

1848992

Component name

Leaflet GeoJSON

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

5236

Component created

Component changed

Component body

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 (since 2.x) in combination with Panels or use the Leaflet GeoJSON Bean module (since 1.x) or .

Architecture

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

Leaflet GeoJSON Bean
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

Documentation

Implement custom GeoJSON sources using hook_leaflet_geojson_source_info()

References

  • Leaflet GeoJSON got kickstarted while working on Geocluster.