Skip to content

Commit

Permalink
Update readme example
Browse files Browse the repository at this point in the history
  • Loading branch information
supersonicclay committed Sep 26, 2019
1 parent 707cd9c commit 65bb8c9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ yarn add nebula.gl
[EditableGeoJsonLayer](/docs/api-reference/layers/editable-geojson-layer.md) is implemented as a [deck.gl](https://deck.gl) layer. It provides the ability to view and edit multiple types of geometry formatted as [GeoJSON](https://tools.ietf.org/html/rfc7946) (an open standard format for geometry) including polygons, lines, and points.

```js
import React from 'react';
import DeckGL from 'deck.gl';
import { EditableGeoJsonLayer } from 'nebula.gl';
import { EditableGeoJsonLayer, DrawPolygonMode } from 'nebula.gl';

const myFeatureCollection = {
type: 'FeatureCollection',
Expand All @@ -74,19 +73,19 @@ const myFeatureCollection = {
]
};

const selectedFeatureIndexes = [];

class App extends React.Component {
state = {
mode: 'drawPolygon',
selectedFeatureIndexes: [],
data: myFeatureCollection
};

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

onEdit: ({ updatedData }) => {
this.setState({
Expand All @@ -99,3 +98,5 @@ class App extends React.Component {
}
}
```

[CodeSandbox](https://codesandbox.io/s/admiring-shape-4dkyt)

0 comments on commit 65bb8c9

Please sign in to comment.