]> granicus.if.org Git - postgis/commitdiff
Move over ST_Distance_Spher* functions
authorRegina Obe <lr@pcorp.us>
Sun, 26 Oct 2008 21:24:40 +0000 (21:24 +0000)
committerRegina Obe <lr@pcorp.us>
Sun, 26 Oct 2008 21:24:40 +0000 (21:24 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@3181 b70326c6-7e19-0410-871a-916f4a2858ee

doc/reference.xml
doc/reference_new.xml

index 1245d8bf4b50cc27748a3d035ef4c8693b0535f2..1a6bbd4e0cf58b7253f585cc55ad10526dca3e15 100644 (file)
     <sect2>
       <title>Measurement Functions</title>
          <variablelist>
-        <varlistentry id="ST_Distance_Sphere">
-          <term>ST_Distance_Sphere(point, point)</term>
-
-          <listitem>
-            <para>Returns linear distance in meters between two lat/lon
-            points. Uses a spherical earth and radius of 6370986 meters.
-            Faster than <link
-            linkend="ST_Distance_Spheroid">ST_Distance_Spheroid()</link>, but less
-            accurate. Only implemented for points.</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry id="ST_Distance_Spheroid">
-          <term>ST_Distance_Spheroid(point, point, spheroid)</term>
-
-          <listitem>
-            <para>Returns linear distance between two lat/lon points given a
-            particular spheroid. See the explanation of spheroids given for
-            <link linkend="length_spheroid">length_spheroid()</link>.
-            Currently only implemented for points.</para>
-          </listitem>
-        </varlistentry>
-
-        <varlistentry id="length_spheroid">
+     
+        <varlistentry id="ST_Length_Spheroid">
           <term>ST_length_spheroid(geometry,spheroid)</term>
 
           <listitem>
index c5d7f50ebc37b21bcd0d97b5e31302e3416a7721..13689b1614d963a07529bbb5fe368b26bd9b530e 100644 (file)
@@ -6210,6 +6210,123 @@ SELECT ST_Disjoint('POINT(0 0)'::geometry, 'LINESTRING ( 0 0, 0 2 )'::geometry);
       </refsection>
     </refentry>
 
+       <refentry id="ST_Distance_Sphere">
+         <refnamediv>
+               <refname>ST_Distance_Sphere</refname>
+       
+               <refpurpose>Returns linear distance in meters between two lon/lat
+                               points. Uses a spherical earth and radius of 6370986 meters.
+                               Faster than <link linkend="ST_Distance_Spheroid">ST_Distance_Spheroid()</link>, but less
+                               accurate. Only implemented for points.</refpurpose>
+         </refnamediv>
+       
+         <refsynopsisdiv>
+               <funcsynopsis>
+                 <funcprototype>
+                       <funcdef>float <function>ST_Distance_Sphere</function></funcdef>
+                       <paramdef><type>geometry </type> <parameter>pointlonlatA</parameter></paramdef>
+                       <paramdef><type>geometry </type> <parameter>pointlonlatB</parameter></paramdef>
+                 </funcprototype>
+               </funcsynopsis>
+         </refsynopsisdiv>
+       
+         <refsection>
+               <title>Description</title>
+       
+               <para>Returns linear distance in meters between two lon/lat
+                               points. Uses a spherical earth and radius of 6370986 meters.
+                               Faster than <link linkend="ST_Distance_Spheroid" />, but less
+                               accurate. Only implemented for points.</para>
+               <note>
+                       <para>This function currently does not look at the SRID of a point geometry and will always assume its in WGS 80 long lat.</para>
+               </note>
+         </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, 
+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
+       
+       </programlisting>
+         </refsection>
+       
+         <!-- Optionally add a "See Also" section -->
+         <refsection>
+               <title>See Also</title>
+       
+               <para><xref linkend="ST_Distance" />, <xref linkend="ST_Distance_Spheroid" /></para>
+         </refsection>
+       </refentry>
+       
+       <refentry id="ST_Distance_Spheroid">
+         <refnamediv>
+               <refname>ST_Distance_Spheroid</refname>
+       
+               <refpurpose>Returns linear distance between two lon/lat points given a
+            particular spheroid. 
+            Currently only implemented for points.</refpurpose>
+         </refnamediv>
+       
+         <refsynopsisdiv>
+               <funcsynopsis>
+                 <funcprototype>
+                       <funcdef>float <function>ST_Distance_Spheroid</function></funcdef>
+                       <paramdef><type>geometry </type> <parameter>pointlonlatA</parameter></paramdef>
+                       <paramdef><type>geometry </type> <parameter>pointlonlatB</parameter></paramdef>
+                       <paramdef><type>spheroid </type> <parameter>measurement_spheroid</parameter></paramdef>
+                 </funcprototype>
+               </funcsynopsis>
+         </refsynopsisdiv>
+       
+         <refsection>
+               <title>Description</title>
+       
+               <para>Returns linear distance in meters between two lon/lat
+                               points given a particular spheroid. See the explanation of spheroids given for
+            <link linkend="ST_Length_Spheroid" />.</para>
+               <note>
+                       <para>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.</para>
+               </note>
+         </refsection>
+         
+       
+         <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]') 
+                       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
+       
+       </programlisting>
+         </refsection>
+       
+         <!-- Optionally add a "See Also" section -->
+         <refsection>
+               <title>See Also</title>
+       
+               <para><xref linkend="ST_Distance" />, <xref linkend="ST_Distance_Sphere" /></para>
+         </refsection>
+       </refentry>
+
     <refentry id="ST_DWithin">
       <refnamediv>
         <refname>ST_DWithin</refname>