Tolerance for validation of spatial data

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

Tolerance for validation of spatial data

klaus.rossmy
Hi guys!
We got a problem with the mapping of oracle sdo data:
java.lang.IllegalArgumentException: holes must not contain null elements
        at com.vividsolutions.jts.geom.Polygon.<init>(Polygon.java:130)
        at com.vividsolutions.jts.geom.GeometryFactory.createPolygon(GeometryFactory.java:401)
        at org.hibernate.spatial.dialect.oracle.SDOGeometryValueExtractor.conve
rtSDOPolygon(SDOGeometryValueExtractor.java:236)

When we execute validation in oracle, we get a result which is depending on the tolerance, for instance 0.1:

select SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(coordinate.shape, 0.1)
  from
          GEOPORTAL.coordinate coordinate ;

results in  a ORA-13356 error, while 0.0000005 results in 'TRUE'

So how does that relate to Hibernate Spatial?

Thanks Tilman



_______________________________________________
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: Tolerance for validation of spatial data

klaus.rossmy
Now I got a bit further with the issue:
It seems that the data we work with has been imported by an oracle import tool which fails to recognize multi polygons and labels them as polygons.
So knowing that, is was easy to patch hibernate spatial for a workaround:
In class SDOGeometryValueExtractor add the following code snippet at line 236 (or just before the 'return getGeometryFactory().createPolygon(shell, holes);' statement)

        for (LinearRing hole:holes)
        {
            if (hole == null)
            {
                return convertSDOMultiPolygon(dim, lrsDim, SDOGeom);
            }
        }

Cheers Tilman


_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users