<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div dir="auto" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(33, 33, 33);">
I'm familiar with next_left_edge/next_right_edge in edge_data and made use of it in edge_topo. I'll try to explain the difference between their usages.</div>
<div dir="auto" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(33, 33, 33);">
<br>
</div>
<div dir="auto" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(33, 33, 33);">
Suppose topogeometry 1 in layer 1 is composed of faces 1, 2, 3, and 4. The next_xx_edge fields od edge_data would provide the next edge for each of faces 1 through 4, but would provide no information as to whether the opposite side of that edge is another face
 in topogeometry 1 or not.</div>
<div dir="auto" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(33, 33, 33);">
<br>
</div>
<div dir="auto" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(33, 33, 33);">
The fields next_xx_edge in edge_topo share the following attribute with their equivalents in edge_data: next_left_edge shares the edn_node and next_right_edge shares the start_node. The difference is that whereas in edge_data next_xx_edge has the same face
 on one of its sides as the previous edge, in edge_topo next_xx_edge has the same topogeometry one one side and a different topogeometry on the other. Further edges that are not a boundary between two topogeometries for a given layer are not included for the
 layer in edge_topo. Thus an edge with left_face 1 and right_face 4 would not be in edge_topo with layer 1 since both it is an internal edge of topogeometry 1.</div>
<div dir="auto" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(33, 33, 33);">
<br>
</div>
<div dir="auto" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(33, 33, 33);">
Now let's say that layer 2 has child_layer 1 and that topogeometry 1 in layer 2 consists of topogeometries 1, 10, and 15 from layer 1. It would use the edge_topo table to determine which edges are edges of 1, 10, or 15 in layer 1, and thus topogeometry 1 of
 layer 2, as well as whether the opposite side is one of the other components of layer 2 topogeometry 1, and thus and internal edge of that topogeometry, or not.</div>
<div dir="auto" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(33, 33, 33);">
<br>
</div>
<div dir="auto" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(33, 33, 33);">
I've written a script that takes edge_id, left_face, and right_face from edge_data and fills edge_id, layer_id, left_topo, and right_topo. I wrote another script that fills in next_xx_edge for each edge_id/layer_id combination I described above. The first pass
 with that script found instances where more than one edge bordering the same topogeometry met the start_ or end_ node. As far as I could identify, those were all cases where an interior ring touched an exterior ring of the topogeometry. With that information,
 a single WITH RECURSIVE query can get all the edges of one ring on a y topogeometry from any member of the ring, in order.</div>
<div id="ms-outlook-mobile-body-separator-line" data-applydefaultfontstyles="true" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt;" dir="auto">
<div dir="auto" style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt;">
<br>
</div>
</div>
<div style="font-family:Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif;font-size:12pt" dir="auto" id="ms-outlook-mobile-signature">
<span style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt;">Sent from my Verizon, Samsung Galaxy smartphone</span><br>
<span style="font-family: Aptos, Aptos_MSFontService, -apple-system, Roboto, Arial, Helvetica, sans-serif; font-size: 12pt;">Get
<a href="https://aka.ms/AAb9ysg">Outlook for Android</a></span></div>
<div id="mail-editor-reference-message-container" dir="auto"><br>
<hr style="display: inline-block; width: 98%;">
<div id="divRplyFwdMsg" style="font-size: 11pt;" dir="auto"><b>From:</b> Sandro Santilli <strk@kbt.io><br>
<b>Sent:</b> Sunday, March 15, 2026 7:41:48 AM<br>
<b>To:</b> Scott Smith <smiths@latfor.state.ny.us><br>
<b>Cc:</b> postgis-devel@lists.osgeo.org <postgis-devel@lists.osgeo.org><br>
<b>Subject:</b> Re: Adding a small feature to PostGIS topology<br>
</div>
<br>
On Sun, Mar 15, 2026 at 01:44:06AM +0000, Scott Smith wrote:<br>
> The edge_topo table was populated using those indices. However, I am<br>
> not aware of anything in the indices that identifies what edges follow<br>
> each other.<br>
<br>
Those are the the next_left_edge and next_right_edge fields.<br>
Those tell you which edge follows while you walk on the specific<br>
side of the edge (forward on the left, backward on the right).<br>
<br>
Once you are on the next edge, if the other side face is still part of<br>
the topogeometry you can continue looking for the next one and so on.<br>
<br>
--strk;<br>
<br>
</div>
</body>
</html>