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

Add functionality to rewind geojson into old-style d3 geojson #229

Closed
matkoniecz opened this issue Mar 30, 2021 · 4 comments
Closed

Add functionality to rewind geojson into old-style d3 geojson #229

matkoniecz opened this issue Mar 30, 2021 · 4 comments

Comments

@matkoniecz
Copy link

Triggered by https://gis.stackexchange.com/questions/392452/why-d3-js-works-only-with-geojson-violating-right-hand-rule

It would be useful to have functionality with d3 to rewind right-hand geojson into left-hand geojso.

Right now displaying RFC 7946 geojson requires importing extra library.

(and maybe add some warning on detecting small areas misinterpreted by D3 to be planet-covering area with a small hole? this D3 behavior was really confusing. I was looking for bugs in my code for hours.)

BTW, ad #79 (comment)

I’m disappointed that RFC 7946 standardizes the opposite winding order to D3, Shapefiles and PostGIS. And I don’t see an easy way for D3 to change its behavior, since it would break all existing (spherical) GeoJSON used by D3. I’d be interested to see an empirical analysis of GeoJSON use in practice to see what winding order is commonly used.

right-hand winding order seems to be clearly more and more standard to me (see for example QGIS which will not open them at all) and D3 seems to growing oddity. Especially as

result is the same whether the exterior ring is clockwise or anticlockwise

appears to not be true in many cases

@matkoniecz
Copy link
Author

Or maybe have opt-in setting "I want to use geojson, not d3-old-style-geojson"?

@Fil
Copy link
Member

Fil commented Mar 30, 2021

I agree it would be useful. Can we follow the conversation at #138?

@Fil Fil transferred this issue from d3/d3-shape Mar 30, 2021
@Fil
Copy link
Member

Fil commented Dec 16, 2022

Closing as duplicate of #138. Current solution at https://observablehq.com/@fil/rewind

@matkoniecz
Copy link
Author

posted in #138 (comment)

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