From 31f5aaa48be2d6f34066ff0dc8185dc579cbad6c Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Fri, 4 Aug 2017 15:46:26 +0000 Subject: [PATCH] =?utf8?q?ST=5FCentroid=20for=20geography=20(Danny=20G?= =?utf8?q?=C3=B6tte)=20References=20#2951?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.osgeo.org/postgis/trunk@15518 b70326c6-7e19-0410-871a-916f4a2858ee --- NEWS | 1 + doc/reference_measure.xml | 21 ++++++++++++++++----- postgis/Makefile.in | 1 + postgis/geography.sql.in | 17 ++++++++++++++--- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 43c81e644..df2d65145 100644 --- 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) diff --git a/doc/reference_measure.xml b/doc/reference_measure.xml index f86f210e1..c06c45c2a 100644 --- a/doc/reference_measure.xml +++ b/doc/reference_measure.xml @@ -830,12 +830,21 @@ SELECT degrees(ST_Azimuth(ST_Point(25, 45), ST_Point(75, 100))) AS degA_B, - - geometry ST_Centroid + + geometry ST_Centroid + + geometry + g1 + + + geography ST_Centroid + + geography + g1 + boolean + use_spheroid=true + - geometry - g1 - @@ -859,6 +868,8 @@ SELECT degrees(ST_Azimuth(ST_Point(25, 45), ST_Point(75, 100))) AS degA_B, New in 2.3.0 : support CIRCULARSTRING and COMPOUNDCURVE (using CurveToLine) + Availability: 2.4.0 support for geography was introduced. + 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). diff --git a/postgis/Makefile.in b/postgis/Makefile.in index b731b88f4..48da991ba 100644 --- a/postgis/Makefile.in +++ b/postgis/Makefile.in @@ -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 \ diff --git a/postgis/geography.sql.in b/postgis/geography.sql.in index 5d27cc30d..8166c5661 100644 --- a/postgis/geography.sql.in +++ b/postgis/geography.sql.in @@ -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; + +----------------------------------------------------------------------------- -- 2.50.1