Skip to content

Instantly share code, notes, and snippets.

@tim-salabim
Created February 5, 2025 18:13
Show Gist options
  • Save tim-salabim/8371fa6523c689bbd3c597a1f6334dfe to your computer and use it in GitHub Desktop.
Save tim-salabim/8371fa6523c689bbd3c597a1f6334dfe to your computer and use it in GitHub Desktop.
addDeckGlPolygons = function(map, geom_column_name, layerId) {
let gaDeckLayers = window["@geoarrow/deck"]["gl-layers"];
let data_fl = document.getElementById(layerId + '-1-attachment');
fetch(data_fl.href)
.then(result => Arrow.tableFromIPC(result))
.then(arrow_table => {
let geoArrowPolygon = new gaDeckLayers.GeoArrowPolygonLayer({
id: layerId,
data: arrow_table,
getPolygon: arrow_table.getChild(geom_column_name),
filled: true,
stroked: true,
lineWidthMinPixels: 1,
lineWidthUnits: 'pixels',
lineWidth: 1,
getLineColor: [0, 0, 0, 0],
//https://deck.gl/docs/developer-guide/performance#supply-attributes-directly
getFillColor: [0, 0, 0, 120]
/*
({ index, data }) => {
const recordBatch = data.data;
const len = recordBatch.data.length / 4;
return [
recordBatch.get(index)["fillColor"],
recordBatch.get(index + len * 1)["fillColor"],
recordBatch.get(index + len * 2)["fillColor"],
recordBatch.get(index + len * 3)["fillColor"]
];
}
*/
});
var decklayer = new deck.MapboxOverlay({
interleaved: true,
layers: [geoArrowPolygon],
});
map.addControl(decklayer);
return map;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment