- #4268, Bump minimum SFCGAL version to 1.3.1 (Darafei Praliaskouski)
- #4331, ST_3DMakeBox now returns error instead of a miniscule box (Regina Obe)
- #4342, Removed "versioned" variants of ST_AsGeoJSON and ST_AsKML (Paul Ramsey)
+ - #4356, ST_Accum removed. Use array_agg instead. (Darafei Praliaskouski)
* New Features *
- #2902, postgis_geos_noop (Sandro Santilli)
--First 3 Rejects from a successful quintuplet experiment
SELECT gid, ST_IsValidReason(the_geom) as validity_info
FROM
-(SELECT ST_MakePolygon(ST_ExteriorRing(e.buff), ST_Accum(f.line)) As the_geom, gid
+(SELECT ST_MakePolygon(ST_ExteriorRing(e.buff), array_agg(f.line)) As the_geom, gid
FROM (SELECT ST_Buffer(ST_MakePoint(x1*10,y1), z1) As buff, x1*10 + y1*100 + z1*1000 As gid
FROM generate_series(-4,6) x1
CROSS JOIN generate_series(2,5) y1
--First 3 Rejects from a successful quintuplet experiment
SELECT gid, reason(ST_IsValidDetail(the_geom)), ST_AsText(location(ST_IsValidDetail(the_geom))) as location
FROM
-(SELECT ST_MakePolygon(ST_ExteriorRing(e.buff), ST_Accum(f.line)) As the_geom, gid
+(SELECT ST_MakePolygon(ST_ExteriorRing(e.buff), array_agg(f.line)) As the_geom, gid
FROM (SELECT ST_Buffer(ST_MakePoint(x1*10,y1), z1) As buff, x1*10 + y1*100 + z1*1000 As gid
FROM generate_series(-4,6) x1
CROSS JOIN generate_series(2,5) y1
geometries must be closed LINESTRINGS. Comes in 2 variants.</para>
<para>Variant 1: Takes one closed linestring.</para>
<para>Variant 2: Creates a Polygon formed by the given shell and array of
- holes. You can construct a geometry array using ST_Accum or the PostgreSQL ARRAY[] and
+ holes. You can construct a geometry array using the PostgreSQL array_agg, ARRAY[] and
ARRAY() constructs. Input geometries must be closed LINESTRINGS.</para>
<note>
<para>This function will not accept a MULTILINESTRING. Use <xref linkend="ST_LineMerge" /> or <xref linkend="ST_Dump" /> to generate line strings.</para>
<para>Build province boundaries with holes
representing lakes in the province from a set of
province polygons/multipolygons and water linestrings.
- This is an example of using PostGIS ST_Accum.
<note><para>The CASE construct is used because feeding a null array into
ST_MakePolygon results in NULL.</para></note>
<note><para>A left join is used to guarantee we get all provinces back even if they have no lakes.</para></note></para>
<programlisting>
SELECT p.gid, p.province_name,
CASE WHEN
- ST_Accum(w.the_geom) IS NULL THEN p.the_geom
- ELSE ST_MakePolygon(ST_LineMerge(ST_Boundary(p.the_geom)), ST_Accum(w.the_geom)) END
+ array_agg(w.the_geom) IS NULL THEN p.the_geom
+ ELSE ST_MakePolygon(ST_LineMerge(ST_Boundary(p.the_geom)), array_agg(w.the_geom)) END
FROM
provinces p LEFT JOIN waterlines w
ON (ST_Within(w.the_geom, p.the_geom) AND ST_IsClosed(w.the_geom))
<title>See Also</title>
<para>
<xref linkend="ST_Boundary" />,
- <xref linkend="ST_Accum" />,
<xref linkend="ST_AddPoint" />,
<xref linkend="ST_GeometryType" />,
<xref linkend="ST_IsClosed" />,
<?xml version="1.0" encoding="UTF-8"?>
<sect1 id="Geometry_Processing">
<title>Geometry Processing</title>
-
- <refentry id="ST_Accum">
- <refnamediv>
- <refname>ST_Accum</refname>
-
- <refpurpose>An aggregate function to construct an array of geometries.</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>geometry[] <function>ST_Accum</function></funcdef>
- <paramdef><type>geometry set</type> <parameter>geomfield</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
-
- <refsection>
- <title>Description</title>
-
- <para>An aggregate function to construct an array of geometries.</para>
- <para>Enhanced: 2.0.0 support for Polyhedral surfaces, Triangles and TIN was introduced.</para>
- <para>&Z_support;</para>
- <para>&curve_support;</para>
- <para>&P_support;</para>
- <para>&T_support;</para>
- </refsection>
-
-
- <refsection>
- <title>Examples</title>
-
- <programlisting>SELECT (ST_Accum(the_geom)) As all_em, ST_AsText((ST_Accum(the_geom))[1]) As grabone,
-(ST_Accum(the_geom))[2:4] as grab_rest
- FROM (SELECT ST_MakePoint(a*CAST(random()*10 As integer), a*CAST(random()*10 As integer), a*CAST(random()*10 As integer)) As the_geom
- FROM generate_series(1,4) a) As foo;
-
-all_em|grabone | grab_rest
-
--------------------------------------------------------------------------------+
-
- {0101000080000000000000144000000000000024400000000000001040:
- 0101000080000000000
-00018400000000000002C400000000000003040:
-0101000080000000000000354000000000000038400000000000001840:
-010100008000000000000040400000000000003C400000000000003040} |
- POINT(5 10) | {010100008000000000000018400000000000002C400000000000003040:
- 0101000080000000000000354000000000000038400000000000001840:
- 010100008000000000000040400000000000003C400000000000003040}
-(1 row)
- </programlisting>
- </refsection>
-
- <!-- Optionally add a "See Also" section -->
- <refsection>
- <title>See Also</title>
-
- <para><xref linkend="ST_Collect" /></para>
- </refsection>
- </refentry>
-
<refentry id="ST_Buffer">
<refnamediv>
<refname>ST_Buffer</refname>
-- end Old underscored_names replaced by CamelCase names
-
---- Start Aggregates and supporting functions --
--- Deprecation in: 1.2.3
--- Changed: 2.5.0 use 'internal' stype
-CREATE AGGREGATE accum (
- sfunc = pgis_geometry_accum_transfn,
- basetype = geometry,
- stype = internal,
- finalfunc = pgis_geometry_accum_finalfn
- );
-- Deprecation in 1.2.3
CREATE OR REPLACE FUNCTION collect(geometry, geometry)
RETURNS geometry
Datum PGISDirectFunctionCall1(PGFunction func, Datum arg1);
Datum PGISDirectFunctionCall2(PGFunction func, Datum arg1, Datum arg2);
Datum pgis_geometry_accum_transfn(PG_FUNCTION_ARGS);
-Datum pgis_geometry_accum_finalfn(PG_FUNCTION_ARGS);
Datum pgis_geometry_union_finalfn(PG_FUNCTION_ARGS);
Datum pgis_geometry_collect_finalfn(PG_FUNCTION_ARGS);
Datum pgis_geometry_polygonize_finalfn(PG_FUNCTION_ARGS);
return result;
}
-/**
-** The "accum" final function just returns the geometry[]
-*/
-PG_FUNCTION_INFO_V1(pgis_geometry_accum_finalfn);
-Datum
-pgis_geometry_accum_finalfn(PG_FUNCTION_ARGS)
-{
- pgis_abs *p;
- Datum result = 0;
-
- if (PG_ARGISNULL(0))
- PG_RETURN_NULL(); /* returns null iff no input values */
-
- p = (pgis_abs*) PG_GETARG_POINTER(0);
-
- result = pgis_accum_finalfn(p, CurrentMemoryContext, fcinfo);
-
- PG_RETURN_DATUM(result);
-
-}
-
/**
* The "union" final function passes the geometry[] to a union
* conversion before returning the result.
AS 'MODULE_PATHNAME'
LANGUAGE 'c' _PARALLEL;
--- Availability: 1.4.0
--- Changed: 2.5.0 use 'internal' transfer type
-CREATE OR REPLACE FUNCTION pgis_geometry_accum_finalfn(internal)
- RETURNS geometry[]
- AS 'MODULE_PATHNAME'
- LANGUAGE 'c' _PARALLEL;
-
-- Availability: 1.4.0
-- Changed: 2.5.0 use 'internal' transfer type
CREATE OR REPLACE FUNCTION pgis_geometry_union_finalfn(internal)
AS 'MODULE_PATHNAME'
LANGUAGE 'c' _PARALLEL;
--- Availability: 1.2.2
--- Changed: 2.4.0 marked parallel safe
--- Changed: 2.5.0 use 'internal' stype
-CREATE AGGREGATE ST_Accum (geometry) (
- sfunc = pgis_geometry_accum_transfn,
- stype = internal,
-#if POSTGIS_PGSQL_VERSION >= 96
- parallel = safe,
-#endif
- finalfunc = pgis_geometry_accum_finalfn
- );
-
-- Availability: 1.4.0
CREATE OR REPLACE FUNCTION ST_Union (geometry[])
RETURNS geometry
DROP AGGREGATE IF EXISTS st_geomunion(geometry);
DROP AGGREGATE IF EXISTS accum_old(geometry);
DROP AGGREGATE IF EXISTS st_accum_old(geometry);
+DROP AGGREGATE IF EXISTS st_accum(geometry); -- Dropped in 3.0.0
+DROP FUNCTION IF EXISTS pgis_geometry_accum_finalfn(internal);
DROP AGGREGATE IF EXISTS st_astwkb_agg(geometry, integer); -- temporarely introduced before 2.2.0 final
DROP AGGREGATE IF EXISTS st_astwkb_agg(geometry, integer, bigint); -- temporarely introduced before 2.2.0 final
POSTGIS_DEPRECATE("3.0.0", sfcgal_distance3d);
POSTGIS_DEPRECATE("3.0.0", LWGEOM_mindistance3d);
POSTGIS_DEPRECATE("3.0.0", intersects);
+POSTGIS_DEPRECATE("3.0.0", pgis_geometry_accum_finalfn);
(7, 'POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0))');
SELECT 't1', ST_AsText(unnest(ST_ClusterIntersecting(geom ORDER BY id))) FROM cluster_inputs;
-SELECT 't2', ST_AsText(unnest(ST_ClusterIntersecting(ST_Accum(geom ORDER BY id)))) FROM cluster_inputs;
+SELECT 't2', ST_AsText(unnest(ST_ClusterIntersecting(array_agg(geom ORDER BY id)))) FROM cluster_inputs;
SELECT 't3', ST_AsText(unnest(ST_ClusterWithin(geom, 1.4 ORDER BY id))) FROM cluster_inputs;
-SELECT 't4', ST_AsText(unnest(ST_ClusterWithin(ST_Accum(geom ORDER BY id), 1.5))) FROM cluster_inputs;
+SELECT 't4', ST_AsText(unnest(ST_ClusterWithin(array_agg(geom ORDER BY id), 1.5))) FROM cluster_inputs;
-- tests for ST_DBSCAN