forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[geo] add support for deck.gl's path layer (apache#4067)
* [geo] add support for deck.gl's path layer Works with json and polyline data. * Lint
- Loading branch information
1 parent
f0b7f13
commit 707b5fd
Showing
10 changed files
with
182 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { PathLayer } from 'deck.gl'; | ||
|
||
import DeckGLContainer from './DeckGLContainer'; | ||
|
||
function deckPath(slice, payload, setControlValue) { | ||
const fd = slice.formData; | ||
const c = fd.color_picker; | ||
const fixedColor = [c.r, c.g, c.b, 255 * c.a]; | ||
const data = payload.data.paths.map(path => ({ | ||
path, | ||
width: fd.line_width, | ||
color: fixedColor, | ||
})); | ||
|
||
const layer = new PathLayer({ | ||
id: `path-layer-${slice.containerId}`, | ||
data, | ||
rounded: true, | ||
widthScale: 1, | ||
}); | ||
const viewport = { | ||
...fd.viewport, | ||
width: slice.width(), | ||
height: slice.height(), | ||
}; | ||
ReactDOM.render( | ||
<DeckGLContainer | ||
mapboxApiAccessToken={payload.data.mapboxApiKey} | ||
viewport={viewport} | ||
layers={[layer]} | ||
mapStyle={fd.mapbox_style} | ||
setControlValue={setControlValue} | ||
/>, | ||
document.getElementById(slice.containerId), | ||
); | ||
} | ||
module.exports = deckPath; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters