duckdb / duckdb_spatial

MIT License
414 stars 32 forks source link

ST_Overlaps gives the error answer #274

Open cuteDen-ECNU opened 4 months ago

cuteDen-ECNU commented 4 months ago

Considering the following statement:

FORCE INSTALL spatial FROM 'http://nightly-extensions.duckdb.org';
LOAD spatial;
SELECT ST_Overlaps(g1, g2)
  FROM (VALUES
  ('MULTILINESTRING((14 71,92 96),(6 25,63 63,6 25),(71 55,25 87,7 18,34 26,15 55))'::geometry, 
   'LINESTRING(6 25,63 63,6 25)'::geometry)
  ) AS sdb(g1, g2);

--expected{false}; actual{true}

According to the definition of ST_Overlaps:

Two geometries overlap if they have the same dimension, their interiors intersect in that dimension. and each has at least one point inside the other (or equivalently, neither one covers the other).

g1 covers g2, which violates "neither one covers the other", thus, they do not overlap each other.

Besides, after updating the geos version, the result of the above statement is false, which makes me believe it is a solved logic bug in goes.

Version: Spatial version: FORCE INSTALL spatial FROM 'http://nightly-extensions.duckdb.org/'; and LOAD spatial;

DuckDB version:

┌─────────────────┬────────────┐
│ library_version │ source_id  │
│     varchar     │  varchar   │
├─────────────────┼────────────┤
│ v0.10.0         │ 20b1486d11 │
└─────────────────┴────────────┘
darkblue-b commented 1 month ago

@cuteDen-ECNU good thinking -- this was not expected in GEOS and has been amended upstream