-
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
polygonContains make my demo wrong #140
Comments
This comment has been minimized.
This comment has been minimized.
@Fil d3/d3@eff0a11: My confusion : What's more, I want to check the data of my topoJSON(contain polygon data) whether is standard. Do you know some tools that can detect my data or some documents that describe the standard? |
You can test your topojson file with http://mapshaper.org/ You're right, the commit that introduced that epsilon was The corresponding issue #2025 has sadly disappeared, but there is a related discussion here https://stackoverflow.com/questions/25895676/how-to-stop-d3-js-from-creating-infinite-areas-from-linear-polygons It would be very useful to create a simple demo of the bug so we can work on it. |
There is no test for (disappeared) issue #2025, which means that if you build d3-geo by reverting dab64a2 on https://github.com/d3/d3-geo/blob/master/src/polygonContains.js#L71 , all the unit tests pass. However, this does not seem to be the solution because… it appears that two small polygons in your dataset are counter-clockwise, which means that they should be drawn as "the whole planet around the polygon", and their geoBounds are (correctly) evaluated as [-180…180]. However there seems to be a (different) bug that makes d3.geoPath draw them as if they were clockwise. https://beta.observablehq.com/@fil/small-circle-test (filed under #141) |
@Fil Thanks for the bug of details and point out the data with counter-clockwise. |
Hello D3 Team:
I used OpenLayers and D3 for wind display. It worked great in D3 version3. After D3 version4 publishing, I tried to upgrade from version 3 to version 4. Certainly, I changed the function name like from
d3.geo.mercator()
tod3.geoMercator()
. But failed at the end.The v3 demo (correct)
The v4 demo (wrong, the center of the area will be wrong when you scroll mouse to zoom map )
I compared much code and found the difference.
v3.5.16 :
return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < 0) ^ winding & 1;
After v3.5.16 (v3.5.17, v4) :
return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < -ε) ^ winding & 1;
Could anyone explain the changes, please?
How can I modify my current code if the changes are necessary?
My code snippets :
This is my stackoverflow detail
I will express my sincere thanks to you if you can reply me!
The text was updated successfully, but these errors were encountered: