[osmosis-dev] Invalid ways, now with code

Toby Murray toby.murray at gmail.com
Wed Dec 12 07:33:08 GMT 2012


As a refresher, this topic originally started in November:
http://lists.openstreetmap.org/pipermail/osmosis-dev/2012-November/001408.html

Since then I have managed to modify both the --write-pgsql(-dump) and
the --write-pgsql-change tasks to take in an optional
keepInvalidWays=true/false parameter. It defaults to true as Brett
suggested but if it is set to false:

For write-pgsql(-dump) it is pretty straightforward. If a way has less
than two nodes it is ignored, just like it used to be.

For writing changes, it is a little more complicated since invalid
ways can come from new v1 ways being created or they can be an
existing and valid way being modified to have less than two nodes in
it. Ways that are invalid in v1 are just ignored and not inserted.
Existing ways that become invalid as a result of the change are
removed from the database instead of being updated.

There are a few things I still want to test but I think it is in
pretty good shape. I did add a couple of invalid ways to the test
files although it is kind of hard to test all the cases without
bloating the file count and test code...

Anyway, thoughts? My changes are on github in the invalid_geometry branch:
https://github.com/ToeBee/osmosis

And a diff of all my changes:
https://github.com/ToeBee/osmosis/compare/master...invalid_geometry

Toby



More information about the osmosis-dev mailing list