Closed datenexperte closed 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.
Thank you for the information. We will update geolatte-geom and wait for the Oracle problems to be fixed.
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;
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
Should be fixed by commit 6efbfd8
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))
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:
Reading a geometry from the database which contains an empty polygon leads to error: java.lang.IllegalArgumentException: Empty linear ring is not valid. at org.geolatte.geom.Polygon.checkLinearRing(Polygon.java:101) at org.geolatte.geom.Polygon.checkRings(Polygon.java:95) at org.geolatte.geom.Polygon.(Polygon.java:87)
at org.geolatte.geom.codec.db.oracle.PolygonSdoDecoder.internalDecode(PolygonSdoDecoder.java:45)
at org.geolatte.geom.codec.db.oracle.AbstractSDODecoder.decode(AbstractSDODecoder.java:27)
at org.geolatte.geom.codec.db.oracle.AbstractSDODecoder.decode(AbstractSDODecoder.java:13)
at org.geolatte.geom.codec.db.oracle.Decoders.decode(Decoders.java:52)
Saving MULTIPOLYGON EMPTY or GEOMETRYCOLLECTION EMPTY leads to error Caused by: java.lang.NullPointerException at org.geolatte.geom.codec.db.oracle.OracleJDBCTypeFactory.createElemInfoArray(OracleJDBCTypeFactory.java:149) at org.geolatte.geom.codec.db.oracle.OracleJDBCTypeFactory.createStruct(OracleJDBCTypeFactory.java:140) at org.hibernate.spatial.dialect.oracle.SDOGeometryValueBinder.store(SDOGeometryValueBinder.java:72) at org.hibernate.spatial.dialect.oracle.SDOGeometryValueBinder.toNative(SDOGeometryValueBinder.java:78)
Saving GEOMETRYCOLLECTION with MULTIPOLYGON EMPTY or GEOMETRYCOLLECTION with GEOMETRYCOLLECTION EMPTY leads to error Caused by: java.lang.NullPointerException at org.geolatte.geom.codec.db.oracle.SdoGeometryCollectionEncoder.join(SdoGeometryCollectionEncoder.java:47) at org.geolatte.geom.codec.db.oracle.SdoGeometryCollectionEncoder.encode(SdoGeometryCollectionEncoder.java:27) at org.geolatte.geom.codec.db.oracle.SdoGeometryCollectionEncoder.encode(SdoGeometryCollectionEncoder.java:11) at org.geolatte.geom.codec.db.oracle.Encoders.encode(Encoders.java:41) at org.hibernate.spatial.dialect.oracle.SDOGeometryValueBinder.toNative(SDOGeometryValueBinder.java:77)
Saving MULTIPOINT with POINT EMPTY leads to error Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 at org.geolatte.geom.PackedPositionSequence.getCoordinates(PackedPositionSequence.java:119) at org.geolatte.geom.AbstractPositionSequence.getPositionN(AbstractPositionSequence.java:63) at org.geolatte.geom.Point.getPosition(Point.java:56) at org.geolatte.geom.codec.db.oracle.SdoMultiPointEncoder.pointToOrdinates(SdoMultiPointEncoder.java:41) at org.geolatte.geom.codec.db.oracle.SdoMultiPointEncoder.encode(SdoMultiPointEncoder.java:30) at org.geolatte.geom.codec.db.oracle.SdoMultiPointEncoder.encode(SdoMultiPointEncoder.java:11) at org.geolatte.geom.codec.db.oracle.Encoders.encode(Encoders.java:41)