[Tile-serving] [osm2pgsql-dev/osm2pgsql] Add grouped-linemerge generalization (PR #2482)

leijurv notifications at github.com
Fri Jun 5 21:22:04 UTC 2026


@leijurv commented on this pull request.



> +    CASE WHEN ST_X(ST_StartPoint(l."{geom_column}")) = n.x
+          AND ST_Y(ST_StartPoint(l."{geom_column}")) = n.y
+         THEN ST_X(ST_EndPoint(l."{geom_column}"))
+         ELSE ST_X(ST_StartPoint(l."{geom_column}")) END,
+    CASE WHEN ST_X(ST_StartPoint(l."{geom_column}")) = n.x
+          AND ST_Y(ST_StartPoint(l."{geom_column}")) = n.y
+         THEN ST_Y(ST_EndPoint(l."{geom_column}"))
+         ELSE ST_Y(ST_StartPoint(l."{geom_column}")) END
+    FROM nodes n
+    JOIN {src} l
+      ON {group_join}
+     AND ( (ST_X(ST_StartPoint(l."{geom_column}")) = n.x
+        AND ST_Y(ST_StartPoint(l."{geom_column}")) = n.y)
+       OR (ST_X(ST_EndPoint(l."{geom_column}")) = n.x
+        AND ST_Y(ST_EndPoint(l."{geom_column}")) = n.y) )
+     AND {where}

I think this is true already, I've looked at it in `EXPLAIN ANALYZE` and `WorkTable Scan on nodes n (rows=43 loops=319)` shows each iteration joins only ~43 frontier rows, not the 13613 accumulated. If it were re-joining the whole set, that scan would show thousands of rows. It works because I am doing `WITH RECURSIVE ... UNION` rather than `WITH RECURSIVE ... UNION ALL`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2482#discussion_r3365453931
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/pull/2482/review/4439785007 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20260605/66c23d2b/attachment-0001.htm>


More information about the Tile-serving mailing list