Skip to content

Commit

Permalink
Merge pull request #208 from kekehurry/feature/more_controls_over_dec…
Browse files Browse the repository at this point in the history
…kgllayer

Feature/more controls over deckgllayer
  • Loading branch information
amcarrero authored Jun 21, 2024
2 parents daa33ea + 56f31de commit b4392f9
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
Expand Down
66 changes: 42 additions & 24 deletions src/views/CityScopeJS/DeckglMap/deckglLayers/base/GeoJson.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,47 @@
import {GeoJsonLayer} from '@deck.gl/layers';

/**
* Data format:
* Valid GeoJSON object
*/
export default function GeoJsonBaseLayer({data, opacity}){
/**
* Data format:
* Valid GeoJSON object
*/

return new GeoJsonLayer({
id: data.id,
data: data.data,
pickable: data.properties.pickable || true,
stroked: data.properties.stroked || false,
filled: data.properties.filled || true,
extruded: data.properties.extruded || true,
pointType: data.properties.pointType || 'circle',
lineWidthScale: data.properties.lineWidthScale || 20,
lineWidthMinPixels: data.properties.lineWidthMinPixels || 2,
getFillColor: [160, 160, 180, 200],
getLineColor: d => d.properties.color,
getPointRadius: data.properties.pointRadius || 100,
getLineWidth: data.properties.lineWidth || 1,
getElevation: data.properties.elevation || 30,
opacity
});


export default function GeoJsonBaseLayer({data, opacity}){
if(data){
return new GeoJsonLayer({
id: data.id,
data: data.data,
opacity: opacity || 0.5,
pickable: data.properties?.pickable || true,
stroked: data.properties?.stroked || false,
filled: data.properties?.filled || true,
extruded: data.properties?.extruded || true,
wireframe: data.properties?.wireframe || false,
pointType: data.properties?.pointType || 'circle',
autoHighlight: data.properties?.autoHighlight || true,
highlightColor: data.properties?.highlightColor || [242, 0, 117, 120],
lineWidthUnits: data.properties?.lineWidthUnits || 'pixels',
lineWidthMinPixels: data.properties?.lineWidthMinPixels || 1,
getFillColor: d => d.properties?.color || data.properties?.color || [160, 160, 180, 200],
getLineColor: d => d.properties?.lineColor || data.properties?.lineColor || [255, 255, 255],
getPointRadius: d => d.properties?.pointRadius || data.properties?.pointRadius || 10,
getLineWidth: d => d.properties?.lineWidth ||data.properties?.lineWidth || 1,
getElevation: d => d.properties?.height || data.properties?.height || 1,
updateTriggers: {
getFillColor: data,
getLineColor: data,
getPointRadius: data,
getLineWidth: data,
getElevation: data,
},
transitions: {
getFillColor: data.properties?.duration || 500,
getElevation: data.properties?.duration || 500,
getLineWidth: data.properties?.duration || 500,
getPointRadius: data.properties?.duration || 500,
getLineColor: data.properties?.duration || 500,
}
});


}
}

0 comments on commit b4392f9

Please sign in to comment.