@deck.gl-community/editable-layers
TypeScript icon, indicating that this package has built-in type declarations

9.0.0-alpha.1 • Public • Published

editable-layers | Website

An editing framework for deck.gl

docs

@deck.gl-community/editable-layers provides editable and interactive map overlay layers, built using the power of deck.gl.

Getting started

Running the example

  1. git clone git@github.com:uber/@deck.gl-community/editable-layers.git
  2. cd @deck.gl-community/editable-layers
  3. yarn
  4. cd examples/advanced
  5. yarn
  6. export MapboxAccessToken='<Add your key>'
  7. yarn start-local
  8. You can now view and edit geometry.

Installation

For npm

npm install @deck.gl-community/editable-layers

For yarn

yarn add @deck.gl-community/editable-layers

EditableGeoJsonLayer

EditableGeoJsonLayer is implemented as a deck.gl layer. It provides the ability to view and edit multiple types of geometry formatted as GeoJSON (an open standard format for geometry) including polygons, lines, and points.

import DeckGL from '@deck.gl/react';
import { EditableGeoJsonLayer, DrawPolygonMode } from '@deck.gl-community/editable-layers';

const myFeatureCollection = {
  type: 'FeatureCollection',
  features: [
    /* insert features here */
  ],
};

const selectedFeatureIndexes = [];

class App extends React.Component {
  state = {
    data: myFeatureCollection,
  };

  render() {
    const layer = new EditableGeoJsonLayer({
      id: 'geojson-layer',
      data: this.state.data,
      mode: DrawPolygonMode,
      selectedFeatureIndexes,

      onEdit: ({ updatedData }) => {
        this.setState({
          data: updatedData,
        });
      },
    });

    return <DeckGL {...this.props.viewport} layers={[layer]} />;
  }
}

Useful examples (Codesandbox)

Package Sidebar

Install

npm i @deck.gl-community/editable-layers

Weekly Downloads

559

Version

9.0.0-alpha.1

License

MIT

Unpacked Size

1.41 MB

Total Files

295

Last publish

Collaborators

  • felixpalmer
  • chrisgervang
  • donmccurdy
  • ibgreen