Contents:
This toolbox provides native Octave/MATLAB implementations of a subset of the C++ library, GeographicLib. Key components of this toolbox are
- Geodesics, direct, inverse, area calculations.
- Projections, transverse Mercator, polar stereographic, etc.
- Grid systems, UTM, UPS, MGRS.
- Geoid lookup, egm84, egm96, egm2008 geoids supported.
- Geometric transformations, geocentric, local cartesian.
- Great ellipse, direct, inverse, area calculations.
- Geodesics and coordinate conversions on a triaxial ellipsoid.
(The last two items are not present in the C++ library.) All the functions are vectorized and so offer speeds comparable to compiled C++ code when operating on arrays.
Some common features of these functions:
- Angles (latitude, longitude, azimuth, meridian convergence) are measured in degrees.
- Distances are measured in meters, areas in meters^2.
- Latitudes must lie in
[-90, 90]
. Latitudes outside this range are treated in NaNs - The ellipsoid is specified as
[a, e]
, wherea
= equatorial radius ande
= eccentricity. The eccentricity can be pure imaginary to denote a prolate ellipsoid. - Keep
|e| < 0.2
(i.e.,|f| <= 1/50
) for full double precision accuracy.
There is some overlap between this toolbox and MATLAB's Mapping Toolbox. However, this toolbox offers:
- better accuracy;
- treatment of oblate and prolate ellipsoid;
- guaranteed convergence for geoddistance;
- calculation of area and differential properties of geodesics;
- ellipsoidal versions of the equidistant azimuthal and gnomonic projections.
Licensed under the MIT/X11 License; see LICENSE.txt.
The toolbox is available from
-
SourceForge This includes packages for Octave,
geographiclib-octave-M.N.tar.gz
, and MATLAB,geographiclib_toolbox-M.N.mltbx
. HereM.N
stands for the version number, e.g.,2.0
. The Octave and MATLAB packages contain exactly the same code; it's just the packaging that is different. -
Octave Packages. This links to the SourceForge download site.
-
MATLAB Central. You need to log in to download packages from here. Use SourceForge (see above) if you don't have an account.
Either download the package to your computer and install it in Octave with the commands
pkg install geographiclib-octave-M.N.tar.gz
pkg load geographiclib
Or you can have Octave download and install the package with the commands
pkg install "https://sourceforge.net/projects/geographiclib/files/distrib-Octave/geographiclib-octave-M.N.tar.gz"
pkg load geographiclib
NOTE: in both cases replace M.N
by the version number.
Other useful Octave package commands
pkg list % list all packages
ver geographiclib % list version
pkg describe -verbose geographiclib % list functions
news geographiclib % change log
pkg test geographiclib % run the tests
pkg unload geographiclib % remove from path
pkg uninstall geographiclib % uninstall
The MATLAB toolbox can be installed via the "Add-Ons" menu item with MATLAB. Alternatively, it can be installed by downloading the package from SourceForge (see above) and using the command
matlab.addons.install geographiclib_toolbox-M.N.mltbx
NOTE: replace M.N
by the version number.
Other useful MATLAB toolboxes commands
t = matlab.addons.installedAddons % list all toolboxes
n = 1; % the row with geographiclib
matlab.addons.uninstall(t.Identifier(n)) % uninstall
geoddistance
- Distance between points on an ellipsoidgeodreckon
- Point at specified azimuth, range on an ellipsoidgeodarea
- Surface area of polygon on an ellipsoid
tranmerc_fwd
- Forward transverse Mercator projectiontranmerc_inv
- Inverse transverse Mercator projectionpolarst_fwd
- Forward polar stereographic projectionpolarst_inv
- Inverse polar stereographic projectioneqdazim_fwd
- Forward azimuthal equidistant projectioneqdazim_inv
- Inverse azimuthal equidistant projectioncassini_fwd
- Forward Cassini-Soldner projectioncassini_inv
- Inverse Cassini-Soldner projectiongnomonic_fwd
- Forward ellipsoidal gnomonic projectiongnomonic_inv
- Inverse ellipsoidal gnomonic projection
utmups_fwd
- Convert to UTM/UPS systemutmups_inv
- Convert from UTM/UPS systemmgrs_fwd
- Convert UTM/UPS coordinates to MGRSmgrs_inv
- Convert MGRS to UTM/UPS coordinates
geoid_height
- Compute the height of the geoid above the ellipsoidgeoid_load
- Load a geoid model
geocent_fwd
- Conversion from geographic to geocentric coordinatesgeocent_inv
- Conversion from geocentric to geographic coordinatesloccart_fwd
- Convert geographic to local cartesian coordinatesloccart_inv
- Convert local cartesian to geographic coordinates
gedistance
- Great ellipse distance on an ellipsoidgereckon
- Point along great ellipse at given azimuth and range
defaultellipsoid
- Set/return the default ellipsoidecc2flat
- Convert eccentricity to flatteningflat2ecc
- Convert flattening to eccentricitylinesimp
- Simplify 2d or 3d polylinegeographiclib_test
- The test suite for the geographiclib packagegeographiclib_signtest
- Another test suite
geoddoc
- Geodesics on an ellipsoid of revolutionprojdoc
- Projections for an ellipsoidgedoc
- Great ellipses on an ellipsoid of revolution
See also Implementation details for details of some of the algorithms used here.
triaxial.triaxial
- The constructortriaxial.carttocart2
- Find the closest point on the ellipsoidtriaxial.cart2tocart
- Find the point above a point on the ellipsoidtriaxial.cart2toellip
- Convert a surface point to ellipsoidal coordinatestriaxial.elliptocart2
- Convert ellipsoid coordinates to a surface pointtriaxial.carttoellip
- Convert cartesian coordinates to ellipsoidtriaxial.elliptocart
- Convert ellipsoidal coordinates to cartesiantriaxial.cart2togeod
- Convert a surface point to geodetic coordinatestriaxial.carttogeod
- Convert a cartesian point to geodetictriaxial.geodtocart
- Convert geodetic coordinates to cartesiantriaxial.cart2toparam
- Convert a surface point to parametric coordinatestriaxial.paramtocart2
- Convert parametric coordinates to a surface pointtriaxial.cart2togeocen
- Convert a surface point to geocentric coordinatestriaxial.geocentocart2
- Convert geocentric coordinates to a surface pointtriaxial.convert
- General coordinate conversiontriaxial.cart2rand
- Random points on the ellipsoidtriaxial.reckon
- Solve the direct geodesic problemtriaxial.distance
- Solve the inverse geodesic problemtriaxial.hybrid
- Solve the hybrid geodesic problemtriaxial.cart2norm
- Force a point to lie on the ellipsoidtriaxial.scaled
- Return a scaled ellipsoidtriaxial.cartproj
- Plot a curve on the ellipsoidtriaxial.horizon
- Point on the horizon of the ellipsoidtriaxial.ellipnorm
- Reduce ellipsoidal coordinates to standard rangestriaxial.ellipflip
- Switch ellipsoidal coordinates to the other sheettriaxial.demo
- Demonstrate geodesicstriaxial.doc
- Summary documentation of triaxial classtriaxial.tests
- Self test
See the change log. Releases are tagged in git as, e.g.,
v1.52
, v2.0
, etc.
- GeographicLib.
- Implementations in other languages.
- How to install the geoid datasets.
- C. F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475–485 (2011); preprint; addenda.
- C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87(1), 43–55 (2013); addenda.
- Implementation details for the triaxial class.