Package Exports
- @nebula.gl/edit-modes
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nebula.gl/edit-modes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Nebula.gl | Website
An editing framework for deck.gl
Getting started
Running the example
git clone git@github.com:uber/nebula.gl.git
cd nebula.gl
yarn
cd examples/advanced
yarn
export MapboxAccessToken='<Add your key>'
yarn start-local
- You can view/edit geometry.
Installation
yarn add nebula.gl
nebula.gl will automatically install a compatible version of deck.gl.
EditableGeoJsonLayer
The Editable GeoJSON layer accepts a GeoJSON FeatureCollection
and renders the features as editable polygons, lines, and points. See the example below and for the official documentation click here.
import React from 'react';
import DeckGL from 'deck.gl';
import { EditableGeoJsonLayer } from 'nebula.gl';
const myFeatureCollection = {
type: 'FeatureCollection',
features: [
/* insert features here */
]
};
class App extends React.Component {
state = {
mode: 'modify',
selectedFeatureIndexes: [0],
data: myFeatureCollection
};
render() {
const layer = new EditableGeoJsonLayer({
id: 'geojson-layer',
data: this.state.data,
mode: this.state.mode,
selectedFeatureIndexes: this.state.selectedFeatureIndexes,
onEdit: ({ updatedData }) => {
this.setState({
data: updatedData,
});
}
});
return <DeckGL {...this.props.viewport} layers={[layer]} />;
}
}