Skip to content

Instantly share code, notes, and snippets.

@ultramenid
Created October 20, 2025 08:19
Show Gist options
  • Select an option

  • Save ultramenid/a8a5a47664d9f338d9cca7e47faa18fa to your computer and use it in GitHub Desktop.

Select an option

Save ultramenid/a8a5a47664d9f338d9cca7e47faa18fa to your computer and use it in GitHub Desktop.
app.get("/gee/lulc", async (req, res) => {
try {
const { kab, kec, des, year = 1992 } = req.query;
const yearInt = parseInt(year, 10);
let geometry = ee.FeatureCollection("projects/ee-dataaurigagee/assets/LTKL/desa");
if (kab) geometry = geometry.filter(ee.Filter.eq("kab", kab));
if (kec) geometry = geometry.filter(ee.Filter.eq("kec", kec));
if (des) geometry = geometry.filter(ee.Filter.eq("des", des));
const MBI4_1 = `projects/ee-dataaurigagee/assets/LTKL/LTKLcollection2/LTKL_mbi41_${yearInt}`;
const LULCyear = ee.Image(MBI4_1).clip(geometry);
const mapInfo = await LULCyear.getMap();
res.send(mapInfo.urlFormat);
} catch (err) {
console.error("Error creating map:", err);
res.status(500).send("Error generating map");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment