View Ticket
Not logged in
Ticket Hash: 105da85e115fed394ff7bfaba77f93dec0978253
Title: Touches() fails to detect overlapping linestrings when one of them is a circular one
Status: Closed Type: Code_Defect
Severity: Critical Priority: Immediate
Subsystem: Resolution: External_Bug
Last Modified: 2018-06-19 13:39:07
Version Found In: mod_spatialite-4.4.0-RC0-win-x86
User Comments:
anonymous added on 2018-05-22 18:36:04:
Two multi-node linestrings exist.

L1 is a common line with start and end nodes S1 & E1 respectively.
L2 is circular linestring with overlapping start- and end-nodes S2 & E2.
L1's E1 also overlaps S2 & E2.

A Touches() spatial operation between L1 and L2 does not provide a TRUE result
(which is an unexpected behavior). Going reverse, a Touches() operation between
L2 and L1 provides a TRUE result for both start and end nodes S2 & E2 (which is
the expected behavior).

SQL query that manifests the problem (OGC_FID=10 is the feature ID we test against):

SELECT OGC_FID, OSM_ID, ref, reg_ref, old_ref, (SELECT highway FROM roads WHERE OGC_FID=10) as h0,
(SELECT ref FROM roads WHERE OGC_FID=10) as r0,
(SELECT reg_ref FROM roads WHERE OGC_FID=10) as rr0,
(SELECT old_ref FROM roads WHERE OGC_FID=10) as or0,
Touches
(
    StartPoint((SELECT Geometry FROM roads WHERE OGC_FID=10)), Geometry
) as t
FROM roads
WHERE highway IN ('secondary', 'secondary_link', 'tertiary', 'tertiary_link')
AND 
(
    (highway IN ('secondary', 'secondary_link') AND h0 IN ('secondary', 'secondary_link')) OR
    (highway IN ('tertiary', 'tertiary_link') AND h0 IN ('tertiary', 'tertiary_link'))
)
AND t=1 AND reg_ref = rr0 AND ref = r0 AND old_ref=or0 AND idway IS NULL AND OGC_FID != 10;

sandro added on 2018-06-19 13:39:07:
SpatiaLite Touches() fully depends on the corresponding GEOS function.

please report this supposed bug to the GEOS bug tracker or to the GEOS mailing list.