[SCM] PostGIS branch master updated. 3.6.0rc2-126-g0383bab91
git at osgeo.org
git at osgeo.org
Wed Oct 8 13:28:26 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 0383bab91e5f2eb7ac418fc661d473d3b87f5330 (commit)
from 747d7732b009ee6821501f290a3f729e56a9634d (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 0383bab91e5f2eb7ac418fc661d473d3b87f5330
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Wed Oct 8 13:27:52 2025 -0700
Support MultiLineString as input to ST_MakeLine.
Handle each sub-geometry in order it appears
in the collection.
Closes #6001
diff --git a/NEWS b/NEWS
index f07ea83e1..69d76e147 100644
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,7 @@ xxxx/xx/xx
- #5993, [topology] Add max_edges parameter to TopoGeo_AddLinestring
(Sandro Santilli)
-
+ - #6001, support MultiLineString in ST_MakeLine (Paul Ramsey)
PostGIS 3.6.0
diff --git a/doc/reference_constructor.xml b/doc/reference_constructor.xml
index 819527f6b..e849926c5 100644
--- a/doc/reference_constructor.xml
+++ b/doc/reference_constructor.xml
@@ -1,70 +1,70 @@
<!-- Converted by db4-upgrade version 1.1 -->
<section xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="Geometry_Constructors">
- <title>Geometry Constructors</title>
+ <title>Geometry Constructors</title>
- <refentry xml:id="ST_Collect">
- <refnamediv>
- <refname>ST_Collect</refname>
- <refpurpose>Creates a GeometryCollection or Multi* geometry from a set of geometries.</refpurpose>
- </refnamediv>
+ <refentry xml:id="ST_Collect">
+ <refnamediv>
+ <refname>ST_Collect</refname>
+ <refpurpose>Creates a GeometryCollection or Multi* geometry from a set of geometries.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_Collect</function></funcdef>
- <paramdef><type>geometry</type> <parameter>g1</parameter></paramdef>
- <paramdef><type>geometry</type> <parameter>g2</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>geometry <function>ST_Collect</function></funcdef>
- <paramdef><type>geometry[]</type> <parameter>g1_array</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>geometry <function>ST_Collect</function></funcdef>
- <paramdef><type>geometry set</type> <parameter>g1field</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_Collect</function></funcdef>
+ <paramdef><type>geometry</type> <parameter>g1</parameter></paramdef>
+ <paramdef><type>geometry</type> <parameter>g2</parameter></paramdef>
+ </funcprototype>
+ <funcprototype>
+ <funcdef>geometry <function>ST_Collect</function></funcdef>
+ <paramdef><type>geometry[]</type> <parameter>g1_array</parameter></paramdef>
+ </funcprototype>
+ <funcprototype>
+ <funcdef>geometry <function>ST_Collect</function></funcdef>
+ <paramdef><type>geometry set</type> <parameter>g1field</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
- <para> Collects geometries into a geometry collection.
- The result is either a Multi* or a
- GeometryCollection, depending on whether the input geometries have the same or different types
- (homogeneous or heterogeneous).
- The input geometries are left unchanged within the collection.
- </para>
+ <refsection>
+ <title>Description</title>
+ <para> Collects geometries into a geometry collection.
+ The result is either a Multi* or a
+ GeometryCollection, depending on whether the input geometries have the same or different types
+ (homogeneous or heterogeneous).
+ The input geometries are left unchanged within the collection.
+ </para>
- <para><emphasis role="bold">Variant 1:</emphasis> accepts two input geometries</para>
- <para><emphasis role="bold">Variant 2:</emphasis> accepts an array of geometries</para>
- <para><emphasis role="bold">Variant 3:</emphasis> aggregate function accepting a rowset of geometries.</para>
+ <para><emphasis role="bold">Variant 1:</emphasis> accepts two input geometries</para>
+ <para><emphasis role="bold">Variant 2:</emphasis> accepts an array of geometries</para>
+ <para><emphasis role="bold">Variant 3:</emphasis> aggregate function accepting a rowset of geometries.</para>
- <note><para>
- If any of the input geometries are collections (Multi* or GeometryCollection)
- ST_Collect returns a GeometryCollection (since that is the only type
- which can contain nested collections).
- To prevent this, use <xref linkend="ST_Dump"/> in a subquery to expand the
- input collections to their atomic elements (see example below).
- </para></note>
+ <note><para>
+ If any of the input geometries are collections (Multi* or GeometryCollection)
+ ST_Collect returns a GeometryCollection (since that is the only type
+ which can contain nested collections).
+ To prevent this, use <xref linkend="ST_Dump"/> in a subquery to expand the
+ input collections to their atomic elements (see example below).
+ </para></note>
- <note><para>ST_Collect and <xref linkend="ST_Union"/> appear similar, but in fact operate quite differently.
- ST_Collect aggregates geometries into a collection without changing them in any way.
- ST_Union geometrically merges geometries where they overlap,
- and splits linestrings at intersections.
- It may return single geometries when it dissolves boundaries.
- </para></note>
+ <note><para>ST_Collect and <xref linkend="ST_Union"/> appear similar, but in fact operate quite differently.
+ ST_Collect aggregates geometries into a collection without changing them in any way.
+ ST_Union geometrically merges geometries where they overlap,
+ and splits linestrings at intersections.
+ It may return single geometries when it dissolves boundaries.
+ </para></note>
- <para role="availability" conformance="1.4.0">Availability: 1.4.0 - ST_Collect(geomarray) was introduced. ST_Collect was enhanced to handle more geometries faster.</para>
- <para>&Z_support;</para>
- <para>&curve_support;</para>
- </refsection>
+ <para role="availability" conformance="1.4.0">Availability: 1.4.0 - ST_Collect(geomarray) was introduced. ST_Collect was enhanced to handle more geometries faster.</para>
+ <para>&Z_support;</para>
+ <para>&curve_support;</para>
+ </refsection>
- <refsection>
- <title>Examples - Two-input variant</title>
- <para>Collect 2D points.</para>
+ <refsection>
+ <title>Examples - Two-input variant</title>
+ <para>Collect 2D points.</para>
<programlisting>
SELECT ST_AsText( ST_Collect( ST_GeomFromText('POINT(1 2)'),
- ST_GeomFromText('POINT(-2 3)') ));
+ ST_GeomFromText('POINT(-2 3)') ));
st_astext
----------
@@ -74,9 +74,9 @@ MULTIPOINT((1 2),(-2 3))
<para>Collect 3D points.</para>
<programlisting>
SELECT ST_AsEWKT( ST_Collect( ST_GeomFromEWKT('POINT(1 2 3)'),
- ST_GeomFromEWKT('POINT(1 2 4)') ) );
+ ST_GeomFromEWKT('POINT(1 2 4)') ) );
- st_asewkt
+ st_asewkt
-------------------------
MULTIPOINT(1 2 3,1 2 4)
</programlisting>
@@ -84,15 +84,15 @@ SELECT ST_AsEWKT( ST_Collect( ST_GeomFromEWKT('POINT(1 2 3)'),
<para>Collect curves.</para>
<programlisting>
SELECT ST_AsText( ST_Collect( 'CIRCULARSTRING(220268 150415,220227 150505,220227 150406)',
- 'CIRCULARSTRING(220227 150406,2220227 150407,220227 150406)'));
+ 'CIRCULARSTRING(220227 150406,2220227 150407,220227 150406)'));
- st_astext
+ st_astext
------------------------------------------------------------------------------------
MULTICURVE(CIRCULARSTRING(220268 150415,220227 150505,220227 150406),
CIRCULARSTRING(220227 150406,2220227 150407,220227 150406))
</programlisting>
- </refsection>
- <refsection>
+ </refsection>
+ <refsection>
<title>Examples - Array variant</title>
<para>Using an array constructor for a subquery.</para>
<programlisting>
@@ -101,186 +101,188 @@ SELECT ST_Collect( ARRAY( SELECT geom FROM sometable ) );
<para>Using an array constructor for values.</para>
<programlisting>
SELECT ST_AsText( ST_Collect(
- ARRAY[ ST_GeomFromText('LINESTRING(1 2, 3 4)'),
- ST_GeomFromText('LINESTRING(3 4, 4 5)') ] )) As wktcollect;
+ ARRAY[ ST_GeomFromText('LINESTRING(1 2, 3 4)'),
+ ST_GeomFromText('LINESTRING(3 4, 4 5)') ] )) As wktcollect;
--wkt collect --
MULTILINESTRING((1 2,3 4),(3 4,4 5))
</programlisting>
- </refsection>
- <refsection>
- <title>Examples - Aggregate variant</title>
- <para>Creating multiple collections by grouping geometries in a table.</para>
+ </refsection>
+ <refsection>
+ <title>Examples - Aggregate variant</title>
+ <para>Creating multiple collections by grouping geometries in a table.</para>
<programlisting>
SELECT stusps, ST_Collect(f.geom) as geom
- FROM (SELECT stusps, (ST_Dump(geom)).geom As geom
- FROM
- somestatetable ) As f
- GROUP BY stusps
+ FROM (SELECT stusps, (ST_Dump(geom)).geom As geom
+ FROM
+ somestatetable ) As f
+ GROUP BY stusps
</programlisting>
- </refsection>
- <refsection>
- <title>See Also</title>
- <para><xref linkend="ST_Dump"/>, <xref linkend="ST_Union"/></para>
- </refsection>
- </refentry>
+ </refsection>
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="ST_Dump"/>, <xref linkend="ST_Union"/></para>
+ </refsection>
+ </refentry>
- <refentry xml:id="ST_LineFromMultiPoint">
- <refnamediv>
- <refname>ST_LineFromMultiPoint</refname>
+ <refentry xml:id="ST_LineFromMultiPoint">
+ <refnamediv>
+ <refname>ST_LineFromMultiPoint</refname>
- <refpurpose>Creates a LineString from a MultiPoint geometry.</refpurpose>
- </refnamediv>
+ <refpurpose>Creates a LineString from a MultiPoint geometry.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_LineFromMultiPoint</function></funcdef>
- <paramdef><type>geometry </type> <parameter>aMultiPoint</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_LineFromMultiPoint</function></funcdef>
+ <paramdef><type>geometry </type> <parameter>aMultiPoint</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
+ <refsection>
+ <title>Description</title>
- <para>Creates a LineString from a MultiPoint geometry.</para>
+ <para>Creates a LineString from a MultiPoint geometry.</para>
- <para>Use <xref linkend="ST_MakeLine"/> to create lines from Point or LineString inputs.</para>
+ <para>Use <xref linkend="ST_MakeLine"/> to create lines from Point or LineString inputs.</para>
- <para>&Z_support;</para>
+ <para>&Z_support;</para>
- </refsection>
+ </refsection>
- <refsection>
- <title>Examples</title>
- <para>Create a 3D line string from a 3D MultiPoint</para>
- <programlisting>
+ <refsection>
+ <title>Examples</title>
+ <para>Create a 3D line string from a 3D MultiPoint</para>
+ <programlisting>
SELECT ST_AsEWKT( ST_LineFromMultiPoint('MULTIPOINT(1 2 3, 4 5 6, 7 8 9)') );
--result--
LINESTRING(1 2 3,4 5 6,7 8 9)
</programlisting>
- </refsection>
+ </refsection>
- <!-- Optionally add a "See Also" section -->
- <refsection>
- <title>See Also</title>
+ <!-- Optionally add a "See Also" section -->
+ <refsection>
+ <title>See Also</title>
- <para><xref linkend="ST_AsEWKT"/>, <xref linkend="ST_MakeLine"/></para>
- </refsection>
- </refentry>
+ <para><xref linkend="ST_AsEWKT"/>, <xref linkend="ST_MakeLine"/></para>
+ </refsection>
+ </refentry>
- <refentry xml:id="ST_MakeEnvelope">
- <refnamediv>
- <refname>ST_MakeEnvelope</refname>
+ <refentry xml:id="ST_MakeEnvelope">
+ <refnamediv>
+ <refname>ST_MakeEnvelope</refname>
- <refpurpose>Creates a rectangular Polygon from minimum and maximum coordinates.</refpurpose>
- </refnamediv>
+ <refpurpose>Creates a rectangular Polygon from minimum and maximum coordinates.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_MakeEnvelope</function></funcdef>
- <paramdef><type>float</type> <parameter>xmin</parameter></paramdef>
- <paramdef><type>float</type> <parameter>ymin</parameter></paramdef>
- <paramdef><type>float</type> <parameter>xmax</parameter></paramdef>
- <paramdef><type>float</type> <parameter>ymax</parameter></paramdef>
- <paramdef choice="opt"><type>integer</type> <parameter>srid=unknown</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_MakeEnvelope</function></funcdef>
+ <paramdef><type>float</type> <parameter>xmin</parameter></paramdef>
+ <paramdef><type>float</type> <parameter>ymin</parameter></paramdef>
+ <paramdef><type>float</type> <parameter>xmax</parameter></paramdef>
+ <paramdef><type>float</type> <parameter>ymax</parameter></paramdef>
+ <paramdef choice="opt"><type>integer</type> <parameter>srid=unknown</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
+ <refsection>
+ <title>Description</title>
- <para>Creates a rectangular Polygon from the minimum and maximum values for X and Y.
- Input values must be in the spatial reference system specified by the SRID.
- If no SRID is specified the unknown spatial reference system (SRID 0) is used.</para>
+ <para>Creates a rectangular Polygon from the minimum and maximum values for X and Y.
+ Input values must be in the spatial reference system specified by the SRID.
+ If no SRID is specified the unknown spatial reference system (SRID 0) is used.</para>
- <para role="availability" conformance="1.5">Availability: 1.5</para>
- <para role="enhanced" conformance="2.0">Enhanced: 2.0: Ability to specify an envelope without specifying an SRID was introduced.</para>
+ <para role="availability" conformance="1.5">Availability: 1.5</para>
+ <para role="enhanced" conformance="2.0">Enhanced: 2.0: Ability to specify an envelope without specifying an SRID was introduced.</para>
- </refsection>
+ </refsection>
- <refsection>
- <title>Example: Building a bounding box polygon</title>
- <programlisting>
+ <refsection>
+ <title>Example: Building a bounding box polygon</title>
+ <programlisting>
SELECT ST_AsText( ST_MakeEnvelope(10, 10, 11, 11, 4326) );
st_asewkt
-----------
POLYGON((10 10, 10 11, 11 11, 11 10, 10 10))
</programlisting>
- </refsection>
- <refsection>
- <title>See Also</title>
- <para><xref linkend="ST_MakePoint"/>, <xref linkend="ST_MakeLine"/>, <xref linkend="ST_MakePolygon"/>, <xref linkend="ST_TileEnvelope"/></para>
- </refsection>
- </refentry>
+ </refsection>
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="ST_MakePoint"/>, <xref linkend="ST_MakeLine"/>, <xref linkend="ST_MakePolygon"/>, <xref linkend="ST_TileEnvelope"/></para>
+ </refsection>
+ </refentry>
- <refentry xml:id="ST_MakeLine">
- <refnamediv>
- <refname>ST_MakeLine</refname>
+ <refentry xml:id="ST_MakeLine">
+ <refnamediv>
+ <refname>ST_MakeLine</refname>
- <refpurpose>Creates a LineString from Point, MultiPoint, or LineString geometries.</refpurpose>
- </refnamediv>
+ <refpurpose>Creates a LineString from Point, MultiPoint, or LineString geometries.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_MakeLine</function></funcdef>
- <paramdef><type>geometry</type> <parameter>geom1</parameter></paramdef>
- <paramdef><type>geometry</type> <parameter>geom2</parameter></paramdef>
- </funcprototype>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_MakeLine</function></funcdef>
+ <paramdef><type>geometry</type> <parameter>geom1</parameter></paramdef>
+ <paramdef><type>geometry</type> <parameter>geom2</parameter></paramdef>
+ </funcprototype>
- <funcprototype>
- <funcdef>geometry <function>ST_MakeLine</function></funcdef>
- <paramdef><type>geometry[]</type> <parameter>geoms_array</parameter></paramdef>
- </funcprototype>
+ <funcprototype>
+ <funcdef>geometry <function>ST_MakeLine</function></funcdef>
+ <paramdef><type>geometry[]</type> <parameter>geoms_array</parameter></paramdef>
+ </funcprototype>
- <funcprototype>
- <funcdef>geometry <function>ST_MakeLine</function></funcdef>
- <paramdef><type>geometry set</type> <parameter>geoms</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
+ <funcprototype>
+ <funcdef>geometry <function>ST_MakeLine</function></funcdef>
+ <paramdef><type>geometry set</type> <parameter>geoms</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
+ <refsection>
+ <title>Description</title>
- <para>Creates a LineString containing the points of Point, MultiPoint, or LineString geometries.
- Other geometry types cause an error.
- </para>
- <para><emphasis role="bold">Variant 1:</emphasis> accepts two input geometries</para>
- <para><emphasis role="bold">Variant 2:</emphasis> accepts an array of geometries</para>
- <para><emphasis role="bold">Variant 3:</emphasis> aggregate function accepting a rowset of geometries.
- To ensure the order of the input geometries use <varname>ORDER BY</varname> in the function call,
- or a subquery with an <varname>ORDER BY</varname> clause.</para>
+ <para>Creates a LineString containing the points of Point, MultiPoint, or LineString geometries.
+ Other geometry types cause an error.
+ </para>
+ <para><emphasis role="bold">Variant 1:</emphasis> accepts two input geometries</para>
+ <para><emphasis role="bold">Variant 2:</emphasis> accepts an array of geometries</para>
+ <para><emphasis role="bold">Variant 3:</emphasis> aggregate function accepting a rowset of geometries.
+ To ensure the order of the input geometries use <varname>ORDER BY</varname> in the function call,
+ or a subquery with an <varname>ORDER BY</varname> clause.</para>
- <para>
- Repeated nodes at the beginning of input LineStrings are collapsed to a single point.
- Repeated points in Point and MultiPoint inputs are not collapsed.
- <xref linkend="ST_RemoveRepeatedPoints"/> can be used to collapse repeated points from the output LineString.
- </para>
+ <para>
+ Repeated nodes at the beginning of input LineStrings are collapsed to a single point.
+ Repeated points in Point and MultiPoint inputs are not collapsed.
+ Components of MultiLineString are handled in the order they appear in the collection.
+ <xref linkend="ST_RemoveRepeatedPoints"/> can be used to collapse repeated points from the output LineString.
+ </para>
- <para>&Z_support;</para>
+ <para>&Z_support;</para>
- <para role="availability" conformance="2.3.0">Availability: 2.3.0 - Support for MultiPoint input elements was introduced</para>
- <para role="availability" conformance="2.0.0">Availability: 2.0.0 - Support for LineString input elements was introduced</para>
- <para role="availability" conformance="1.4.0">Availability: 1.4.0 - ST_MakeLine(geomarray) was introduced. ST_MakeLine aggregate functions was enhanced to handle more points faster.</para>
+ <para role="availability" conformance="3.7.0">Availability: 3.7.0 - Support for MultiLineString input elements was introduced</para>
+ <para role="availability" conformance="2.3.0">Availability: 2.3.0 - Support for MultiPoint input elements was introduced</para>
+ <para role="availability" conformance="2.0.0">Availability: 2.0.0 - Support for LineString input elements was introduced</para>
+ <para role="availability" conformance="1.4.0">Availability: 1.4.0 - ST_MakeLine(geomarray) was introduced. ST_MakeLine aggregate functions was enhanced to handle more points faster.</para>
- </refsection>
+ </refsection>
- <refsection>
- <title>Examples: Two-input variant</title>
+ <refsection>
+ <title>Examples: Two-input variant</title>
<para>Create a line composed of two points.</para>
<programlisting>
SELECT ST_AsText( ST_MakeLine(ST_Point(1,2), ST_Point(3,4)) );
- st_astext
+ st_astext
---------------------
LINESTRING(1 2,3 4)
</programlisting>
@@ -289,7 +291,7 @@ SELECT ST_AsText( ST_MakeLine(ST_Point(1,2), ST_Point(3,4)) );
<programlisting>
SELECT ST_AsEWKT( ST_MakeLine(ST_MakePoint(1,2,3), ST_MakePoint(3,4,5) ));
- st_asewkt
+ st_asewkt
-------------------------
LINESTRING(1 2 3,3 4 5)
</programlisting>
@@ -302,123 +304,123 @@ SELECT ST_AsEWKT( ST_MakeLine(ST_MakePoint(1,2,3), ST_MakePoint(3,4,5) ));
-----------------------------
LINESTRING(0 0,1 1,2 2,3 3)
</programlisting>
- </refsection>
+ </refsection>
- <refsection>
- <title>Examples: Array variant</title>
+ <refsection>
+ <title>Examples: Array variant</title>
- <para>Create a line from an array formed by a subquery with ordering.</para>
+ <para>Create a line from an array formed by a subquery with ordering.</para>
<programlisting>
SELECT ST_MakeLine( ARRAY( SELECT ST_Centroid(geom) FROM visit_locations ORDER BY visit_time) );
</programlisting>
- <para>Create a 3D line from an array of 3D points</para>
+ <para>Create a 3D line from an array of 3D points</para>
<programlisting>
SELECT ST_AsEWKT( ST_MakeLine(
ARRAY[ ST_MakePoint(1,2,3), ST_MakePoint(3,4,5), ST_MakePoint(6,6,6) ] ));
- st_asewkt
+ st_asewkt
-------------------------
LINESTRING(1 2 3,3 4 5,6 6 6)
</programlisting>
- </refsection>
+ </refsection>
- <refsection>
- <title>Examples: Aggregate variant</title>
- <para>This example queries time-based sequences of GPS points from a set of tracks
- and creates one record for each track.
- The result geometries are LineStrings composed of the GPS track points in the order of travel.</para>
+ <refsection>
+ <title>Examples: Aggregate variant</title>
+ <para>This example queries time-based sequences of GPS points from a set of tracks
+ and creates one record for each track.
+ The result geometries are LineStrings composed of the GPS track points in the order of travel.</para>
<para>Using aggregate <varname>ORDER BY</varname> provides a correctly-ordered LineString.</para>
- <programlisting>
+ <programlisting>
SELECT gps.track_id, ST_MakeLine(gps.geom ORDER BY gps_time) As geom
- FROM gps_points As gps
- GROUP BY track_id;</programlisting>
+ FROM gps_points As gps
+ GROUP BY track_id;</programlisting>
<para>Prior to PostgreSQL 9, ordering in a subquery can be used.
However, sometimes the query plan may not respect the order of the subquery.</para>
- <programlisting>
+ <programlisting>
SELECT gps.track_id, ST_MakeLine(gps.geom) As geom
- FROM ( SELECT track_id, gps_time, geom
- FROM gps_points ORDER BY track_id, gps_time ) As gps
- GROUP BY track_id;</programlisting>
- </refsection>
+ FROM ( SELECT track_id, gps_time, geom
+ FROM gps_points ORDER BY track_id, gps_time ) As gps
+ GROUP BY track_id;</programlisting>
+ </refsection>
- <refsection>
- <title>See Also</title>
- <para><xref linkend="ST_RemoveRepeatedPoints"/>,
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="ST_RemoveRepeatedPoints"/>,
<xref linkend="ST_AsEWKT"/>,
<xref linkend="ST_AsText"/>,
<xref linkend="ST_GeomFromText"/>,
<xref linkend="ST_MakePoint"/>,
<xref linkend="ST_Point"/>
</para>
- </refsection>
- </refentry>
+ </refsection>
+ </refentry>
- <refentry xml:id="ST_MakePoint">
- <refnamediv>
- <refname>ST_MakePoint</refname>
+ <refentry xml:id="ST_MakePoint">
+ <refnamediv>
+ <refname>ST_MakePoint</refname>
- <refpurpose>Creates a 2D, 3DZ or 4D Point.</refpurpose>
- </refnamediv>
+ <refpurpose>Creates a 2D, 3DZ or 4D Point.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_MakePoint</function></funcdef>
- <paramdef><type>float</type> <parameter>x</parameter></paramdef>
- <paramdef><type>float</type> <parameter>y</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_MakePoint</function></funcdef>
- <paramdef><type>float</type> <parameter>x</parameter></paramdef>
- <paramdef><type>float</type> <parameter>y</parameter></paramdef>
- <paramdef><type>float</type> <parameter>z</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_MakePoint</function></funcdef>
- <paramdef><type>float</type> <parameter>x</parameter></paramdef>
- <paramdef><type>float</type> <parameter>y</parameter></paramdef>
- <paramdef><type>float</type> <parameter>z</parameter></paramdef>
- <paramdef><type>float</type> <parameter>m</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_MakePoint</function></funcdef>
+ <paramdef><type>float</type> <parameter>x</parameter></paramdef>
+ <paramdef><type>float</type> <parameter>y</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_MakePoint</function></funcdef>
+ <paramdef><type>float</type> <parameter>x</parameter></paramdef>
+ <paramdef><type>float</type> <parameter>y</parameter></paramdef>
+ <paramdef><type>float</type> <parameter>z</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_MakePoint</function></funcdef>
+ <paramdef><type>float</type> <parameter>x</parameter></paramdef>
+ <paramdef><type>float</type> <parameter>y</parameter></paramdef>
+ <paramdef><type>float</type> <parameter>z</parameter></paramdef>
+ <paramdef><type>float</type> <parameter>m</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
+ <refsection>
+ <title>Description</title>
- <para>Creates a 2D XY, 3D XYZ or 4D XYZM Point geometry.
- Use <xref linkend="ST_MakePointM"/> to make points with XYM coordinates.</para>
+ <para>Creates a 2D XY, 3D XYZ or 4D XYZM Point geometry.
+ Use <xref linkend="ST_MakePointM"/> to make points with XYM coordinates.</para>
- <para>Use <xref linkend="ST_SetSRID"/> to specify a SRID for the created point.</para>
+ <para>Use <xref linkend="ST_SetSRID"/> to specify a SRID for the created point.</para>
- <para>
- While not OGC-compliant, <varname>ST_MakePoint</varname> is
- faster than <xref linkend="ST_GeomFromText"/>
- and <xref linkend="ST_PointFromText"/>.
- It is also easier to use for numeric coordinate values.</para>
+ <para>
+ While not OGC-compliant, <varname>ST_MakePoint</varname> is
+ faster than <xref linkend="ST_GeomFromText"/>
+ and <xref linkend="ST_PointFromText"/>.
+ It is also easier to use for numeric coordinate values.</para>
- <note><para>For geodetic coordinates, <varname>X</varname> is longitude and <varname>Y</varname> is latitude</para></note>
+ <note><para>For geodetic coordinates, <varname>X</varname> is longitude and <varname>Y</varname> is latitude</para></note>
- <note><para>
- The functions
- <xref linkend="ST_Point"/>, <xref linkend="ST_PointZ"/>, <xref linkend="ST_PointM"/>, and <xref linkend="ST_PointZM"/>
- can be used to create points with a given SRID.
- </para></note>
+ <note><para>
+ The functions
+ <xref linkend="ST_Point"/>, <xref linkend="ST_PointZ"/>, <xref linkend="ST_PointM"/>, and <xref linkend="ST_PointZM"/>
+ can be used to create points with a given SRID.
+ </para></note>
- <para>&Z_support;</para>
- </refsection>
+ <para>&Z_support;</para>
+ </refsection>
- <refsection>
- <title>Examples</title>
- <programlisting>-- Create a point with unknown SRID
+ <refsection>
+ <title>Examples</title>
+ <programlisting>-- Create a point with unknown SRID
SELECT ST_MakePoint(-71.1043443253471, 42.3150676015829);
-- Create a point in the WGS 84 geodetic CRS
@@ -432,62 +434,62 @@ SELECT ST_Z(ST_MakePoint(1, 2,1.5));
result
-------
1.5</programlisting>
- </refsection>
- <refsection>
- <title>See Also</title>
- <para>
- <xref linkend="ST_GeomFromText"/>, <xref linkend="ST_PointFromText"/>, <xref linkend="ST_SetSRID"/>, <xref linkend="ST_MakePointM"/>,
- <xref linkend="ST_Point"/>, <xref linkend="ST_PointZ"/>, <xref linkend="ST_PointM"/>, <xref linkend="ST_PointZM"/>
- </para>
- </refsection>
- </refentry>
+ </refsection>
+ <refsection>
+ <title>See Also</title>
+ <para>
+ <xref linkend="ST_GeomFromText"/>, <xref linkend="ST_PointFromText"/>, <xref linkend="ST_SetSRID"/>, <xref linkend="ST_MakePointM"/>,
+ <xref linkend="ST_Point"/>, <xref linkend="ST_PointZ"/>, <xref linkend="ST_PointM"/>, <xref linkend="ST_PointZM"/>
+ </para>
+ </refsection>
+ </refentry>
- <refentry xml:id="ST_MakePointM">
- <refnamediv>
- <refname>ST_MakePointM</refname>
+ <refentry xml:id="ST_MakePointM">
+ <refnamediv>
+ <refname>ST_MakePointM</refname>
- <refpurpose>Creates a Point from X, Y and M values.</refpurpose>
- </refnamediv>
+ <refpurpose>Creates a Point from X, Y and M values.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_MakePointM</function></funcdef>
- <paramdef><type>float</type> <parameter>x</parameter></paramdef>
- <paramdef><type>float</type> <parameter>y</parameter></paramdef>
- <paramdef><type>float</type> <parameter>m</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_MakePointM</function></funcdef>
+ <paramdef><type>float</type> <parameter>x</parameter></paramdef>
+ <paramdef><type>float</type> <parameter>y</parameter></paramdef>
+ <paramdef><type>float</type> <parameter>m</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
+ <refsection>
+ <title>Description</title>
- <para>Creates a point with X, Y and M (measure) ordinates.
- Use <xref linkend="ST_MakePoint"/> to make points with XY, XYZ, or XYZM coordinates.</para>
+ <para>Creates a point with X, Y and M (measure) ordinates.
+ Use <xref linkend="ST_MakePoint"/> to make points with XY, XYZ, or XYZM coordinates.</para>
- <para>Use <xref linkend="ST_SetSRID"/> to specify a SRID for the created point.</para>
+ <para>Use <xref linkend="ST_SetSRID"/> to specify a SRID for the created point.</para>
- <note><para>For geodetic coordinates, <varname>X</varname> is longitude and <varname>Y</varname> is latitude</para></note>
+ <note><para>For geodetic coordinates, <varname>X</varname> is longitude and <varname>Y</varname> is latitude</para></note>
- <note><para>
- The functions
- <xref linkend="ST_PointM"/>, and <xref linkend="ST_PointZM"/>
- can be used to create points with an M value and a given SRID.
- </para></note>
+ <note><para>
+ The functions
+ <xref linkend="ST_PointM"/>, and <xref linkend="ST_PointZM"/>
+ can be used to create points with an M value and a given SRID.
+ </para></note>
- </refsection>
+ </refsection>
- <refsection>
- <title>Examples</title>
- <note><para><xref linkend="ST_AsEWKT"/> is used for text output
- because <xref linkend="ST_AsText"/> does not support M values.</para></note>
+ <refsection>
+ <title>Examples</title>
+ <note><para><xref linkend="ST_AsEWKT"/> is used for text output
+ because <xref linkend="ST_AsText"/> does not support M values.</para></note>
- <para>Create point with unknown SRID.</para>
- <programlisting>
+ <para>Create point with unknown SRID.</para>
+ <programlisting>
SELECT ST_AsEWKT( ST_MakePointM(-71.1043443253471, 42.3150676015829, 10) );
- st_asewkt
+ st_asewkt
-----------------------------------------------
POINTM(-71.1043443253471 42.3150676015829 10)
</programlisting>
@@ -496,7 +498,7 @@ SELECT ST_AsEWKT( ST_MakePointM(-71.1043443253471, 42.3150676015829, 10) );
<programlisting>
SELECT ST_AsEWKT( ST_SetSRID( ST_MakePointM(-71.104, 42.315, 10), 4326));
- st_asewkt
+ st_asewkt
---------------------------------------------------------
SRID=4326;POINTM(-71.104 42.315 10)
</programlisting>
@@ -509,59 +511,59 @@ result
-------
10
</programlisting>
- </refsection>
- <refsection>
- <title>See Also</title>
- <para><xref linkend="ST_MakePoint"/>, <xref linkend="ST_SetSRID"/>,
- <xref linkend="ST_PointM"/>, <xref linkend="ST_PointZM"/></para>
- </refsection>
- </refentry>
+ </refsection>
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="ST_MakePoint"/>, <xref linkend="ST_SetSRID"/>,
+ <xref linkend="ST_PointM"/>, <xref linkend="ST_PointZM"/></para>
+ </refsection>
+ </refentry>
- <refentry xml:id="ST_MakePolygon">
- <refnamediv>
- <refname>ST_MakePolygon</refname>
+ <refentry xml:id="ST_MakePolygon">
+ <refnamediv>
+ <refname>ST_MakePolygon</refname>
- <refpurpose>Creates a Polygon from a shell and optional list of holes.</refpurpose>
- </refnamediv>
+ <refpurpose>Creates a Polygon from a shell and optional list of holes.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_MakePolygon</function></funcdef>
- <paramdef><type>geometry</type> <parameter>linestring</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_MakePolygon</function></funcdef>
- <paramdef><type>geometry</type> <parameter>outerlinestring</parameter></paramdef>
- <paramdef><type>geometry[]</type> <parameter>interiorlinestrings</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_MakePolygon</function></funcdef>
+ <paramdef><type>geometry</type> <parameter>linestring</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_MakePolygon</function></funcdef>
+ <paramdef><type>geometry</type> <parameter>outerlinestring</parameter></paramdef>
+ <paramdef><type>geometry[]</type> <parameter>interiorlinestrings</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
+ <refsection>
+ <title>Description</title>
- <para>Creates a Polygon formed by the given shell and optional array of holes.
- Input geometries must be closed LineStrings (rings).</para>
+ <para>Creates a Polygon formed by the given shell and optional array of holes.
+ Input geometries must be closed LineStrings (rings).</para>
- <para><emphasis role="bold">Variant 1:</emphasis> Accepts one shell LineString.</para>
- <para><emphasis role="bold">Variant 2:</emphasis> Accepts a shell LineString and an array of
- inner (hole) LineStrings. A geometry array can be constructed using the PostgreSQL array_agg(), ARRAY[] or
- ARRAY() constructs.</para>
+ <para><emphasis role="bold">Variant 1:</emphasis> Accepts one shell LineString.</para>
+ <para><emphasis role="bold">Variant 2:</emphasis> Accepts a shell LineString and an array of
+ inner (hole) LineStrings. A geometry array can be constructed using the PostgreSQL array_agg(), ARRAY[] or
+ ARRAY() constructs.</para>
- <note><para>This function does not accept MultiLineStrings.
- Use <xref linkend="ST_LineMerge"/> to generate a LineString, or <xref linkend="ST_Dump"/> to extract LineStrings.</para>
- </note>
+ <note><para>This function does not accept MultiLineStrings.
+ Use <xref linkend="ST_LineMerge"/> to generate a LineString, or <xref linkend="ST_Dump"/> to extract LineStrings.</para>
+ </note>
- <para>&Z_support;</para>
- </refsection>
+ <para>&Z_support;</para>
+ </refsection>
- <refsection>
- <title>Examples: Single input variant</title>
- <para>Create a Polygon from a 2D LineString.</para>
- <programlisting>
+ <refsection>
+ <title>Examples: Single input variant</title>
+ <para>Create a Polygon from a 2D LineString.</para>
+ <programlisting>
SELECT ST_MakePolygon( ST_GeomFromText('LINESTRING(75 29,77 29,77 29, 75 29)'));
</programlisting>
@@ -589,18 +591,18 @@ st_asewkt
----------
POLYGONM((75.15 29.53 1,77 29 1,77.6 29.5 2,75.15 29.53 2))
</programlisting>
- </refsection>
- <refsection>
- <title>Examples: Outer shell with inner holes variant</title>
+ </refsection>
+ <refsection>
+ <title>Examples: Outer shell with inner holes variant</title>
- <para>Create a donut Polygon with an extra hole</para>
- <programlisting>
+ <para>Create a donut Polygon with an extra hole</para>
+ <programlisting>
SELECT ST_MakePolygon( ST_ExteriorRing( ST_Buffer(ring.line,10)),
- ARRAY[ ST_Translate(ring.line, 1, 1),
- ST_ExteriorRing(ST_Buffer(ST_Point(20,20),1)) ]
- )
+ ARRAY[ ST_Translate(ring.line, 1, 1),
+ ST_ExteriorRing(ST_Buffer(ST_Point(20,20),1)) ]
+ )
FROM (SELECT ST_ExteriorRing(
- ST_Buffer(ST_Point(10,10),10,10)) AS line ) AS ring;
+ ST_Buffer(ST_Point(10,10),10,10)) AS line ) AS ring;
</programlisting>
<para>Create a set of province boundaries with holes
representing lakes. The input is a table of
@@ -618,20 +620,20 @@ FROM (SELECT ST_ExteriorRing(
<note><para>The CASE construct is used because passing a null array into
ST_MakePolygon results in a NULL return value.</para></note>
- <programlisting>
+ <programlisting>
SELECT p.gid, p.province_name,
- CASE WHEN array_agg(w.geom) IS NULL
- THEN p.geom
- ELSE ST_MakePolygon( ST_LineMerge(ST_Boundary(p.geom)),
+ CASE WHEN array_agg(w.geom) IS NULL
+ THEN p.geom
+ ELSE ST_MakePolygon( ST_LineMerge(ST_Boundary(p.geom)),
array_agg(w.geom)) END
FROM
- provinces p LEFT JOIN waterlines w
- ON (ST_Within(w.geom, p.geom) AND ST_IsClosed(w.geom))
+ provinces p LEFT JOIN waterlines w
+ ON (ST_Within(w.geom, p.geom) AND ST_IsClosed(w.geom))
GROUP BY p.gid, p.province_name, p.geom;
</programlisting>
- <para>Another technique is to utilize a correlated subquery
- and the ARRAY() constructor that converts a row set to an array.</para>
+ <para>Another technique is to utilize a correlated subquery
+ and the ARRAY() constructor that converts a row set to an array.</para>
<programlisting>
SELECT p.gid, p.province_name,
CASE WHEN EXISTS( SELECT w.geom
@@ -648,31 +650,31 @@ SELECT p.gid, p.province_name,
END AS geom
FROM provinces p;
</programlisting>
- </refsection>
- <refsection>
- <title>See Also</title>
- <para>
- <xref linkend="ST_BuildArea"/>
- <xref linkend="ST_Polygon"/>
- </para>
- </refsection>
- </refentry>
+ </refsection>
+ <refsection>
+ <title>See Also</title>
+ <para>
+ <xref linkend="ST_BuildArea"/>
+ <xref linkend="ST_Polygon"/>
+ </para>
+ </refsection>
+ </refentry>
- <refentry xml:id="ST_Point">
- <refnamediv>
- <refname>ST_Point</refname>
+ <refentry xml:id="ST_Point">
+ <refnamediv>
+ <refname>ST_Point</refname>
- <refpurpose>Creates a Point with X, Y and SRID values.</refpurpose>
- </refnamediv>
+ <refpurpose>Creates a Point with X, Y and SRID values.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_Point</function></funcdef>
- <paramdef><type>float</type> <parameter>x</parameter></paramdef>
- <paramdef><type>float</type> <parameter>y</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_Point</function></funcdef>
+ <paramdef><type>float</type> <parameter>x</parameter></paramdef>
+ <paramdef><type>float</type> <parameter>y</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
<funcsynopsis>
<funcprototype>
<funcdef>geometry <function>ST_Point</function></funcdef>
@@ -681,38 +683,38 @@ FROM provinces p;
<paramdef><type>integer</type> <parameter>srid=unknown</parameter></paramdef>
</funcprototype>
</funcsynopsis>
- </refsynopsisdiv>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
+ <refsection>
+ <title>Description</title>
- <para>Returns a Point with the given X and Y coordinate values. This is the SQL-MM equivalent for <xref linkend="ST_MakePoint"/> that takes just X and Y.</para>
+ <para>Returns a Point with the given X and Y coordinate values. This is the SQL-MM equivalent for <xref linkend="ST_MakePoint"/> that takes just X and Y.</para>
- <note><para>For geodetic coordinates, <varname>X</varname> is longitude and <varname>Y</varname> is latitude</para></note>
+ <note><para>For geodetic coordinates, <varname>X</varname> is longitude and <varname>Y</varname> is latitude</para></note>
- <para role="enhanced" conformance="3.2.0">Enhanced: 3.2.0 srid as an extra optional argument was added. Older installs require combining with ST_SetSRID to mark the srid on the geometry.</para>
- <para>&sqlmm_compliant; SQL-MM 3: 6.1.2</para>
+ <para role="enhanced" conformance="3.2.0">Enhanced: 3.2.0 srid as an extra optional argument was added. Older installs require combining with ST_SetSRID to mark the srid on the geometry.</para>
+ <para>&sqlmm_compliant; SQL-MM 3: 6.1.2</para>
- </refsection>
+ </refsection>
- <refsection>
- <title>Examples: Geometry</title>
+ <refsection>
+ <title>Examples: Geometry</title>
<programlisting>SELECT ST_Point( -71.104, 42.315);</programlisting>
<para>Creating a point with SRID specified:</para>
- <programlisting>SELECT ST_Point( -71.104, 42.315, 4326);</programlisting>
+ <programlisting>SELECT ST_Point( -71.104, 42.315, 4326);</programlisting>
<para>Alternative way of specifying SRID:</para>
<programlisting>SELECT ST_SetSRID( ST_Point( -71.104, 42.315), 4326);</programlisting>
- </refsection>
+ </refsection>
- <refsection>
- <title>Examples: Geography</title>
+ <refsection>
+ <title>Examples: Geography</title>
- <para>Create <link linkend="PostGIS_Geography">geography</link> points using the <varname>::</varname> cast syntax:</para>
- <programlisting>SELECT ST_Point( -71.104, 42.315, 4326)::geography;</programlisting>
+ <para>Create <link linkend="PostGIS_Geography">geography</link> points using the <varname>::</varname> cast syntax:</para>
+ <programlisting>SELECT ST_Point( -71.104, 42.315, 4326)::geography;</programlisting>
<para>Pre-PostGIS 3.2 code, using <varname>CAST</varname>:</para>
<programlisting>SELECT CAST( ST_SetSRID(ST_Point( -71.104, 42.315), 4326) AS geography);</programlisting>
@@ -723,17 +725,17 @@ In this example a point in Pennsylvania State Plane feet (SRID 2273)
is projected to WGS84 (SRID 4326).</para>
<programlisting>
SELECT ST_Transform( ST_Point( 3637510, 3014852, 2273), 4326)::geography;</programlisting>
- </refsection>
+ </refsection>
- <!-- Optionally add a "See Also" section -->
- <refsection>
- <title>See Also</title>
+ <!-- Optionally add a "See Also" section -->
+ <refsection>
+ <title>See Also</title>
- <para><xref linkend="ST_MakePoint"/>,
- <xref linkend="ST_PointZ"/>, <xref linkend="ST_PointM"/>, <xref linkend="ST_PointZM"/>,
- <xref linkend="ST_SetSRID"/>, <xref linkend="ST_Transform"/></para>
- </refsection>
- </refentry>
+ <para><xref linkend="ST_MakePoint"/>,
+ <xref linkend="ST_PointZ"/>, <xref linkend="ST_PointM"/>, <xref linkend="ST_PointZM"/>,
+ <xref linkend="ST_SetSRID"/>, <xref linkend="ST_Transform"/></para>
+ </refsection>
+ </refentry>
<refentry xml:id="ST_PointZ">
@@ -849,49 +851,49 @@ SELECT ST_Transform( ST_Point( 3637510, 3014852, 2273), 4326)::geography;</progr
</refsection>
</refentry>
- <refentry xml:id="ST_Polygon">
- <refnamediv>
- <refname>ST_Polygon</refname>
- <refpurpose>Creates a Polygon from a LineString with a specified SRID.</refpurpose>
- </refnamediv>
+ <refentry xml:id="ST_Polygon">
+ <refnamediv>
+ <refname>ST_Polygon</refname>
+ <refpurpose>Creates a Polygon from a LineString with a specified SRID.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_Polygon</function></funcdef>
- <paramdef><type>geometry </type> <parameter>lineString</parameter></paramdef>
- <paramdef><type>integer </type> <parameter>srid</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_Polygon</function></funcdef>
+ <paramdef><type>geometry </type> <parameter>lineString</parameter></paramdef>
+ <paramdef><type>integer </type> <parameter>srid</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
+ <refsection>
+ <title>Description</title>
- <para>Returns a polygon built from the given LineString
- and sets the spatial reference system from the <varname>srid</varname>.</para>
+ <para>Returns a polygon built from the given LineString
+ and sets the spatial reference system from the <varname>srid</varname>.</para>
- <para>ST_Polygon is similar to <xref linkend="ST_MakePolygon"/> Variant 1
- with the addition of setting the SRID.</para>
- <para>To create polygons with holes
- use <xref linkend="ST_MakePolygon"/> Variant 2 and then <xref linkend="ST_SetSRID"/>.
- </para>
+ <para>ST_Polygon is similar to <xref linkend="ST_MakePolygon"/> Variant 1
+ with the addition of setting the SRID.</para>
+ <para>To create polygons with holes
+ use <xref linkend="ST_MakePolygon"/> Variant 2 and then <xref linkend="ST_SetSRID"/>.
+ </para>
- <note><para>This function does not accept MultiLineStrings.
- Use <xref linkend="ST_LineMerge"/> to generate a LineString, or <xref linkend="ST_Dump"/> to extract LineStrings.</para>
- </note>
+ <note><para>This function does not accept MultiLineStrings.
+ Use <xref linkend="ST_LineMerge"/> to generate a LineString, or <xref linkend="ST_Dump"/> to extract LineStrings.</para>
+ </note>
- <para>&sfs_compliant;</para>
- <para>&sqlmm_compliant; SQL-MM 3: 8.3.2</para>
- <para>&Z_support;</para>
+ <para>&sfs_compliant;</para>
+ <para>&sqlmm_compliant; SQL-MM 3: 8.3.2</para>
+ <para>&Z_support;</para>
- </refsection>
+ </refsection>
- <refsection>
- <title>Examples</title>
+ <refsection>
+ <title>Examples</title>
<para>Create a 2D polygon.</para>
- <programlisting>
+ <programlisting>
SELECT ST_AsText( ST_Polygon('LINESTRING(75 29, 77 29, 77 29, 75 29)'::geometry, 4326) );
-- result --
@@ -904,40 +906,40 @@ SELECT ST_AsEWKT( ST_Polygon( ST_GeomFromEWKT('LINESTRING(75 29 1, 77 29 2, 77 2
-- result --
SRID=4326;POLYGON((75 29 1, 77 29 2, 77 29 3, 75 29 1))
</programlisting>
- </refsection>
+ </refsection>
- <!-- Optionally add a "See Also" section -->
- <refsection>
- <title>See Also</title>
+ <!-- Optionally add a "See Also" section -->
+ <refsection>
+ <title>See Also</title>
- <para> <xref linkend="ST_AsEWKT"/>, <xref linkend="ST_AsText"/>, <xref linkend="ST_GeomFromEWKT"/>, <xref linkend="ST_GeomFromText"/>, <xref linkend="ST_LineMerge"/>, <xref linkend="ST_MakePolygon"/></para>
- </refsection>
- </refentry>
+ <para> <xref linkend="ST_AsEWKT"/>, <xref linkend="ST_AsText"/>, <xref linkend="ST_GeomFromEWKT"/>, <xref linkend="ST_GeomFromText"/>, <xref linkend="ST_LineMerge"/>, <xref linkend="ST_MakePolygon"/></para>
+ </refsection>
+ </refentry>
- <refentry xml:id="ST_TileEnvelope">
- <refnamediv>
- <refname>ST_TileEnvelope</refname>
- <refpurpose>Creates a rectangular Polygon in <link xlink:href="https://en.wikipedia.org/wiki/Web_Mercator_projection">Web Mercator</link> (SRID:3857) using the <link xlink:href="https://en.wikipedia.org/wiki/Tiled_web_map">XYZ tile system</link>.</refpurpose>
- </refnamediv>
+ <refentry xml:id="ST_TileEnvelope">
+ <refnamediv>
+ <refname>ST_TileEnvelope</refname>
+ <refpurpose>Creates a rectangular Polygon in <link xlink:href="https://en.wikipedia.org/wiki/Web_Mercator_projection">Web Mercator</link> (SRID:3857) using the <link xlink:href="https://en.wikipedia.org/wiki/Tiled_web_map">XYZ tile system</link>.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_TileEnvelope</function></funcdef>
- <paramdef><type>integer</type> <parameter>tileZoom</parameter></paramdef>
- <paramdef><type>integer</type> <parameter>tileX</parameter></paramdef>
- <paramdef><type>integer</type> <parameter>tileY</parameter></paramdef>
- <paramdef choice="opt"><type>geometry</type> <parameter>bounds=SRID=3857;LINESTRING(-20037508.342789 -20037508.342789,20037508.342789 20037508.342789)</parameter></paramdef>
- <paramdef choice="opt"><type>float</type> <parameter>margin=0.0</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_TileEnvelope</function></funcdef>
+ <paramdef><type>integer</type> <parameter>tileZoom</parameter></paramdef>
+ <paramdef><type>integer</type> <parameter>tileX</parameter></paramdef>
+ <paramdef><type>integer</type> <parameter>tileY</parameter></paramdef>
+ <paramdef choice="opt"><type>geometry</type> <parameter>bounds=SRID=3857;LINESTRING(-20037508.342789 -20037508.342789,20037508.342789 20037508.342789)</parameter></paramdef>
+ <paramdef choice="opt"><type>float</type> <parameter>margin=0.0</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
+ <refsection>
+ <title>Description</title>
- <para>Creates a rectangular Polygon
+ <para>Creates a rectangular Polygon
giving the extent of a tile in the <link xlink:href="https://en.wikipedia.org/wiki/Tiled_web_map">XYZ tile system</link>.
The tile is specified by the zoom level Z and the XY index of the tile in the grid at that level.
Can be used to define the tile bounds required by <xref linkend="ST_AsMVTGeom"/> to convert geometry
@@ -949,7 +951,7 @@ SRID=4326;POLYGON((75 29 1, 77 29 2, 77 29 3, 75 29 1))
The optional <varname>bounds</varname> parameter can be used to generate tiles in any coordinate system.
It is a geometry that has the SRID and extent of the "Zoom Level zero" square within which the XYZ tile system is inscribed.</para>
- <para>The optional <varname>margin</varname> parameter can be used to expand a tile by the given percentage.
+ <para>The optional <varname>margin</varname> parameter can be used to expand a tile by the given percentage.
E.g. <varname>margin=0.125</varname> expands the tile by 12.5%, which is equivalent to buffer=512 when the tile extent size is 4096, as used in <xref linkend="ST_AsMVTGeom"/>.
This is useful to create a tile buffer to include data lying outside of the tile's visible area, but whose existence affects the tile rendering.
For example, a city name (a point) could be near an edge of a tile, so its label should be rendered on two tiles, even though the point is located in the visible area of just one tile.
@@ -958,13 +960,13 @@ SRID=4326;POLYGON((75 29 1, 77 29 2, 77 29 3, 75 29 1))
Do not specify a margin when using with <varname>ST_AsMVTGeom</varname>.
See the example for <xref linkend="ST_AsMVT"/>.</para>
- <para role="enhanced" conformance="3.1.0">Enhanced: 3.1.0 Added margin parameter.</para>
- <para role="availability" conformance="3.0.0">Availability: 3.0.0</para>
- </refsection>
+ <para role="enhanced" conformance="3.1.0">Enhanced: 3.1.0 Added margin parameter.</para>
+ <para role="availability" conformance="3.0.0">Availability: 3.0.0</para>
+ </refsection>
- <refsection>
- <title>Example: Building a tile envelope</title>
- <programlisting>SELECT ST_AsText( ST_TileEnvelope(2, 1, 1) );
+ <refsection>
+ <title>Example: Building a tile envelope</title>
+ <programlisting>SELECT ST_AsText( ST_TileEnvelope(2, 1, 1) );
st_astext
------------------------------
@@ -976,64 +978,64 @@ SELECT ST_AsText( ST_TileEnvelope(3, 1, 1, ST_MakeEnvelope(-180, -90, 180, 90, 4
------------------------------------------------------
POLYGON((-135 45,-135 67.5,-90 67.5,-90 45,-135 45))
</programlisting>
- </refsection>
- <refsection>
- <title>See Also</title>
- <para><xref linkend="ST_MakeEnvelope"/></para>
- </refsection>
- </refentry>
+ </refsection>
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="ST_MakeEnvelope"/></para>
+ </refsection>
+ </refentry>
- <refentry xml:id="ST_HexagonGrid">
- <refnamediv>
- <refname>ST_HexagonGrid</refname>
- <refpurpose>Returns a set of hexagons and cell indices that completely cover the bounds of the geometry argument.</refpurpose>
- </refnamediv>
+ <refentry xml:id="ST_HexagonGrid">
+ <refnamediv>
+ <refname>ST_HexagonGrid</refname>
+ <refpurpose>Returns a set of hexagons and cell indices that completely cover the bounds of the geometry argument.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>setof record <function>ST_HexagonGrid</function></funcdef>
- <paramdef><type>float8</type> <parameter>size</parameter></paramdef>
- <paramdef><type>geometry</type> <parameter>bounds</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>setof record <function>ST_HexagonGrid</function></funcdef>
+ <paramdef><type>float8</type> <parameter>size</parameter></paramdef>
+ <paramdef><type>geometry</type> <parameter>bounds</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
+ <refsection>
+ <title>Description</title>
- <para>Starts with the concept of a hexagon tiling of the plane.
- (Not a hexagon tiling of the globe, this is not the
- <link xlink:href="https://github.com/uber/h3">H3</link> tiling scheme.)
- For a given planar SRS, and a given edge size, starting at the origin of the SRS,
- there is one unique hexagonal tiling of the plane, Tiling(SRS, Size).
- This function answers the question: what hexagons in a given Tiling(SRS, Size)
- overlap with a given bounds.</para>
+ <para>Starts with the concept of a hexagon tiling of the plane.
+ (Not a hexagon tiling of the globe, this is not the
+ <link xlink:href="https://github.com/uber/h3">H3</link> tiling scheme.)
+ For a given planar SRS, and a given edge size, starting at the origin of the SRS,
+ there is one unique hexagonal tiling of the plane, Tiling(SRS, Size).
+ This function answers the question: what hexagons in a given Tiling(SRS, Size)
+ overlap with a given bounds.</para>
- <para><inlinemediaobject><imageobject>
- <imagedata fileref="images/st_hexagongrid01.png"/>
- </imageobject></inlinemediaobject></para>
+ <para><inlinemediaobject><imageobject>
+ <imagedata fileref="images/st_hexagongrid01.png"/>
+ </imageobject></inlinemediaobject></para>
- <para>The SRS for the output hexagons is the SRS provided by the bounds geometry.</para>
- <para>Doubling or tripling the edge size of the hexagon generates a new parent tiling that
- fits with the origin tiling. Unfortunately, it is not possible to generate parent
- hexagon tilings that the child tiles perfectly fit inside.</para>
+ <para>The SRS for the output hexagons is the SRS provided by the bounds geometry.</para>
+ <para>Doubling or tripling the edge size of the hexagon generates a new parent tiling that
+ fits with the origin tiling. Unfortunately, it is not possible to generate parent
+ hexagon tilings that the child tiles perfectly fit inside.</para>
- <para><inlinemediaobject><imageobject>
- <imagedata fileref="images/st_hexagongrid02.png"/>
- </imageobject></inlinemediaobject></para>
+ <para><inlinemediaobject><imageobject>
+ <imagedata fileref="images/st_hexagongrid02.png"/>
+ </imageobject></inlinemediaobject></para>
- <para role="availability" conformance="3.1.0">Availability: 3.1.0</para>
+ <para role="availability" conformance="3.1.0">Availability: 3.1.0</para>
- </refsection>
+ </refsection>
- <refsection>
- <title>Example: Counting points in hexagons</title>
- <para>To do a point summary against a hexagonal tiling, generate a hexagon grid using the
- extent of the points as the bounds, then spatially join to that grid.</para>
- <programlisting>SELECT COUNT(*), hexes.geom
+ <refsection>
+ <title>Example: Counting points in hexagons</title>
+ <para>To do a point summary against a hexagonal tiling, generate a hexagon grid using the
+ extent of the points as the bounds, then spatially join to that grid.</para>
+ <programlisting>SELECT COUNT(*), hexes.geom
FROM
ST_HexagonGrid(
10000,
@@ -1045,16 +1047,16 @@ FROM
GROUP BY hexes.geom;</programlisting>
</refsection>
<refsection>
- <title>Example: Generating hex coverage of polygons</title>
- <para>If we generate a set of hexagons for each polygon boundary and filter
- out those that do not intersect their hexagons, we end up with a tiling for
- each polygon.</para>
- <para><inlinemediaobject><imageobject>
- <imagedata fileref="images/st_hexagongrid03.png"/>
- </imageobject></inlinemediaobject></para>
- <para>Tiling states results in a hexagon coverage of each state, and multiple
- hexagons overlapping at the borders between states.</para>
- <note><para>The LATERAL keyword is implied for set-returning functions when referring to a prior table in the FROM list. So CROSS JOIN LATERAL, CROSS JOIN, or just plain , are equivalent constructs for this example.</para></note>
+ <title>Example: Generating hex coverage of polygons</title>
+ <para>If we generate a set of hexagons for each polygon boundary and filter
+ out those that do not intersect their hexagons, we end up with a tiling for
+ each polygon.</para>
+ <para><inlinemediaobject><imageobject>
+ <imagedata fileref="images/st_hexagongrid03.png"/>
+ </imageobject></inlinemediaobject></para>
+ <para>Tiling states results in a hexagon coverage of each state, and multiple
+ hexagons overlapping at the borders between states.</para>
+ <note><para>The LATERAL keyword is implied for set-returning functions when referring to a prior table in the FROM list. So CROSS JOIN LATERAL, CROSS JOIN, or just plain , are equivalent constructs for this example.</para></note>
<programlisting>SELECT admin1.gid, hex.geom
FROM
admin1
@@ -1069,41 +1071,41 @@ WHERE
<title>See Also</title>
<para><xref linkend="ST_EstimatedExtent"/>, <xref linkend="ST_SetSRID"/>, <xref linkend="ST_SquareGrid"/>, <xref linkend="ST_TileEnvelope"/></para>
</refsection>
- </refentry>
+ </refentry>
- <refentry xml:id="ST_Hexagon">
- <refnamediv>
- <refname>ST_Hexagon</refname>
- <refpurpose>Returns a single hexagon, using the provided edge size and
- cell coordinate within the hexagon grid space.</refpurpose>
- </refnamediv>
+ <refentry xml:id="ST_Hexagon">
+ <refnamediv>
+ <refname>ST_Hexagon</refname>
+ <refpurpose>Returns a single hexagon, using the provided edge size and
+ cell coordinate within the hexagon grid space.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_Hexagon</function></funcdef>
- <paramdef><type>float8</type> <parameter>size</parameter></paramdef>
- <paramdef><type>integer</type> <parameter>cell_i</parameter></paramdef>
- <paramdef><type>integer</type> <parameter>cell_j</parameter></paramdef>
- <paramdef choice="opt"><type>geometry</type> <parameter>origin</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_Hexagon</function></funcdef>
+ <paramdef><type>float8</type> <parameter>size</parameter></paramdef>
+ <paramdef><type>integer</type> <parameter>cell_i</parameter></paramdef>
+ <paramdef><type>integer</type> <parameter>cell_j</parameter></paramdef>
+ <paramdef choice="opt"><type>geometry</type> <parameter>origin</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
+ <refsection>
+ <title>Description</title>
- <para>Uses the same hexagon tiling concept as <xref linkend="ST_HexagonGrid"/>, but generates just one hexagon at the desired cell coordinate. Optionally,
- can adjust origin coordinate of the tiling, the default origin is at 0,0.
- </para>
- <para>Hexagons are generated with no SRID set, so use <xref linkend="ST_SetSRID"/> to set the SRID to the one you expect.</para>
+ <para>Uses the same hexagon tiling concept as <xref linkend="ST_HexagonGrid"/>, but generates just one hexagon at the desired cell coordinate. Optionally,
+ can adjust origin coordinate of the tiling, the default origin is at 0,0.
+ </para>
+ <para>Hexagons are generated with no SRID set, so use <xref linkend="ST_SetSRID"/> to set the SRID to the one you expect.</para>
- <para role="availability" conformance="3.1.0">Availability: 3.1.0</para>
- </refsection>
+ <para role="availability" conformance="3.1.0">Availability: 3.1.0</para>
+ </refsection>
- <refsection>
- <title>Example: Creating a hexagon at the origin</title>
- <programlisting>SELECT ST_AsText(ST_SetSRID(ST_Hexagon(1.0, 0, 0), 3857));
+ <refsection>
+ <title>Example: Creating a hexagon at the origin</title>
+ <programlisting>SELECT ST_AsText(ST_SetSRID(ST_Hexagon(1.0, 0, 0), 3857));
POLYGON((-1 0,-0.5
-0.866025403784439,0.5
@@ -1111,12 +1113,12 @@ POLYGON((-1 0,-0.5
0,0.5
0.866025403784439,-0.5
0.866025403784439,-1 0)) </programlisting>
- </refsection>
- <refsection>
- <title>See Also</title>
- <para><xref linkend="ST_TileEnvelope"/>, <xref linkend="ST_HexagonGrid"/>, <xref linkend="ST_Square"/></para>
- </refsection>
- </refentry>
+ </refsection>
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="ST_TileEnvelope"/>, <xref linkend="ST_HexagonGrid"/>, <xref linkend="ST_Square"/></para>
+ </refsection>
+ </refentry>
<refentry xml:id="ST_SquareGrid">
<refnamediv>
@@ -1203,51 +1205,51 @@ FROM admin0 WHERE name = 'Canada'
</refsection>
</refentry>
- <refentry xml:id="ST_Square">
- <refnamediv>
- <refname>ST_Square</refname>
- <refpurpose>Returns a single square, using the provided edge size and
- cell coordinate within the square grid space.</refpurpose>
- </refnamediv>
+ <refentry xml:id="ST_Square">
+ <refnamediv>
+ <refname>ST_Square</refname>
+ <refpurpose>Returns a single square, using the provided edge size and
+ cell coordinate within the square grid space.</refpurpose>
+ </refnamediv>
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry <function>ST_Square</function></funcdef>
- <paramdef><type>float8</type> <parameter>size</parameter></paramdef>
- <paramdef><type>integer</type> <parameter>cell_i</parameter></paramdef>
- <paramdef><type>integer</type> <parameter>cell_j</parameter></paramdef>
- <paramdef choice="opt"><type>geometry</type> <parameter>origin='POINT(0 0)'</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>geometry <function>ST_Square</function></funcdef>
+ <paramdef><type>float8</type> <parameter>size</parameter></paramdef>
+ <paramdef><type>integer</type> <parameter>cell_i</parameter></paramdef>
+ <paramdef><type>integer</type> <parameter>cell_j</parameter></paramdef>
+ <paramdef choice="opt"><type>geometry</type> <parameter>origin='POINT(0 0)'</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
- <refsection>
- <title>Description</title>
+ <refsection>
+ <title>Description</title>
- <para>Uses the same square tiling concept as <xref linkend="ST_SquareGrid"/>, but generates just one square at the desired cell coordinate. Optionally,
- can adjust origin coordinate of the tiling, the default origin is at 0,0.
- </para>
+ <para>Uses the same square tiling concept as <xref linkend="ST_SquareGrid"/>, but generates just one square at the desired cell coordinate. Optionally,
+ can adjust origin coordinate of the tiling, the default origin is at 0,0.
+ </para>
- <para>
+ <para>
Squares are generated with the SRID of the given origin.
Use <xref linkend="ST_SetSRID"/> to set the SRID if the given origin
has an unknown SRID (as is the case by default).</para>
- <para role="availability" conformance="3.1.0">Availability: 3.1.0</para>
- </refsection>
+ <para role="availability" conformance="3.1.0">Availability: 3.1.0</para>
+ </refsection>
- <refsection>
- <title>Example: Creating a square at the origin</title>
- <programlisting>SELECT ST_AsText(ST_SetSRID(ST_Square(1.0, 0, 0), 3857));
+ <refsection>
+ <title>Example: Creating a square at the origin</title>
+ <programlisting>SELECT ST_AsText(ST_SetSRID(ST_Square(1.0, 0, 0), 3857));
POLYGON((0 0,0 1,1 1,1 0,0 0))</programlisting>
- </refsection>
- <refsection>
- <title>See Also</title>
- <para><xref linkend="ST_TileEnvelope"/>, <xref linkend="ST_SquareGrid"/>, <xref linkend="ST_Hexagon"/></para>
- </refsection>
- </refentry>
+ </refsection>
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="ST_TileEnvelope"/>, <xref linkend="ST_SquareGrid"/>, <xref linkend="ST_Hexagon"/></para>
+ </refsection>
+ </refentry>
diff --git a/liblwgeom/lwline.c b/liblwgeom/lwline.c
index 999927fea..50185f510 100644
--- a/liblwgeom/lwline.c
+++ b/liblwgeom/lwline.c
@@ -192,6 +192,16 @@ lwline_from_lwgeom_array(int32_t srid, uint32_t ngeoms, LWGEOM **geoms)
*/
ptarray_append_ptarray(pa, ((LWLINE*)g)->points, -1);
}
+ else if ( g->type == MULTILINETYPE )
+ {
+ LWMLINE *mline = lwgeom_as_lwmline(g);
+ for ( uint32_t j = 0; j < mline->ngeoms; j++ )
+ {
+ LWLINE *line = mline->geoms[j];
+ if (lwline_is_empty(line)) continue;
+ ptarray_append_ptarray(pa, line->points, -1);
+ }
+ }
else if ( g->type == MULTIPOINTTYPE )
{
it = lwpointiterator_create(g);
diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c
index 507e2283d..4bf5816e9 100644
--- a/liblwgeom/ptarray.c
+++ b/liblwgeom/ptarray.c
@@ -184,7 +184,7 @@ ptarray_append_ptarray(POINTARRAY *pa1, POINTARRAY *pa2, double gap_tolerance)
/* Check for pathology */
if( ! pa1 || ! pa2 )
{
- lwerror("ptarray_append_ptarray: null input");
+ lwerror("%s: null input", __func__);
return LW_FAILURE;
}
@@ -194,13 +194,13 @@ ptarray_append_ptarray(POINTARRAY *pa1, POINTARRAY *pa2, double gap_tolerance)
if( FLAGS_GET_READONLY(pa1->flags) )
{
- lwerror("ptarray_append_ptarray: target pointarray is read-only");
+ lwerror("%s: target pointarray is read-only", __func__);
return LW_FAILURE;
}
if( FLAGS_GET_ZM(pa1->flags) != FLAGS_GET_ZM(pa2->flags) )
{
- lwerror("ptarray_append_ptarray: appending mixed dimensionality is not allowed");
+ lwerror("%s: appending mixed dimensionality is not allowed", __func__);
return LW_FAILURE;
}
@@ -209,17 +209,17 @@ ptarray_append_ptarray(POINTARRAY *pa1, POINTARRAY *pa2, double gap_tolerance)
/* Check for duplicate end point */
if ( pa1->npoints )
{
- POINT2D tmp1, tmp2;
- getPoint2d_p(pa1, pa1->npoints-1, &tmp1);
- getPoint2d_p(pa2, 0, &tmp2);
+ const POINT2D *tmp1, *tmp2;
+ tmp1 = getPoint2d_cp(pa1, pa1->npoints-1);
+ tmp2 = getPoint2d_cp(pa2, 0);
/* If the end point and start point are the same, then don't copy start point */
- if (p2d_same(&tmp1, &tmp2)) {
+ if (p2d_same(tmp1, tmp2)) {
poff = 1;
--npoints;
}
- else if ( gap_tolerance == 0 || ( gap_tolerance > 0 &&
- distance2d_pt_pt(&tmp1, &tmp2) > gap_tolerance ) )
+ else if ((gap_tolerance == 0) ||
+ (gap_tolerance > 0 && distance2d_pt_pt(tmp1, tmp2) > gap_tolerance) )
{
lwerror("Second line start point too far from first line end point");
return LW_FAILURE;
diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c
index 1e126ce82..06ea00934 100644
--- a/postgis/lwgeom_functions_basic.c
+++ b/postgis/lwgeom_functions_basic.c
@@ -1467,8 +1467,10 @@ Datum LWGEOM_makeline_garray(PG_FUNCTION_ARGS)
geom = (GSERIALIZED *)DatumGetPointer(value);
- if (gserialized_get_type(geom) != POINTTYPE && gserialized_get_type(geom) != LINETYPE &&
- gserialized_get_type(geom) != MULTIPOINTTYPE)
+ if (gserialized_get_type(geom) != POINTTYPE &&
+ gserialized_get_type(geom) != MULTIPOINTTYPE &&
+ gserialized_get_type(geom) != LINETYPE &&
+ gserialized_get_type(geom) != MULTILINETYPE)
{
continue;
}
diff --git a/regress/core/ctors.sql b/regress/core/ctors.sql
index 2af13ae92..d4038d44e 100644
--- a/regress/core/ctors.sql
+++ b/regress/core/ctors.sql
@@ -36,3 +36,11 @@ select ST_makebox2d('POINT(0 0)', 'SRID=3;POINT(1 1)');
select ST_3DMakeBox('SRID=3;POINT(0 0)', 'SRID=3;POINT(1 1)');
select ST_3DMakeBox('POINT(0 0)', 'SRID=3;POINT(1 1)');
+
+SELECT 'ST_MakeLine2', ST_AsText(ST_MakeLine(geom))
+FROM (
+ VALUES
+ ('LINESTRING(0 0, 1 1)'),
+ ('MULTILINESTRING((1 1, 2 2), (2 2, 3 3))'),
+ ('MULTILINESTRING(EMPTY, (4 4, 5 5))')
+ ) AS geoms(geom);
diff --git a/regress/core/ctors_expected b/regress/core/ctors_expected
index a459f433a..d18c7100c 100644
--- a/regress/core/ctors_expected
+++ b/regress/core/ctors_expected
@@ -9,3 +9,4 @@ BOX(0 0,1 1)
ERROR: BOX2D_construct: Operation on mixed SRID geometries (Point, 0) != (Point, 3)
BOX3D(0 0 0,1 1 0)
ERROR: BOX3D_construct: Operation on mixed SRID geometries (Point, 0) != (Point, 3)
+ST_MakeLine2|LINESTRING(0 0,1 1,2 2,3 3,4 4,5 5)
-----------------------------------------------------------------------
Summary of changes:
NEWS | 2 +-
doc/reference_constructor.xml | 1408 +++++++++++++++++++-------------------
liblwgeom/lwline.c | 10 +
liblwgeom/ptarray.c | 18 +-
postgis/lwgeom_functions_basic.c | 6 +-
regress/core/ctors.sql | 8 +
regress/core/ctors_expected | 1 +
7 files changed, 738 insertions(+), 715 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list