whosonfirst/go-whosonfirst-validate

Add geometry validation option

Opened this issue · 3 comments

When creating or updating geometries in WOF admin records, I've been using osgeo to "validate" geometries. There is a python script here and a whosonfirst-cookbook doc here that I use/follow to make sure new geometries make tools like postgis and elasticsearch happy.

Maybe this is outside of the scope of this tool, but it would be great to wrap the geometry validation into an existing validation tool.. rather than validating geometries independently from this repo's wof-validate-index to validate properties.

This is currently being explored here:

https://github.com/whosonfirst/go-whosonfirst-browser/blob/update/editor/editor.go#L383

Which is to say:

  1. It's not happening yet. It's on the list.
  2. That code may be moved back in to the go-whosonfirst-validate package afterwards. It's all a bit in flux.

It would be helpful if you could enumerate exactly what "valid geometry" means. Winding order, etc.

I can add actual error messages the next time I validate geometries, but this is a short list of validation errors I've needed to fix:

  • Self-intersection
  • Ring Self-intersection
  • Hole lies outside shell
  • Too few points in geometry component
  • Nested shells
  • Duplicate Rings

These issues were caught using osgeo's isValid function.

Okay, let's try to track down which of those can and can't be handled by: