Published
Edited
Dec 12, 2020
6 stars
Insert cell
Insert cell
{
let container = html`<div style='height:450px;' />`;
yield container;

let map = new mapboxgl.Map({
container,
center: [130.7393, 32.2118],
zoom: 13,
pitch: 60,
bearing: -60,
style: {
'version': 8,
'sources': {
'base': {
'type': 'raster',
'tiles': [
'https://cyberjapandata.gsi.go.jp/xyz/hillshademap/{z}/{x}/{y}.png'
],
'tileSize': 256,
'attribution': '地理院タイル'
},
'flood': {
'type': 'raster',
'tiles': [
// 令和2年7月豪雨 浸水推定図 球磨川水系球磨川 人吉市周辺(2020年7月4日13時作成)
'https://cyberjapandata.gsi.go.jp/xyz/20200703oame_kumagawahitoyoshi_0704dansaizu/{z}/{x}/{y}.png'
],
'tileSize': 256,
'attribution': "地理院タイル"
}
},
'layers': [
{
'id': 'base-tiles',
'type': 'raster',
'source': 'base',
'minzoom': 1,
'maxzoom': 18
},
{
'id': 'flood-tiles',
'type': 'raster',
'source': 'flood',
'minzoom': 1,
'maxzoom': 18,
'paint': {
'raster-opacity': 0.8
}
}
]
},
scrollZoom: true
});

map.addControl(new mapboxgl.NavigationControl(), "top-right");

map.on('load', function () {
map.addSource('mapbox-dem', {
'type': 'raster-dem',
'url': 'mapbox://mapbox.mapbox-terrain-dem-v1',
'tileSize': 512,
'maxzoom': 13
});
// add the DEM source as a terrain layer with exaggerated height
map.setTerrain({ 'source': 'mapbox-dem', 'exaggeration': 1.5 });
});

invalidation.then(() => map.remove());
}
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more