From be2604afdb75eae09cddc09160891678a71bcfe0 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Sun, 4 Jan 2015 16:43:37 +0000 Subject: [PATCH] CamelCase-ize ST_ShiftLongitude, ST_CombineBbox, ST_FindExtent (#2748) git-svn-id: http://svn.osgeo.org/postgis/trunk@13172 b70326c6-7e19-0410-871a-916f4a2858ee --- NEWS | 3 ++ doc/reference_processing.xml | 11 ++--- postgis/postgis.sql.in | 79 ++++++++++++++++++++++++++++-------- regress/tickets.sql | 2 +- 4 files changed, 71 insertions(+), 24 deletions(-) diff --git a/NEWS b/NEWS index 162da5d6d..c1e499792 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,9 @@ PostGIS 2.2.0 * Deprecated signatures * + - #2748, ST_Shift_Longitude renamed to ST_ShiftLongitude, + ST_Find_Extent renamed to ST_FindExtent, + ST_Combine_BBox renamed to ST_CombineBbox - #2769, ST_Mem_Size renamed to ST_MemSize - #2565, ST_SummaryStats(tablename, rastercolumn, ...) - #2567, ST_Count(tablename, rastercolumn, ...) diff --git a/doc/reference_processing.xml b/doc/reference_processing.xml index ca15d6e52..164892928 100644 --- a/doc/reference_processing.xml +++ b/doc/reference_processing.xml @@ -2499,7 +2499,7 @@ MULTILINESTRING((76 175,90 161),(90 161,101 150),(126 125,126 156.25))) - ST_Shift_Longitude + ST_ShiftLongitude Reads every point/vertex in every component of every feature in a geometry, and if the longitude coordinate is <0, adds 360 @@ -2510,7 +2510,7 @@ MULTILINESTRING((76 175,90 161),(90 161,101 150),(126 125,126 156.25))) - geometry ST_Shift_Longitude + geometry ST_ShiftLongitude geometry geomA @@ -2531,6 +2531,7 @@ MULTILINESTRING((76 175,90 161),(90 161,101 150),(126 125,126 156.25))) &Z_support; Enhanced: 2.0.0 support for Polyhedral surfaces and TIN was introduced. + NOTE: this function was renamed from "ST_Shift_Longitude" in 2.2.0 &P_support; &T_support; @@ -2540,14 +2541,14 @@ MULTILINESTRING((76 175,90 161),(90 161,101 150),(126 125,126 156.25))) Examples --3d points -SELECT ST_AsEWKT(ST_Shift_Longitude(ST_GeomFromEWKT('SRID=4326;POINT(-118.58 38.38 10)'))) As geomA, - ST_AsEWKT(ST_Shift_Longitude(ST_GeomFromEWKT('SRID=4326;POINT(241.42 38.38 10)'))) As geomb +SELECT ST_AsEWKT(ST_ShiftLongitude(ST_GeomFromEWKT('SRID=4326;POINT(-118.58 38.38 10)'))) As geomA, + ST_AsEWKT(ST_ShiftLongitude(ST_GeomFromEWKT('SRID=4326;POINT(241.42 38.38 10)'))) As geomb geomA geomB ---------- ----------- SRID=4326;POINT(241.42 38.38 10) SRID=4326;POINT(-118.58 38.38 10) --regular line string -SELECT ST_AsText(ST_Shift_Longitude(ST_GeomFromText('LINESTRING(-118.58 38.38, -118.20 38.45)'))) +SELECT ST_AsText(ST_ShiftLongitude(ST_GeomFromText('LINESTRING(-118.58 38.38, -118.20 38.45)'))) st_astext ---------- diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in index 5ce971221..23c6f2061 100644 --- a/postgis/postgis.sql.in +++ b/postgis/postgis.sql.in @@ -886,12 +886,21 @@ CREATE OR REPLACE FUNCTION ST_Transscale(geometry,float8,float8,float8,float8) 0, 0, 1, $2 * $4, $3 * $5, 0)' LANGUAGE 'sql' IMMUTABLE STRICT; --- Availability: 1.2.2 -CREATE OR REPLACE FUNCTION ST_Shift_Longitude(geometry) +-- Availability: 2.2.0 +CREATE OR REPLACE FUNCTION ST_ShiftLongitude(geometry) RETURNS geometry AS 'MODULE_PATHNAME', 'LWGEOM_longitude_shift' LANGUAGE 'c' IMMUTABLE STRICT; +-- Availability: 1.2.2 +-- Deprecation in 2.2.0 +CREATE OR REPLACE FUNCTION ST_Shift_Longitude(geometry) + RETURNS geometry AS + $$ SELECT _postgis_deprecate('ST_Shift_Longitude', 'ST_ShiftLongitude', '2.2.0'); + SELECT ST_ShiftLongitude($1); + $$ + LANGUAGE 'sql' IMMUTABLE STRICT; + ----------------------------------------------------------------------------- -- BOX3D FUNCTIONS ----------------------------------------------------------------------------- @@ -954,13 +963,6 @@ CREATE OR REPLACE FUNCTION ST_MakeBox2d(geom1 geometry, geom2 geometry) AS 'MODULE_PATHNAME', 'BOX2D_construct' LANGUAGE 'c' IMMUTABLE STRICT; - --- Availability: 1.2.2 -CREATE OR REPLACE FUNCTION ST_Combine_BBox(box2d,geometry) - RETURNS box2d - AS 'MODULE_PATHNAME', 'BOX2D_combine' - LANGUAGE 'c' IMMUTABLE; - ----------------------------------------------------------------------- -- ST_ESTIMATED_EXTENT( , , ) ----------------------------------------------------------------------- @@ -1003,15 +1005,15 @@ CREATE OR REPLACE FUNCTION ST_estimated_extent(text,text) RETURNS box2d AS ----------------------------------------------------------------------- -- FIND_EXTENT( ,
, ) ----------------------------------------------------------------------- --- Availability: 1.2.2 -CREATE OR REPLACE FUNCTION ST_find_extent(text,text,text) RETURNS box2d AS + +-- Availability: 2.2.0 +CREATE OR REPLACE FUNCTION ST_FindExtent(text,text,text) RETURNS box2d AS $$ DECLARE schemaname alias for $1; tablename alias for $2; columnname alias for $3; myrec RECORD; - BEGIN FOR myrec IN EXECUTE 'SELECT ST_Extent("' || columnname || '") As extent FROM "' || schemaname || '"."' || tablename || '"' LOOP return myrec.extent; @@ -1020,12 +1022,20 @@ END; $$ LANGUAGE 'plpgsql' IMMUTABLE STRICT; +-- Availability: 1.2.2 +-- Deprecation in 2.2.0 +CREATE OR REPLACE FUNCTION ST_find_extent(text,text,text) RETURNS box2d AS + $$ SELECT _postgis_deprecate('ST_Find_Extent', 'ST_FindExtent', '2.2.0'); + SELECT ST_FindExtent($1,$2,$3); + $$ + LANGUAGE 'sql' IMMUTABLE STRICT; ----------------------------------------------------------------------- -- FIND_EXTENT(
, ) ----------------------------------------------------------------------- --- Availability: 1.2.2 -CREATE OR REPLACE FUNCTION ST_find_extent(text,text) RETURNS box2d AS + +-- Availability: 2.2.0 +CREATE OR REPLACE FUNCTION ST_FindExtent(text,text) RETURNS box2d AS $$ DECLARE tablename alias for $1; @@ -1040,6 +1050,13 @@ END; $$ LANGUAGE 'plpgsql' IMMUTABLE STRICT; +-- Availability: 1.2.2 +-- Deprecation in 2.2.0 +CREATE OR REPLACE FUNCTION ST_find_extent(text,text) RETURNS box2d AS + $$ SELECT _postgis_deprecate('ST_Find_Extent', 'ST_FindExtent', '2.2.0'); + SELECT ST_FindExtent($1,$2); + $$ + LANGUAGE 'sql' IMMUTABLE STRICT; ------------------------------------------- -- other lwgeom functions @@ -3278,15 +3295,41 @@ CREATE OR REPLACE FUNCTION ST_DelaunayTriangles(g1 geometry, tolerance float8 DE -------------------------------------------------------------------------------- ------------------------------------------------------------------------ --- Availability: 1.2.2 -CREATE OR REPLACE FUNCTION ST_Combine_BBox(box3d,geometry) + +-- Availability: 2.2.0 +CREATE OR REPLACE FUNCTION ST_CombineBBox(box3d,geometry) RETURNS box3d AS 'MODULE_PATHNAME', 'BOX3D_combine' LANGUAGE 'c' IMMUTABLE; +-- Availability: 1.2.2 +-- Deprecation in 2.2.0 +CREATE OR REPLACE FUNCTION ST_Combine_BBox(box3d,geometry) + RETURNS box3d AS + $$ SELECT _postgis_deprecate('ST_Combine_BBox', 'ST_CombineBbox', '2.2.0'); + SELECT ST_CombineBbox($1,$2); + $$ + LANGUAGE 'sql' IMMUTABLE; + +-- Availability: 2.2.0 +CREATE OR REPLACE FUNCTION ST_CombineBbox(box2d,geometry) + RETURNS box2d + AS 'MODULE_PATHNAME', 'BOX2D_combine' + LANGUAGE 'c' IMMUTABLE; + +-- Availability: 1.2.2 +-- Deprecation in 2.2.0 +CREATE OR REPLACE FUNCTION ST_Combine_BBox(box2d,geometry) + RETURNS box2d AS + $$ SELECT _postgis_deprecate('ST_Combine_BBox', 'ST_CombineBbox', '2.2.0'); + SELECT ST_CombineBbox($1,$2); + $$ + LANGUAGE 'sql' IMMUTABLE; + + -- Availability: 1.2.2 CREATE AGGREGATE ST_Extent( - sfunc = ST_combine_bbox, + sfunc = ST_combine_bbox, -- TODO: use ST_CombineBbox (since 2.2.0) finalfunc = box2d, basetype = geometry, stype = box3d @@ -3294,7 +3337,7 @@ CREATE AGGREGATE ST_Extent( -- Availability: 2.0.0 CREATE AGGREGATE ST_3DExtent( - sfunc = ST_combine_bbox, + sfunc = ST_combine_bbox, -- TODO: use ST_CombineBbox (since 2.2.0) basetype = geometry, stype = box3d ); diff --git a/regress/tickets.sql b/regress/tickets.sql index 0dab8e3d5..a33003406 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -62,7 +62,7 @@ SELECT '#66', ST_AsText((ST_Dump(ST_GeomFromEWKT('CIRCULARSTRING(0 0,1 1,2 2)')) -- #68 -- SELECT '#68a', ST_AsText(ST_Shift_Longitude(ST_GeomFromText('MULTIPOINT(1 3, 4 5)'))); -SELECT '#68b', ST_AsText(ST_Shift_Longitude(ST_GeomFromText('CIRCULARSTRING(1 3, 4 5, 6 7)'))); +SELECT '#68b', ST_AsText(ST_ShiftLongitude(ST_GeomFromText('CIRCULARSTRING(1 3, 4 5, 6 7)'))); -- #69 -- SELECT '#69', ST_AsText(ST_Translate(ST_GeomFromText('CIRCULARSTRING(220268 150415,220227 150505,220227 150406)'),1,2)); -- 2.40.0