[postgis-tickets] [PostGIS] #2918: Use GeographicLib functions for ST_Azimuth, ST_Distance and ST_Project

PostGIS trac at osgeo.org
Mon Sep 1 05:00:44 PDT 2014


#2918: Use GeographicLib functions for ST_Azimuth, ST_Distance and ST_Project
---------------------+------------------------------------------------------
 Reporter:  mwtoews  |       Owner:  pramsey
     Type:  patch    |      Status:  new    
 Priority:  medium   |   Milestone:         
Component:  postgis  |     Version:  trunk  
 Keywords:           |  
---------------------+------------------------------------------------------
 I've been testing the direct and inverse functions in geodesic.h, and they
 look pretty good! This stand-alone C library which is detachable from
 [http://sourceforge.net/p/geographiclib/code/ci/master/tree/legacy/C/
 GeographicLib] was recently published by Karney (2013) with an MIT/X11
 License. The peer-reviewed algorithms are "accurate, robust, and fast
 solutions to the direct and inverse geodesic problems".

 The attached patch is only a start, with a `USE_GEODESIC` def at the top
 of `lwspheroid.c` to toggle the library's use, or the existing library
 use. Yet to come are more regression tests, speed testing (I'd like help
 here), and any related discussion on if this is a good idea. Also, there
 are polygon area functions that I'll look at further only if things are
 looking good.

 The library is actually really easy to use. All angular units are in
 degrees, and linear units are in metres.

  * `geod_inverse` : takes two points, and returns the forward and reverse
 azimuths (these are different!), and the distance between the two points.
 Used in `spheroid_distance` and `spheroid_direction`.
  * `geod_direct` : takes a point, a forward azimuth, and distance, and
 returns the second point and the reverse azimuth. Used in
 `spheroid_project`.

 Although I haven't written the extra regression tests yet, the library
 solves #2913 for inverse solutions to near-antipodal points.

 The patch passes all of the existing regression tickets.

 Patch source at GitHub pull request:
  * https://github.com/postgis/postgis/pull/27
  * https://github.com/postgis/postgis/pull/27.diff

 == References ==
 C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87(1), 43–55 (Jan.
 2013); DOI:[http://dx.doi.org/10.1007/s00190-012-0578-z
 10.1007/s00190-012-0578-z] [http://geographiclib.sourceforge.net/geod-
 addenda.html Addenda]

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2918>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list