From: Regina Obe Date: Sun, 26 Oct 2008 21:24:40 +0000 (+0000) Subject: Move over ST_Distance_Spher* functions X-Git-Tag: 1.4.0b1~581 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e1f24a4eaebf45e79509a8cb8aa8d84a4b482c45;p=postgis Move over ST_Distance_Spher* functions git-svn-id: http://svn.osgeo.org/postgis/trunk@3181 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/reference.xml b/doc/reference.xml index 1245d8bf4..1a6bbd4e0 100644 --- a/doc/reference.xml +++ b/doc/reference.xml @@ -422,30 +422,8 @@ Measurement Functions - - ST_Distance_Sphere(point, point) - - - Returns linear distance in meters between two lat/lon - points. Uses a spherical earth and radius of 6370986 meters. - Faster than ST_Distance_Spheroid(), but less - accurate. Only implemented for points. - - - - - ST_Distance_Spheroid(point, point, spheroid) - - - Returns linear distance between two lat/lon points given a - particular spheroid. See the explanation of spheroids given for - length_spheroid(). - Currently only implemented for points. - - - - + + ST_length_spheroid(geometry,spheroid) diff --git a/doc/reference_new.xml b/doc/reference_new.xml index c5d7f50eb..13689b161 100644 --- a/doc/reference_new.xml +++ b/doc/reference_new.xml @@ -6210,6 +6210,123 @@ SELECT ST_Disjoint('POINT(0 0)'::geometry, 'LINESTRING ( 0 0, 0 2 )'::geometry); + + + ST_Distance_Sphere + + Returns linear distance in meters between two lon/lat + points. Uses a spherical earth and radius of 6370986 meters. + Faster than ST_Distance_Spheroid(), but less + accurate. Only implemented for points. + + + + + + float ST_Distance_Sphere + geometry pointlonlatA + geometry pointlonlatB + + + + + + Description + + Returns linear distance in meters between two lon/lat + points. Uses a spherical earth and radius of 6370986 meters. + Faster than , but less + accurate. Only implemented for points. + + This function currently does not look at the SRID of a point geometry and will always assume its in WGS 80 long lat. + + + + + + Examples + + SELECT round(CAST(ST_Distance_Sphere(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, +round(CAST(ST_Distance(ST_Transform(the_geom,32611), + ST_Transform(ST_GeomFromText('POINT(-118 38)', 4326),32611)) As numeric),2) As min_dist_line_point_meters +FROM + (SELECT ST_GeomFromText('LINESTRING(-118.584 38.374,-118.583 38.5)', 4326) As the_geom) as foo; + dist_meters | dist_utm11_meters | dist_degrees | min_dist_line_point_meters + -------------+-------------------+--------------+---------------------------- + 70424.47 | 70438.00 | 0.72900 | 65871.18 + + + + + + + See Also + + , + + + + + + ST_Distance_Spheroid + + Returns linear distance between two lon/lat points given a + particular spheroid. + Currently only implemented for points. + + + + + + float ST_Distance_Spheroid + geometry pointlonlatA + geometry pointlonlatB + spheroid measurement_spheroid + + + + + + Description + + Returns linear distance in meters between two lon/lat + points given a particular spheroid. See the explanation of spheroids given for + . + + This function currently does not look at the SRID of a point geometry to determine spheroid and will always assume points are along the spheroid given. + + + + + + Examples + + SELECT round(CAST( + ST_Distance_Spheroid(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), + ST_Transform(ST_GeomFromText('POINT(-118 38)', 4326),32611)) As numeric),2) As dist_utm11_meters +FROM + (SELECT ST_GeomFromText('LINESTRING(-118.584 38.374,-118.583 38.5)', 4326) As the_geom) as foo; + dist_meters_spheroid | dist_meters_sphere | dist_utm11_meters +----------------------+--------------------+------------------- + 70454.92 | 70424.47 | 70438.00 + + + + + + + See Also + + , + + + ST_DWithin