<refsection>
<title>See Also</title>
- <para><xref linkend="ST_3DDistance"/>, <xref linkend="ST_DWithin"/>, <xref linkend="ST_Distance_Sphere"/>, <xref linkend="ST_Distance_Spheroid"/>, <xref linkend="ST_MaxDistance" />, <xref linkend="ST_Transform" /></para>
+ <para><xref linkend="ST_3DDistance"/>, <xref linkend="ST_DWithin"/>, <xref linkend="ST_DistanceSphere"/>, <xref linkend="ST_Distance_Spheroid"/>, <xref linkend="ST_MaxDistance" />, <xref linkend="ST_Transform" /></para>
</refsection>
</refentry>
</refsection>
</refentry>
-<refentry id="ST_Distance_Sphere">
+<refentry id="ST_DistanceSphere">
<refnamediv>
- <refname>ST_Distance_Sphere</refname>
+ <refname>ST_DistanceSphere</refname>
<refpurpose>Returns minimum distance in meters between two lon/lat
geometries. Uses a spherical earth and radius of 6370986 meters.
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
- <funcdef>float <function>ST_Distance_Sphere</function></funcdef>
+ <funcdef>float <function>ST_DistanceSphere</function></funcdef>
<paramdef><type>geometry </type> <parameter>geomlonlatA</parameter></paramdef>
<paramdef><type>geometry </type> <parameter>geomlonlatB</parameter></paramdef>
</funcprototype>
</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_Sphere</para>
</refsection>
<refsection>
<title>Examples</title>
- <programlisting>SELECT round(CAST(ST_Distance_Sphere(ST_Centroid(the_geom), ST_GeomFromText('POINT(-118 38)',4326)) As numeric),2) As dist_meters,
+ <programlisting>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,
<programlisting>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
<refsection>
<title>See Also</title>
- <para><xref linkend="ST_Distance" />, <xref linkend="ST_Distance_Sphere" /></para>
+ <para><xref linkend="ST_Distance" />, <xref linkend="ST_DistanceSphere" /></para>
</refsection>
</refentry>
#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)
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
---------------------------------------------------------------