openAIP / openaip

Public issue tracker of www.openaip.net.
39 stars 3 forks source link

Updating geometry seems to create spurious additional points #175

Closed Pops-67 closed 2 years ago

Pops-67 commented 2 years ago

Editing an airspace, doing nothing to the geometry, push the "update geometry" button. Nothing seemingly happens, then "save". Editing again, and there seems to be lots of spurious points added and many copies.

reskume commented 2 years ago

This is an intended behavior. The underlying parser implicitly tried to create a valid geometry (from an already valid one) as it was configured to always create valid geometries. This has been changed. Now the airspace edit page provides a "Fix Geometry" checkbox to let the parser try to fix an invalid airspace geometry. If set to "true", this will change an invalid geometry. Though the fixed geometry that is returned has many more coordinates, the actual area that the geometry covers doesn't change much (change is due to a 0.1m buffer around the original geometry).

Pops-67 commented 2 years ago

That functions sounds like trouble further down the road. Let's say the the geometry is changed ever so slightly in the original source, then a "fixed" geometry will be very difficult to change without updating the entire geometry. Maybe a warning about this on the checkbox?

reskume commented 2 years ago

The API and database only accept valid GeoJSON geometries ( unknown bugs excepted ). The now implemented behavior is the following:

  1. Geometry is valid + "Fix Geometry" is "true": Geometry is validated but not changed (was changed in former version)
  2. Geometry is valid + "Fix Geometry" is "false": Geometry is validated but not changed
  3. Geometry is invalid + "Fix Geometry" is "false": Geometry is validated and error will occur in frontend web app
  4. Geometry is invalid + "Fix Geometry" is "true": Geometry is validated + fixed geometry with changed geometry is returned and shown in the geometry input field

Of course, the fixed geometry will not be the same as the input (original) OpenAIR definition. There is also a warning about this in the hint text of the checkbox "Fix Geometry". This behavior applies also to OpenAIR circle, arc definitions etc which are internally calculated as parts of a single polygon, i.e. the internally used airspace is ALWAYS a "simple" (no holes) polygon. The OpenAIR input is really only intended as input. We can output OpenAIR also but the output will always only have simple polygon airspaces, i.e. no arcs, circles etc.

The "Fix Geometry" feature can fix a lot of issues e.g. kinked polygons (most common), duplicate coordinates and some other issues. But it's crucial to visually validate the output of the fixed geometry before submitting it to the database.