Public
Edited
Jan 17, 2024
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
filteredData = gridData.map((obj) => {
const filteredEntries = Object.entries(obj).filter(
([key]) =>
key.includes("_pct_") || ["lat", "long", "LSOA11CD"].includes(key)
);
return Object.fromEntries(filteredEntries);
})
Insert cell
Insert cell
Insert cell
Insert cell
combined_variables = mergeOnColumn(
[educations, employment, gp, hospitals, supermarket],
"geo-code"
)
Insert cell
Insert cell
Insert cell
Insert cell
lsoa_data = lsoa_london.features.map((feature) => {
const matchingCsvRow = combined_variables.find(
(row) => row["geo-code"] === feature.properties["LSOA11CD"]
);
return {
...feature,
properties: {
...feature.properties,
...matchingCsvRow // Merge CSV data into properties
}
};
})
Insert cell
Insert cell
Insert cell
gridData = grids_100m.map((row1) => {
const matchingRow2 = combined_variables.find(
(row2) => row2["geo-code"] === row1["LSOA11CD"]
);
return {
...row1,
...matchingRow2
};
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Example for creating the grids programmatically
grids_50m = {
var extent = turf.bbox(london_boundary);
var cellSide = 50;
var options = {
units: "meters",
mask: turf.multiPolygon(london_boundary.features[0].geometry.coordinates)
};

// var grid = turf.pointGrid(extent, cellSide, options); // uncomment to use. beware of heavy notebook load
// return grid; // uncomment to use. beware of heavy notebook load
}
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