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))
.then(rows => rows.map(r => r.split(",").map(d => d === "e" ? 0 : parseFloat(d))))
.then(data => resolve(data))
.catch(error => {throw error});
});
}