Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


GeographicLib / News: Recent posts

GeographicLib 1.36 (released 2014-05-13)

Changes between 1.36 (released 2014-05-13) and 1.35 versions:

  • Changes to comply with NGA's prohibition of the use of the
    upper-case letters N/S to designate the hemisphere when displaying
    UTM/UPS coordinates:
    • UTMUPS::DecodeZone allows north/south as hemisphere designators
      (in addition to n/s);
    • UTMUPS::EncodeZone now encodes the hemisphere in lower case (to
      distinguish this use from a grid zone designator);
    • UTMUPS::EncodeZone takes an optional parameter abbrev to
      indicate whether to use n/s or north/south as the hemisphere
    • GeoCoords::UTMUPSRepresentation and AltUTMUPSRepresentation
      similarly accept the abbrev parameter;
    • GeoConvert uses the flags -a and -l to govern whether UTM/UPS
      output uses n/s (the -a flag) or north/south (the -l flag) to
      denote the hemisphere;
    • Fixed a bug what allowed +3N to be accepted as an alternation
      UTM zone designation (instead of 3N).
      WARNING: The use of lower case n/s for the hemisphere might cause
      compatibility problems. However DecodeZone has always accepted
      either case; so the issue will only arise with other software
      reading the zone information. To avoid possible misinterpretation
      of the zone designator, consider calling EncodeZone with abbrev =
      false and GeoConvert with -l, so that north/south are used to
      denote the hemisphere.... read more
Posted by Charles Karney 2014-05-13


After upgrading to GeographicLib version 1.34 or later, it's possible
that projects that compile and link to GeographicLib will get this
compiler error:

#error :  GEOGRAPHICLIB_SHARED_LIB must be 0 or 1

This will only happen on non-Windows systems and is caused by cmake
finding the cmake configuration for a pre-1.34 version of GeographicLib.
The fix is to remove all earlier cmake configuration files with (as
root):... read more

Posted by Charles Karney 2014-03-15

GeographicLib 1.35 (released 2014-03-13)

Changes between 1.35 (released 2014-03-13) and 1.34 versions:

  • Fix blunder in UTMUPS::EncodeEPSG (found by Ben Adler).

  • Matlab wrapper routines geodesic{direct,inverse,line} switch to
    "exact" routes if |f| > 0.02.

  • GeodSolve.cgi allows ellipsoid to be set (and uses the -E option
    for GeodSolve).

  • Set title in HTML versions of man pages for the utility programs.

  • Changes in cmake support:

    • add _d to names of executables in debug mode of Visual Studio;
    • add support for Android (cmake-only), thanks to Pullan Yu;
    • check CPACK version numbers supplied on command line;
    • configured version of is
      project-config.cmake (instead of geographiclib-config.cmake), to
      prevent find_package incorrectly using this file;
    • fix tests with multi-line output;
    • this release includes a file, pom.xml, which is used by an
Posted by Charles Karney 2014-03-13

Bug in UTMUPS::EncodeEPSG (+ fix)

Ben Adler found a bug in UTMUPS::EncodeEPSG. Here is the fix

diff --git a/src/UTMUPS.cpp b/src/UTMUPS.cpp
index 2abf43e..ec66c1d 100644
--- a/src/UTMUPS.cpp
+++ b/src/UTMUPS.cpp
@@ -292,7 +292,7 @@ namespace GeographicLib {
     if (zone == UPS)
       epsg = epsgS;
     else if (zone >= MINUTMZONE && zone <= MAXUTMZONE)
-      epsg = epsg + (zone - MINUTMZONE) + epsg01S;
+      epsg = (zone - MINUTMZONE) + epsg01S;
     if (epsg >= 0 && northp)
       epsg += epsgN - epsgS;
     return epsg;... [read more](/p/geographiclib/news/2014/01/bug-in-utmupsencodeepsg--fix/)
Posted by Charles Karney 2014-01-16

GeographicLib 1.34 (released 2013-12-11)

  • Many changes in cmake support:
    • minimum version of cmake needed increased to 2.8.4 (which was
      released in 2011-02);
    • allow building both shared and static librarys with
    • both shared and static libraries (Release plus Debug) included in
      binary installer;
    • find_package uses COMPONENTS and GeographicLib_USE_STATIC_LIBS to
      select the library to use;
    • find_package version checking allows nmake and Visual Studio
      generators to interoperate on Windows;
    • find_package (GeographicLib ...) requires that GeographicLib be
      capitalized correctly;
    • on Unix/Linux, don't include the version number in directory for
      the cmake configuration files;
    • the GEOGRAPHICLIB_EXAMPLES configuration parameter is no longer
      used; cmake always configures to build the examples, but they are
      not built by default (instead build targets: exampleprograms and
    • matlab-all target renamed to matlabinterface;
    • the configuration parameters PACKAGE_PATH and INSTALL_PATH are
      now deprecated (use CMAKE_INSTALL_PREFIX instead);
    • on Linux, the installed package is relocatable;
    • on MacOSX, the installed utilities can find the shared library.... read more
Posted by Charles Karney 2013-12-11

GeographicLib 1.33 (released 2013-10-08)

  • Add NETGeographic .NET wrapper library (courtesy of Scott Heiman).
  • Make inspector functions in GeographicLib::Ellipsoid const.
  • Add Accumulator.cpp to instantiate GeographicLib::Accumulator.
  • Defer some of the initialization of GeographicLib::OSGB to when it
    is first called.
  • Fix bug in autoconf builds under MacOS.
Posted by Charles Karney 2013-10-08

GeographicLib 1.32 (released 2013-07-12)

  • Generalize C interface for polygon areas to allow vertices to be
    specified incrementally.

  • Fix way flags for C++11 support are determined.

Posted by Charles Karney 2013-07-12

GeographicLib 1.31 (released 2013-07-01)

  • Changes breaking binary compatibility (source compatibility is

    • overloaded versions of DMS::Encode,
      EllipticFunction::EllipticFunction, and
      GeoCoords::DMSRepresentation, have been eliminated by the use of
      optional arguments;
    • correct the declaration of first arg to UTMUPS::DecodeEPSG.
  • FIX BUG in GeographicLib::GravityCircle constructor (found by
    Mathieu Peyréga) which caused bogus results for the gravity
    disturbance and gravity anomaly vectors. (This only affected
    calculations using GravityCircle. GravityModel calculations did not
    suffer from this bug.)... read more

Posted by Charles Karney 2013-07-01

BUG in GravityCircle constructor

Mathieu Peyréga found a bug in the constructor for GravityCircle which
caused bogus results for the gravity disturbance and gravity anomaly
vectors. (This only affected calculations using GravityCircle.
GravityModel calculations did not suffer from this bug.) The following
patch (which will be included in the next release) fixes the problem.

--- a/include/GeographicLib/GravityCircle.hpp
+++ b/include/GeographicLib/GravityCircle.hpp
@@ -71,7 +71,7 @@ namespace GeographicLib {
, _h(h)
, _Z(Z)
, _Px(P)
- , _invR(Math::hypot(_Px, _Z))
+ , _invR(1 / Math::hypot(_Px, _Z))
, _cpsi(_Px * _invR)
, _spsi(_Z * _invR)
, _cphi(cphi)

Posted by Charles Karney 2013-04-10

GeographicLib 1.30 (released 2013-02-27)

  • Changes to geodesic routines:
    • fix BUG in fail-safe mechanisms in Geodesic::Inverse;
    • the command line utility Geod is now called GeodSolve;
    • allow addition of polygon edges in PolygonArea;
    • add full Maxima implementation of geodesic algorithms.
Posted by Charles Karney 2013-02-27

GeographicLib 1.29 (released 2013-01-16)

  • Changes to allow compilation with libc++ (courtesy of Kal Conley).

  • Add description of geodesics on triaxial ellipsoid to

  • Update journal reference for "Algorithms for geodesics".

Posted by Charles Karney 2013-01-16

URLs for C and Fortran geodesic library documentaton

Here are the URLs for the documentation on the C and Fortran geodesic

Posted by Charles Karney 2012-12-11

Example of PolygonArea bug (fixed in version 1.28)

Here an example of a triangle whose area is now computed correctly by

lat lon
  9 -0.00000000000001
  9 180
  9 0

Previously (version 1.27 and before) the area was computed as
approximately 1/2 of the earth's area. Now (version 1.28) the area is
correctly reported as close to 0.

Posted by Charles Karney 2012-12-11

GeographicLib 1.28 (released 2012-12-11)

  • Changes to geodesic routines:
    • compute longitude difference exactly;
    • hence fix BUG in area calculations for polygons with vertices very
      close to the prime meridian;
    • fix BUG is geoddistance.m where the value of m12 was wrong for
      meridional geodesics;
    • add Matlab implementations of the geodesic projections;
    • remove unneeded special code for geodesics which start at a pole;
    • include polygon area routine in C and Fortran implementations;
    • add doxygen documentation for C and Fortran libraries.
Posted by Charles Karney 2012-12-11

Mailing lists for GeographicLib

I've creates two mailing lists for GeographicLib

  • geographiclib-announce -- for announcements of new versions
  • geographiclib-users -- for bug reports, general questions

To sign up visit

Posted by Charles Karney 2012-11-29

GeographicLib 1.27 (released 2012-11-29)

  • Changes to geodesic routines:
    • add native matlab implementations: geoddistance.m, geodreckon.m,
    • add C and Fortran implementations;
    • improve the solution of the direct problem so that the series
      solution is accurate to round off for |f| < 1/50;
    • tighten up the convergence criteria for solution of the inverse
    • no longer signal failures of convergence with NaNs (a slightly
      less accurate answer is returned instead).... read more
Posted by Charles Karney 2012-11-29

GeographicLib 1.26 (released 2012-10-22)

  • Replace the series used for geodesic areas by one with better
    convergence (this only makes an appreciable difference if |f| >
Posted by Charles Karney 2012-10-22

WARNING: Accuracy of area computation in GeodesicExact v1.25

The documentation for GeodesicExact notes that the area is computed using a series expansion and implies that the result in accurate if b/a ∈ [1/3, 3]. This turns out to be wildly optimistic. The results are accurate to roundoff for |f| < 0.1. Reasonably accurate results may be obtained for b/a ∈ [0.8, 1.5]. Outside this range the results for the area should not be trusted at all.... read more

Posted by Charles Karney 2012-10-19

Fix to a python script in GeographicLib 1.25 noticed a typo in one of the python scripts included
with version 1.25. I've fixed this in the source tree and created new
installation packages. In case you have already downloaded version
1.25, here is the patch:

diff --git a/python/geographiclib/ b/python/geographiclib/
index 5ee15bb..371e212 100644
--- a/python/geographiclib/
+++ b/python/geographiclib/
@@ -162,7 +162,7 @@ class GeodesicLine(object):
     # sig2 = sig1 + sig12
     ssig2 = self._ssig1 * csig12 + self._csig1 * ssig12
     csig2 = self._csig1 * csig12 - self._ssig1 * ssig12
-    dn2 = math.sqrt(1 + self_k2 * Math.sq(ssig2))
+    dn2 = math.sqrt(1 + self._k2 * Math.sq(ssig2))
     if outmask & (
       Geodesic.DISTANCE | Geodesic.REDUCEDLENGTH | Geodesic.GEODESICSCALE):
       if arcmode:
Posted by Charles Karney 2012-10-17

GeographicLib 1.25 (released 2012-10-16)

  • Changes to geodesic calculations:
    • restart Newton's method in Geodesic::Inverse when it goes awry;
    • back up Newton's method with the bisection method;
    • Geodesic::Inverse now converges for any value of f;
    • add GeodesicExact and GeodesicLineExact which are formulated in
      terms of elliptic integrals and thus yield accurate results
      even for very eccentric ellipsoids.
    • the -E option to Geod invokes these exact classes.... read more
Posted by Charles Karney 2012-10-16

GeographicLib 1.24 (released 2012-09-22)

  • Allow the specification of the hemisphere in UTM coordinates in
    order to provide continuity across the equator:

    • add UTMUPS::Transfer;
    • add GeoCoords::UTMUPSRepresentation(bool, int) and
      GeoCoords::AltUTMUPSRepresentation(bool, int);
    • use the hemisphere letter in, e.g., GeoConvert -u -z 31N.
  • Add UTMUPS::DecodeEPSG and UTMUPS::EncodeEPSG.

  • cmake changes:

    • restore support for cmake 2.4.x;
    • explicitly check version of doxygen.... read more
Posted by Charles Karney 2012-09-22

GeographicLib 1.23 (released 2012-07-17)

  • Documentation changes:
  • remove html documentation from distribution and use web links if
    doxygen is not available;
  • use doxygen tags to document exceptions;
  • begin migrating the documentation to using Greek letters where
    appropriate (requires doxygen or later).

  • Add Math::AngNormalize and Math::AngNormalize2; the allowed range
    for longitudes and azimuths widened to [-540d, 540d).... read more

Posted by Charles Karney 2012-07-17

BUG (and fix) in LambertConformalConic::Forwa

There's a bug in LambertConformalConic::Forward in versions 1.22 and
earlier which results in incorrect results being returned when the
tangent latitude is negative. This following patch fixes the problem.
This will be included in the next release.

diff --git a/src/LambertConformalConic.cpp b/src/LambertConformalConic.cpp
index 4d5af6d..0c7561d 100644
--- a/src/LambertConformalConic.cpp
+++ b/src/LambertConformalConic.cpp
@@ -343,7 +343,7 @@ namespace GeographicLib {
// and drho is evaluated with divided differences
lam = lon * Math::degree<real>(),
- phi = lat * Math::degree<real>(),
+ phi = sign * lat * Math::degree<real>(),
sphi = sin(phi), cphi = abs(lat) != 90 ? cos(phi) : epsx
tphi = sphi/cphi, tbet = _fm * tphi, scbet = hyp(tbet),
scphi = 1/cphi, shxi = sinh(eatanhe(sphi)),

Posted by Charles Karney 2012-07-15

GeographicLib 1.22 (released 2012-05-27)

  • Add Geohash and Ellipsoid classes.

  • Fix bug in AlbersEqualArea of very prolate ellipsoids (b^2 > 2

  • cmake changes:

  • optionally use PACKAGE_PATH and INSTALL_PATH to determine
  • use COMMON_INSTALL_PATH to determine layout of installation
  • as a consequence, the installation paths for the documentation,
    and python and matlab interfaces are shortened for Windows;
  • zip source distribution now uses DOS line endings;
  • the tests work in debug mode for Windows;
  • default setting of GEOGRAPHICLIB_DATA does not depend on
  • add a cmake configuration for build tree.
Posted by Charles Karney 2012-05-27

GeographcLib 1.21 (released 2012-04-25)

  • Support colon-separated DMS output:
  • DMS::Encode and GeoCoords::DMSRepresentation generalized;
  • GeoConvert and Geod now accept a -: option.

  • GeoidEval does not print the gradient of the geoid height by default
    (because it's subject to large errors); give the -g option to get
    the gradient printed.

  • Work around optimization BUG in GeographicLib::Geodesic::Inverse
    with tdm mingw g++ version 4.6.1.... read more

Posted by Charles Karney 2012-04-24