From 7cc018a2b3985f7bf920d11e378dc5b376e2fb77 Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Fri, 8 Apr 2011 17:02:51 +0000 Subject: [PATCH] Azimuth example with angles of azimuth and my drawing cheatsheet (st_azimuthmath.sql) in case have to do this again. git-svn-id: http://svn.osgeo.org/postgis/trunk@7011 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/html/image_src/Makefile.in | 2 ++ doc/html/image_src/st_azimuth01.wkt | 4 +++ doc/html/image_src/st_azimuth02.wkt | 4 +++ doc/html/image_src/st_azimuthmath.sql | 37 ++++++++++++++++++++++ doc/reference_measure.xml | 44 +++++++++++++++++++++------ 5 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 doc/html/image_src/st_azimuth01.wkt create mode 100644 doc/html/image_src/st_azimuth02.wkt create mode 100644 doc/html/image_src/st_azimuthmath.sql diff --git a/doc/html/image_src/Makefile.in b/doc/html/image_src/Makefile.in index 697a1cf1e..5886bdf97 100644 --- a/doc/html/image_src/Makefile.in +++ b/doc/html/image_src/Makefile.in @@ -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 index 000000000..f0db723be --- /dev/null +++ b/doc/html/image_src/st_azimuth01.wkt @@ -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 index 000000000..d8f1ac9d6 --- /dev/null +++ b/doc/html/image_src/st_azimuth02.wkt @@ -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 index 000000000..21c0e5635 --- /dev/null +++ b/doc/html/image_src/st_azimuthmath.sql @@ -0,0 +1,37 @@ +-- st_azimuth01.wkt +POINT(25 45); --point 1 +POINT(75 100); -- point 2 +SELECT ST_AsText( + ST_MakeLine( + ST_Point(25,45), ST_Point(25 + ST_Length('LINESTRING(25 45,75 100)'::Geometry) ,45)) + ); -- horizontal -- LINESTRING(25 45,99.33034 45) + +-- control point +SELECT ST_AsText( + ST_SnapToGrid( + ST_PointN(ST_Boundary(ST_Buffer(ST_Point(25, 45),ST_Length('LINESTRING(25 45,75 100)'::Geometry))),30), + 0.0001)); --POINT(86.8034 86.2957) + +-- arc from horizontal +-- 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) +SELECT ST_AsText(ST_SnapToGrid(ST_CurveToLine('CIRCULARSTRING(99.33034 45, 86.8034 86.2957,75 100)',16),0.00001)); + +-- st_azimuth02.wkt +POINT(75 100); --point 1 +POINT(25 45); -- point 2 +SELECT ST_AsText( + ST_MakeLine( + ST_Point(75,100), ST_Point(75 + ST_Length('LINESTRING(25 45,75 100)'::Geometry) ,100)) + ); -- horizontal -- LINESTRING(75 100,149.33034 100) + +-- control point +SELECT ST_AsText( + ST_SnapToGrid( + ST_PointN(ST_Boundary(ST_Buffer(ST_Point(75, 100),ST_Length('LINESTRING(25 45,75 100)'::Geometry))),30), + 0.0001)); --POINT(136.8034 141.2957) + +-- arc from horizontal +-- 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) +SELECT ST_AsText(ST_SnapToGrid(ST_CurveToLine('CIRCULARSTRING(149.33034 100, 136.8034 141.2957,25 45)',16),0.00001)); + + diff --git a/doc/reference_measure.xml b/doc/reference_measure.xml index 4fd23dc09..c3ac1b3c3 100644 --- a/doc/reference_measure.xml +++ b/doc/reference_measure.xml @@ -729,7 +729,7 @@ SELECT ST_Area(the_geog)/POWER(0.3048,2) As sqft_spheroid, ST_Area(the_geog,fal ST_Azimuth - Returns the angle in radians from the horizontal of the vector defined by pointA and pointB + 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. @@ -745,31 +745,57 @@ SELECT ST_Area(the_geog)/POWER(0.3048,2) As sqft_spheroid, ST_Area(the_geog,fal 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. + 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 The Azimuth is mathematical concept defined as the angle, in this case measured in radian, between a reference plane and a point Availability: 1.1.0 Azimuth is especially useful in conjunction with ST_Translate for shifting an object along its perpendicular axis. See - upgis_lineshift Plpgsqlfunctions PostGIS wiki section for example of this. + upgis_lineshift Plpgsqlfunctions PostGIS wiki section for example of this. Examples --Azimuth in degrees -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 + + + + + + + + + + degAz is curve shown with horizontal and points + + + + + + + + + degAzrev is azimuth curve shown with horizontal and points + + + + + + + See Also - , + , -- 2.50.1