164 lines
7.5 KiB
Plaintext
164 lines
7.5 KiB
Plaintext
int usage(int retval, bool brief) {
|
|
if (brief)
|
|
( retval ? std::cerr : std::cout ) << "Usage:\n"
|
|
" Planimeter [ -r ] [ -s ] [ -l ] [ -e a f ] [ --comment-delimiter\n"
|
|
" commentdelim ] [ --version | -h | --help ] [ --input-file infile |\n"
|
|
" --input-string instring ] [ --line-separator linesep ] [ --output-file\n"
|
|
" outfile ]\n"
|
|
"\n"
|
|
"For full documentation type:\n"
|
|
" Planimeter --help\n"
|
|
"or visit:\n"
|
|
" http://geographiclib.sf.net/1.35/Planimeter.1.html\n";
|
|
else
|
|
( retval ? std::cerr : std::cout ) << "Man page:\n"
|
|
"NAME\n"
|
|
" Planimeter -- compute the area of geodesic polygons\n"
|
|
"\n"
|
|
"SYNOPSIS\n"
|
|
" Planimeter [ -r ] [ -s ] [ -l ] [ -e a f ] [ --comment-delimiter\n"
|
|
" commentdelim ] [ --version | -h | --help ] [ --input-file infile |\n"
|
|
" --input-string instring ] [ --line-separator linesep ] [ --output-file\n"
|
|
" outfile ]\n"
|
|
"\n"
|
|
"DESCRIPTION\n"
|
|
" Measure the area of a geodesic polygon. Reads polygon vertices from\n"
|
|
" standard input, one per line. Vertices may be given as latitude and\n"
|
|
" longitude, UTM/UPS, or MGRS coordinates, interpreted in the same way as\n"
|
|
" GeoConvert(1). (MGRS coordinates signify the center of the\n"
|
|
" corresponding MGRS square.) The end of input, a blank line, or a line\n"
|
|
" which can't be interpreted as a vertex signals the end of one polygon\n"
|
|
" and the start of the next. For each polygon print a summary line with\n"
|
|
" the number of points, the perimeter (in meters), and the area (in\n"
|
|
" meters^2).\n"
|
|
"\n"
|
|
" The edges of the polygon are given by the shortest geodesic between\n"
|
|
" consecutive vertices. In certain cases, there may be two or many such\n"
|
|
" shortest geodesics, and in that case, the polygon is not uniquely\n"
|
|
" specified by its vertices. This only happens with very long edges (for\n"
|
|
" the WGS84 ellipsoid, any edge shorter than 19970 km is uniquely\n"
|
|
" specified by its end points). In such cases, insert an additional\n"
|
|
" vertex near the middle of the long edge to define the boundary of the\n"
|
|
" polygon.\n"
|
|
"\n"
|
|
" By default, polygons traversed in a counter-clockwise direction return\n"
|
|
" a positive area and those traversed in a clockwise direction return a\n"
|
|
" negative area. This sign convention is reversed if the -r option is\n"
|
|
" given.\n"
|
|
"\n"
|
|
" Of course, encircling an area in the clockwise direction is equivalent\n"
|
|
" to encircling the rest of the ellipsoid in the counter-clockwise\n"
|
|
" direction. The default interpretation used by Planimeter is the one\n"
|
|
" that results in a smaller magnitude of area; i.e., the magnitude of the\n"
|
|
" area is less than or equal to one half the total area of the ellipsoid.\n"
|
|
" If the -s option is given, then the interpretation used is the one that\n"
|
|
" results in a positive area; i.e., the area is positive and less than\n"
|
|
" the total area of the ellipsoid.\n"
|
|
"\n"
|
|
" Only simple polygons are supported for the area computation. Polygons\n"
|
|
" may include one or both poles. There is no need to close the polygon.\n"
|
|
"\n"
|
|
"OPTIONS\n"
|
|
" -r toggle whether counter-clockwise traversal of the polygon returns a\n"
|
|
" positive (the default) or negative result.\n"
|
|
"\n"
|
|
" -s toggle whether to return a signed result (the default) or not.\n"
|
|
"\n"
|
|
" -l toggle whether the vertices represent a polygon (the default) or a\n"
|
|
" polyline. For a polyline, the number of points and the length of\n"
|
|
" the path joining them is returned; the path is not closed and the\n"
|
|
" area is not reported.\n"
|
|
"\n"
|
|
" -e specify the ellipsoid via a f; the equatorial radius is a and the\n"
|
|
" flattening is f. Setting f = 0 results in a sphere. Specify f < 0\n"
|
|
" for a prolate ellipsoid. A simple fraction, e.g., 1/297, is\n"
|
|
" allowed for f. (Also, if f > 1, the flattening is set to 1/f.) By\n"
|
|
" default, the WGS84 ellipsoid is used, a = 6378137 m, f =\n"
|
|
" 1/298.257223563. If entering vertices as UTM/UPS or MGRS\n"
|
|
" coordinates, use the default ellipsoid, since the conversion of\n"
|
|
" these coordinates to latitude and longitude always uses the WGS84\n"
|
|
" parameters.\n"
|
|
"\n"
|
|
" --comment-delimiter\n"
|
|
" set the comment delimiter to commentdelim (e.g., \"#\" or \"//\"). If\n"
|
|
" set, the input lines will be scanned for this delimiter and, if\n"
|
|
" found, the delimiter and the rest of the line will be removed prior\n"
|
|
" to processing. For a given polygon, the last such string found\n"
|
|
" will be appended to the output line (separated by a space).\n"
|
|
"\n"
|
|
" --version\n"
|
|
" print version and exit.\n"
|
|
"\n"
|
|
" -h print usage and exit.\n"
|
|
"\n"
|
|
" --help\n"
|
|
" print full documentation and exit.\n"
|
|
"\n"
|
|
" --input-file\n"
|
|
" read input from the file infile instead of from standard input; a\n"
|
|
" file name of \"-\" stands for standard input.\n"
|
|
"\n"
|
|
" --input-string\n"
|
|
" read input from the string instring instead of from standard input.\n"
|
|
" All occurrences of the line separator character (default is a\n"
|
|
" semicolon) in instring are converted to newlines before the reading\n"
|
|
" begins.\n"
|
|
"\n"
|
|
" --line-separator\n"
|
|
" set the line separator character to linesep. By default this is a\n"
|
|
" semicolon.\n"
|
|
"\n"
|
|
" --output-file\n"
|
|
" write output to the file outfile instead of to standard output; a\n"
|
|
" file name of \"-\" stands for standard output.\n"
|
|
"\n"
|
|
"EXAMPLES\n"
|
|
" Example (the area of the 100km MGRS square 18SWK)\n"
|
|
"\n"
|
|
" Planimeter <<EOF\n"
|
|
" 18N 500000 4400000\n"
|
|
" 18N 600000 4400000\n"
|
|
" 18N 600000 4500000\n"
|
|
" 18N 500000 4500000\n"
|
|
" EOF\n"
|
|
" => 4 400139.53295860 10007388597.1913\n"
|
|
"\n"
|
|
" The following code takes the output from gdalinfo and reports the area\n"
|
|
" covered by the data (assuming the edges of the image are geodesics).\n"
|
|
"\n"
|
|
" #! /bin/sh\n"
|
|
" egrep '^((Upper|Lower) (Left|Right)|Center) ' |\n"
|
|
" sed -e 's/d /d/g' -e \"s/' /'/g\" | tr -s '(),\\r\\t' ' ' | awk '{\n"
|
|
" if ($1 $2 == \"UpperLeft\")\n"
|
|
" ul = $6 \" \" $5;\n"
|
|
" else if ($1 $2 == \"LowerLeft\")\n"
|
|
" ll = $6 \" \" $5;\n"
|
|
" else if ($1 $2 == \"UpperRight\")\n"
|
|
" ur = $6 \" \" $5;\n"
|
|
" else if ($1 $2 == \"LowerRight\")\n"
|
|
" lr = $6 \" \" $5;\n"
|
|
" else if ($1 == \"Center\") {\n"
|
|
" printf \"%s\\n%s\\n%s\\n%s\\n\\n\", ul, ll, lr, ur;\n"
|
|
" ul = ll = ur = lr = \"\";\n"
|
|
" }\n"
|
|
" }\n"
|
|
" ' | Planimeter | cut -f3 -d' '\n"
|
|
"\n"
|
|
"SEE ALSO\n"
|
|
" GeoConvert(1). The algorithm for the area of geodesic polygon is given\n"
|
|
" in Section 6 of C. F. F. Karney, Algorithms for geodesics, J. Geodesy\n"
|
|
" 87, 43-55 (2013); DOI http://dx.doi.org/10.1007/s00190-012-0578-z\n"
|
|
" <http://dx.doi.org/10.1007/s00190-012-0578-z>; addenda:\n"
|
|
" http://geographiclib.sf.net/geod-addenda.html\n"
|
|
" <http://geographiclib.sf.net/geod-addenda.html>.\n"
|
|
"\n"
|
|
"AUTHOR\n"
|
|
" Planimeter was written by Charles Karney.\n"
|
|
"\n"
|
|
"HISTORY\n"
|
|
" Planimeter was added to GeographicLib, <http://geographiclib.sf.net>,\n"
|
|
" in version 1.4.\n"
|
|
;
|
|
return retval;
|
|
}
|