PHPackages                             nzta/googlemap-leafletfield - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nzta/googlemap-leafletfield

ActiveSilverstripe-vendormodule[Utility &amp; Helpers](/categories/utility)

nzta/googlemap-leafletfield
===========================

Provides a form field type allowing users to draw features on a map, the features are stored as geoJSON objects in a single database field

2.0.0(7y ago)0622—6.3%2[1 PRs](https://github.com/NZTA/googlemap-leafletfield/pulls)BSD-3-ClauseJavaScriptCI passing

Since Apr 24Pushed 1y ago3 watchersCompare

[ Source](https://github.com/NZTA/googlemap-leafletfield)[ Packagist](https://packagist.org/packages/nzta/googlemap-leafletfield)[ Docs](https://github.com/nzta/googlemap-leafletfield)[ RSS](/packages/nzta-googlemap-leafletfield/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (10)Used By (0)

SilverStripe LeafletField module
================================

[](#silverstripe-leafletfield-module)

Provides a form field type allowing users to draw features on a map, the features are stored as geoJSON objects in a single database field.

Installation
------------

[](#installation)

```
$ composer require NZTA/googlemap-leafletfield

```

Basic Usage
-----------

[](#basic-usage)

Import the field

```
use NZTA\LeafletField\LeafletField;

```

Create a text database field to store the geojson value.

```
public static $db = [
    'Geometry' => 'Text',
];

```

Create a LeafletField, passing through the object that you want to store the value against.

```
$field = new LeafletField('Geometry', 'Geometry', $this);

```

[Leaflet.draw demo](http://leaflet.github.io/Leaflet.draw/)

Field Options
-------------

[](#field-options)

Define default field options through config.

```
NZTA\LeafletField\LeafletField:
  map_options:
    center:
      latitude: "-40.866119"
      longitude: "174.143780"
    zoom: 5
  draw_options:
    polyline:
      shapeOptions:
        color: '#269634'
    polygon:
      allowIntersection: false
      drawError:
        color: '#b00b00'
        timeout: 1000
    rectangle: false
    circle: false

```

Define custom options for individual field instances (overrides defaults).

```
$field->setLimit(1); // Limit the amount of objects the field can contain.
$field->setMapOptions([
    'center' => [
        'latitude' => '-40.866119',
        'longitude' => '174.143780'
    ],
    'zoom' => 5
]);
$field->setDrawOptions([
    'polyline' => [
        'shapeOptions' => [
            'color' => '#269634'
        ]
    ],
    'polygon' => [
        'allowIntersection' => false,
        'drawError' => [
            'color' => '#b00b00',
            'timeout' => 1000
        ]
    ],
    'rectangle' => false,
    'circle' => false
]);

```

The draw options are set using the same structure as [Leaflet.draw options](https://github.com/Leaflet/Leaflet.draw#drawoptions).

Requirements
------------

[](#requirements)

- SilverStripe 4.0

Project Links
-------------

[](#project-links)

- [GitHub Project Page](https://github.com/NZTA/silverstripe-leafletfield)
- [Issue Tracker](https://github.com/NZTA/silverstripe-leafletfield/issues)
- [Leaflet](http://leafletjs.com/)
- [Leaflet.draw](https://github.com/Leaflet/Leaflet.draw)
- [GeoJSON](http://geojson.org/geojson-spec.html)

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 52.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~197 days

Recently: every ~178 days

Total

8

Last Release

2707d ago

Major Versions

1.2.3 → 2.0.02018-10-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/ff99459f7f2ca26bdf0fa8e4b43a971c28d8f2bf6f588eda2d239a6a8bf5b7ee?d=identicon)[NZTA](/maintainers/NZTA)

---

Top Contributors

[![benmanu](https://avatars.githubusercontent.com/u/1373344?v=4)](https://github.com/benmanu "benmanu (9 commits)")[![robbyahn](https://avatars.githubusercontent.com/u/2970208?v=4)](https://github.com/robbyahn "robbyahn (6 commits)")[![ishannz](https://avatars.githubusercontent.com/u/20032948?v=4)](https://github.com/ishannz "ishannz (2 commits)")

---

Tags

silverstripemapleaflet

### Embed Badge

![Health badge](/badges/nzta-googlemap-leafletfield/health.svg)

```
[![Health](https://phpackages.com/badges/nzta-googlemap-leafletfield/health.svg)](https://phpackages.com/packages/nzta-googlemap-leafletfield)
```

###  Alternatives

[silverstripe/userforms

UserForms enables CMS users to create dynamic forms via a drag and drop interface and without getting involved in any PHP code

1371.1M85](/packages/silverstripe-userforms)[symbiote/silverstripe-advancedworkflow

Adds configurable workflow support to the CMS, with a GUI for creating custom workflow definitions.

46302.4k9](/packages/symbiote-silverstripe-advancedworkflow)[axllent/silverstripe-cms-tweaks

Several CMS usability improvements

1726.4k1](/packages/axllent-silverstripe-cms-tweaks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
