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

Ensure polygons are counter clock wise #28

Open
nmondollot opened this issue Jan 17, 2024 · 0 comments
Open

Ensure polygons are counter clock wise #28

nmondollot opened this issue Jan 17, 2024 · 0 comments

Comments

@nmondollot
Copy link
Member

nmondollot commented Jan 17, 2024

The GeoJSON spec says that polygons should be counter clock wise (more info here).

We currently don't enforce this.
When a polygon is saved as clock wise, edited in a GeoJSON tool (like geojson.io) and imported back in the database, the polygon coordinates are changed although the polygon is essentially the same => this creates noise (which is especially visible in the import UI).

Solution: ensure polygons are counter clock wise for the Boulder model.

Previous attempt: 39cc8e6
=> let's make the code simpler / test it, or just wait for rgeo to support the feature out of the box.

In the meantime we can run this query:

Boulder.where("ST_IsPolygonCW(polygon::geometry) = true").update_all("polygon = ST_ForcePolygonCCW(polygon::geometry)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant