- #2748, ST_Shift_Longitude renamed to ST_ShiftLongitude,
ST_Find_Extent renamed to ST_FindExtent,
- ST_Combine_BBox renamed to ST_CombineBbox
+ ST_Combine_BBox renamed to ST_CombineBbox,
+ ST_Length_Spheroid renamed to ST_LengthSpheroid,
+ ST_Distance_Spheroid renamed to ST_DistanceSpheroid
- #2769, ST_Mem_Size renamed to ST_MemSize
- #2565, ST_SummaryStats(tablename, rastercolumn, ...)
- #2567, ST_Count(tablename, rastercolumn, ...)
<refpurpose>Returns minimum distance in meters between two lon/lat
geometries. Uses a spherical earth and radius of 6370986 meters.
- Faster than ST_Distance_Spheroid <xref linkend="ST_Distance_Spheroid" />, but less
+ Faster than ST_DistanceSpheroid <xref linkend="ST_Distance_Spheroid" />, but less
accurate. PostGIS versions prior to 1.5 only implemented for points.</refpurpose>
</refnamediv>
<refentry id="ST_Distance_Spheroid">
<refnamediv>
- <refname>ST_Distance_Spheroid</refname>
+ <refname>ST_DistanceSpheroid</refname>
<refpurpose>Returns the minimum distance between two lon/lat geometries given a
particular spheroid.
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
- <funcdef>float <function>ST_Distance_Spheroid</function></funcdef>
+ <funcdef>float <function>ST_DistanceSpheroid</function></funcdef>
<paramdef><type>geometry </type> <parameter>geomlonlatA</parameter></paramdef>
<paramdef><type>geometry </type> <parameter>geomlonlatB</parameter></paramdef>
<paramdef><type>spheroid </type> <parameter>measurement_spheroid</parameter></paramdef>
</note>
<para>Availability: 1.5 - support for other geometry types besides points was introduced. Prior versions only work with points.</para>
+ <para>Changed: 2.2.0 In prior versions this used to be called ST_Distance_Spheroid</para>
</refsection>
<title>Examples</title>
<programlisting>SELECT round(CAST(
- ST_Distance_Spheroid(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)',4326), 'SPHEROID["WGS 84",6378137,298.257223563]')
+ ST_DistanceSpheroid(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)',4326), 'SPHEROID["WGS 84",6378137,298.257223563]')
As numeric),2) As dist_meters_spheroid,
round(CAST(ST_Distance_Sphere(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)',4326)) As numeric),2) As dist_meters_sphere,
round(CAST(ST_Distance(ST_Transform(ST_Centroid(the_geom),32611),
<refentry id="ST_Length_Spheroid">
<refnamediv>
- <refname>ST_Length_Spheroid</refname>
+ <refname>ST_LengthSpheroid</refname>
<refpurpose>Calculates the 2D or 3D length of a linestring/multilinestring on an ellipsoid. This
is useful if the coordinates of the geometry are in
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
- <funcdef>float <function>ST_Length_Spheroid</function></funcdef>
+ <funcdef>float <function>ST_LengthSpheroid</function></funcdef>
<paramdef><type>geometry </type> <parameter>a_linestring</parameter></paramdef>
<paramdef><type>spheroid </type> <parameter>a_spheroid</parameter></paramdef>
</funcprototype>
<literallayout>SPHEROID["GRS_1980",6378137,298.257222101]</literallayout>
<note><para>Will return 0 for anything that is not a MULTILINESTRING or LINESTRING</para></note>
+ <para>Availability: 1.2.2</para>
+ <para>Changed: 2.2.0 In prior versions this used to be called ST_Length_Spheroid</para>
<para>&Z_support;</para>
</refsection>
<refsection>
<title>Examples</title>
- <programlisting>SELECT ST_Length_Spheroid( geometry_column,
+ <programlisting>SELECT ST_LengthSpheroid( geometry_column,
'SPHEROID["GRS_1980",6378137,298.257222101]' )
FROM geometry_table;
-SELECT ST_Length_Spheroid( the_geom, sph_m ) As tot_len,
-ST_Length_Spheroid(ST_GeometryN(the_geom,1), sph_m) As len_line1,
-ST_Length_Spheroid(ST_GeometryN(the_geom,2), sph_m) As len_line2
+SELECT ST_LengthSpheroid( the_geom, sph_m ) As tot_len,
+ST_LengthSpheroid(ST_GeometryN(the_geom,1), sph_m) As len_line1,
+ST_LengthSpheroid(ST_GeometryN(the_geom,2), sph_m) As len_line2
FROM (SELECT ST_GeomFromText('MULTILINESTRING((-118.584 38.374,-118.583 38.5),
(-71.05957 42.3589 , -71.061 43))') As the_geom,
CAST('SPHEROID["GRS_1980",6378137,298.257222101]' As spheroid) As sph_m) as foo;
85204.5207562955 | 13986.8725229309 | 71217.6482333646
--3D
-SELECT ST_Length_Spheroid( the_geom, sph_m ) As tot_len,
-ST_Length_Spheroid(ST_GeometryN(the_geom,1), sph_m) As len_line1,
-ST_Length_Spheroid(ST_GeometryN(the_geom,2), sph_m) As len_line2
+SELECT ST_LengthSpheroid( the_geom, sph_m ) As tot_len,
+ST_LengthSpheroid(ST_GeometryN(the_geom,1), sph_m) As len_line1,
+ST_LengthSpheroid(ST_GeometryN(the_geom,2), sph_m) As len_line2
FROM (SELECT ST_GeomFromEWKT('MULTILINESTRING((-118.584 38.374 20,-118.583 38.5 30),
(-71.05957 42.3589 75, -71.061 43 90))') As the_geom,
CAST('SPHEROID["GRS_1980",6378137,298.257222101]' As spheroid) As sph_m) as foo;
-- this is a fake (for back-compatibility)
-- uses 3d if 3d is available, 2d otherwise
+-- TODO: deprecate ?
-- Availability: 2.0.0
CREATE OR REPLACE FUNCTION ST_3DLength_spheroid(geometry, spheroid)
RETURNS FLOAT8
LANGUAGE 'c' IMMUTABLE STRICT
COST 100;
--- Availability: 1.2.2
-CREATE OR REPLACE FUNCTION ST_length_spheroid(geometry, spheroid)
+-- Availability in 2.2.0
+CREATE OR REPLACE FUNCTION ST_LengthSpheroid(geometry, spheroid)
RETURNS FLOAT8
AS 'MODULE_PATHNAME','LWGEOM_length_ellipsoid_linestring'
LANGUAGE 'c' IMMUTABLE STRICT
COST 100;
+-- Availability: 1.2.2
+-- Deprecation in 2.2.0
+CREATE OR REPLACE FUNCTION ST_length_spheroid(geometry, spheroid)
+ RETURNS FLOAT8 AS
+ $$ SELECT _postgis_deprecate('ST_Length_Spheroid', 'ST_LengthSpheroid', '2.2.0');
+ SELECT ST_LengthSpheroid($1,$2);
+ $$
+ LANGUAGE 'sql' IMMUTABLE STRICT;
+
-- Availability: 1.2.2
CREATE OR REPLACE FUNCTION ST_length2d_spheroid(geometry, spheroid)
RETURNS FLOAT8
AS 'MODULE_PATHNAME','area'
LANGUAGE 'c' IMMUTABLE STRICT;
--- Availability: 1.2.2
-CREATE OR REPLACE FUNCTION ST_distance_spheroid(geom1 geometry, geom2 geometry,spheroid)
+-- Availability: 2.0.0
+CREATE OR REPLACE FUNCTION ST_DistanceSpheroid(geom1 geometry, geom2 geometry,spheroid)
RETURNS FLOAT8
AS 'MODULE_PATHNAME','LWGEOM_distance_ellipsoid'
LANGUAGE 'c' IMMUTABLE STRICT
COST 100;
+-- Availability: 1.2.2
+-- Deprecation in 2.2.0
+CREATE OR REPLACE FUNCTION ST_distance_spheroid(geom1 geometry, geom2 geometry,spheroid)
+ RETURNS FLOAT8 AS
+ $$ SELECT _postgis_deprecate('ST_Distance_Spheroid', 'ST_DistanceSpheroid', '2.2.0');
+ SELECT ST_DistanceSpheroid($1,$2,$3);
+ $$
+ LANGUAGE 'sql' IMMUTABLE STRICT;
+
-- Minimum distance. 2d only.
-- PostGIS equivalent function: distance(geom1 geometry, geom2 geometry)
select 'emptyCollectionArea', st_area('GEOMETRYCOLLECTION EMPTY');
--
-select 'spheroidLength1', round(st_length_spheroid('MULTILINESTRING((-118.584 38.374,-118.583 38.5),(-71.05957 42.3589 , -71.061 43))'::geometry,'SPHEROID["GRS_1980",6378137,298.257222101]'::spheroid)::numeric,5);
+select 'spheroidLength1_deprecated', round(st_length_spheroid('MULTILINESTRING((-118.584 38.374,-118.583 38.5),(-71.05957 42.3589 , -71.061 43))'::geometry,'SPHEROID["GRS_1980",6378137,298.257222101]'::spheroid)::numeric,5);
+select 'spheroidLength1', round(ST_LengthSpheroid('MULTILINESTRING((-118.584 38.374,-118.583 38.5),(-71.05957 42.3589 , -71.061 43))'::geometry,'SPHEROID["GRS_1980",6378137,298.257222101]'::spheroid)::numeric,5);
emptyMultiLineArea|0
emptyMultiPointArea|0
emptyCollectionArea|0
+spheroidLength1_deprecated|85204.52077
spheroidLength1|85204.52077
SELECT '#667', ST_AsEWKT(ST_LineToCurve(ST_Buffer(ST_SetSRID(ST_Point(i,j),4326), j))) As the_geom FROM generate_series(-10,50,10) As i CROSS JOIN generate_series(40,70, 20) As j ORDER BY i, j, i*j LIMIT 1;
-- #677 --
-SELECT '#677',round(ST_Distance_Spheroid(ST_GeomFromEWKT('MULTIPOLYGON(((-10 40,-10 55,-10 70,5 40,-10 40)))'), ST_GeomFromEWKT('MULTIPOINT(20 40,20 55,20 70,35 40,35 55,35 70,50 40,50 55,50 70)'), 'SPHEROID["GRS_1980",6378137,298.257222101]')) As result;
+SELECT '#677.deprecated',round(ST_Distance_Spheroid(ST_GeomFromEWKT('MULTIPOLYGON(((-10 40,-10 55,-10 70,5 40,-10 40)))'), ST_GeomFromEWKT('MULTIPOINT(20 40,20 55,20 70,35 40,35 55,35 70,50 40,50 55,50 70)'), 'SPHEROID["GRS_1980",6378137,298.257222101]')) As result;
+SELECT '#677',round(ST_DistanceSpheroid(ST_GeomFromEWKT('MULTIPOLYGON(((-10 40,-10 55,-10 70,5 40,-10 40)))'), ST_GeomFromEWKT('MULTIPOINT(20 40,20 55,20 70,35 40,35 55,35 70,50 40,50 55,50 70)'), 'SPHEROID["GRS_1980",6378137,298.257222101]')) As result;
-- #680 --
SELECT '#680', encode(ST_AsBinary(geography(foo1.the_geom),'ndr'),'hex') As result FROM ((SELECT ST_SetSRID(ST_MakePointM(i,j,m),4326) As the_geom FROM generate_series(-10,50,10) As i CROSS JOIN generate_series(50,70, 20) AS j CROSS JOIN generate_series(1,2) As m ORDER BY i, j, i*j*m)) As foo1 LIMIT 1;
#835.12|MULTIPOLYGON EMPTY
#650|MULTIPOINT(0 0,1 1,2 2)
#667|SRID=4326;CURVEPOLYGON(CIRCULARSTRING(30 40,-50 39.9999999999999,30 40))
+#677.deprecated|1121395
#677|1121395
#680|01d107000000000000000024c000000000000049400000000000000040
#681a|