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.projection #820
Closed
Closed
d3.geo.projection #820
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We can use the implicit array.toString() rather than join(",").
This is still a work in progress, but it's a start.
Add projection.{line,polygon} support to d3.geo.path.
One more thing left to do: interpolate along the cut line when joining endpoints. Ideally, the distance between interpolated points should be less than 180°. This should probably also apply to points interpolated at ±90° latitudes.
Also restore path.area and add a few tests.
Passes spiral test.
Conflicts: d3.v2.js d3.v2.min.js src/geo/circle.js src/geo/projection.js
Hurrah for tests!
Conflicts: d3.v2.min.js
This reverts commit b6d7c5e.
Conflicts: d3.v2.min.js
Interpolation of longitudes becomes inaccurate near the poles, since they become mathematically insignificant in relation to a sphere. However, for map projections, we want to interpolate longitudes even at the poles themselves, since many projections distort the poles along an edge.
It was breaking obviously in the resampling demo. Retains a minor optimisation.
Polygon LinearRings weren't being closed correctly.
This was breaking antemeridian clipping in some rare cases where a point was coincident with the antemeridian.
@jasondavies I found some anomalies in the antemeridian cutting demo. The coordinates are: projection.rotate([210.5, 62.5, 0]);
projection.rotate([349, -62.5, 0]);
projection.rotate([30.5, 52, 0]); |
The antemeridian interpolator was mistakenly assuming longitudes of interpolation points are exactly on the antemeridian. An alternative fix would be to use exact equality tests for the coincident points test, but it feels safer to use a margin of error.
Thanks. All fixed in 7686856. |
Nicely done! |
This can be optimised using the 3D coordinates directly from the rotation step, rather than performing additional trig. calculations.
Add extra ring if polygon "surrounds" clip circle.
I've reinstated the original conditional for linear longitudinal interpolation, since the x * x < ε conditional was not tight enough and hence caused glitches in projections that include the poles e.g. stereographic. Back to solving the issue that was primarily noticeable in the Albers demo: graticules near the poles would not resample correctly. We made an assumption that a point mid-way along the connecting great arc is going to be approximately mid-way in pixel-space. This is a reasonable assumption in most cases, but there is an area of high instability near the poles, since a small change in distance could result in a large change in longitude, e.g. imagine a great arc going right over a pole, so the longitude will change greatly depending on which side of the pole you're on. So the new fix is to see if the distance in pixel-space hardly changed at all, and in this case we attempt to interpolate again, mid-way to the new spherical coordinates. I think we can probably improve this even further by borrowing methods from standard root-finding techniques e.g. Newton-Raphson.
Better resampling for non-linear distortions.
This was referenced Oct 5, 2012
Merged into #846. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.