Public
Edited
Jan 23, 2024
Importers
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Comments explain the parameters and sub-parameters in Banegas (2023)
// Geographic > Proximity to workspaces
accessibilities_variables = [
{
layer: "acc_employment",
group: "overview",
weight: 1
},
{
layer: "acc_gp",
group: "overview",
weight: 1
},
{
layer: "acc_hospitals",
group: "overview",
weight: 1
},
{
layer: "acc_school",
group: "overview",
weight: 1
},
{
layer: "acc_supermarket",
group: "overview",
weight: 1
},
{
layer: "acc_urbancentre",
group: "overview",
weight: 1
}
]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
gas_electricity_variables = [
{
layer: "gas_mean_consumption",
group: "overview",
weight: 1
},
{
layer: "elec_mean_consumption",
group: "overview",
weight: 1
}
]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Comments explain the parameters and sub-parameters in Banegas (2023)
multideprivation_variables = [
{
layer: "simd2020_Total_population", // Socio-demographic > Total population
group: "overview",
weight: 1
},
{
layer: "simd2020_income_count", // Economic > Household income
group: "overview",
weight: 1
},
{
layer: "simd2020_employment_rate", //Socio-demographic > Employment
group: "overview",
weight: 1
},
{
layer: "simd2020_University", // Socio-demographic > educational level
group: "overview",
weight: 1
},
// {
// layer: "simd2020_drive_primary", // Geographic > Proximity to libraries/schools/postoffice
// group: "overview",
// weight: 1
// },
// {
// layer: "simd2020_drive_petrol", // Geographic > Proximity to petrol station
// group: "overview",
// weight: 1
// },
// {
// layer: "simd2020_drive_retail", // Geographic > Proximity to retail
// group: "overview",
// weight: 1
// },
// {
// layer: "simd2020_PT_retail", // Geographic > Proximity to retail
// group: "overview",
// weight: 1
// }
]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
transformer_variables = [
{
layer: "transformer_loading",
group: "aggregated",
weight: 1
},
{
layer: "transformer_spareload",
group: "aggregated",
weight: 1
}
]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// Comments explain the parameters and sub-parameters in Banegas (2023)
conservationarea_variables = [
{
layer: "conservation_area",
group: "aggregated",
weight: 1
}
]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
projection: "identity", // Set the projection
marks: [Plot.geo(parking_spaces, { stroke: "black" })]
})
Insert cell
// {
// await visibility();
// return quickmap(parking_spaces, {
// attrib: "parkable_area",
// heatmap: { radius: 60, blur: 35 }
// });
// }
Insert cell
parking_spaces_csv = FileAttachment("parking_spaces.csv")
.csv({ typed: true })
.then((d) => {
return d.filter((value) => value["parkable_area"] !== -9999);
})
Insert cell
Insert cell
// Comments explain the parameters and sub-parameters in Banegas (2023)
parkingspaces_variables = [
{
layer: "parking_sp",
group: "detailed",
weight: 1
},
{
layer: "parkable_area",
group: "detailed",
weight: 1
}
]
Insert cell
Insert cell
Insert cell
// {
// await visibility();
// return quickmap(existing_evcs);
// }
Insert cell
existing_evcs_csv = FileAttachment("existing_evcs.csv").csv({typed: true})
Insert cell
Insert cell
existingevcs_variables = [
{
layer: "access24Hours",
group: "detailed",
weight: 1
},
{
layer: "connector1RatedOutputKW",
group: "detailed",
weight: 1
}
]
Insert cell
Insert cell
Insert cell
// {
// await visibility();
// return quickmap(steetlighting);
// }
Insert cell
Insert cell
Insert cell
streetlight_variable = [
{
layer: "pole_no",
group: "detailed",
weight: 1
}
]
Insert cell
Insert cell
// {
// await visibility();
// let data = geo.coords2geo(epc_surveys_csv, {
// lat: "lat",
// lon: "long"
// });
// return quickmap(data);
// }
Insert cell
Insert cell
epc_surveys_csv = FileAttachment("epc_surveys.csv")
.csv({ typed: true })
.then((d) => {
return d.map((row) => ({
long: row["LONGITUDE"],
lat: row["LATITUDE"],
prime_energy_indicator: row["Primary Energy Indicator (kWh/m²/year)"],
potential_epc: row["Potential Energy Efficiency Rating"],
co2_emission: row["CO2 Emissions Current Per Floor Area (kg.CO2/m²/yr)"]
}));
})
Insert cell
Insert cell
epc_variables = [
{
layer: "prime_energy_indicator",
group: "detailed",
weight: 1
},
{
layer: "potential_epc",
group: "detailed",
weight: 1
},
{
layer: "co2_emission",
group: "detailed",
weight: 1
}
]
Insert cell
Insert cell
Insert cell
variables = {
let variables = [].concat(
accessibilities_variables,
gas_electricity_variables,
multideprivation_variables,
transformer_variables,
conservationarea_variables,
parkingspaces_variables,
existingevcs_variables,
streetlight_variable,
epc_variables
);
return variables;
}
Insert cell
Insert cell
all_data = {
let alldata = [].concat(
accessibilities_csv,
gas_electricity_csv,
multideprivations_csv,
transformer_loading_csv,
conservation_area_csv,
parking_spaces_csv,
existing_evcs_csv,
streetlighting_csv,
epc_surveys_csv
);
return alldata;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
accessibilities = FileAttachment("accessibilities.geojson").json()
Insert cell
conservation_area = FileAttachment("conservation_area.geojson").json()
Insert cell
existing_evcs = FileAttachment("existing_evcs.geojson").json()
Insert cell
gas_electricity_consumption = FileAttachment(
"gas_electricity_consumption.geojson"
).json()
Insert cell
multideprivations = FileAttachment("multideprivations.geojson").json()
Insert cell
parking_spaces = FileAttachment("parking_spaces.geojson").json()
Insert cell
steetlighting = FileAttachment("streetlighting.geojson").json()
Insert cell
transformer_loading = FileAttachment("transformer_loading.geojson").json()
Insert cell
Insert cell
// https://en.wikipedia.org/wiki/Correlation#Sample_correlation_coefficient
function corr(x, y) {
const n = x.length;
if (y.length !== n)
throw new Error("The two columns must have the same length.");
const x_ = d3.mean(x);
const y_ = d3.mean(y);
const XY = d3.sum(x, (_, i) => (x[i] - x_) * (y[i] - y_));
const XX = d3.sum(x, (d) => (d - x_) ** 2);
const YY = d3.sum(y, (d) => (d - y_) ** 2);
return XY / Math.sqrt(XX * YY);
}
Insert cell
Insert cell
Insert cell
Insert cell
// maplibregl = require("maplibre-gl")
Insert cell
Insert cell
heatLayer = require("leaflet.heat").catch(() => L.heatLayer)
Insert cell
Insert cell
providers = (L, require("leaflet-providers").catch(() => L.tileLayer.provider))
Insert cell
Insert cell
Insert cell
<link href='https://watergis.github.io/maplibre-gl-legend/maplibre-gl-legend.css' rel='stylesheet' />
Insert cell
<link href="https://unpkg.com/maplibre-gl@2.1.9/dist/maplibre-gl.css" rel="stylesheet" />
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