File: Planimeter.1.html

package info (click to toggle)
geographiclib 1.49-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 11,656 kB
  • sloc: cpp: 32,394; cs: 9,567; sh: 4,757; ansic: 2,377; java: 2,208; python: 1,779; makefile: 861; xml: 390; pascal: 34
file content (201 lines) | stat: -rw-r--r-- 9,474 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Planimeter(1)</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body>



<h1 id="NAME">NAME</h1>

<p>Planimeter -- compute the area of geodesic polygons</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<p><b>Planimeter</b> [ <b>-r</b> ] [ <b>-s</b> ] [ <b>-l</b> ] [ <b>-e</b> <i>a</i> <i>f</i> ] [ <b>-w</b> ] [ <b>-p</b> <i>prec</i> ] [ <b>-G</b> | <b>-E</b> | <b>-Q</b> | <b>-R</b> ] [ <b>--comment-delimiter</b> <i>commentdelim</i> ] [ <b>--version</b> | <b>-h</b> | <b>--help</b> ] [ <b>--input-file</b> <i>infile</i> | <b>--input-string</b> <i>instring</i> ] [ <b>--line-separator</b> <i>linesep</i> ] [ <b>--output-file</b> <i>outfile</i> ]</p>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>Measure the area of a geodesic polygon. Reads polygon vertices from standard input, one per line. Vertices may be given as latitude and longitude, UTM/UPS, or MGRS coordinates, interpreted in the same way as GeoConvert(1). (MGRS coordinates signify the center of the corresponding MGRS square.) The end of input, a blank line, or a line which can&#39;t be interpreted as a vertex signals the end of one polygon and the start of the next. For each polygon print a summary line with the number of points, the perimeter (in meters), and the area (in meters^2).</p>

<p>The edges of the polygon are given by the <i>shortest</i> geodesic between consecutive vertices. In certain cases, there may be two or many such shortest geodesics, and in that case, the polygon is not uniquely specified by its vertices. This only happens with very long edges (for the WGS84 ellipsoid, any edge shorter than 19970 km is uniquely specified by its end points). In such cases, insert an additional vertex near the middle of the long edge to define the boundary of the polygon.</p>

<p>By default, polygons traversed in a counter-clockwise direction return a positive area and those traversed in a clockwise direction return a negative area. This sign convention is reversed if the <b>-r</b> option is given.</p>

<p>Of course, encircling an area in the clockwise direction is equivalent to encircling the rest of the ellipsoid in the counter-clockwise direction. The default interpretation used by <b>Planimeter</b> is the one that results in a smaller magnitude of area; i.e., the magnitude of the area is less than or equal to one half the total area of the ellipsoid. If the <b>-s</b> option is given, then the interpretation used is the one that results in a positive area; i.e., the area is positive and less than the total area of the ellipsoid.</p>

<p>Only simple (i.e., non-self-intersecting) polygons are supported for the area computation. Polygons may include one or both poles. There is no need to close the polygon.</p>

<h1 id="OPTIONS">OPTIONS</h1>

<dl>

<dt id="r"><b>-r</b></dt>
<dd>

<p>toggle whether counter-clockwise traversal of the polygon returns a positive (the default) or negative result.</p>

</dd>
<dt id="s"><b>-s</b></dt>
<dd>

<p>toggle whether to return a signed result (the default) or not.</p>

</dd>
<dt id="l"><b>-l</b></dt>
<dd>

<p>toggle whether the vertices represent a polygon (the default) or a polyline. For a polyline, the number of points and the length of the path joining them is returned; the path is not closed and the area is not reported.</p>

</dd>
<dt id="e-a-f"><b>-e</b> <i>a</i> <i>f</i></dt>
<dd>

<p>specify the ellipsoid via the equatorial radius, <i>a</i> and the flattening, <i>f</i>. Setting <i>f</i> = 0 results in a sphere. Specify <i>f</i> &lt; 0 for a prolate ellipsoid. A simple fraction, e.g., 1/297, is allowed for <i>f</i>. By default, the WGS84 ellipsoid is used, <i>a</i> = 6378137 m, <i>f</i> = 1/298.257223563. If entering vertices as UTM/UPS or MGRS coordinates, use the default ellipsoid, since the conversion of these coordinates to latitude and longitude always uses the WGS84 parameters.</p>

</dd>
<dt id="w"><b>-w</b></dt>
<dd>

<p>toggle the longitude first flag (it starts off); if the flag is on, then when reading geographic coordinates, longitude precedes latitude (this can be overridden by a hemisphere designator, <i>N</i>, <i>S</i>, <i>E</i>, <i>W</i>).</p>

</dd>
<dt id="p-prec"><b>-p</b> <i>prec</i></dt>
<dd>

<p>set the output precision to <i>prec</i> (default 6); the perimeter is given (in meters) with <i>prec</i> digits after the decimal point; the area is given (in meters^2) with (<i>prec</i> - 5) digits after the decimal point.</p>

</dd>
<dt id="G"><b>-G</b></dt>
<dd>

<p>use the series formulation for the geodesics. This is the default option and is recommended for terrestrial applications. This option, <b>-G</b>, and the following three options, <b>-E</b>, <b>-Q</b>, and <b>-R</b>, are mutually exclusive.</p>

</dd>
<dt id="E"><b>-E</b></dt>
<dd>

<p>use &quot;exact&quot; algorithms (based on elliptic integrals) for the geodesic calculations. These are more accurate than the (default) series expansions for |<i>f</i>| &gt; 0.02. (But note that the implementation of areas in GeodesicExact uses a high order series and this is only accurate for modest flattenings.)</p>

</dd>
<dt id="Q"><b>-Q</b></dt>
<dd>

<p>perform the calculation on the authalic sphere. The area calculation is accurate even if the flattening is large, <i>provided</i> the edges are sufficiently short. The perimeter calculation is not accurate.</p>

</dd>
<dt id="R"><b>-R</b></dt>
<dd>

<p>The lines joining the vertices are rhumb lines instead of geodesics.</p>

</dd>
<dt id="comment-delimiter-commentdelim"><b>--comment-delimiter</b> <i>commentdelim</i></dt>
<dd>

<p>set the comment delimiter to <i>commentdelim</i> (e.g., &quot;#&quot; or &quot;//&quot;). If set, the input lines will be scanned for this delimiter and, if found, the delimiter and the rest of the line will be removed prior to processing. For a given polygon, the last such string found will be appended to the output line (separated by a space).</p>

</dd>
<dt id="version"><b>--version</b></dt>
<dd>

<p>print version and exit.</p>

</dd>
<dt id="h"><b>-h</b></dt>
<dd>

<p>print usage and exit.</p>

</dd>
<dt id="help"><b>--help</b></dt>
<dd>

<p>print full documentation and exit.</p>

</dd>
<dt id="input-file-infile"><b>--input-file</b> <i>infile</i></dt>
<dd>

<p>read input from the file <i>infile</i> instead of from standard input; a file name of &quot;-&quot; stands for standard input.</p>

</dd>
<dt id="input-string-instring"><b>--input-string</b> <i>instring</i></dt>
<dd>

<p>read input from the string <i>instring</i> instead of from standard input. All occurrences of the line separator character (default is a semicolon) in <i>instring</i> are converted to newlines before the reading begins.</p>

</dd>
<dt id="line-separator-linesep"><b>--line-separator</b> <i>linesep</i></dt>
<dd>

<p>set the line separator character to <i>linesep</i>. By default this is a semicolon.</p>

</dd>
<dt id="output-file-outfile"><b>--output-file</b> <i>outfile</i></dt>
<dd>

<p>write output to the file <i>outfile</i> instead of to standard output; a file name of &quot;-&quot; stands for standard output.</p>

</dd>
</dl>

<h1 id="EXAMPLES">EXAMPLES</h1>

<p>Example (the area of the 100km MGRS square 18SWK)</p>

<pre><code>   Planimeter &lt;&lt;EOF
   18n 500000 4400000
   18n 600000 4400000
   18n 600000 4500000
   18n 500000 4500000
   EOF
   =&gt; 4 400139.53295860 10007388597.1913</code></pre>

<p>The following code takes the output from gdalinfo and reports the area covered by the data (assuming the edges of the image are geodesics).</p>

<pre><code>   #! /bin/sh
   egrep &#39;^((Upper|Lower) (Left|Right)|Center) &#39; |
   sed -e &#39;s/d /d/g&#39; -e &quot;s/&#39; /&#39;/g&quot; | tr -s &#39;(),\r\t&#39; &#39; &#39; | awk &#39;{
       if ($1 $2 == &quot;UpperLeft&quot;)
           ul = $6 &quot; &quot; $5;
       else if ($1 $2 == &quot;LowerLeft&quot;)
           ll = $6 &quot; &quot; $5;
       else if ($1 $2 == &quot;UpperRight&quot;)
           ur = $6 &quot; &quot; $5;
       else if ($1 $2 == &quot;LowerRight&quot;)
           lr = $6 &quot; &quot; $5;
       else if ($1 == &quot;Center&quot;) {
           printf &quot;%s\n%s\n%s\n%s\n\n&quot;, ul, ll, lr, ur;
           ul = ll = ur = lr = &quot;&quot;;
       }
   }
   &#39; | Planimeter | cut -f3 -d&#39; &#39;</code></pre>

<h1 id="SEE-ALSO">SEE ALSO</h1>

<p>GeoConvert(1), GeodSolve(1).</p>

<p>An online version of this utility is availbable at <a href="https://geographiclib.sourceforge.io/cgi-bin/Planimeter">https://geographiclib.sourceforge.io/cgi-bin/Planimeter</a>.</p>

<p>The algorithm for the area of geodesic polygon is given in Section 6 of C. F. F. Karney, <i>Algorithms for geodesics</i>, J. Geodesy 87, 43-55 (2013); DOI <a href="https://doi.org/10.1007/s00190-012-0578-z">https://doi.org/10.1007/s00190-012-0578-z</a>; addenda: <a href="https://geographiclib.sourceforge.io/geod-addenda.html">https://geographiclib.sourceforge.io/geod-addenda.html</a>.</p>

<h1 id="AUTHOR">AUTHOR</h1>

<p><b>Planimeter</b> was written by Charles Karney.</p>

<h1 id="HISTORY">HISTORY</h1>

<p><b>Planimeter</b> was added to GeographicLib, <a href="https://geographiclib.sourceforge.io">https://geographiclib.sourceforge.io</a>, in version 1.4.</p>


</body>

</html>