Published
Edited
Jul 20, 2019
1 fork
Importers
8 stars
Insert cell
Insert cell
Insert cell
fetchTile = function(coord) {
return new Promise(resolve => {
fetch(`https://cyberjapandata.gsi.go.jp/xyz/dem/${coord.z}/${coord.x}/${coord.y}.txt`)
.then(response => response.text())
.then(text => text.split("\n"))
.then(rows => rows.slice(0, rows.length - 1)) // Last row: empty
.then(rows => rows.map(r => r.split(",").map(d => d === "e" ? 0 : parseFloat(d)))) // e: sea
.then(data => resolve(data))
.catch(error => {throw error});
});
}
Insert cell
Insert cell
tileCoord = ({z: 13, x: 7262, y: 3232})
Insert cell
Insert cell
data = fetchTile(tileCoord)
Insert cell
Insert cell
Insert cell
imshow(data, 1, d3.interpolateViridis)
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more