Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing properties of Geometry objects when using AlbersUsa projector #34

Open
jtsiros opened this issue Sep 2, 2023 · 0 comments
Open

Comments

@jtsiros
Copy link

jtsiros commented Sep 2, 2023

I'm looking at the Globe Albersusa example and noticed that the properties of Geometry object is not available after feature_from_name returns. I need to access these properties to assign/map the FIPS county ID to each SVG subcomponent so I can map specific data to each county.

Here's the equivalent code in JS does this automatically without having to do any manual mapping:

ex:

     // Draw county boundaries and fill accordingly
      svg.selectAll("path")
        .data(feature(usCounties, usCounties.objects.counties).features)
        .enter().append("path")
        .attr("d", path)
        .attr("fill", d => {
          const countyData = countyToData[d.id];
          console.log(d, countyData);
          if (countyData) {
            return d3.color(colorScale(countyData.rise));
          }
          return "darkgrey";
        })
        .attr("stroke", "#ffffff") // color of the border
        .attr("stroke-width", "1.0"); // thickness of the border;

How can i do something similar with d3_geo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant