Storing empty geometries in Oracle10g

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Storing empty geometries in Oracle10g

G.Belger
Hi List!

I started using hibernatespatial two weeks ago, it's a great project,
thanks! It is nice to be able to work with two different spatial
db-systems (in my case PostGIS and Oracle10g) using the same code.

However i encountered a problem today. Using hibernatespatial-oracle, i
have problems storing empty geometries. Maybe someone can help?

When i try to save an 'LINESTRING EMPTY' (i.e. a jts LineString without
coordinates) , the oracla adapter will throw up because of the dimension
0 of that geometry.

java.lang.IllegalArgumentException: Dimension can only be 2,3 or 4.
        at
org.hibernatespatial.oracle.SDOGType.setDimension(SDOGType.java:28)
        at org.hibernatespatial.oracle.SDOGType.<init>(SDOGType.java:17)
        at
org.hibernatespatial.oracle.SDOGeometryType.convertJTSLineString(SDOGeom
etryType.java:155)
        at
org.hibernatespatial.oracle.SDOGeometryType.convertJTSGeometry(SDOGeomet
ryType.java:102)
        at org.

When i try to save an 'GEOMETRYCOLLECTION EMPTY' (i.e. an empty
Geometrycollection), the oracle adapter runs into this
NullPointerException.

java.lang.NullPointerException
at
org.hibernatespatial.oracle.OracleJDBCTypeFactory.createElemInfoArray(Or
acleJDBCTypeFactory.java:57)
        at
org.hibernatespatial.oracle.OracleJDBCTypeFactory.createStruct(OracleJDB
CTypeFactory.java:49)
        at
org.hibernatespatial.oracle.SDOGeometry.store(SDOGeometry.java:154)
        at
org.hibernatespatial.oracle.SDOGeometryType.conv2DBGeometry(SDOGeometryT
ype.java:82)

At least the later seems to be a bug...?

Both works fine when working with PostGIS (PostGIS seems to convert the
empty LineString automatically into an empty GeometryCollection, i
suppose this is correct in regards to SimpleFeature-Spec?).

As i mentioned before, i am using both PostGIS and Oracle, so it would
be nice to have a solution for both cases. Has anyone an idea? Btw:
storing 'null' is not an option: i want to access the DBs from ArcGis
(10), which refuses to work with 'null' geometries (empty collections
are fine however).

Thanks in advance and kind regards
Gernot
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Storing empty geometries in Oracle10g

Karel Maesen
Administrator
Hi,

Storing empty geometries is indeed not supported in the current version of
the Oracle Spatial Dialect provider. The reason for that was that storing
empty geometries fails when a spatial index is defined on the column.

Anyway, I created an issue for it
(http://www.hibernatespatial.org/jira/browse/HIBSPA-85) , and I'll look
into it as soon as possible.

Regards,

Karel


> Hi List!
>
> I started using hibernatespatial two weeks ago, it's a great project,
> thanks! It is nice to be able to work with two different spatial
> db-systems (in my case PostGIS and Oracle10g) using the same code.
>
> However i encountered a problem today. Using hibernatespatial-oracle, i
> have problems storing empty geometries. Maybe someone can help?
>
> When i try to save an 'LINESTRING EMPTY' (i.e. a jts LineString without
> coordinates) , the oracla adapter will throw up because of the dimension
> 0 of that geometry.
>
> java.lang.IllegalArgumentException: Dimension can only be 2,3 or 4.
> at
> org.hibernatespatial.oracle.SDOGType.setDimension(SDOGType.java:28)
> at org.hibernatespatial.oracle.SDOGType.<init>(SDOGType.java:17)
> at
> org.hibernatespatial.oracle.SDOGeometryType.convertJTSLineString(SDOGeom
> etryType.java:155)
> at
> org.hibernatespatial.oracle.SDOGeometryType.convertJTSGeometry(SDOGeomet
> ryType.java:102)
> at org.
>
> When i try to save an 'GEOMETRYCOLLECTION EMPTY' (i.e. an empty
> Geometrycollection), the oracle adapter runs into this
> NullPointerException.
>
> java.lang.NullPointerException
> at
> org.hibernatespatial.oracle.OracleJDBCTypeFactory.createElemInfoArray(Or
> acleJDBCTypeFactory.java:57)
> at
> org.hibernatespatial.oracle.OracleJDBCTypeFactory.createStruct(OracleJDB
> CTypeFactory.java:49)
> at
> org.hibernatespatial.oracle.SDOGeometry.store(SDOGeometry.java:154)
> at
> org.hibernatespatial.oracle.SDOGeometryType.conv2DBGeometry(SDOGeometryT
> ype.java:82)
>
> At least the later seems to be a bug...?
>
> Both works fine when working with PostGIS (PostGIS seems to convert the
> empty LineString automatically into an empty GeometryCollection, i
> suppose this is correct in regards to SimpleFeature-Spec?).
>
> As i mentioned before, i am using both PostGIS and Oracle, so it would
> be nice to have a solution for both cases. Has anyone an idea? Btw:
> storing 'null' is not an option: i want to access the DBs from ArcGis
> (10), which refuses to work with 'null' geometries (empty collections
> are fine however).
>
> Thanks in advance and kind regards
> Gernot
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>


_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Storing empty geometries in Oracle10g

G.Belger
Hi,

Thanks for the answer and the ticket.

I will try to work around it for the moment, but fixing the bug would be great of course!

Kind regards
Gernot

> -----Urspr√ľngliche Nachricht-----
> Von:
> [hidden email]
> [mailto:[hidden email].
> org] Im Auftrag von Karel Maesen
> Gesendet: Freitag, 10. Juni 2011 11:25
> An: Hibernate Spatial Users Discussion
> Betreff: Re: [hibernatespatial-users] Storing empty
> geometries in Oracle10g
>
> Hi,
>
> Storing empty geometries is indeed not supported in the
> current version of the Oracle Spatial Dialect provider. The
> reason for that was that storing empty geometries fails when
> a spatial index is defined on the column.
>
> Anyway, I created an issue for it
> (http://www.hibernatespatial.org/jira/browse/HIBSPA-85) , and
> I'll look into it as soon as possible.
>
> Regards,
>
> Karel
>
>
> > Hi List!
> >
> > I started using hibernatespatial two weeks ago, it's a
> great project,
> > thanks! It is nice to be able to work with two different spatial
> > db-systems (in my case PostGIS and Oracle10g) using the same code.
> >
> > However i encountered a problem today. Using
> hibernatespatial-oracle,
> > i have problems storing empty geometries. Maybe someone can help?
> >
> > When i try to save an 'LINESTRING EMPTY' (i.e. a jts LineString
> > without
> > coordinates) , the oracla adapter will throw up because of the
> > dimension 0 of that geometry.
> >
> > java.lang.IllegalArgumentException: Dimension can only be 2,3 or 4.
> > at
> > org.hibernatespatial.oracle.SDOGType.setDimension(SDOGType.java:28)
> > at org.hibernatespatial.oracle.SDOGType.<init>(SDOGType.java:17)
> > at
> >
> org.hibernatespatial.oracle.SDOGeometryType.convertJTSLineString(SDOGe
> > om
> > etryType.java:155)
> > at
> >
> org.hibernatespatial.oracle.SDOGeometryType.convertJTSGeometry(SDOGeom
> > et
> > ryType.java:102)
> > at org.
> >
> > When i try to save an 'GEOMETRYCOLLECTION EMPTY' (i.e. an empty
> > Geometrycollection), the oracle adapter runs into this
> > NullPointerException.
> >
> > java.lang.NullPointerException
> > at
> >
> org.hibernatespatial.oracle.OracleJDBCTypeFactory.createElemInfoArray(
> > Or
> > acleJDBCTypeFactory.java:57)
> > at
> >
> org.hibernatespatial.oracle.OracleJDBCTypeFactory.createStruct(OracleJ
> > DB
> > CTypeFactory.java:49)
> > at
> > org.hibernatespatial.oracle.SDOGeometry.store(SDOGeometry.java:154)
> > at
> >
> org.hibernatespatial.oracle.SDOGeometryType.conv2DBGeometry(SDOGeometr
> > yT
> > ype.java:82)
> >
> > At least the later seems to be a bug...?
> >
> > Both works fine when working with PostGIS (PostGIS seems to convert
> > the empty LineString automatically into an empty
> GeometryCollection, i
> > suppose this is correct in regards to SimpleFeature-Spec?).
> >
> > As i mentioned before, i am using both PostGIS and Oracle,
> so it would
> > be nice to have a solution for both cases. Has anyone an idea? Btw:
> > storing 'null' is not an option: i want to access the DBs
> from ArcGis
> > (10), which refuses to work with 'null' geometries (empty
> collections
> > are fine however).
> >
> > Thanks in advance and kind regards
> > Gernot
> > _______________________________________________
> > hibernatespatial-users mailing list
> > [hidden email]
> >
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespat
> > ial-users
> >
>
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hiber
natespatial-users
>
>
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users