Demo

This project is not covered by Drupal’s security advisory policy.

A Geofield widget that provides a Leaflet map and uses the Leaflet widget plugin for adding and removing geometries. Leaflet.widget uses the Leaflet.draw geometry creation tools.

Important : since Leaflet 1.41 and 2.00, this module has been embedded into the Leaflet module, as a submodule (more info). Drupal 7 sites may still use this module, but sites running Drupal 8 and later should switch to Leaflet's submodule.

Features

  • Create & manage simple geometries: Point, LineString, Polygon.
  • Maintains complex geometries: MultiPoint, MultiLineString, MultiPolygon and GeometryCollection. (These can't be created yet but it won't mess with your existing data.)
  • Delete geometries.
  • Supports single or multi-value Geofields (cardinality).
  • Use base layers defined by Leaflet module.

Installation

Drupal 7

  1. Install and enable Leaflet Widget and its required modules in the usual way.
    Learn more about installing Drupal modules.
  2. Download the Leaflet Widget JavaScript library and place it in sites/all/libraries.
    Ensure you have a path like sites/all/libraries/Leaflet.widget/dist/Leaflet.widget.js

Further documentation How to install Leaflet Widget for Geofield.

Drupal 8

Please use the 2.x branch of the module. You should not use Geofield as a backend for saving the json data. You will lose a lot of important information, because Geofield converts the GeoJON data into WKT and back.
I created a better backend module for saving GeoJSON data based on the standard file field.
To use it, install Leaflet GeoJson File module.

Requirements

Drupal 7

  • Libraries (2.x)
  • Geofield (1.x or 2.x) please use the same module versions
  • GeoPHP 1.x-dev: This module requires the latest dev release as there are issues with parsing GeoJSON in the latest stable release.
  • Leaflet Widget requires Leaflet JS to be available. By default the version bundled with the Leaflet.widget library will be used. However if you have Leaflet module installed and Leaflet JS located at sites/all/libraries/leaflet, that version will be used.

Drupal 8.x-2.0

The 2.x branch is a complete rewrite of the module using Leaflet.geoman.
Demo

Important:

Do not use Geofield as a backend for saving the json data. You will lose a lot of important information, because Geofield converts the GeoJON data into WKT and back.
I created a better backend module for saving GeoJSON data based on the standard file field.
To use it, install Leaflet GeoJson File module.
It supports drawing of

  • Markers
  • Polyline
  • Rectangle
  • Polygon / Multipolygon
  • Circle

It has

  • Edit Mode
  • Drag Mode
  • Cut Mode
  • Delete Mode

The GeoJSON Data is saved in the geofield module.
Settings

Drupal 8.x-1.0 legacy module

This version is no longer compatible with latest versions of the Leaflet module, and as such it is now deprecated.

You can add the following code in your project composer.json file, under the repositories key:

"wicket": {
    "type": "package",
    "package": {
        "name": "arthur-e/Wicket",
        "version": "1.3.4",
        "type": "drupal-library",
        "dist": {
            "url": "https://github.com/arthur-e/Wicket/archive/1.3.4.zip",
            "type": "zip"
        }
    }
}

Then launch this command: composer require arthur-e/Wicket.

Development sponsored by Affinity Bridge.

Project information

Releases