GeoLatte / geolatte-geom

A geometry model that conforms to the OGC Simple Features for SQL specification.
Other
134 stars 63 forks source link

Problems with empty geometries #142

Closed datenexperte closed 2 years ago

datenexperte commented 2 years ago

We have encountered problems with empty geometries in Geolatte, both under Oracle and Postgis.

Versions: geolatte-geom 1.6.1 hibernate 5.4.28.Final PostgreSQL 13.3 Oracle 19.3

When using Geolatte with Postgis, an empty geometry is always converted to an empty GeometryCollection. Is there a reason for this? Saving a MULTIPOINT with POINT EMPTY, MULTILINESTRING with LINESTRING EMPTY or MULTIPOLYGON with POLYGON EMPTY leads to errors like this "MultiLineString cannot contain GeometryCollection element".

Using Geolatte with Oracle there are several problems with empty geometries:

maesenka commented 2 years ago

Postgis pre 2.2.2 serialized empty geometries as empty GeometryCollections. This behavioral change is reflected in later versions of geolatte-geom & Hibernate. See this commit: ec88a38abb2bda12b7bd9a32b5b6e3eb7420adfd

You may want to update the geolatte-geom (or Hibernate) version to the latest, if possible. That should fix at least that issue.

The Oracle SDO problems are more serious. I will try to fix as soon as possible.

datenexperte commented 2 years ago

Thank you for the information. We will update geolatte-geom and wait for the Oracle problems to be fixed.

maesenka commented 2 years ago

Could you provide the geometries in WKT that cause the problems?

I have been working on this but I notice that Oracle doesn't seem to support empty geometries. In any case the following throws an error in Oracle 18-xe:

SELECT  SDO_GEOMETRY('POINT EMPTY')
FROM DUAL;
MartinSteinwender commented 2 years ago

ich have replaced empty geometries by NULL after running into excpetions https://gis.stackexchange.com/questions/200270/is-it-possible-to-store-empty-geometries-in-an-oracle-database

maesenka commented 2 years ago

Should be fixed by commit 6efbfd8

datenexperte commented 2 years ago

Thanks for fixing the errors. These are some geometries I tested with:

GEOMETRYCOLLECTION (POLYGON EMPTY, POLYGON ((210 380, 400 380, 400 280, 210 280, 210 380))) GEOMETRYCOLLECTION (MULTIPOLYGON EMPTY, POLYGON ((210 380, 400 380, 400 280, 210 280, 210 380))) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION EMPTY, POLYGON ((210 380, 400 380, 400 280, 210 280, 210 380))) MULTIPOINT (EMPTY, (1 1))