I just uploaded [my first semi-automated change](https://www.openstreetmap.org/changeset/41782744).
This change was generated with
[my hack for generating centerlines for riverbank polygons](https://github.com/StyXman/osm-centerlines).
This time I expanded it to include a JOSM plugin which will take all the closed
polygons from the selection and run the algorithm on them, creating new lines.
It still needs some polishing, like making sure they're riverbanks and copying
useful tags to the new line, and probably running a simplifying algo at some
point. Also, even simple looking polygons might generate
complex lines (in plural, and some of these lines could be spurious), so some
manual editing might be required afterwards, specially
connecting the new line to existing centerlines. Still, I think it's useful.

Like I mentioned last time, its setup is quite complex: The JOSM plugin calls a
Python script that needs the Python module installed. That module, for lack of
proper bindings for SFCGAL, depends on PostgreSQL+PostGIS (but we all have one,
right? :-[ ), and connection strings are currently hardcoded. All that to say:
it's quite hacky, not even alpha quality from the installation point of view.

Lastly, as [imagico mentioned in the first post about this hack](https://www.openstreetmap.org/user/Marcos%20Dione/diary/39135#comment35387),
the algorithms are not fast, and I already made my computer start thrashing the
disk swapping like Hell because `pg` hit a big polygon and started using lots of
RAM to calculate its centerline. At least this time I can see how complex the
polygons are before handing them to the code. As an initial benchmark, the original data
for that changeset (I later simplified it with JOSM's tool) took 0.063927s in
`pg+gis` and 0.004737s in the Python code. More test will come later.

Okey, one last thing: Java is hard for a Pythonista. At some point it took me
2h40 to write [60 lines of code](https://github.com/StyXman/osm-centerlines/commit/054e962c276aa20b2723e7e8d6c9fc5bf044572d#diff-44ef0f6444ae43a1b83e7b6a9a6bbd77R153),
~2m40 per line!

