Public
Edited
Sep 24, 2018
1 fork
8 stars
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
Insert cell
Insert cell
Insert cell
world.features.find(o => o.properties.name.match("Serbia"))
Insert cell
areas = world.features

// select only countries in europe
.filter(o => o.properties.continent == "Europe"
|| o.properties.name == "Morocco"
|| o.properties.name == "Algeria"
|| o.properties.name == "Tunisia"
|| o.properties.name == "Turkey"
|| o.properties.name == "Greenland"
)

// flatten multipolygons into polygons
.reduce((countries2, feature) => {
if (feature.geometry.type == "Polygon") {
countries2.push(feature);
} else { // MultiPolygon
feature.geometry.coordinates.forEach(coordinates => {
countries2.push({
type: "Feature",
properties: feature.properties,
geometry: { type: "Polygon", coordinates },
});
});
}

return countries2;
}, [])
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