[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0alpha1-31-geab253b38
git at osgeo.org
git at osgeo.org
Sat Jun 11 05:47:29 PDT 2022
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 eab253b3822dd600d70b51e7988431440f24026b (commit)
via 1fd20c9c1190c442b3399b9dde56029b5a7c9f5c (commit)
via acfd2483c540472093812e3356d7fcbb04fc1106 (commit)
via f712a84d1237514a1210a027871c646b9d554771 (commit)
via 9b0809bdbf3561b4263993dfb6a9e33931cdfc2b (commit)
from a64af1feb79f40d9e5714a5b09ad3ec07a04b742 (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 eab253b3822dd600d70b51e7988431440f24026b
Author: Darafei Praliaskouski <me at komzpa.net>
Date: Sat Jun 11 15:46:58 2022 +0300
Add NEWS for directed linemerge.
diff --git a/NEWS b/NEWS
index 88607d974..4a03f6cc7 100644
--- a/NEWS
+++ b/NEWS
@@ -5,10 +5,12 @@ Changes since PostGIS 3.3.0alpha1
- #5158, pgtopo_import / pgtopo_export manpages (Sandro Santilli)
- #5170, add a -Z option to raster2pgsql to
control number of rows per copy statement (Regina Obe)
+ - #4939, #5161, ST_LineMerge now has option to keep the directions of input linestrings,
+ useful when processing road graphs. Requires GEOS 3.11. (Sergei Shoulbakov)
* New features *
- #5169, ST_SimplifyPolygonHull (requires GEOS 3.11)
- Paul Ramsey, Martin Davis
+ (Paul Ramsey, Martin Davis)
PostGIS 3.3.0alpha1
commit 1fd20c9c1190c442b3399b9dde56029b5a7c9f5c
Merge: a64af1feb acfd2483c
Author: Sergei <managerzf168 at gmail.com>
Date: Sat Jun 11 15:37:04 2022 +0300
Merge acfd2483c540472093812e3356d7fcbb04fc1106 into a64af1feb79f40d9e5714a5b09ad3ec07a04b742
commit acfd2483c540472093812e3356d7fcbb04fc1106
Author: sergei sh <sshoulbakov at kontur.io>
Date: Fri Jun 3 12:16:02 2022 +0300
ST_LineMerg directed: creating overload for GEOS < 3.11
diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in
index 0a2e1faa1..8b175688b 100644
--- a/postgis/postgis.sql.in
+++ b/postgis/postgis.sql.in
@@ -1872,8 +1872,6 @@ CREATE OR REPLACE FUNCTION ST_LineMerge(geometry)
LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
_COST_HIGH;
-#if POSTGIS_GEOS_VERSION >= 31100
-
-- Availability: 3.3.0
CREATE OR REPLACE FUNCTION ST_LineMerge(geometry, boolean)
RETURNS geometry
@@ -1881,8 +1879,6 @@ CREATE OR REPLACE FUNCTION ST_LineMerge(geometry, boolean)
LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
_COST_HIGH;
-#endif
-
-----------------------------------------------------------------------------
-- Affine transforms
-----------------------------------------------------------------------------
commit f712a84d1237514a1210a027871c646b9d554771
Author: sergei sh <sshoulbakov at kontur.io>
Date: Mon May 30 14:51:38 2022 +0300
ST_LineMerge directed: docs; new image generator style
diff --git a/doc/html/image_src/Makefile.in b/doc/html/image_src/Makefile.in
index 175685c2e..d08d126ff 100644
--- a/doc/html/image_src/Makefile.in
+++ b/doc/html/image_src/Makefile.in
@@ -104,6 +104,7 @@ IMAGES= \
../images/st_line_interpolate_points01.png \
../images/st_linemerge01.png \
../images/st_linemerge02.png \
+ ../images/st_linemerge03.png \
../images/st_line_substring01.png \
../images/st_locatebetween01.png \
../images/st_longestline01.png \
diff --git a/doc/html/image_src/st_linemerge03.wkt b/doc/html/image_src/st_linemerge03.wkt
new file mode 100644
index 000000000..08904f16b
--- /dev/null
+++ b/doc/html/image_src/st_linemerge03.wkt
@@ -0,0 +1,2 @@
+ArgA-arrow;MULTILINESTRING((60 130, 10 170), (120 150, 60 130), (120 150, 180 130))
+Result-arrow;MULTILINESTRING((120 50, 60 30, 10 70), (120 50, 180 30))
diff --git a/doc/html/image_src/styles.conf b/doc/html/image_src/styles.conf
index ac85f1ad7..511dbc6b9 100644
--- a/doc/html/image_src/styles.conf
+++ b/doc/html/image_src/styles.conf
@@ -168,6 +168,18 @@ polygonFillColor = "#ff000020"
polygonStrokeColor = "#770000"
polygonStrokeWidth = 2
+[Style]
+styleName = Result-arrow
+pointSize = 5
+pointColor = "#770000"
+lineWidth = 4
+lineColor = "#770000"
+lineStartSize = 5
+lineArrowSize = 10
+polygonFillColor = "#ff000020"
+polygonStrokeColor = "#770000"
+polygonStrokeWidth = 2
+
[Style]
# Result style for overlapping results
styleName = Result-light
diff --git a/doc/reference_processing.xml b/doc/reference_processing.xml
index bd5135038..11b77d91a 100644
--- a/doc/reference_processing.xml
+++ b/doc/reference_processing.xml
@@ -1186,6 +1186,11 @@ FROM test;
<funcdef>geometry <function>ST_LineMerge</function></funcdef>
<paramdef><type>geometry </type> <parameter>amultilinestring</parameter></paramdef>
</funcprototype>
+ <funcprototype>
+ <funcdef>geometry <function>ST_LineMerge</function></funcdef>
+ <paramdef><type>geometry </type> <parameter>amultilinestring</parameter></paramdef>
+ <paramdef><type>boolean </type> <parameter>directed</parameter></paramdef>
+ </funcprototype>
</funcsynopsis>
</refsynopsisdiv>
@@ -1198,9 +1203,14 @@ FROM test;
Lines are not joined across intersections of 3-way or greater degree.
</para>
+ <para>If <emphasis role="bold">directed</emphasis> is TRUE, then ST_LineMerge
+ will not change point order within LineStrings, so lines with opposite directions
+ will not be merged</para>
+
<note><para>Only use with MultiLineString/LineStrings. Other geometry types
return an empty GeometryCollection</para></note>
<para>Performed by the GEOS module.</para>
+ <para>Enhanced: 3.3.0 accept a directed parameter - requires GEOS >= 3.11.0</para>
<para>Availability: 1.1.0</para>
<warning><para>This function strips the M dimension.</para></warning>
</refsection>
@@ -1258,6 +1268,27 @@ SELECT ST_AsText(ST_LineMerge(
----------------
MULTILINESTRING((-45.2 -33.2,-46 -32),(-29 -27,-30 -29.7,-36 -31,-45 -33))
</programlisting>
+
+<para>
+ <informalfigure>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/st_linemerge03.png" />
+ </imageobject>
+ <caption>
+ <para>Lines with opposite directions are not merged if directed = TRUE.</para>
+ </caption>
+ </mediaobject>
+ </informalfigure>
+</para>
+<programlisting>
+SELECT ST_AsText(ST_LineMerge(
+'MULTILINESTRING((60 30, 10 70), (120 50, 60 30), (120 50, 180 30))',
+TRUE));
+-------------------------------------------------------
+ MULTILINESTRING((120 50,60 30,10 70),(120 50,180 30))
+</programlisting>
+
<para>Example showing Z-dimension handling.</para>
<programlisting>
SELECT ST_AsText(ST_LineMerge(
commit 9b0809bdbf3561b4263993dfb6a9e33931cdfc2b
Author: sergei sh <sshoulbakov at kontur.io>
Date: Thu May 26 15:00:52 2022 +0300
ST_LineMerge overload with "directed" argument.
Closes #5161
diff --git a/liblwgeom/liblwgeom.h.in b/liblwgeom/liblwgeom.h.in
index d1a1e4974..54e0fa35b 100644
--- a/liblwgeom/liblwgeom.h.in
+++ b/liblwgeom/liblwgeom.h.in
@@ -2400,6 +2400,7 @@ LWGEOM *lwgeom_centroid(const LWGEOM* geom);
LWGEOM *lwgeom_union(const LWGEOM *geom1, const LWGEOM *geom2);
LWGEOM *lwgeom_union_prec(const LWGEOM *geom1, const LWGEOM *geom2, double gridSize);
LWGEOM *lwgeom_linemerge(const LWGEOM *geom1);
+LWGEOM *lwgeom_linemerge_directed(const LWGEOM *geom1, int directed);
LWGEOM *lwgeom_unaryunion(const LWGEOM *geom1);
LWGEOM *lwgeom_unaryunion_prec(const LWGEOM *geom1, double gridSize);
LWGEOM *lwgeom_clip_by_rect(const LWGEOM *geom1, double x0, double y0, double x1, double y1);
diff --git a/liblwgeom/lwgeom_geos.c b/liblwgeom/lwgeom_geos.c
index e3f321e04..d5f636dbf 100644
--- a/liblwgeom/lwgeom_geos.c
+++ b/liblwgeom/lwgeom_geos.c
@@ -749,6 +749,12 @@ lwgeom_intersection_prec(const LWGEOM* geom1, const LWGEOM* geom2, double prec)
LWGEOM*
lwgeom_linemerge(const LWGEOM* geom)
+{
+ return lwgeom_linemerge_directed(geom, LW_FALSE);
+}
+
+LWGEOM*
+lwgeom_linemerge_directed(const LWGEOM* geom, int directed)
{
LWGEOM* result;
int32_t srid = RESULT_SRID(geom);
@@ -765,7 +771,20 @@ lwgeom_linemerge(const LWGEOM* geom)
if (!(g1 = LWGEOM2GEOS(geom, AUTOFIX))) GEOS_FAIL();
- g3 = GEOSLineMerge(g1);
+ if (directed)
+ {
+#if POSTGIS_GEOS_VERSION < 31100
+ lwerror("Directed line merging requires GEOS-3.11 or higher");
+ GEOS_FREE_AND_FAIL(g1);
+ return NULL;
+#else
+ g3 = GEOSLineMergeDirected(g1);
+#endif
+ }
+ else
+ {
+ g3 = GEOSLineMerge(g1);
+ }
if (!g3) GEOS_FREE_AND_FAIL(g1);
GEOSSetSRID(g3, srid);
diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c
index 2b7a39105..82eb636af 100644
--- a/postgis/lwgeom_geos.c
+++ b/postgis/lwgeom_geos.c
@@ -3116,15 +3116,18 @@ PG_FUNCTION_INFO_V1(linemerge);
Datum linemerge(PG_FUNCTION_ARGS)
{
GSERIALIZED *geom1;
+ bool directed = false;
GSERIALIZED *result;
LWGEOM *lwgeom1, *lwresult ;
geom1 = PG_GETARG_GSERIALIZED_P(0);
+ if ( PG_NARGS() > 1 )
+ directed = PG_GETARG_BOOL(1);
lwgeom1 = lwgeom_from_gserialized(geom1) ;
- lwresult = lwgeom_linemerge(lwgeom1);
+ lwresult = lwgeom_linemerge_directed(lwgeom1, directed ? LW_TRUE : LW_FALSE);
result = geometry_serialize(lwresult) ;
lwgeom_free(lwgeom1) ;
diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in
index 05fb550b3..0a2e1faa1 100644
--- a/postgis/postgis.sql.in
+++ b/postgis/postgis.sql.in
@@ -1872,6 +1872,17 @@ CREATE OR REPLACE FUNCTION ST_LineMerge(geometry)
LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
_COST_HIGH;
+#if POSTGIS_GEOS_VERSION >= 31100
+
+-- Availability: 3.3.0
+CREATE OR REPLACE FUNCTION ST_LineMerge(geometry, boolean)
+ RETURNS geometry
+ AS 'MODULE_PATHNAME', 'linemerge'
+ LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
+ _COST_HIGH;
+
+#endif
+
-----------------------------------------------------------------------------
-- Affine transforms
-----------------------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
NEWS | 4 +++-
doc/html/image_src/Makefile.in | 1 +
doc/html/image_src/st_linemerge03.wkt | 2 ++
doc/html/image_src/styles.conf | 12 ++++++++++++
doc/reference_processing.xml | 31 +++++++++++++++++++++++++++++++
liblwgeom/liblwgeom.h.in | 1 +
liblwgeom/lwgeom_geos.c | 21 ++++++++++++++++++++-
postgis/lwgeom_geos.c | 5 ++++-
postgis/postgis.sql.in | 7 +++++++
9 files changed, 81 insertions(+), 3 deletions(-)
create mode 100644 doc/html/image_src/st_linemerge03.wkt
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list