[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-1145-g759da8e7f

git at osgeo.org git at osgeo.org
Wed Jul 5 11:47:23 PDT 2023


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  759da8e7f4ca4dc58dad317f6df9011f751c5722 (commit)
      from  dc1fe8fa7a66586ec51463fb65a40c47b31e5e24 (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 759da8e7f4ca4dc58dad317f6df9011f751c5722
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Jul 5 11:46:11 2023 -0700

    Add ST_LineExtend for users who want slightly longer lines.
    Supports things like extending for noding and so on.
    Closes #5267

diff --git a/doc/reference_editor.xml b/doc/reference_editor.xml
index 529e084e5..b67916a71 100644
--- a/doc/reference_editor.xml
+++ b/doc/reference_editor.xml
@@ -1244,6 +1244,72 @@ SELECT ST_AsText(ST_Multi('POLYGON ((10 30, 30 30, 30 10, 10 10, 10 30))'));
 			<para><xref linkend="ST_AsText" /></para>
 		</refsection>
 	</refentry>
+
+    <refentry id="ST_LineExtend">
+          <refnamediv>
+            <refname>ST_LineExtend</refname>
+
+            <refpurpose>Returns a line with the last and first segments extended the specified distance(s).</refpurpose>
+          </refnamediv>
+
+          <refsynopsisdiv>
+            <funcsynopsis>
+              <funcprototype>
+                <funcdef>geometry <function>ST_LineExtend</function></funcdef>
+                <paramdef><type>geometry </type>
+                <parameter>line</parameter></paramdef>
+                <paramdef><type>float </type>
+                <parameter>distance_forward</parameter></paramdef>
+                <paramdef choice="opt"><type>float</type> <parameter>distance_backward=0.0</parameter></paramdef>
+              </funcprototype>
+            </funcsynopsis>
+          </refsynopsisdiv>
+
+          <refsection>
+            <title>Description</title>
+
+            <para>Returns a line with the last and first segments extended the specified distance(s). Distance of zero carries out no extension. Only non-negative distances are allowed. The first (and last) two distinct points in a line are used to determine the direction of projection, duplicate points are ignored.</para>
+
+            <para role="availability" conformance="3.4.0">Availability: 3.4.0</para>
+
+          </refsection>
+
+          <refsection>
+            <title>Example: Projected point at 100,000 meters and bearing 45 degrees </title>
+
+<programlisting>
+SELECT ST_AsText(ST_Project('POINT(0 0)'::geography, 100000, radians(45.0)));
+--------------------------------------------
+ POINT(0.635231029125537 0.639472334729198)
+</programlisting>
+          </refsection>
+
+          <refsection>
+            <title>See Also</title>
+
+            <para><xref linkend="ST_LocateAlong" />, <xref linkend="ST_Project" /></para>
+          </refsection>
+    </refentry>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 	<refentry id="ST_Normalize">
 		<refnamediv>
@@ -1308,6 +1374,99 @@ SELECT ST_AsText(ST_Normalize(ST_GeomFromText(
 		</refsection>
 	</refentry>
 
+
+    <refentry id="ST_Project">
+          <refnamediv>
+            <refname>ST_Project</refname>
+
+            <refpurpose>Returns a point projected from a start point by a distance and bearing (azimuth).</refpurpose>
+          </refnamediv>
+
+          <refsynopsisdiv>
+            <funcsynopsis>
+              <funcprototype>
+                <funcdef>geometry <function>ST_Project</function></funcdef>
+                <paramdef><type>geometry </type>
+                <parameter>g1</parameter></paramdef>
+                <paramdef><type>float </type>
+                <parameter>distance</parameter></paramdef>
+                <paramdef><type>float </type>
+                <parameter>azimuth</parameter></paramdef>
+              </funcprototype>
+
+              <funcprototype>
+                <funcdef>geometry <function>ST_Project</function></funcdef>
+                <paramdef><type>geometry </type>
+                <parameter>g1</parameter></paramdef>
+                <paramdef><type>geometry </type>
+                <parameter>g2</parameter></paramdef>
+                <paramdef><type>float </type>
+                <parameter>distance</parameter></paramdef>
+              </funcprototype>
+
+              <funcprototype>
+                <funcdef>geography <function>ST_Project</function></funcdef>
+                <paramdef><type>geography </type>
+                <parameter>g1</parameter></paramdef>
+                <paramdef><type>float </type>
+                <parameter>distance</parameter></paramdef>
+                <paramdef><type>float </type>
+                <parameter>azimuth</parameter></paramdef>
+              </funcprototype>
+
+              <funcprototype>
+                <funcdef>geography <function>ST_Project</function></funcdef>
+                <paramdef><type>geography </type>
+                <parameter>g1</parameter></paramdef>
+                <paramdef><type>geography </type>
+                <parameter>g2</parameter></paramdef>
+                <paramdef><type>float </type>
+                <parameter>distance</parameter></paramdef>
+              </funcprototype>
+
+            </funcsynopsis>
+          </refsynopsisdiv>
+
+          <refsection>
+            <title>Description</title>
+
+            <para>Returns a point projected from a point along a geodesic using a given distance and azimuth (bearing). This is known as the direct geodesic problem.</para>
+            <para>The two-point version uses the path from the first to the second point to implicitly define the azimuth and uses the distance as before.</para>
+            <para>The distance is given in meters.  Negative values are supported.</para>
+            <para>The azimuth (also known as heading or bearing) is given in radians.
+            It is measured clockwise from true north.</para>
+            <itemizedlist>
+                <listitem><para>North is azimuth zero (0 degrees)</para></listitem>
+                <listitem><para>East is azimuth &#x03C0;/2 (90 degrees)</para></listitem>
+                <listitem><para>South is azimuth &#x03C0; (180 degrees)</para></listitem>
+                <listitem><para>West is azimuth 3&#x03C0;/2 (270 degrees)</para></listitem>
+            </itemizedlist>
+            <para>Negative azimuth values and values greater than 2&#x03C0; (360 degrees) are supported.</para>
+
+            <para role="availability" conformance="2.0.0">Availability: 2.0.0</para>
+            <para role="enhanced" conformance="2.4.0">Enhanced: 2.4.0 Allow negative distance and non-normalized azimuth.</para>
+            <para role="enhanced" conformance="3.4.0">Enhanced: 3.4.0 Allow geometry arguments and two-point form omitting azimuth.</para>
+
+          </refsection>
+
+          <refsection>
+            <title>Example: Projected point at 100,000 meters and bearing 45 degrees </title>
+
+<programlisting>
+SELECT ST_AsText(ST_Project('POINT(0 0)'::geography, 100000, radians(45.0)));
+--------------------------------------------
+ POINT(0.635231029125537 0.639472334729198)
+</programlisting>
+          </refsection>
+
+          <refsection>
+            <title>See Also</title>
+
+            <para><xref linkend="ST_Azimuth" />, <xref linkend="ST_Distance" />, <ulink url="http://www.postgresql.org/docs/current/interactive/functions-math.html">PostgreSQL function radians()</ulink></para>
+          </refsection>
+    </refentry>
+
+
 	<refentry id="ST_QuantizeCoordinates">
 		<refnamediv>
 			<refname>
diff --git a/doc/reference_measure.xml b/doc/reference_measure.xml
index 8708b2a22..4bd94c94d 100644
--- a/doc/reference_measure.xml
+++ b/doc/reference_measure.xml
@@ -1868,98 +1868,6 @@ FROM ST_GeogFromText('MULTIPOLYGON(((-71.1044543107478 42.340674480411,-71.10445
 	  </refsection>
 	</refentry>
 
-	<refentry id="ST_Project">
-		  <refnamediv>
-			<refname>ST_Project</refname>
-
-			<refpurpose>Returns a point projected from a start point by a distance and bearing (azimuth).</refpurpose>
-		  </refnamediv>
-
-		  <refsynopsisdiv>
-			<funcsynopsis>
-			  <funcprototype>
-				<funcdef>geometry <function>ST_Project</function></funcdef>
-				<paramdef><type>geometry </type>
-				<parameter>g1</parameter></paramdef>
-				<paramdef><type>float </type>
-				<parameter>distance</parameter></paramdef>
-				<paramdef><type>float </type>
-				<parameter>azimuth</parameter></paramdef>
-			  </funcprototype>
-
-              <funcprototype>
-                <funcdef>geometry <function>ST_Project</function></funcdef>
-                <paramdef><type>geometry </type>
-                <parameter>g1</parameter></paramdef>
-                <paramdef><type>geometry </type>
-                <parameter>g2</parameter></paramdef>
-                <paramdef><type>float </type>
-                <parameter>distance</parameter></paramdef>
-              </funcprototype>
-
-              <funcprototype>
-                <funcdef>geography <function>ST_Project</function></funcdef>
-                <paramdef><type>geography </type>
-                <parameter>g1</parameter></paramdef>
-                <paramdef><type>float </type>
-                <parameter>distance</parameter></paramdef>
-                <paramdef><type>float </type>
-                <parameter>azimuth</parameter></paramdef>
-              </funcprototype>
-
-              <funcprototype>
-                <funcdef>geography <function>ST_Project</function></funcdef>
-                <paramdef><type>geography </type>
-                <parameter>g1</parameter></paramdef>
-                <paramdef><type>geography </type>
-                <parameter>g2</parameter></paramdef>
-                <paramdef><type>float </type>
-                <parameter>distance</parameter></paramdef>
-              </funcprototype>
-
-			</funcsynopsis>
-		  </refsynopsisdiv>
-
-		  <refsection>
-			<title>Description</title>
-
-			<para>Returns a point projected from a point along a geodesic using a given distance and azimuth (bearing). This is known as the direct geodesic problem.</para>
-            <para>The two-point version uses the path from the first to the second point to implicitly define the azimuth and uses the distance as before.</para>
-			<para>The distance is given in meters.  Negative values are supported.</para>
-			<para>The azimuth (also known as heading or bearing) is given in radians.
-			It is measured clockwise from true north.</para>
-            <itemizedlist>
-                <listitem><para>North is azimuth zero (0 degrees)</para></listitem>
-                <listitem><para>East is azimuth &#x03C0;/2 (90 degrees)</para></listitem>
-                <listitem><para>South is azimuth &#x03C0; (180 degrees)</para></listitem>
-                <listitem><para>West is azimuth 3&#x03C0;/2 (270 degrees)</para></listitem>
-            </itemizedlist>
-            <para>Negative azimuth values and values greater than 2&#x03C0; (360 degrees) are supported.</para>
-
-			<para role="availability" conformance="2.0.0">Availability: 2.0.0</para>
-			<para role="enhanced" conformance="2.4.0">Enhanced: 2.4.0 Allow negative distance and non-normalized azimuth.</para>
-            <para role="enhanced" conformance="3.4.0">Enhanced: 3.4.0 Allow geometry arguments and two-point form omitting azimuth.</para>
-
-		  </refsection>
-
-		  <refsection>
-			<title>Example: Projected point at 100,000 meters and bearing 45 degrees </title>
-
-<programlisting>
-SELECT ST_AsText(ST_Project('POINT(0 0)'::geography, 100000, radians(45.0)));
---------------------------------------------
- POINT(0.635231029125537 0.639472334729198)
-</programlisting>
-		  </refsection>
-
-		  <refsection>
-			<title>See Also</title>
-
-			<para><xref linkend="ST_Azimuth" />, <xref linkend="ST_Distance" />, <ulink url="http://www.postgresql.org/docs/current/interactive/functions-math.html">PostgreSQL function radians()</ulink></para>
-		  </refsection>
-	</refentry>
-
-
 <refentry id="ST_ShortestLine">
 	  <refnamediv>
 		<refname>ST_ShortestLine</refname>
diff --git a/liblwgeom/liblwgeom.h.in b/liblwgeom/liblwgeom.h.in
index 3bf5b4820..cbac60f3c 100644
--- a/liblwgeom/liblwgeom.h.in
+++ b/liblwgeom/liblwgeom.h.in
@@ -1153,6 +1153,11 @@ extern POINTARRAY* lwline_interpolate_points(const LWLINE *line, double length_f
  */
 extern LWPOINT* lwline_interpolate_point_3d(const LWLINE *line, double distance);
 
+/**
+ * Extend the ends of a line
+ */
+extern LWLINE* lwline_extend(const LWLINE *line, double distance_forward, double distance_backward);
+
 /******************************************************************
  * LWPOLY functions
  ******************************************************************/
diff --git a/liblwgeom/liblwgeom_internal.h b/liblwgeom/liblwgeom_internal.h
index cc45fdeef..a0f76162f 100644
--- a/liblwgeom/liblwgeom_internal.h
+++ b/liblwgeom/liblwgeom_internal.h
@@ -196,9 +196,9 @@ int lwpoint_is_empty(const LWPOINT *point);
 /*
 * Number of vertices?
 */
-uint32_t lwline_count_vertices(LWLINE *line);
-uint32_t lwpoly_count_vertices(LWPOLY *poly);
-uint32_t lwcollection_count_vertices(LWCOLLECTION *col);
+uint32_t lwline_count_vertices(const LWLINE *line);
+uint32_t lwpoly_count_vertices(const LWPOLY *poly);
+uint32_t lwcollection_count_vertices(const LWCOLLECTION *col);
 
 /*
 * DP simplification
diff --git a/liblwgeom/lwcollection.c b/liblwgeom/lwcollection.c
index 6d5c5ce68..2cba81c1b 100644
--- a/liblwgeom/lwcollection.c
+++ b/liblwgeom/lwcollection.c
@@ -497,7 +497,7 @@ lwcollection_force_dims(const LWCOLLECTION *col, int hasz, int hasm, double zval
 }
 
 
-uint32_t lwcollection_count_vertices(LWCOLLECTION *col)
+uint32_t lwcollection_count_vertices(const LWCOLLECTION *col)
 {
 	uint32_t i = 0;
 	uint32_t v = 0; /* vertices */
diff --git a/liblwgeom/lwgeom.c b/liblwgeom/lwgeom.c
index 1a580b9d6..6f2eb9764 100644
--- a/liblwgeom/lwgeom.c
+++ b/liblwgeom/lwgeom.c
@@ -1264,10 +1264,10 @@ uint32_t lwgeom_count_vertices(const LWGEOM *geom)
 	case TRIANGLETYPE:
 	case CIRCSTRINGTYPE:
 	case LINETYPE:
-		result = lwline_count_vertices((LWLINE *)geom);
+		result = lwline_count_vertices((const LWLINE *)geom);
 		break;
 	case POLYGONTYPE:
-		result = lwpoly_count_vertices((LWPOLY *)geom);
+		result = lwpoly_count_vertices((const LWPOLY *)geom);
 		break;
 	case COMPOUNDTYPE:
 	case CURVEPOLYTYPE:
@@ -1279,7 +1279,7 @@ uint32_t lwgeom_count_vertices(const LWGEOM *geom)
 	case POLYHEDRALSURFACETYPE:
 	case TINTYPE:
 	case COLLECTIONTYPE:
-		result = lwcollection_count_vertices((LWCOLLECTION *)geom);
+		result = lwcollection_count_vertices((const LWCOLLECTION *)geom);
 		break;
 	default:
 		lwerror("%s: unsupported input geometry type: %s",
diff --git a/liblwgeom/lwline.c b/liblwgeom/lwline.c
index af5b67eb4..936d9503c 100644
--- a/liblwgeom/lwline.c
+++ b/liblwgeom/lwline.c
@@ -502,7 +502,7 @@ lwline_force_dims(const LWLINE *line, int hasz, int hasm, double zval, double mv
 	return lineout;
 }
 
-uint32_t lwline_count_vertices(LWLINE *line)
+uint32_t lwline_count_vertices(const LWLINE *line)
 {
 	assert(line);
 	if ( ! line->points )
@@ -667,3 +667,73 @@ lwline_interpolate_point_3d(const LWLINE *line, double distance)
 	getPoint4d_p(ipa, ipa->npoints - 1, &pt);
 	return lwpoint_make(line->srid, has_z, has_m, &pt);
 }
+
+extern LWLINE *
+lwline_extend(const LWLINE *line, double distance_forward, double distance_backward)
+{
+	POINTARRAY *pa, *opa;
+	POINT4D p00, p01, p10, p11;
+	POINT4D p_start, p_end;
+	uint32_t i;
+	bool forward = false, backward = false;
+
+	if (distance_forward < 0 || distance_backward < 0)
+		lwerror("%s: distances must be non-negative", __func__);
+
+	if (!line || lwline_is_empty(line) || lwline_count_vertices(line) < 2)
+	{
+		lwerror("%s: line must have at least two points", __func__);
+	}
+
+	pa = line->points;
+	if (distance_backward > 0.0)
+	{
+		i = 0;
+		/* Get two distinct points at start of pointarray */
+		getPoint4d_p(pa, i++, &p00);
+		getPoint4d_p(pa, i, &p01);
+		while(p4d_same(&p00, &p01))
+		{
+			if (i == pa->npoints - 1)
+			{
+				lwerror("%s: line must have at least two distinct points", __func__);
+			}
+			i++;
+			getPoint4d_p(pa, i, &p01);
+		}
+		project_pt_pt(&p01, &p00, distance_backward, &p_start);
+		backward = true;
+	}
+
+	if (distance_forward > 0.0)
+	{
+		i = pa->npoints - 1;
+		/* Get two distinct points at end of pointarray */
+		getPoint4d_p(pa, i--, &p10);
+		getPoint4d_p(pa, i, &p11);
+		while(p4d_same(&p10, &p11))
+		{
+			if (i == 0)
+			{
+				lwerror("%s: line must have at least two distinct points", __func__);
+			}
+			i--;
+			getPoint4d_p(pa, i, &p11);
+		}
+		project_pt_pt(&p11, &p10, distance_forward, &p_end);
+		forward = true;
+	}
+
+	opa = ptarray_construct_empty(ptarray_has_z(pa), ptarray_has_m(pa), pa->npoints + 2);
+
+	if (backward)
+	{
+		ptarray_append_point(opa, &p_start, true);
+	}
+	ptarray_append_ptarray(opa, pa, -1.0);
+	if (forward)
+	{
+		ptarray_append_point(opa, &p_end, true);
+	}
+	return lwline_construct(line->srid, NULL, opa);
+}
diff --git a/liblwgeom/lwpoly.c b/liblwgeom/lwpoly.c
index e35fe2e5b..716bf00b3 100644
--- a/liblwgeom/lwpoly.c
+++ b/liblwgeom/lwpoly.c
@@ -415,7 +415,7 @@ lwpoly_force_dims(const LWPOLY *poly, int hasz, int hasm, double zval, double mv
 	return polyout;
 }
 
-uint32_t lwpoly_count_vertices(LWPOLY *poly)
+uint32_t lwpoly_count_vertices(const LWPOLY *poly)
 {
 	uint32_t i = 0;
 	uint32_t v = 0; /* vertices */
diff --git a/liblwgeom/measures.c b/liblwgeom/measures.c
index d1e327cd2..3469d29d7 100644
--- a/liblwgeom/measures.c
+++ b/liblwgeom/measures.c
@@ -2486,8 +2486,8 @@ project_pt(const POINT2D *P, double distance, double azimuth, POINT2D *R)
 
 	double dx = cos(slope) * distance;
 	double dy = sin(slope) * distance;
-	R->x += dx;
-	R->y += dy;
+	R->x = P->x + dx;
+	R->y = P->x + dy;
 	return LW_TRUE;
 }
 
@@ -2505,10 +2505,10 @@ project_pt_pt(const POINT4D *A, const POINT4D *B, double distance, POINT4D *R)
 	double dy = (B->y - A->y) * prop;
 	double dz = (B->z - A->z) * prop;
 	double dm = (B->m - A->m) * prop;
-	R->x += dx;
-	R->y += dy;
-	if (isfinite(dz)) R->z += dz;
-	if (isfinite(dm)) R->m += dm;
+	R->x = B->x + dx;
+	R->y = B->y + dy;
+	if (isfinite(dz)) R->z = B->z + dz;
+	if (isfinite(dm)) R->m = B->m + dm;
 	return LW_TRUE;
 }
 
diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index 4f22b76a9..b0aa4b9b3 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -107,6 +107,7 @@ Datum LWGEOM_hasBBOX(PG_FUNCTION_ARGS);
 Datum LWGEOM_azimuth(PG_FUNCTION_ARGS);
 Datum geometry_project_direction(PG_FUNCTION_ARGS);
 Datum geometry_project_geometry(PG_FUNCTION_ARGS);
+Datum geometry_line_extend(PG_FUNCTION_ARGS);
 Datum LWGEOM_angle(PG_FUNCTION_ARGS);
 Datum LWGEOM_affine(PG_FUNCTION_ARGS);
 Datum LWGEOM_longitude_shift(PG_FUNCTION_ARGS);
@@ -2651,6 +2652,45 @@ Datum geometry_project_geometry(PG_FUNCTION_ARGS)
 }
 
 
+
+/**
+ * Extend the ends of a line outwards from
+ * the end, the start, or both, a set positive distance.
+ * ST_LineExtent(linestring, distance_forward, distance_backward (default 0.0)
+ * Geometry must be linestring.
+ */
+PG_FUNCTION_INFO_V1(geometry_line_extend);
+Datum geometry_line_extend(PG_FUNCTION_ARGS)
+{
+	GSERIALIZED *geom1, *geom2;
+	LWLINE *lwline1, *lwline2;
+	LWGEOM *lwgeom1, *lwgeom2;
+	double distance_forward, distance_backward;
+
+	geom1 = PG_GETARG_GSERIALIZED_P(0);
+	distance_forward = PG_GETARG_FLOAT8(1);
+	distance_backward = PG_GETARG_FLOAT8(2);
+
+	lwgeom1 = lwgeom_from_gserialized(geom1);
+	lwline1 = lwgeom_as_lwline(lwgeom1);
+	if (!lwline1)
+		lwpgerror("Argument must be LINESTRING geometry");
+
+	if (lwline_is_empty(lwline1))
+		PG_RETURN_NULL();
+
+	if (lwline_length_2d(lwline1) <= 0.0)
+		PG_RETURN_POINTER(geom1);
+
+	lwline2 = lwline_extend(lwline1, distance_forward, distance_backward);
+	lwgeom2 = lwline_as_lwgeom(lwline2);
+	geom2 = geometry_serialize(lwgeom2);
+
+	PG_RETURN_POINTER(geom2);
+}
+
+
+
 /**
  * Compute the angle defined by 3 points or the angle between 2 vectors
  * defined by 4 points
diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in
index 5e9275c74..016233f6d 100644
--- a/postgis/postgis.sql.in
+++ b/postgis/postgis.sql.in
@@ -1411,6 +1411,13 @@ CREATE OR REPLACE FUNCTION ST_Angle(pt1 geometry, pt2 geometry, pt3 geometry, pt
 	LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
 	_COST_LOW;
 
+-- Availability: 3.4.0
+CREATE OR REPLACE FUNCTION ST_LineExtend(geom geometry, distance_forward float8, distance_backward float8 DEFAULT 0.0)
+	RETURNS geometry
+	AS 'MODULE_PATHNAME', 'geometry_line_extend'
+	LANGUAGE 'c' IMMUTABLE STRICT PARALLEL SAFE
+	_COST_LOW;
+
 -- Availability: Future
 -- CREATE OR REPLACE FUNCTION _ST_DistanceRectTree(g1 geometry, g2 geometry)
 --	RETURNS float8
diff --git a/regress/core/measures.sql b/regress/core/measures.sql
index 465578177..705789cdc 100644
--- a/regress/core/measures.sql
+++ b/regress/core/measures.sql
@@ -298,6 +298,7 @@ SELECT 'st_project.04', ST_AsText(ST_SnapToGrid(ST_Project('POINT(0 0)'::geometr
 SELECT 'st_project.05', ST_AsText(ST_SnapToGrid(ST_Project('POINT(0 0)'::geometry, 1, pi()/4), 0.001), 3);
 SELECT 'st_project.06', ST_AsText(ST_SnapToGrid(ST_Project('POINT(0 0)'::geometry, 1, pi()+pi()/4), 0.001), 3);
 SELECT 'st_project.07', ST_AsText(ST_SnapToGrid(ST_Project('POINT(0 0)'::geometry, 0, 0), 0.001), 3);
+SELECT 'st_project.08', ST_AsText(ST_SnapToGrid(ST_Project('POINT(10 10)'::geometry, 1, pi()+pi()/4), 0.001), 3);
 
 SELECT 'st_project.11', ST_AsText(ST_SnapToGrid(ST_Project('POINT(1 0)'::geometry, 'POINT(0 0)'::geometry, 1), 0.1), 2);
 SELECT 'st_project.12', ST_AsText(ST_SnapToGrid(ST_Project('POINT(-1 0)'::geometry, 'POINT(0 0)'::geometry, 1), 0.1), 2);
@@ -306,3 +307,11 @@ SELECT 'st_project.14', ST_AsText(ST_SnapToGrid(ST_Project('POINT(0 -1)'::geomet
 SELECT 'st_project.15', ST_AsText(ST_SnapToGrid(ST_Project('POINT(1 1)'::geometry, 'POINT(0 0)'::geometry, 1), 0.001), 3);
 SELECT 'st_project.16', ST_AsText(ST_SnapToGrid(ST_Project('POINT(-1 -1)'::geometry, 'POINT(0 0)'::geometry, 1), 0.001), 3);
 SELECT 'st_project.17', ST_AsText(ST_SnapToGrid(ST_Project('POINT(0 0)'::geometry, 'POINT(0 0)'::geometry, 1), 0.001), 3);
+SELECT 'st_project.18', ST_AsText(ST_SnapToGrid(ST_Project('POINT(10 10)'::geometry, 'POINT(8 8)'::geometry, 1), 0.001), 3);
+
+SELECT 'st_lineextend.1', ST_AsText(ST_SnapToGrid(ST_LineExtend('LINESTRING(0 0,1 1)'::geometry, 1, 1), 0.001), 3);
+SELECT 'st_lineextend.2', ST_AsText(ST_SnapToGrid(ST_LineExtend('LINESTRING(0 0,1 1)'::geometry, 0, 1), 0.001), 3);
+SELECT 'st_lineextend.3', ST_AsText(ST_SnapToGrid(ST_LineExtend('LINESTRING(0 0,1 1)'::geometry, 1), 0.001), 3);
+SELECT 'st_lineextend.4', ST_AsText(ST_SnapToGrid(ST_LineExtend('LINESTRING(0 0,1 1,1 1,1 1)'::geometry, 1), 0.001), 3);
+SELECT 'st_lineextend.5', ST_AsText(ST_SnapToGrid(ST_LineExtend('LINESTRING EMPTY'::geometry, 1), 0.001), 3);
+SELECT 'st_lineextend.6', ST_AsText(ST_SnapToGrid(ST_LineExtend('POINT EMPTY'::geometry, 1), 0.001), 3);
diff --git a/regress/core/measures_expected b/regress/core/measures_expected
index a9114589c..09878b4a0 100644
--- a/regress/core/measures_expected
+++ b/regress/core/measures_expected
@@ -86,6 +86,7 @@ st_project.04|POINT(-1 0)
 st_project.05|POINT(0.707 0.707)
 st_project.06|POINT(-0.707 -0.707)
 st_project.07|POINT(0 0)
+st_project.08|POINT(9.293 9.293)
 st_project.11|POINT(-1 0)
 st_project.12|POINT(1 0)
 st_project.13|POINT(0 -1)
@@ -93,3 +94,10 @@ st_project.14|POINT(0 1)
 st_project.15|POINT(-0.707 -0.707)
 st_project.16|POINT(0.707 0.707)
 st_project.17|POINT(0 0)
+st_project.18|POINT(7.293 7.293)
+st_lineextend.1|LINESTRING(-0.707 -0.707,0 0,1 1,1.707 1.707)
+st_lineextend.2|LINESTRING(-0.707 -0.707,0 0,1 1)
+st_lineextend.3|LINESTRING(0 0,1 1,1.707 1.707)
+st_lineextend.4|LINESTRING(0 0,1 1,1.707 1.707)
+st_lineextend.5|
+ERROR:  Argument must be LINESTRING geometry

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

Summary of changes:
 doc/reference_editor.xml         | 159 +++++++++++++++++++++++++++++++++++++++
 doc/reference_measure.xml        |  92 ----------------------
 liblwgeom/liblwgeom.h.in         |   5 ++
 liblwgeom/liblwgeom_internal.h   |   6 +-
 liblwgeom/lwcollection.c         |   2 +-
 liblwgeom/lwgeom.c               |   6 +-
 liblwgeom/lwline.c               |  72 +++++++++++++++++-
 liblwgeom/lwpoly.c               |   2 +-
 liblwgeom/measures.c             |  12 +--
 postgis/lwgeom_functions_basic.c |  40 ++++++++++
 postgis/postgis.sql.in           |   7 ++
 regress/core/measures.sql        |   9 +++
 regress/core/measures_expected   |   8 ++
 13 files changed, 313 insertions(+), 107 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list