I have an urgent and annoying need to run some Node.js code to fix GeoJSON polygons to conform to the "right-hand rule", but I'm a Python person. Anyone have experience integrating Node.js and Python?
The Node.js code I need to use is this: https://github.com/mapbox/geojson-rewind
I'm wondering if it would just be easier to port that code into Python. I expect the need to fix GeoJSON again in the future, so this will come up again. Sadly, I'm not well versed in Node.js enough to really understand how the geojson-rewind code works.
I'm also not a totally awesome programmer. I'd much rather use someone else's code than my own, since I'm sure someone else would do it better.
@ekansa the algorithm is pretty simple to determine if they're inside out https://stackoverflow.com/a/1165943 .
@fenwick67 Oh! Thanks! That looks useful!
@ekansa (then if it's inside out just reverse the order of the points). If you just need to fix actual files, the geojson-rewind thing can be ran as a command line tool according to the README
@fenwick67 Thanks. Made some progress on my problem inspired by this, and implemented in Python.
Work in progress here: https://github.com/ekansa/open-context-py/blob/master/opencontext_py/libs/validategeojson.py
I'm looking at installing this:
http://naked.readthedocs.io/