Add mangrove-map.js script

This commit is contained in:
Sam 2024-09-10 09:11:43 +01:00
parent c31c1f5f06
commit cb0fc7a843
1 changed files with 20 additions and 0 deletions

20
static/js/mangrove-map.js Normal file
View File

@ -0,0 +1,20 @@
maplibregl.addProtocol("cog", MaplibreCOGProtocol.cogProtocol);
map.on("load", () => {
map.addSource("imageSource", {
type: "raster",
url: `cog://http://localhost:5000/cog?year=${year}&pid=${pid}`,
tileSize: 256,
minzoom: 0,
});
map.addLayer({
id: "imageLayer",
source: "imageSource",
type: "raster",
});
});
document.addEventListener("DOMContentLoaded", function () {
fetchDataForTable();
});