tracts = {
const lookups = d3.group(andChangeTable1, (d) => "" + d.GeoID);
const supplemented = [];
for (let feature of NYC.features) {
const { properties } = feature;
const matched = lookups.get(properties.GEOID);
if (matched !== undefined) {
let census_data = matched[0];
census_data = Object.fromEntries(
Object.entries(census_data).map(([k, v]) => [
k,
k == "GeoID" ? "" + v : v && v.replace ? +v.replace(",", "") : v
])
);
feature.properties = { ...feature.properties, ...census_data };
supplemented.push(feature);
}
}
return {
type: "FeatureCollection",
features: supplemented
};
}