-
Notifications
You must be signed in to change notification settings - Fork 161
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
Expose Fit Internals #217
Comments
That might look something like adding the following to index.js: (long names as this is probably a rare use case, and because these will end up on export {
fitExtent as geoProjectionFitExtent,
fitSize as geoProjectionFitSize,
fitWidth as geoProjectionFitWidth,
fitHeight as geoProjectionFitHeight
} from "./projection/fit.js"; Then in the externally defined projection I could say: import {
geoProjectionFitExtent as fitExtent,
geoProjectionFitSize as fitSize,
geoProjectionFitWidth as fitWidth,
geoProjectionFitHeight as fitHeight
} from 'd3-geo'; |
An alternative approach would be to finally offer a composite projections construct, that would deal with all the peculiarities (clipping, inverse, etc). |
Interesting idea! Were there already discussions along the lines of a composite projections construct? More sleuthing reveals another approach, though not sure if this is applicable https://github.com/d3/d3-geo-projection/blob/master/src/gilbert.js#L37 Maybe I could just say property("fitExtent");
property("fitHeight");
property("fitSize");
property("fitWidth"); |
Considering submitting a PR with the change to expose these. |
It looks like @HarryStevens has an alternative here https://observablehq.com/@washpostgraphics/geo-albers-usa-pr |
Yep, I just kept copy-pasting code from d3-geo until it stopped throwing errors. |
apologies slightly off topic, but any chance of publishing https://observablehq.com/@washpostgraphics/geo-albers-usa-pr to npm for easier use off of observable? |
Faced with the task of adding
fit
methods to geo-albers-usa-territories , I'm a bit stuck.Ideally I could follow the pattern found in albersUsa.js, namely
However, since the projection is not inside this repository, and those internals from
fit.js
are not exported from the top level of this package, I see no way to access them. Am I missing an approach that would work?FWIW I did try
But that feels janky, and caused some headaches with Rollup (here's what I tried, for reference).
I propose to export these methods from the
d3-geo
package, for use by projections defined outside this project.Thoughts?
The text was updated successfully, but these errors were encountered: