-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #217 from CityScope/feature/h3-layers
added h3 cluster and h3 hexagon base layers
- Loading branch information
Showing
5 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/views/CityScopeJS/DeckglMap/deckglLayers/base/H3Cluster.js
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,33 @@ | ||
import {H3ClusterLayer} from '@deck.gl/geo-layers'; | ||
/** | ||
* Data format: | ||
* | ||
{ | ||
"color": [R,G,B], | ||
"hexIds": [ | ||
"88283082b9fffff", | ||
"88283082b1fffff", | ||
"88283082b5fffff", | ||
"88283082b7fffff", | ||
"88283082bbfffff", | ||
"882830876dfffff" | ||
] | ||
}, | ||
{ | ||
* ] | ||
*/ | ||
export default function H3ClusterBaseLayer({data, opacity}){ | ||
|
||
return new H3ClusterLayer({ | ||
id: data.id, | ||
data: data.data, | ||
pickable: data.properties.pickable || true, | ||
getHexagons: d => d.hexIds, | ||
getFillColor: d => d.color || [255, 255, 0], | ||
getLineColor: data.properties.getLineColor || [255, 255, 255], | ||
lineWidthMinPixels: data.properties.lineWidthMinPixels || 2, | ||
opacity | ||
}); | ||
|
||
|
||
} |
34 changes: 34 additions & 0 deletions
34
src/views/CityScopeJS/DeckglMap/deckglLayers/base/H3Hexagon.js
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,34 @@ | ||
import {H3HexagonLayer} from '@deck.gl/geo-layers'; | ||
/** | ||
* Data format: | ||
* | ||
{ | ||
"color": [R,G,B], | ||
"hexIds": [ | ||
"88283082b9fffff", | ||
"88283082b1fffff", | ||
"88283082b5fffff", | ||
"88283082b7fffff", | ||
"88283082bbfffff", | ||
"882830876dfffff" | ||
] | ||
}, | ||
{ | ||
* ] | ||
*/ | ||
export default function H3HexagonBaseLayer({data, opacity}){ | ||
|
||
return new H3HexagonLayer({ | ||
id: data.id, | ||
data: data.data, | ||
pickable: data.properties.pickable || true, | ||
extruded: data.properties.extruded || true, | ||
getHexagon: d => d.hex, | ||
getFillColor: d => d.color || [255, (1 - d.elevation / 500) * 255, 0], | ||
getElevation: d => d.elevation, | ||
elevationScale: data.properties.elevationScale || 20, | ||
opacity | ||
}); | ||
|
||
|
||
} |
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