Created
November 27, 2022 04:40
-
-
Save darrenwiens/3af685b3b5d4afe31640189f450b0293 to your computer and use it in GitHub Desktop.
A client for consuming 3DEP tiles from Microsoft Planetary Computer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>3dep-tile-client</title> | |
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"> | |
<link href="https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.css" rel="stylesheet"> | |
<script src="https://api.mapbox.com/mapbox-gl-js/v2.11.0/mapbox-gl.js"></script> | |
<style> | |
body { | |
margin: 0; | |
padding: 0; | |
} | |
#map { | |
position: absolute; | |
top: 0; | |
bottom: 0; | |
width: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script> | |
mapboxgl.accessToken = 'YOUR_MAPBOX_TOKEN'; | |
const map = new mapboxgl.Map({ | |
container: 'map', | |
zoom: 14, | |
center: [-121.07592403878053, 47.2010187008799], | |
pitch: 60, | |
bearing: 0, | |
style: 'mapbox://styles/mapbox/satellite-streets-v12' | |
}); | |
map.on('load', () => { | |
map.addSource("augmented-dem", { | |
type: "raster-dem", | |
tiles: [ | |
"http://127.0.0.1:8000/{z}/{x}/{y}" | |
], | |
tileSize: 256, | |
encoding: "terrarium", | |
}); | |
map.setTerrain({ source: "augmented-dem", exaggeration: 1 }); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment