react-simple-maps
react-simple-maps copied to clipboard
Display and center only a single state from a full US counties map
Hi
I'm currently using us-albers topojson map, and I wonder if there is a way to get one state from full US map. Here is my attempt in sandbox. I'm able to filter out the geometries to a single state using the following code, but I'm having trouble centering single on a single state:
function getGeo(state) {
if (!state) {
return geo;
}
const { type, bbox, transform, objects, arcs } = geo;
const { states, nation } = objects;
return {
type,
bbox,
transform,
objects: {
states: {
type: "GeometryCollection",
geometries: states.geometries.filter(n => n.properties.abbr === state)
}
},
arcs,
nation
};
}
Related Issues:
- #95