Published
Edited
Feb 5, 2022
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
transformed = {
// check if at least one region has been selected
if (featureCollection && featureCollection.features.length) {
// only one feature, don't use join
const bufferWidthinKM = 10;
if (featureCollection.features.length === 1) {
return turf.buffer(featureCollection, bufferWidthinKM);
} else {
// more than one feature! Join features first
return turf.buffer(
turf.union(...featureCollection.features),
bufferWidthinKM
);
}
} else {
throw new Error(
"Click on a region in the map above to see the transformed output!"
);
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
import { table } from "@tmcw/tables/2"
Insert cell
Insert cell
Insert cell
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