Skip to content

Commit e13b7a7

Browse files
committed
more docs added
1 parent 9c78248 commit e13b7a7

File tree

1 file changed

+63
-2
lines changed

1 file changed

+63
-2
lines changed

README.md

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ A golang port of [geographiclib](https://geographiclib.sourceforge.io/).
1212
- [Background: Geodesics on an Ellipsoid](#background-geodesics-on-an-ellipsoid)
1313
- [Short Explanation](#short-explanation-of-library)
1414
- [Long Explanation](#long-explanation-of-library)
15+
- [Library Interface](#the-library-interface)
1516
- [GeographicLib API](#geographiclib-api)
1617
- [Examples](#examples)
1718
- [Progress](#progress)
1819

1920
## Short Explanation of Library
2021
This library can calculate the following:
21-
- Given a latitude/longitude point, an angle from due North, and a distance, calculate the latitude/longitude of the new point. This is calculated with any function starting with `DirectCalc...`
22-
- Given two latitude/longitude points, calculate the distance between them, and the angles formed from due North to the line connecting the two points. This is calculated with any function starting with `InverseCalc...`
22+
- Given a latitude/longitude point, an angle from due North, and a distance, calculate the latitude/longitude of the new point. This is calculated with any function starting with `DirectCalc...()`
23+
- Given two latitude/longitude points, calculate the distance between them, and the angles formed from due North to the line connecting the two points. This is calculated with any function starting with `InverseCalc...()`
2324
- Given a set of points or edges that form a polygon, calculate the area of said polygon. This is done by calling `NewPolygonArea()`, adding the points, and finally calling the `Compute()` method to get both the area and the perimeter of the polygon.
2425
- Given a set of points or edges that form a polyline (a set of connected lines), calculate the perimeter of the line. This is done by calling `NewPolygonArea()` with `is_polyline` set to true, adding the points, and finally calling the `Compute()` method to get the length of the lines.
2526

@@ -83,6 +84,66 @@ The shortest distance found by solving the inverse problem is (obviously) unique
8384
The area of a geodesic polygon can be determined by summing $S_{12}$ for successive edges of the polygon ($S_{12}$ is negated so that clockwise traversal of a polygon gives a positive area). However, if the polygon encircles a pole, the sum must be adjusted by $\pm A/2$, where $A$ is the area of the full ellipsoid, with the sign chosen to place the result in $(-A/2, A/2]$.
8485

8586
## The library Interface
87+
This section is mostly copied from the [python documentation](https://geographiclib.sourceforge.io/Python/doc/interface.html), and altered where necessary.
88+
### The Units
89+
All angles (latitude, longitude, azimuth, arc length) are measured in degrees with latitudes increasing northwards, longitudes increasing eastwards, and azimuths measured clockwise from north. For a point at a pole, the azimuth is defined by keeping the longitude fixed, writing $\phi = \pm (90 \degree − \varepsilon)$, and taking the limit $\varepsilon → 0+$
90+
91+
### Geodesic Dictionary
92+
The results returned by `DirectCalc...()` and `InverseCalc...()` are structs that may contain some or all of the following:
93+
94+
- **LatDeg** = $φ_1$, latitude of a point (degrees)
95+
- **LonDeg** = $λ_1$, longitude of a point (degrees)
96+
- **AziDeg** = $α_1$, azimuth of line at point (degrees)
97+
- **DistanceM** = $s_{12}$, distance from 1 to 2 (meters)
98+
- **ArcLengthDeg** = $σ_{12}$, arc length on auxiliary sphere from 1 to 2 (degrees)
99+
- **ReducedLengthM** = $m_{12}$, reduced length of geodesic (meters)
100+
- **M12** = $M_{12}$, geodesic scale at 2 relative to 1 (dimensionless)
101+
- **M21** = $M_{21}$, geodesic scale at 1 relative to 2 (dimensionless)
102+
- **S12M2** = $S_{12}$, area between geodesic and equator (meters2)
103+
104+
### Outmaks and caps
105+
There are a number of functions provided by the API. Each returns a struct with the fields calculated. A method that returns a struct with fewer fields than another means fewer calculations were made. *For faster computation, call methods that return only the fields you need.*
106+
107+
You can also specify your own subset of fields by using the `DirectCalcWithCapabilities()` or `InverseCalcWithCapabilities()` and passing in a `capabilities` (sometimes called `caps`) field. `capabilities` are obtained by `or`’ing together the following values
108+
109+
- `EMPTY`, no capabilities, no output
110+
- `LATITUDE`, compute latitude, lat2
111+
- `LONGITUDE`, compute longitude, lon2
112+
- `AZIMUTH`, compute azimuths, azi1 and azi2
113+
- `DISTANCE`, compute distance, s12
114+
- `STANDARD`, all of the above
115+
- `DISTANCE_IN`, allow s12 to be used as input in the direct problem
116+
- `REDUCEDLENGTH`, compute reduced length, m12
117+
- `GEODESICSCALE`, compute geodesic scales, M12 and M21
118+
- `AREA`, compute area, S12
119+
- `ALL`, all of the above;
120+
- `LONG_UNROLL`, unroll longitudes
121+
122+
`DISTANCE_IN` is a capability provided to the GeodesicLine constructor. It allows the position on the line to specified in terms of distance. (Without this, the position can only be specified in terms of the arc length.) This only makes sense in the caps parameter.
123+
124+
`LONG_UNROLL` controls the treatment of longitude. If it is not set then the lon1 and lon2 fields are both reduced to the range $[−180\degree, 180\degree]$. If it is set, then lon1 is as given in the function call and (lon2 − lon1) determines how many times and in what sense the geodesic has encircled the ellipsoid. This only makes sense in the outmask parameter.
125+
126+
### Restrictions on Parameters
127+
- Latitudes must lie in $[−90\degree, 90\degree]$. Latitudes outside this range are replaced by NaNs.
128+
- The distance $s_{12}$ is unrestricted. This allows geodesics to wrap around the ellipsoid. Such geodesics are no longer shortest paths. However they retain the property that they are the straightest curves on the surface.
129+
- Similarly, the spherical arc length $a_{12}$ is unrestricted.
130+
- Longitudes and azimuths are unrestricted; internally these are exactly reduced to the range $[−180\degree, 180\degree]$; but see also the LONG_UNROLL bit.
131+
- The equatorial radius a and the polar semi-axis b must both be positive and finite (this implies that $−\infty < f < 1)$.
132+
- The flattening $f$ should satisfy $f \in [−1/50,1/50]$ in order to retain full accuracy. This condition holds for most applications in geodesy.
133+
134+
Reasonably accurate results can be obtained for $−0.2 \le f \le 0.2$. Here is a table of the approximate maximum error (expressed as a distance) for an ellipsoid with the same equatorial radius as the WGS84 ellipsoid and different values of the flattening.
135+
136+
| $\text{abs}(f)$ | $\text{error}$ |
137+
|--------|--------|
138+
| 0.003 | 15 nm |
139+
| 0.01 | 25 nm |
140+
| 0.02 | 30 nm |
141+
| 0.05 | 10 μm |
142+
| 0.1 | 1.5 mm |
143+
| 0.2 | 300 mm |
144+
145+
146+
Here 1 nm = 1 nanometer = $10^{−9}$ m (not 1 nautical mile!)
86147

87148
## GeographicLib API
88149

0 commit comments

Comments
 (0)