Published
Edited
Jun 22, 2020
Insert cell
Insert cell
geotiff = require("https://cdn.jsdelivr.net/npm/geotiff")
Insert cell
Insert cell
Insert cell
url3 =
"https://deafrica-data.s3-us-west-2.amazonaws.com/usgs/c1/l8/192/54/2014/01/10/LC08_L1TP_192054_20140110_20170426_01_T1_sr_band5.tif"
Insert cell

viewof tif = html`<input type=file accept=".tif">`
Insert cell
url2=URL.createObjectURL(tif)
Insert cell
Insert cell
example = geotiff.fromUrl(url2)
Insert cell
Insert cell
image = example.getImage()
Insert cell
Insert cell
image.getBoundingBox()
Insert cell
image.getWidth()
Insert cell
Insert cell
example.getImageCount()
Insert cell
thumbnail = example.getImage(6)
Insert cell
Insert cell
md`That’s much more manageable. Let’s load it:`
Insert cell
{
let data = await readImageData(thumbnail);
let c = DOM.context2d(data.width, data.height, 1);
c.putImageData(data, 0, 0);
return c.canvas;
}
Insert cell
Insert cell
Insert cell
Insert cell
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