Bug report #21267
Geometries stored in Oracle table fail sdo_geom.validate_geometry_with_context(..) check
|Affected QGIS version:||3.4.4||Regression?:||No|
|Operating System:||Windows 10||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||29085|
The geometries that QGIS writes to Oracle are often "invalid" according to Oracle Spatial - sdo_geom.validate_geometry_with_context(..) returns an error code:
ORA-13367: wrong orientation for interior/exterior rings
In an Oracle Spatial geometry, the exterior and/or interior rings are not oriented correctly.
Be sure that the exterior rings are oriented counterclockwise and the interior rings are oriented clockwise.
If the vertices of a simple polygon are drawn in an anticlockwise order, then Oracle regards the geometry as valid.
But if the vertices as drawn in a clockwise order, sdo_geom.validate_geometry_with_context(...) returns 13367.
Also if I start with a polygon that is valid in Oracle and then split it in QGIS, I end up with two polygons that are both invalid (13367).
This problem doesn't appear to have been reported before, which suggests that it doesn't cause problems within QGIS. However, if you are preparing data in QGIS that is then going to be used within an Oracle Spatial application, then the invalid geometries can cause Oracle Spatial functions/operators to fail or return incorrect results.