[SCM] PostGIS branch master updated. 3.6.0rc2-625-g9aee37109

git at osgeo.org git at osgeo.org
Fri Jun 19 12:51:50 PDT 2026


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  9aee37109ed245fc322dfec6b1ac7bb1227eb942 (commit)
      from  6f11ffd051915508ef244399043b484a2de46295 (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 9aee37109ed245fc322dfec6b1ac7bb1227eb942
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Fri Jun 19 23:49:01 2026 +0400

    postgis: add coordinate size accessors
    
    Add ST_XSize, ST_YSize, and ST_ZSize as box3d dimension helpers that also work for geometry and box2d through existing casts. Add ST_MSize for geometry measures, implemented from ST_MMax and ST_MMin.
    
    Closes #2863
    
    Closes https://github.com/postgis/postgis/pull/955

diff --git a/NEWS b/NEWS
index c6231dfc7..f0c449087 100644
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,8 @@ To take advantage of all postgis_sfcgal extension features SFCGAL 2.3+ is needed
  - #4398, Add ST_CatmullSmoothing smoothes but retains original vertices (Paul Ramsey)
  - #4560, ST_3DInterpolatePoint for M interpolation from XYZ inputs (Paul Ramsey)
  - GT-270, Add NURBSCurve (Loïc Bartoletti)
+ - #2863, Add ST_XSize, ST_YSize, ST_ZSize, and ST_MSize dimension helpers
+          (Darafei Praliaskouski)
 
 * Enhancements *
 
diff --git a/doc/reference_bbox.xml b/doc/reference_bbox.xml
index 797c36f3d..4a6be9df9 100644
--- a/doc/reference_bbox.xml
+++ b/doc/reference_bbox.xml
@@ -995,6 +995,165 @@ st_zmin
       </refsection>
     </refentry>
 
+    <refentry xml:id="ST_XSize">
+      <refnamediv>
+        <refname>ST_XSize</refname>
+
+        <refpurpose>Returns the X size of a 2D or 3D bounding box or a geometry.</refpurpose>
+      </refnamediv>
+
+      <refsynopsisdiv>
+        <funcsynopsis>
+          <funcprototype>
+            <funcdef>float <function>ST_XSize</function></funcdef>
+            <paramdef><type>box3d </type> <parameter>aGeomorBox2DorBox3D</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+      </refsynopsisdiv>
+
+      <refsection>
+        <title>Description</title>
+
+        <para>Returns the X size of a 2D or 3D bounding box or a geometry, computed as <code>ST_XMax(aGeomorBox2DorBox3D) - ST_XMin(aGeomorBox2DorBox3D)</code>.</para>
+
+        <note>
+          <para>Although this function is only defined for box3d, it also works for box2d and geometry values due to automatic casting.
+            However it will not accept a geometry or box2d text representation, since those do not auto-cast.</para>
+        </note>
+
+        <para>&Z_support;</para>
+        <para>&curve_support;</para>
+        <para role="availability" conformance="3.7.0">Availability: 3.7.0</para>
+      </refsection>
+
+      <refsection>
+        <title>Examples</title>
+
+        <programlisting>SELECT ST_XSize('BOX3D(1 2 3, 4 5 6)');
+st_xsize
+--------
+3
+
+SELECT ST_XSize(ST_GeomFromText('LINESTRING(1 3, 5 6)'));
+st_xsize
+--------
+4
+        </programlisting>
+      </refsection>
+
+      <refsection>
+        <title>See Also</title>
+
+        <para><xref linkend="ST_XMin"/>, <xref linkend="ST_XMax"/>, <xref linkend="ST_YSize"/>, <xref linkend="ST_ZSize"/>, <xref linkend="ST_MSize"/></para>
+      </refsection>
+    </refentry>
+
+    <refentry xml:id="ST_YSize">
+      <refnamediv>
+        <refname>ST_YSize</refname>
+
+        <refpurpose>Returns the Y size of a 2D or 3D bounding box or a geometry.</refpurpose>
+      </refnamediv>
+
+      <refsynopsisdiv>
+        <funcsynopsis>
+          <funcprototype>
+            <funcdef>float <function>ST_YSize</function></funcdef>
+            <paramdef><type>box3d </type> <parameter>aGeomorBox2DorBox3D</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+      </refsynopsisdiv>
+
+      <refsection>
+        <title>Description</title>
+
+        <para>Returns the Y size of a 2D or 3D bounding box or a geometry, computed as <code>ST_YMax(aGeomorBox2DorBox3D) - ST_YMin(aGeomorBox2DorBox3D)</code>.</para>
+
+        <note>
+          <para>Although this function is only defined for box3d, it also works for box2d and geometry values due to automatic casting.
+            However it will not accept a geometry or box2d text representation, since those do not auto-cast.</para>
+        </note>
+
+        <para>&Z_support;</para>
+        <para>&curve_support;</para>
+        <para role="availability" conformance="3.7.0">Availability: 3.7.0</para>
+      </refsection>
+
+      <refsection>
+        <title>Examples</title>
+
+        <programlisting>SELECT ST_YSize('BOX3D(1 2 3, 4 5 6)');
+st_ysize
+--------
+3
+
+SELECT ST_YSize(ST_GeomFromText('LINESTRING(1 3, 5 6)'));
+st_ysize
+--------
+3
+        </programlisting>
+      </refsection>
+
+      <refsection>
+        <title>See Also</title>
+
+        <para><xref linkend="ST_YMin"/>, <xref linkend="ST_YMax"/>, <xref linkend="ST_XSize"/>, <xref linkend="ST_ZSize"/>, <xref linkend="ST_MSize"/></para>
+      </refsection>
+    </refentry>
+
+    <refentry xml:id="ST_ZSize">
+      <refnamediv>
+        <refname>ST_ZSize</refname>
+
+        <refpurpose>Returns the Z size of a 2D or 3D bounding box or a geometry.</refpurpose>
+      </refnamediv>
+
+      <refsynopsisdiv>
+        <funcsynopsis>
+          <funcprototype>
+            <funcdef>float <function>ST_ZSize</function></funcdef>
+            <paramdef><type>box3d </type> <parameter>aGeomorBox2DorBox3D</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+      </refsynopsisdiv>
+
+      <refsection>
+        <title>Description</title>
+
+        <para>Returns the Z size of a 2D or 3D bounding box or a geometry, computed as <code>ST_ZMax(aGeomorBox2DorBox3D) - ST_ZMin(aGeomorBox2DorBox3D)</code>.</para>
+
+        <note>
+          <para>Although this function is only defined for box3d, it also works for box2d and geometry values due to automatic casting.
+            However it will not accept a geometry or box2d text representation, since those do not auto-cast.</para>
+        </note>
+
+        <para>&Z_support;</para>
+        <para>&curve_support;</para>
+        <para role="availability" conformance="3.7.0">Availability: 3.7.0</para>
+      </refsection>
+
+      <refsection>
+        <title>Examples</title>
+
+        <programlisting>SELECT ST_ZSize('BOX3D(1 2 3, 4 5 6)');
+st_zsize
+--------
+3
+
+SELECT ST_ZSize(ST_GeomFromEWKT('LINESTRING(1 3 4, 5 6 7)'));
+st_zsize
+--------
+3
+        </programlisting>
+      </refsection>
+
+      <refsection>
+        <title>See Also</title>
+
+        <para><xref linkend="ST_ZMin"/>, <xref linkend="ST_ZMax"/>, <xref linkend="ST_XSize"/>, <xref linkend="ST_YSize"/>, <xref linkend="ST_MSize"/></para>
+      </refsection>
+    </refentry>
+
     <refentry xml:id="ST_MMin">
       <refnamediv>
         <refname>ST_MMin</refname>
@@ -1013,7 +1172,7 @@ st_zmin
       <refsection>
         <title>Description</title>
 
-        <para>Returns the M minima of a geometry, or null of the geometry lacks M values.</para>
+        <para>Returns the M minima of a geometry, or null if the geometry lacks M values.</para>
 
         <para>&Z_support;</para>
         <para>&curve_support;</para>
@@ -1032,7 +1191,7 @@ st_mmin
       <refsection>
         <title>See Also</title>
 
-        <para><xref linkend="ST_XMin"/>, <xref linkend="ST_XMax"/>, <xref linkend="ST_YMin"/>, <xref linkend="ST_YMax"/>, <xref linkend="ST_ZMin"/>, <xref linkend="ST_ZMax"/>, <xref linkend="ST_MMax"/></para>
+        <para><xref linkend="ST_XMin"/>, <xref linkend="ST_XMax"/>, <xref linkend="ST_YMin"/>, <xref linkend="ST_YMax"/>, <xref linkend="ST_ZMin"/>, <xref linkend="ST_ZMax"/>, <xref linkend="ST_MMax"/>, <xref linkend="ST_MSize"/></para>
       </refsection>
     </refentry>
 
@@ -1041,7 +1200,7 @@ st_mmin
       <refnamediv>
         <refname>ST_MMax</refname>
 
-        <refpurpose>Returns the M minima of a geometry.</refpurpose>
+        <refpurpose>Returns the M maxima of a geometry.</refpurpose>
       </refnamediv>
 
       <refsynopsisdiv>
@@ -1054,7 +1213,7 @@ st_mmin
 
       <refsection>
         <title>Description</title>
-        <para>Returns the M minima of a geometry, or null of the geometry lacks M values.</para>
+        <para>Returns the M maxima of a geometry, or null if the geometry lacks M values.</para>
 
         <para>&Z_support;</para>
         <para>&curve_support;</para>
@@ -1070,7 +1229,45 @@ st_mmax
 
       <refsection>
         <title>See Also</title>
-        <para><xref linkend="ST_XMin"/>, <xref linkend="ST_XMax"/>, <xref linkend="ST_YMin"/>, <xref linkend="ST_YMax"/>, <xref linkend="ST_ZMin"/>, <xref linkend="ST_ZMax"/>, <xref linkend="ST_MMin"/></para>
+        <para><xref linkend="ST_XMin"/>, <xref linkend="ST_XMax"/>, <xref linkend="ST_YMin"/>, <xref linkend="ST_YMax"/>, <xref linkend="ST_ZMin"/>, <xref linkend="ST_ZMax"/>, <xref linkend="ST_MMin"/>, <xref linkend="ST_MSize"/></para>
+      </refsection>
+    </refentry>
+
+    <refentry xml:id="ST_MSize">
+      <refnamediv>
+        <refname>ST_MSize</refname>
+
+        <refpurpose>Returns the M size of a geometry.</refpurpose>
+      </refnamediv>
+
+      <refsynopsisdiv>
+        <funcsynopsis>
+          <funcprototype>
+            <funcdef>float <function>ST_MSize</function></funcdef><paramdef><type>geometry</type> <parameter>geom</parameter></paramdef>
+          </funcprototype>
+        </funcsynopsis>
+      </refsynopsisdiv>
+
+      <refsection>
+        <title>Description</title>
+        <para>Returns the M size of a geometry, computed as <code>ST_MMax(geom) - ST_MMin(geom)</code>, or null if the geometry lacks M values.</para>
+
+        <para>&Z_support;</para>
+        <para>&curve_support;</para>
+        <para role="availability" conformance="3.7.0">Availability: 3.7.0</para>
+      </refsection>
+
+      <refsection>
+        <title>Examples</title>
+        <programlisting>SELECT ST_MSize('LINESTRING M (1 2 3, 4 6 8)');
+st_msize
+--------
+5       </programlisting>
+      </refsection>
+
+      <refsection>
+        <title>See Also</title>
+        <para><xref linkend="ST_MMin"/>, <xref linkend="ST_MMax"/>, <xref linkend="ST_XSize"/>, <xref linkend="ST_YSize"/>, <xref linkend="ST_ZSize"/></para>
       </refsection>
     </refentry>
 
diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in
index 8167cbe72..7e5cd081b 100644
--- a/postgis/postgis.sql.in
+++ b/postgis/postgis.sql.in
@@ -1130,6 +1130,27 @@ CREATE OR REPLACE FUNCTION ST_ZMax(box3d)
 	LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
 	_COST_DEFAULT;
 
+-- Availability: 3.7.0
+CREATE OR REPLACE FUNCTION ST_XSize(box3d)
+	RETURNS FLOAT8
+	AS 'SELECT @extschema at .ST_XMax($1) - @extschema at .ST_XMin($1)'
+	LANGUAGE 'sql' IMMUTABLE STRICT PARALLEL SAFE
+	_COST_DEFAULT;
+
+-- Availability: 3.7.0
+CREATE OR REPLACE FUNCTION ST_YSize(box3d)
+	RETURNS FLOAT8
+	AS 'SELECT @extschema at .ST_YMax($1) - @extschema at .ST_YMin($1)'
+	LANGUAGE 'sql' IMMUTABLE STRICT PARALLEL SAFE
+	_COST_DEFAULT;
+
+-- Availability: 3.7.0
+CREATE OR REPLACE FUNCTION ST_ZSize(box3d)
+	RETURNS FLOAT8
+	AS 'SELECT @extschema at .ST_ZMax($1) - @extschema at .ST_ZMin($1)'
+	LANGUAGE 'sql' IMMUTABLE STRICT PARALLEL SAFE
+	_COST_DEFAULT;
+
 -- Availability: 3.7.0
 CREATE OR REPLACE FUNCTION ST_MMin(geometry)
 	RETURNS FLOAT8
@@ -1144,6 +1165,13 @@ CREATE OR REPLACE FUNCTION ST_MMax(geometry)
 	LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
 	_COST_DEFAULT;
 
+-- Availability: 3.7.0
+CREATE OR REPLACE FUNCTION ST_MSize(geometry)
+	RETURNS FLOAT8
+	AS 'SELECT @extschema at .ST_MMax($1) - @extschema at .ST_MMin($1)'
+	LANGUAGE 'sql' IMMUTABLE STRICT PARALLEL SAFE
+	_COST_DEFAULT;
+
 -----------------------------------------------------------------------------
 --  BOX2D FUNCTIONS
 -----------------------------------------------------------------------------
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index 413a1b9f1..b31490528 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -123,6 +123,10 @@ SELECT '#175', ST_AsEWKT(ST_GeomFromEWKT('SRID=26915;POINT(482020 4984378.)'));
 -- #178 --
 SELECT '#178a', ST_XMin(ST_MakeBox2D(ST_Point(5, 5), ST_Point(0, 0)));
 SELECT '#178b', ST_XMax(ST_MakeBox2D(ST_Point(5, 5), ST_Point(0, 0)));
+SELECT '#2863a', ST_XSize(ST_MakeBox2D(ST_Point(5, 5), ST_Point(0, 0)));
+SELECT '#2863b', ST_YSize('LINESTRING(1 2 3, 4 6 8)'::geometry);
+SELECT '#2863c', ST_ZSize('LINESTRING(1 2 3, 4 6 8)'::geometry);
+SELECT '#2863d', ST_MSize('LINESTRING M (1 2 3, 4 6 8)'::geometry);
 
 -- #179 --
 SELECT '#179a', ST_MakeLine(ARRAY[NULL,NULL,NULL,NULL]);
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index dc67b09d2..9e968e2dd 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -37,6 +37,10 @@ ERROR:  Invalid hex string, length (267) has to be a multiple of two!
 #175|SRID=26915;POINT(482020 4984378)
 #178a|0
 #178b|5
+#2863a|5
+#2863b|4
+#2863c|5
+#2863d|5
 NOTICE:  No points or linestrings in input array
 #179a|
 NOTICE:  No points or linestrings in input array

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

Summary of changes:
 NEWS                          |   2 +
 doc/reference_bbox.xml        | 207 +++++++++++++++++++++++++++++++++++++++++-
 postgis/postgis.sql.in        |  28 ++++++
 regress/core/tickets.sql      |   4 +
 regress/core/tickets_expected |   4 +
 5 files changed, 240 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list