Public
Edited
Dec 9, 2024
Insert cell
Insert cell
chart = html`<svg style="width: 100%; height: auto; display: block;" viewBox="0 0 ${imageWidth} ${imageHeight}">
${Array.from(
contours(values),
(d) => svg`<path d="${path(d)}" fill="${color(d.value)}" />`
)}
</svg>`
Insert cell
path = d3.geoPath()
Insert cell
contours = d3
.contours()
.size([imageWidth, imageHeight])
.smooth(false)
.thresholds(20)
Insert cell
color = d3.scaleSequential(d3.extent(values), d3.interpolateMagma)
Insert cell
image = tiff.getImage()
Insert cell
values = (await image.readRasters())[0]
Insert cell
imageWidth = image.getWidth()
Insert cell
imageHeight = image.getHeight()
Insert cell
tiff = FileAttachment("out.tiff")
.arrayBuffer()
.then((buffer) => GeoTIFF.fromArrayBuffer(buffer))
Insert cell
computedContours = contours(values)
Insert cell
GeoTIFF = require("geotiff@2")
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