@@ -22,24 +22,28 @@ FROM pgr_separateTouching('SELECT id, geom FROM edges', dryrun => true);
2222NOTICE:
2323 WITH
2424 edges_table AS (
25- SELECT id, geom FROM edges
25+ SELECT id, geom,
26+ ST_StartPoint(geom) AS startpoint,
27+ ST_EndPoint(geom) AS endpoint
28+ FROM (SELECT id, geom FROM edges) _edges
2629 ),
2730
2831 get_touching AS (
29- SELECT e1.id id1, e2.id id2, ST_Snap(e1.geom, e2.geom, 0.01) AS geom, e1.geom AS g1, e2.geom AS g2
32+ SELECT e1.id id1, e2.id id2, ST_Snap(e1.geom, e2.geom, 0.01) AS geom, e1.geom AS g1, e2.geom AS g2,
33+ e1.startpoint AS sp1, e1.endpoint AS ep1
3034 FROM edges_table e1, edges_table e2
3135 WHERE e1.id != e2.id AND ST_DWithin(e1.geom, e2.geom, 0.01) AND NOT(
32- ST_StartPoint( e1.geom) = ST_StartPoint( e2.geom) OR ST_StartPoint( e1.geom) = ST_EndPoint( e2.geom)
33- OR ST_EndPoint( e1.geom) = ST_StartPoint( e2.geom) OR ST_EndPoint( e1.geom) = ST_EndPoint( e2.geom) )
36+ e1.startpoint = e2.startpoint OR e1.startpoint = e2.endpoint
37+ OR e1.endpoint = e2.startpoint OR e1.endpoint = e2.endpoint )
3438 ),
3539
3640 touchings AS (
3741 SELECT id1, g1, g2, st_intersection(geom, g2) AS point
3842 FROM get_touching
3943 WHERE NOT (geom = g1) OR
4044 (ST_touches(g1, g2) AND NOT
41- (ST_Intersection(geom, g2) = ST_StartPoint(g1)
42- OR ST_Intersection(geom, g2) = ST_EndPoint(g1) ))
45+ (ST_Intersection(geom, g2) = sp1
46+ OR ST_Intersection(geom, g2) = ep1 ))
4347 ),
4448
4549 blades AS (
0 commit comments