Chevron Down
Table of Contents
Chevron DownOverview
Chevron DownInteractive Examples
Chevron DownAPI Reference (Modes)
Chevron DownAPI Reference (Overlays)
Chevron DownAPI Reference (Map GL Draw)

SelectionLayer

This layer can be used to select deck.gl objects using mouse drawing.

layers.push(
  new SelectionLayer({
    id: 'selection',
    selectionType: this.state.selectionTool,
    onSelect: ({ pickingInfos }) => {
      this.setState({ selectedFeatureIndexes: pickingInfos.map(pi => pi.index) });
    },
    layerIds: ['geojson'],

    getTentativeFillColor: () => [255, 0, 255, 100],
    getTentativeLineColor: () => [0, 0, 255, 255],
    getTentativeLineDashArray: () => [0, 0],
    lineWidthMinPixels: 3
  })
);

Properties

Inherits all deck.gl's Base Layer properties.

Also inherites some EditableGeoJsonLayer properties.

Note: do not pass a data property.

selectionType (String, required)

  • Default: null

SELECTIONTYPE.RECTANGLE or SELECTIONTYPE.POLYGON

onSelect (Function, required)

Called when selection is completed.

layerIds (String[], required)

Array of layer ids where we will search.