makinacorpus/terra-draw-map

Name: terra-draw-map

Owner: Makina Corpus

Description: null

Created: 2018-04-23 09:44:04.0

Updated: 2018-04-30 10:47:21.0

Pushed: 2018-05-04 15:48:36.0

Homepage: null

Size: 2730

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Terra Draw Map

Component created with React, Leaflet, Leaflet Draw, and turfjs.

Display a map with props layer.

And get info layer who intercept our drawing or on click.

Example Gif

How to use ?
port TerraDrawMap from 'TerraDrawMap';

.

erraDrawMap
config={{ layers: [polygon] }}
maxBounds={[[48.815575, 2.224122], [48.902157, 2.46976]]}
center={[48.856840, 2.351239]}
zoom={11}
getDataOnClick={data => this.getDataOnClick(data)}
getDataOnDraw={data => this.getDataDraw(data)}

Config variable= { layers: [Array on layer] }

Layer = {

id: 'id of layer',
display: boolean,
type: 'fill' or 'line'
geometry: {
    type: 'supported types: Polygon, MultiPolygon, LineString, MultilineString',
    coordinates: [coordinates]
},
paint: () => {
    'function to handle color ... of layer'
}

}

For more : Look for the example inside tests folder.

getDataOnClick

Get data when the user click on layer

Return {'id of layer' : {properties}}
getDataOnDraw

Get data layer under the drawing

Return [{'id of layer' : {properties}}]
Stories folder

Contain all stories for this component

Tests folder

Contain example app (created with create react app) with tests

Src folder

Contain the src component


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.