[SCM] PostGIS branch master updated. 3.6.0rc2-170-g7dc8c00b7

git at osgeo.org git at osgeo.org
Thu Oct 30 10:31:18 PDT 2025


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  7dc8c00b77b76f584ef5746b97a54b72a7d1caee (commit)
      from  cf5994644e5233da594c17bc3b4fd49a780e72ff (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 7dc8c00b77b76f584ef5746b97a54b72a7d1caee
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Thu Oct 30 21:31:00 2025 +0400

    [doc][topology] Meaning of topology.next_left_edge and topology.next_right_edge links
    
    Closes #5109

diff --git a/NEWS b/NEWS
index 0c485943c..488f86f81 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,7 @@ xxxx/xx/xx
  - #5950, Document POSTGIS_REGRESS_DB_OWNER for sandboxed regression roles (Darafei Praliaskouski)
  - #4332, Clarify the scope of several Function Reference categories (Darafei Praliaskouski)
  - #4222, [raster] ST_DumpAsPolygons honours PostgreSQL interrupts (Darafei Praliaskouski)
+ - #5109, Document the meaning of topology.next_left_edge and topology.next_right_edge links (Darafei Praliaskouski)
 
 
 * Bug Fixes *
diff --git a/doc/extras_topology.xml b/doc/extras_topology.xml
index 01f07538d..a3846708b 100644
--- a/doc/extras_topology.xml
+++ b/doc/extras_topology.xml
@@ -17,9 +17,27 @@ how is it used, and various FOSS4G tools that support it in <link xlink:href="ht
 	<para>Details of this project can be found at <link xlink:href="http://trac.osgeo.org/postgis/wiki/UsersWikiPostgisTopology">PostGIS Topology Wiki</link></para>
 	<para>All functions and tables associated with this module are installed in a schema called <varname>topology</varname>.</para>
 	<para>Functions that are defined in SQL/MM standard are prefixed with ST_ and functions specific to PostGIS are not prefixed.</para>
-	<para>Topology support is build by default starting with PostGIS 2.0, and can be disabled specifying --without-topology configure option at build time as described in <xref linkend="postgis_installation"/></para>
+        <para>Topology support is build by default starting with PostGIS 2.0, and can be disabled specifying --without-topology configure option at build time as described in <xref linkend="postgis_installation"/></para>
 
-	<section xml:id="Topology_Types">
+        <section xml:id="Topology_PrimitiveTables">
+            <title>Topology Primitive Tables</title>
+            <para>The core primitives of any topology are stored in the <varname>edge_data</varname>, <varname>node</varname>, and <varname>face</varname> tables that live in the schema created by <xref linkend="CreateTopology"/>.  Each row of <varname>edge_data</varname> represents an oriented edge: it records a directed curve from <varname>start_node</varname> to <varname>end_node</varname> together with the identifier of the face encountered on the left of that direction (<varname>left_face</varname>) and the face encountered on the right (<varname>right_face</varname>).  The same geometric segment may therefore appear twice—once for each orientation—when it belongs to two faces.</para>
+            <para>The <varname>next_left_edge</varname> and <varname>next_right_edge</varname> columns complete this orientation information by encoding how to keep walking around a face.  They store signed integers whose absolute value is the identifier of the next oriented edge and whose sign determines whether the stored orientation has to be followed as-is or reversed when traversing.  Formally, the following rules hold for every edge <varname>e</varname>:</para>
+            <itemizedlist>
+                <listitem>
+                    <para><varname>abs(next_left_edge)</varname> is the identifier of the edge reached by continuing around the face that lies to the left of <varname>e</varname>.  If the value is positive the walk continues from the end node of <varname>e</varname> along the stored orientation of the referenced edge; if it is negative the referenced edge must be followed backwards so that the shared face remains on the walker’s left.</para>
+                </listitem>
+                <listitem>
+                    <para><varname>abs(next_right_edge)</varname> analogously follows the boundary of the face located on the right of <varname>e</varname>.  A positive value means that the next edge is taken with its recorded orientation starting from the end node of <varname>e</varname>, whereas a negative value instructs to traverse the referenced edge in reverse, starting from its end node, so that the right-hand face is preserved.</para>
+                </listitem>
+                <listitem>
+                    <para>A zero value indicates that the edge is dangling on the corresponding side (for example an isolated edge whose incident face is the universal face <varname>0</varname>).  The <varname>abs_next_left_edge</varname> and <varname>abs_next_right_edge</varname> columns exposed by the <varname>edge</varname> view are convenience projections of these absolute values.</para>
+                </listitem>
+            </itemizedlist>
+            <para>This representation is a variant of a doubly connected edge list and is exploited by many topology routines.  Functions such as <xref linkend="GetRingEdges"/> and <xref linkend="ValidateTopology"/> rely on it to reconstruct face boundaries and to diagnose inconsistencies—hence the “invalid next_left_edge” and “invalid next_right_edge” diagnostics reported during validation.  Constructors like <xref linkend="AddEdge"/> initialise the <varname>next_*</varname> attributes with trivial self references, while editing routines including <xref linkend="ST_AddEdgeModFace"/> and <xref linkend="ST_RemEdgeModFace"/> update the links as edges are inserted or removed.  Other bulk operations (for example <xref linkend="TopologyPolygonize"/>) may intentionally leave the fields unset, which is why the documentation flags their behaviour explicitly.</para>
+        </section>
+
+        <section xml:id="Topology_Types">
         <title>Topology Types</title><info>
             <abstract>
                 <para>This section lists the PostgreSQL data types installed by PostGIS Topology.  Note we describe the casting behavior of these which is very
diff --git a/topology/test/regress/nextedge_signs.sql b/topology/test/regress/nextedge_signs.sql
new file mode 100644
index 000000000..1c315086f
--- /dev/null
+++ b/topology/test/regress/nextedge_signs.sql
@@ -0,0 +1,15 @@
+set client_min_messages to ERROR;
+
+SELECT topology.CreateTopology('signed_edges', 0) > 0;
+
+SELECT 'E1', topology.AddEdge('signed_edges', 'LINESTRING(0 0, 1 0)');
+SELECT 'E2', topology.AddEdge('signed_edges', 'LINESTRING(1 0, 1 1)');
+
+SELECT 'sign-consistency', bool_and(next_left_edge = -next_right_edge)
+  FROM signed_edges.edge;
+
+SELECT 'absolute-id',
+       array_agg(edge_id::text || ':' || abs(next_left_edge)::text ORDER BY edge_id)
+  FROM signed_edges.edge;
+
+SELECT topology.DropTopology('signed_edges');
diff --git a/topology/test/regress/nextedge_signs_expected b/topology/test/regress/nextedge_signs_expected
new file mode 100644
index 000000000..fd8f26bc5
--- /dev/null
+++ b/topology/test/regress/nextedge_signs_expected
@@ -0,0 +1,6 @@
+t
+E1|1
+E2|2
+sign-consistency|t
+absolute-id|{1:1,2:2}
+Topology 'signed_edges' dropped
diff --git a/topology/test/tests.mk b/topology/test/tests.mk
index aa1a67526..383e38ccf 100644
--- a/topology/test/tests.mk
+++ b/topology/test/tests.mk
@@ -47,6 +47,7 @@ TESTS += \
 	$(top_srcdir)/topology/test/regress/legacy_query.sql \
 	$(top_srcdir)/topology/test/regress/legacy_validate.sql \
 	$(top_srcdir)/topology/test/regress/maketopologyprecise.sql \
+	$(top_srcdir)/topology/test/regress/nextedge_signs.sql \
 	$(top_srcdir)/topology/test/regress/polygonize.sql \
 	$(top_srcdir)/topology/test/regress/populate_topology_layer.sql \
 	$(top_srcdir)/topology/test/regress/removeunusedprimitives.sql \

-----------------------------------------------------------------------

Summary of changes:
 NEWS                                          |  1 +
 doc/extras_topology.xml                       | 24 +++++++++++++++++++++---
 topology/test/regress/nextedge_signs.sql      | 15 +++++++++++++++
 topology/test/regress/nextedge_signs_expected |  6 ++++++
 topology/test/tests.mk                        |  1 +
 5 files changed, 44 insertions(+), 3 deletions(-)
 create mode 100644 topology/test/regress/nextedge_signs.sql
 create mode 100644 topology/test/regress/nextedge_signs_expected


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list