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

d3.geo.{centroid,area} #941

Closed
mbostock opened this issue Dec 5, 2012 · 4 comments
Closed

d3.geo.{centroid,area} #941

mbostock opened this issue Dec 5, 2012 · 4 comments
Milestone

Comments

@mbostock
Copy link
Member

mbostock commented Dec 5, 2012

This would be useful for computing the lat-lon centroid:

d3.geo.centroid = d3.geo.path().projection(d3_identity).centroid;

Jason points out that we should probably expose d3.geo.area as well, both using spherical coordinates.

@jasondavies
Copy link
Contributor

We should use a spherical polygon area weighting though, otherwise this will be wrong. This should also comply with our interpretation of polygon inside/outside.

@mbostock mbostock mentioned this issue Dec 9, 2012
Merged
mbostock pushed a commit that referenced this issue Dec 9, 2012
Polygons are temporarily treated as lines while I work on adding area
weighting.

See #941.
@jasondavies
Copy link
Contributor

Do we want to return area in (°)² for consistency with our use of degrees elsewhere? Aside from coordinates being in degrees, we also have d3.geo.{circle,greatArc,graticule}.precision, d3.geo.graticule.extent and d3.geo.circle.angle.

If so, we might also make a backwards-incompatible change to d3.geo.greatArc.distance to return degrees, too.

Alternatively, we could simply return steradians and say that this is consistent with d3.geo.greatArc.distance, and simpler to use when converting to real-world units by multiplying by Earth's radius² or radius.

@mbostock
Copy link
Member Author

mbostock commented Dec 9, 2012

I would go with steradians.

@mbostock
Copy link
Member Author

Added in 3.0.

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

No branches or pull requests

2 participants