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. nzta/googlemap-leafletfield

ActiveSilverstripe-vendormodule

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)0480↓50%2[1 PRs](https://github.com/NZTA/googlemap-leafletfield/pulls)BSD-3-ClauseJavaScript

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 1mo ago

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 83% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity18

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

2661d 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/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[silverstripe/widgets

Widgets are small pieces of functionality such as showing the latest Comments or Flickr Photos. They normally display on the sidebar of your website.

39411.8k20](/packages/silverstripe-widgets)[silverstripe/contentreview

Flags pages for periodical author review (incl. reporting)

22264.3k4](/packages/silverstripe-contentreview)[silverstripe/frameworktest

Aids core and module developers in testing their code against a set of sample data and behaviour.

17304.6k23](/packages/silverstripe-frameworktest)[symfony/ux-leaflet-map

Symfony UX Map Leaflet Bridge

13146.6k1](/packages/symfony-ux-leaflet-map)[kinglozzer/silverstripegmapsobject

Add a Google Map (optionally with Streetview) to a DataObject or Page

168.6k](/packages/kinglozzer-silverstripegmapsobject)

PHPackages © 2026

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