Public
Edited
Oct 5, 2023
2 forks
8 stars
Insert cell
Insert cell
Insert cell
Insert cell
GeoTIFF = require("geotiff@2.0.7")
Insert cell
tiff = FileAttachment(
"gpw_v4_population_count_adjusted_to_2015_unwpp_country_totals_rev11_2020_30_min.tif"
)
.arrayBuffer()
.then((buffer) => GeoTIFF.fromArrayBuffer(buffer))
Insert cell
Insert cell
bb = tiff.getImage().then((d) => d.getBoundingBox())
Insert cell
Insert cell
raster = tiff.readRasters()
Insert cell
Insert cell
Plot.plot({
projection: "equal-earth",
width: 1000,
color: {
type: "log",
scheme: "turbo",
none: "white",
domain: [1000, 20000000],
legend: true,
label: "Population"
},

marks: [
Plot.raster(raster[0], {
width: raster.width,
height: raster.height,
x1: bb[0],
y1: bb[3],
x2: bb[2],
y2: bb[1],
interpolate: "nearest",
clip: "sphere"
}),
Plot.geo(await FileAttachment("world.json").json(), {
fill: "none",
stroke: "white",
strokeWidth: 0.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