Display a globe with an atmosphere
Display a globe with an atmosphere.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Display a globe with an atmosphere</title>
<meta property="og:description" content="Display a globe with an atmosphere." />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.0.1/dist/maplibre-gl.css' />
<script src='https://unpkg.com/maplibre-gl@5.0.1/dist/maplibre-gl.js'></script>
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
</style>
</head>
<style>
#map {
background: #000;
}
</style>
<body>
<div id="map"></div>
<script>
const map = new maplibregl.Map({
container: 'map',
zoom: 0,
center: [137.9150899566626, 36.25956997955441],
style: {
'version': 8,
'projection': {
'type': 'globe'
},
'sources': {
'satellite': {
'url': 'https://api.maptiler.com/tiles/satellite-v2/tiles.json?key=get_your_own_OpIi9ZULNHzrESv6T2vL',
'type': 'raster'
},
},
'layers': [
{
'id': 'Satellite',
'type': 'raster',
'source': 'satellite',
},
],
'sky': {
'atmosphere-blend': [
'interpolate',
['linear'],
['zoom'],
0, 1,
5, 1,
7, 0
]
},
'light': {
'anchor': 'map',
'position': [1.5, 90, 80]
}
}
});
</script>
</body>
</html>