From 1b37f7d7f1554f4ef4cd185c1181d54d9956b1db Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sun, 6 Oct 2024 12:06:27 +0800 Subject: Update --- snippets/js_maplibre_terrain | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 snippets/js_maplibre_terrain (limited to 'snippets/js_maplibre_terrain') diff --git a/snippets/js_maplibre_terrain b/snippets/js_maplibre_terrain new file mode 100644 index 0000000..a6466db --- /dev/null +++ b/snippets/js_maplibre_terrain @@ -0,0 +1,27 @@ +map.addSource('hillshading', { + "type": "raster-dem", + "tiles": [ + "https://osmhacktw.github.io/terrain-rgb/tiles/{z}/{x}/{y}.png" + ], + "tileSize": 256, + "maxzoom": 12 +}); +map.setTerrain({ 'source': 'hillshading', 'exaggeration': 1.5 }); + +map.addLayer({ + "id": "hillshading", + "type": "hillshade", + "source": "hillshading", + "minzoom": 6 +}); + +map.on('load', function () { + document.getElementById('slider').addEventListener('input', function (e) { + console.log(e.target.value); + map.setPaintProperty( + 'hillshading', + 'hillshade-illumination-direction', + parseInt(e.target.value) + ); + }); +}); -- cgit v1.2.3-70-g09d2