]> granicus.if.org Git - postgis/commitdiff
ST_Centroid for geography (Danny Götte)
authorRegina Obe <lr@pcorp.us>
Fri, 4 Aug 2017 15:46:26 +0000 (15:46 +0000)
committerRegina Obe <lr@pcorp.us>
Fri, 4 Aug 2017 15:46:26 +0000 (15:46 +0000)
References #2951

git-svn-id: http://svn.osgeo.org/postgis/trunk@15518 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
doc/reference_measure.xml
postgis/Makefile.in
postgis/geography.sql.in

diff --git a/NEWS b/NEWS
index 43c81e644d50d10e005acdd858ccdca4668c560e..df2d651458e1ec5dc58eb662d8d520ff6f059c75 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PostGIS 2.4.0
 
  * 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)
index f86f210e1515be3d994a45f0c9f38e0df94225ff..c06c45c2a99e84f3b9c37d2fa89b9eb6e43c5a1b 100644 (file)
@@ -830,12 +830,21 @@ SELECT degrees(ST_Azimuth(ST_Point(25, 45), ST_Point(75, 100))) AS degA_B,
 
        <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>
+            <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>
 
-                 <paramdef><type>geometry </type>
-                 <parameter>g1</parameter></paramdef>
-               </funcprototype>
          </funcsynopsis>
        </refsynopsisdiv>
 
@@ -859,6 +868,8 @@ SELECT degrees(ST_Azimuth(ST_Point(25, 45), ST_Point(75, 100))) AS degA_B,
          </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>
index b731b88f4ff51ee992bce4c8e36c80022f3e7ced..48da991baf6ed5775db640f2b793e8b56d916bbd 100644 (file)
@@ -97,6 +97,7 @@ PG_OBJS= \
        gserialized_estimate.o \
        geography_inout.o \
        geography_btree.o \
+       geography_centroid.o \
        geography_measurement.o \
        geography_measurement_trees.o \
        geometry_inout.o \
index 5d27cc30dd7d49fff749e89efe4299db0463e349..8166c5661923572b4c6e21a801adb481042380fe 100644 (file)
@@ -835,13 +835,24 @@ CREATE OR REPLACE FUNCTION ST_SRID(geog geography)
        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@.geometry);  $$
+       LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL;
+
+-----------------------------------------------------------------------------