1.0.4 • Published 1 year ago

@nebula.gl/edit-modes v1.0.4

Weekly downloads
9,769
License
MIT
Repository
github
Last release
1 year ago

docs

nebula.gl 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/nebula.gl.git
  2. cd nebula.gl
  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 @nebula.gl/layers
npm install @nebula.gl/overlays
npm install @deck.gl/core
npm install @deck.gl/react
npm install @deck.gl/layers

For yarn

yarn add @nebula.gl/layers
yarn add @nebula.gl/overlays
yarn add @deck.gl/core
yarn add @deck.gl/react
yarn add @deck.gl/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 'nebula.gl';

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)

1.1.0-alpha.5

1 year ago

1.1.0-alpha.3

1 year ago

1.1.0-alpha.4

1 year ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.2-alpha.2

2 years ago

1.0.2-alpha.1

2 years ago

1.0.0-alpha.0

2 years ago

1.0.2-alpha.0

2 years ago

1.0.1-alpha.0

2 years ago

0.23.6

3 years ago

0.23.8

3 years ago

0.23.7

3 years ago

0.23.3

3 years ago

0.22.3

3 years ago

0.22.2

3 years ago

0.22.1

3 years ago

0.21.1

4 years ago

0.21.0

4 years ago

0.20.3

4 years ago

0.20.2

4 years ago

0.21.0-alpha.0

4 years ago

0.20.1

4 years ago

0.20.0

4 years ago

0.19.3

4 years ago

0.19.2

4 years ago

0.19.1

4 years ago

0.19.0

4 years ago

0.18.5

4 years ago

0.18.1

4 years ago

0.18.0

4 years ago

0.17.7

4 years ago

0.18.0-alpha.2

4 years ago

0.18.0-alpha.1

4 years ago

0.18.0-alpha.0

4 years ago

0.17.5

4 years ago

0.17.6

4 years ago

0.17.5-alpha.0

4 years ago

0.17.4-alpha.3

4 years ago

0.17.4

4 years ago

0.17.4-alpha.2

4 years ago

0.17.4-alpha.1

4 years ago

0.17.4-alpha.0

4 years ago

0.17.3

4 years ago

0.17.2

4 years ago

0.17.1

4 years ago

0.17.0

4 years ago

0.16.0

5 years ago

0.15.0

5 years ago

0.15.0-alpha.7

5 years ago

0.15.0-alpha.6

5 years ago

0.15.0-alpha.5

5 years ago

0.15.0-alpha.4

5 years ago

0.15.0-alpha.3

5 years ago

0.14.10

5 years ago

0.14.9

5 years ago

0.14.0

5 years ago

0.13.0

5 years ago