geoclimate icon indicating copy to clipboard operation
geoclimate copied to clipboard

JTS intersects side location conflict

Open ebocher opened this issue 11 months ago • 1 comments

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:

ebocher avatar Mar 27 '24 10:03 ebocher

Good catch !

j3r3m1 avatar Mar 27 '24 12:03 j3r3m1

Fixed with #991 A big thank you to @dr-jts

ebocher avatar Sep 03 '24 13:09 ebocher