orbisgis / geoclimate

Geospatial processing toolbox for environmental and climate studies
GNU Lesser General Public License v3.0
59 stars 15 forks source link

JTS intersects side location conflict #947

Open ebocher opened 3 months ago

ebocher commented 3 months ago

The following topology configuration returns a side location conflict when the intersect operator is called.

This bug is currently present in version 1.19 of JTS used by H2GIS.

Same bug on version 1.20-SNAPSHOT

image

JTS test

   public void testGeometryIntersects() throws Exception {
        Geometry gc0 = reader.read(
                "POLYGON ((414188.5999999999 6422867.1, 414193.7 6422866.5, 414205.1 6422859.4, 414223.7 6422846.8, 414229.6 6422843.2, 414235.2 6422835.4, 414224.7 6422837.9, 414219.4 6422842.1, 414210.9 6422849, 414199.2 6422857.6, 414191.1 6422863.4, 414188.5999999999 6422867.1))");
        Geometry gc1 = reader.read(
                "LINESTRING (414187.2 6422831.6, 414179 6422836.1, 414182.2 6422841.8, 414176.7 6422844, 414184.5 6422859.5, 414188.6 6422867.1)");
        assertTrue(gc0.intersects(gc1));
    }

H2GIS test issue

    @Test
    public void test_ST_Intersects() throws Exception {
        ResultSet rs = st.executeQuery("SELECT ST_INTERSECTS('POLYGON ((414188.5999999999 6422867.1, 414193.7 6422866.5, 414205.1 6422859.4, 414223.7 6422846.8, 414229.6 6422843.2, 414235.2 6422835.4, 414224.7 6422837.9, 414219.4 6422842.1, 414210.9 6422849, 414199.2 6422857.6, 414191.1 6422863.4, 414188.5999999999 6422867.1))'::GEOMETRY, " +
                "'LINESTRING (414187.2 6422831.6, 414179 6422836.1, 414182.2 6422841.8, 414176.7 6422844, 414184.5 6422859.5, 414188.6 6422867.1)'::GEOMETRY)");
        assertTrue(rs.next());
        assertTrue(rs.getBoolean(1));
    }

Error

Exception calling user-defined function: "isIntersects(POLYGON ((414188.5999999999 6422867.1, 414193.7 6422866.5, 414205.1 6422859.4, 414223.7 6422846.8, 414229.6 6422843.2, 414235.2 6422835.4, 414224.7 6422837.9, 414219.4 6422842.1, 414210.9 6422849, 414199.2 6422857.6, 414191.1 6422863.4, 414188.5999999999 6422867.1)), LINESTRING (414187.2 6422831.6, 414179 6422836.1, 414182.2 6422841.8, 414176.7 6422844, 414184.5 6422859.5, 414188.6 6422867.1)): side location conflict [ (414188.6, 6422867.1, NaN) ]"; SQL statement:
j3r3m1 commented 3 months ago

Good catch !