]> granicus.if.org Git - postgis/commitdiff
Azimuth example with angles of azimuth and my drawing cheatsheet (st_azimuthmath...
authorRegina Obe <lr@pcorp.us>
Fri, 8 Apr 2011 17:02:51 +0000 (17:02 +0000)
committerRegina Obe <lr@pcorp.us>
Fri, 8 Apr 2011 17:02:51 +0000 (17:02 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@7011 b70326c6-7e19-0410-871a-916f4a2858ee

doc/html/image_src/Makefile.in
doc/html/image_src/st_azimuth01.wkt [new file with mode: 0644]
doc/html/image_src/st_azimuth02.wkt [new file with mode: 0644]
doc/html/image_src/st_azimuthmath.sql [new file with mode: 0644]
doc/reference_measure.xml

index 697a1cf1e9247a1163f93824250b2e50f0d7c60c..5886bdf97daa2186d700e0d33157168b07e0eba7 100644 (file)
@@ -19,6 +19,8 @@ CUNIT_CPPFLAGS=@CUNIT_CPPFLAGS@ -I../../../liblwgeom
 IMAGES= \
        ../images/de9im01.png \
        ../images/de9im02.png \
+       ../images/st_azimuth01.png \
+       ../images/st_azimuth02.png \
        ../images/st_buffer01.png \
        ../images/st_buffer02.png \
        ../images/st_buffer03.png \
diff --git a/doc/html/image_src/st_azimuth01.wkt b/doc/html/image_src/st_azimuth01.wkt
new file mode 100644 (file)
index 0000000..f0db723
--- /dev/null
@@ -0,0 +1,4 @@
+Style2;POINT(25 45)
+Style1;POINT(75 100)
+Style2-thinline;LINESTRING(25 45,99.3303 45)
+Style3;LINESTRING(99.33034 45,98.9724 52.28569,97.90206 59.50121,96.12963 66.57707,93.67218 73.44514,90.55337 80.03925,86.80325 86.29593,82.45792 92.15489,77.55924 97.55973,75 100)
diff --git a/doc/html/image_src/st_azimuth02.wkt b/doc/html/image_src/st_azimuth02.wkt
new file mode 100644 (file)
index 0000000..d8f1ac9
--- /dev/null
@@ -0,0 +1,4 @@
+Style2;POINT(75 100)
+Style1;POINT(25 45)
+Style2-thinline;LINESTRING(75 100,149.33034 100)
+Style3;LINESTRING(149.33034 100,148.97241 107.28565,147.90209 114.50113,146.12969 121.57695,143.67226 128.44498,140.55349 135.03907,136.8034 141.29571,132.4581 147.15465,127.55946 152.55946,122.15464 157.4581,116.29569 161.80338,110.03905 165.55347,103.44496 168.67223,96.57693 171.12965,89.5011 172.90205,82.28562 173.97236,74.99997 174.33027,67.71433 173.97235,60.49885 172.90203,53.42302 171.12962,46.55499 168.6722,39.96091 165.55342,33.70427 161.80333,27.84533 157.45804,22.44051 152.55939,17.54187 147.15457,13.19659 141.29563,9.44651 135.03898,6.32774 128.44489,3.87032 121.57686,2.09792 114.50103,1.02761 107.28555,0.6697 99.99991,1.02762 92.71426,2.09794 85.49878,3.87035 78.42295,6.32777 71.55493,9.44655 64.96084,13.19664 58.7042,17.54193 52.84526,22.44058 47.44045,25 45)
diff --git a/doc/html/image_src/st_azimuthmath.sql b/doc/html/image_src/st_azimuthmath.sql
new file mode 100644 (file)
index 0000000..21c0e56
--- /dev/null
@@ -0,0 +1,37 @@
+-- st_azimuth01.wkt\r
+POINT(25 45); --point 1\r
+POINT(75 100); -- point 2\r
+SELECT ST_AsText(\r
+       ST_MakeLine(\r
+               ST_Point(25,45), ST_Point(25 + ST_Length('LINESTRING(25 45,75 100)'::Geometry) ,45))\r
+       ); -- horizontal -- LINESTRING(25 45,99.33034 45)\r
+       \r
+-- control point\r
+SELECT ST_AsText(\r
+       ST_SnapToGrid(\r
+               ST_PointN(ST_Boundary(ST_Buffer(ST_Point(25, 45),ST_Length('LINESTRING(25 45,75 100)'::Geometry))),30),\r
+               0.0001)); --POINT(86.8034 86.2957)\r
+\r
+-- arc from horizontal\r
+-- LINESTRING(99.33034 45,98.9724 52.28569,97.90206 59.50121,96.12963 66.57707,93.67218 73.44514,90.55337 80.03925,86.80325 86.29593,82.45792 92.15489,77.55924 97.55973,75 100)\r
+SELECT ST_AsText(ST_SnapToGrid(ST_CurveToLine('CIRCULARSTRING(99.33034 45, 86.8034 86.2957,75 100)',16),0.00001));\r
+\r
+-- st_azimuth02.wkt\r
+POINT(75 100); --point 1\r
+POINT(25 45); -- point 2\r
+SELECT ST_AsText(\r
+       ST_MakeLine(\r
+               ST_Point(75,100), ST_Point(75 + ST_Length('LINESTRING(25 45,75 100)'::Geometry) ,100))\r
+       ); -- horizontal -- LINESTRING(75 100,149.33034 100)\r
+       \r
+-- control point\r
+SELECT ST_AsText(\r
+       ST_SnapToGrid(\r
+               ST_PointN(ST_Boundary(ST_Buffer(ST_Point(75, 100),ST_Length('LINESTRING(25 45,75 100)'::Geometry))),30),\r
+               0.0001)); --POINT(136.8034 141.2957)\r
+\r
+-- arc from horizontal\r
+-- LINESTRING(149.33034 100,148.97241 107.28565,147.90209 114.50113,146.12969 121.57695,143.67226 128.44498,140.55349 135.03907,136.8034 141.29571,132.4581 147.15465,127.55946 152.55946,122.15464 157.4581,116.29569 161.80338,110.03905 165.55347,103.44496 168.67223,96.57693 171.12965,89.5011 172.90205,82.28562 173.97236,74.99997 174.33027,67.71433 173.97235,60.49885 172.90203,53.42302 171.12962,46.55499 168.6722,39.96091 165.55342,33.70427 161.80333,27.84533 157.45804,22.44051 152.55939,17.54187 147.15457,13.19659 141.29563,9.44651 135.03898,6.32774 128.44489,3.87032 121.57686,2.09792 114.50103,1.02761 107.28555,0.6697 99.99991,1.02762 92.71426,2.09794 85.49878,3.87035 78.42295,6.32777 71.55493,9.44655 64.96084,13.19664 58.7042,17.54193 52.84526,22.44058 47.44045,25 45)\r
+SELECT ST_AsText(ST_SnapToGrid(ST_CurveToLine('CIRCULARSTRING(149.33034 100, 136.8034 141.2957,25 45)',16),0.00001));\r
+\r
+\r
index 4fd23dc09d84fd01fbb5060bc6981e724846f7d9..c3ac1b3c349a10effd8a20bb1bebf87b85b4de48 100644 (file)
@@ -729,7 +729,7 @@ SELECT ST_Area(the_geog)/POWER(0.3048,2) As sqft_spheroid,  ST_Area(the_geog,fal
                <refnamediv>
                  <refname>ST_Azimuth</refname>
 
-                 <refpurpose>Returns the angle in radians from the horizontal of the vector defined by pointA and pointB</refpurpose>
+                 <refpurpose>Returns the angle in radians from the horizontal of the vector defined by pointA and pointB. Angle is computed clockwise from down-to-up: on the clock: 12=0; 3=PI/2; 6=PI; 9=3PI/4.</refpurpose>
                </refnamediv>
                <refsynopsisdiv>
                  <funcsynopsis>
@@ -745,31 +745,57 @@ SELECT ST_Area(the_geog)/POWER(0.3048,2) As sqft_spheroid,  ST_Area(the_geog,fal
 
                        <para>Returns the azimuth of the segment defined by the given
                        Point geometries, or NULL if the two points are coincident. Return
-                       value is in radians.</para>
+                       value is in radians. Angle is computed clockwise from down-to-up: on the clock: 12=0; 3=PI/2; 6=PI; 9=3PI/4 </para>
 
                        <para>The Azimuth is mathematical concept defined as the angle, in this case measured in radian, between a reference plane
                                and a point</para>
 
                        <para>Availability: 1.1.0</para>
                        <para>Azimuth is especially useful in conjunction with ST_Translate for shifting an object along its perpendicular axis. See
-                                upgis_lineshift <ulink url="http://postgis.refractions.net/support/wiki/index.php?plpgsqlfunctions">Plpgsqlfunctions PostGIS wiki section</ulink> for example of this.</para>
+                                upgis_lineshift <ulink url="http://www.postgis.org/support/wiki/index.php?plpgsqlfunctions">Plpgsqlfunctions PostGIS wiki section</ulink> for example of this.</para>
                </refsection>
 
                <refsection>
                <title>Examples</title>
                <para>--Azimuth in degrees </para>
 <programlisting>
-SELECT ST_Azimuth(ST_MakePoint(1,2), ST_MakePoint(3,4))/(2*pi())*360 as degAz,
-       ST_Azimuth(ST_MakePoint(3,4), ST_MakePoint(1,2))/(2*pi())*360 As degAzrev
+SELECT ST_Azimuth(ST_Point(25,45), ST_Point(75,100))/(2*pi())*360 as degAz,
+       ST_Azimuth(ST_Point(75,100), ST_Point(25,45))/(2*pi())*360 As degAzrev;
 
-degaz  degazrev
------- ---------
-45             225
+      degaz       |     degazrev
+------------------+------------------
+ 42.2736890060937 | 222.273689006094
 </programlisting>
+               <informaltable>
+                 <tgroup cols="2">
+                       <tbody>
+                               <row>
+                               <entry><para><informalfigure>
+                                       <mediaobject>
+                                         <imageobject>
+                                               <imagedata fileref="images/st_azimuth01.png" />
+                                         </imageobject>
+                                         <caption><para>degAz is curve shown with horizontal and points</para></caption>
+                                       </mediaobject>
+                                 </informalfigure>
+                               </para></entry>
+                               <entry><para><informalfigure>
+                                       <mediaobject>
+                                         <imageobject>
+                                               <imagedata fileref="images/st_azimuth02.png" />
+                                         </imageobject>
+                                         <caption><para>degAzrev is azimuth curve shown with horizontal and points</para></caption>
+                                       </mediaobject>
+                                 </informalfigure>
+                               </para></entry>
+                               </row>
+                       </tbody>
+                       </tgroup>
+               </informaltable>
                </refsection>
                <refsection>
                        <title>See Also</title>
-                       <para><xref linkend="ST_MakePoint" />, <xref linkend="ST_Translate" /></para>
+                       <para><xref linkend="ST_Point" />, <xref linkend="ST_Translate" /></para>
                </refsection>
 
   </refentry>