From: Sandro Santilli Date: Fri, 16 Jan 2015 13:43:35 +0000 (+0000) Subject: CamelCase-ize ST_DistanceSphere (#2748) X-Git-Tag: 2.2.0rc1~708 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a656c023f1a79207111464c3303a900939dc4fd6;p=postgis CamelCase-ize ST_DistanceSphere (#2748) git-svn-id: http://svn.osgeo.org/postgis/trunk@13179 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference_measure.xml b/doc/reference_measure.xml index 1c8f868b7..fa5081a67 100644 --- a/doc/reference_measure.xml +++ b/doc/reference_measure.xml @@ -2030,7 +2030,7 @@ FROM (SELECT See Also - , , , , , + , , , , , @@ -2173,9 +2173,9 @@ postgis=# SELECT ST_MaxDistance('POINT(0 0)'::geometry, 'LINESTRING ( 2 2, 2 2 ) - + - ST_Distance_Sphere + ST_DistanceSphere Returns minimum distance in meters between two lon/lat geometries. Uses a spherical earth and radius of 6370986 meters. @@ -2186,7 +2186,7 @@ postgis=# SELECT ST_MaxDistance('POINT(0 0)'::geometry, 'LINESTRING ( 2 2, 2 2 ) - float ST_Distance_Sphere + float ST_DistanceSphere geometry geomlonlatA geometry geomlonlatB @@ -2205,13 +2205,14 @@ postgis=# SELECT ST_MaxDistance('POINT(0 0)'::geometry, 'LINESTRING ( 2 2, 2 2 ) Availability: 1.5 - support for other geometry types besides points was introduced. Prior versions only work with points. + Changed: 2.2.0 In prior versions this used to be called ST_Distance_Sphere Examples - SELECT round(CAST(ST_Distance_Sphere(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)',4326)) As numeric),2) As dist_meters, + SELECT round(CAST(ST_DistanceSphere(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)',4326)) As numeric),2) As dist_meters, round(CAST(ST_Distance(ST_Transform(ST_Centroid(the_geom),32611), ST_Transform(ST_GeomFromText('POINT(-118 38)', 4326),32611)) As numeric),2) As dist_utm11_meters, round(CAST(ST_Distance(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)', 4326)) As numeric),5) As dist_degrees, @@ -2275,7 +2276,7 @@ FROM SELECT round(CAST( 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_DistanceSphere(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), ST_Transform(ST_GeomFromText('POINT(-118 38)', 4326),32611)) As numeric),2) As dist_utm11_meters FROM @@ -2291,7 +2292,7 @@ FROM See Also - , + , diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in index 6f3cba824..a2482869e 100644 --- a/postgis/postgis.sql.in +++ b/postgis/postgis.sql.in @@ -4729,9 +4729,8 @@ LANGUAGE 'plpgsql' IMMUTABLE STRICT; #include "geography.sql.in" - --- Availability: 1.2.2 -CREATE OR REPLACE FUNCTION ST_distance_sphere(geom1 geometry, geom2 geometry) +-- Availability: 2.2.0 +CREATE OR REPLACE FUNCTION ST_DistanceSphere(geom1 geometry, geom2 geometry) RETURNS FLOAT8 AS $$ select st_distance(geography($1),geography($2),false) @@ -4739,6 +4738,16 @@ CREATE OR REPLACE FUNCTION ST_distance_sphere(geom1 geometry, geom2 geometry) LANGUAGE 'sql' IMMUTABLE STRICT COST 300; +-- Availability: 1.2.2 +-- Deprecation in 2.2.0 +CREATE OR REPLACE FUNCTION ST_distance_sphere(geom1 geometry, geom2 geometry) + RETURNS FLOAT8 AS + $$ SELECT _postgis_deprecate('ST_Distance_Sphere', 'ST_DistanceSphere', '2.2.0'); + SELECT ST_DistanceSphere($1,$2); + $$ + LANGUAGE 'sql' IMMUTABLE STRICT + COST 300; + --------------------------------------------------------------- -- GEOMETRY_COLUMNS view support functions ---------------------------------------------------------------