GeoLatte / geolatte-geom

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

While processing multipolygon, one polygon failed to process with Exception "Positions are collinear in 2D" #78

Closed dnagaraj84 closed 5 years ago

dnagaraj84 commented 5 years ago

Issue on Geolatte Geom 1.3.0

While processing multipolygon, one of the polygon failed to process with Exception "Positions are collinear in 2D"

FAILED POLYGON:

POLYGON((-88.101304825 30.791176733, -88.101303916 30.791176749, -88.101304 30.791177, -88.101304825 30.791176733)))

But when we plotted the points we see there is area exists and its very small area. But Geolatte decided its a collinear data and thrown this exception

I am attaching a record which have 36 Polygon Data along with the above mentioned failed Polygon for reference.

Exception Details

org.hibernate.HibernateException: java.lang.RuntimeException: Found geometry that was not a geometry in MultiPolygon at org.hibernate.spatial.dialect.oracle.SDOGeometryValueBinder.toNative(SDOGeometryValueBinder.java:88) at org.hibernate.spatial.dialect.oracle.SDOGeometryValueBinder.bind(SDOGeometryValueBinder.java:53) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:279) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:274) at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:39) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2715) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3144) at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3067) at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3447) at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:145) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:589) at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:463) at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337) at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39) at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1435)

I am also attaching the Exception logs for references. exception.txt Multipolygon.txt

maesenka commented 5 years ago

The Shoelace algorithm that is used to determine orientation of LinearRings is unstable for such small polygons.

To handle these cases, I effectively ignore the test for CCW-orientation, and assume the ring is acceptable to Oracle.