2017 © Pedro Peláez
 

silverstripe-module 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

image

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

  • Tuesday, September 5, 2017
  • by NZTA
  • Repository
  • 2 Watchers
  • 0 Stars
  • 135 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 8 Versions
  • 29 % Grown

The README.md

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., (*1)

Installation

$ composer require NZTA/googlemap-leafletfield

Basic Usage

Import the field, (*2)

use NZTA\LeafletField\LeafletField;

Create a text database field to store the geojson value., (*3)

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

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

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

Leaflet.draw demo, (*5)

Field Options

Define default field options through config., (*6)

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)., (*7)

$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., (*8)

Requirements

  • SilverStripe 4.0

The Versions

05/09 2017

dev-master

9999999-dev https://github.com/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

  Sources   Download

The Requires

 

by Robby

leaflet map googlemap

05/09 2017

dev-bugfix/googlemap

dev-bugfix/googlemap https://github.com/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

  Sources   Download

The Requires

 

by Robby

leaflet map googlemap

01/09 2017

1.2.3

1.2.3.0 https://github.com/benmanu/silverstripe-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

  Sources   Download

The Requires

 

by Avatar benmanu

leaflet silverstripe map

21/02 2017

1.2.2

1.2.2.0 https://github.com/benmanu/silverstripe-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

  Sources   Download

The Requires

 

by Avatar benmanu

leaflet silverstripe map

21/02 2017

1.2.1

1.2.1.0 https://github.com/benmanu/silverstripe-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

  Sources   Download

The Requires

 

by Avatar benmanu

leaflet silverstripe map

20/02 2017

1.2.0

1.2.0.0 https://github.com/benmanu/silverstripe-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

  Sources   Download

The Requires

 

by Avatar benmanu

leaflet silverstripe map

09/02 2017

1.0.1

1.0.1.0 https://github.com/benmanu/silverstripe-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

  Sources   Download

The Requires

 

by Avatar benmanu

leaflet silverstripe map

24/04 2015

1.0.0

1.0.0.0 https://github.com/benmanu/silverstripe-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

  Sources   Download

The Requires

 

by Avatar benmanu

leaflet silverstripe map