[postgis-tickets] r15518 - ST_Centroid for geography (Danny G?\195?\182tte)

Regina Obe lr at pcorp.us
Fri Aug 4 08:46:26 PDT 2017


Author: robe
Date: 2017-08-04 08:46:26 -0700 (Fri, 04 Aug 2017)
New Revision: 15518

Modified:
   trunk/NEWS
   trunk/doc/reference_measure.xml
   trunk/postgis/Makefile.in
   trunk/postgis/geography.sql.in
Log:
ST_Centroid for geography (Danny G?\195?\182tte)
References #2951

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2017-08-03 05:11:20 UTC (rev 15517)
+++ trunk/NEWS	2017-08-04 15:46:26 UTC (rev 15518)
@@ -3,6 +3,7 @@
 
  * New Features *
 
+  - #2951, ST_Centroid for geography (Danny Götte)
   - #3788, Allow postgis_restore.pl to work on directory-style (-Fd) dumps
            (Roger Crew)
   - #3772, Direction agnostic ST_CurveToLine output (Sandro Santilli / KKGeo)

Modified: trunk/doc/reference_measure.xml
===================================================================
--- trunk/doc/reference_measure.xml	2017-08-03 05:11:20 UTC (rev 15517)
+++ trunk/doc/reference_measure.xml	2017-08-04 15:46:26 UTC (rev 15518)
@@ -830,12 +830,21 @@
 
 	<refsynopsisdiv>
 	  <funcsynopsis>
-		<funcprototype>
-		  <funcdef>geometry <function>ST_Centroid</function></funcdef>
+          <funcprototype>
+  		  <funcdef>geometry <function>ST_Centroid</function></funcdef>
 
-		  <paramdef><type>geometry </type>
-		  <parameter>g1</parameter></paramdef>
-		</funcprototype>
+  		  <paramdef><type>geometry </type>
+  		  <parameter>g1</parameter></paramdef>
+  		</funcprototype>
+            <funcprototype>
+                <funcdef>geography <function>ST_Centroid</function></funcdef>
+
+                <paramdef><type>geography </type>
+                <parameter>g1</parameter></paramdef>
+                <paramdef choice="opt"><type>boolean </type>
+                <parameter>use_spheroid=true</parameter></paramdef>
+	</funcprototype>
+
 	  </funcsynopsis>
 	</refsynopsisdiv>
 
@@ -859,6 +868,8 @@
 	  </para>
 	  <para>New in 2.3.0 : support <varname>CIRCULARSTRING</varname> and <varname>COMPOUNDCURVE</varname> (using CurveToLine)</para>
 
+      <para>Availability: 2.4.0 support for geography was introduced.</para>
+
 	  <para>The centroid is equal to the centroid of the set of component
 	  Geometries of highest dimension (since the lower-dimension geometries
 	  contribute zero "weight" to the centroid).</para>

Modified: trunk/postgis/Makefile.in
===================================================================
--- trunk/postgis/Makefile.in	2017-08-03 05:11:20 UTC (rev 15517)
+++ trunk/postgis/Makefile.in	2017-08-04 15:46:26 UTC (rev 15518)
@@ -97,6 +97,7 @@
 	gserialized_estimate.o \
 	geography_inout.o \
 	geography_btree.o \
+	geography_centroid.o \
 	geography_measurement.o \
 	geography_measurement_trees.o \
 	geometry_inout.o \

Modified: trunk/postgis/geography.sql.in
===================================================================
--- trunk/postgis/geography.sql.in	2017-08-03 05:11:20 UTC (rev 15517)
+++ trunk/postgis/geography.sql.in	2017-08-04 15:46:26 UTC (rev 15518)
@@ -835,13 +835,24 @@
 	RETURNS int4
 	AS 'MODULE_PATHNAME', 'LWGEOM_get_srid'
 	LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-	
+
 -- Availability: 2.2.0
 CREATE OR REPLACE FUNCTION ST_SetSRID(geog geography, srid int4)
 	RETURNS geography
 	AS 'MODULE_PATHNAME', 'LWGEOM_set_srid'
 	LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-  
------------------------------------------------------------------------------
 
+-- Availability: 2.4.0
+CREATE OR REPLACE FUNCTION ST_Centroid(geography, use_spheroid boolean DEFAULT true)
+	RETURNS geography
+	AS 'MODULE_PATHNAME','geography_centroid'
+	LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
 
+
+-- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography
+CREATE OR REPLACE FUNCTION ST_Centroid(text)
+	RETURNS geometry AS
+	$$ SELECT ST_Centroid($1::@extschema at .geometry);  $$
+	LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
+
+-----------------------------------------------------------------------------



More information about the postgis-tickets mailing list