Tuesday, 7 May 2019

coordinate system - Variation of algorithms to find point from another point with bearing and distance


There are several algorithms to calculate distance between two latitude/longitude points.




  1. Haversine

  2. Hubeny

  3. Lambert-Andoyer

  4. Vincenty's formulae for inverse problem


But there are not so many algorithms (actually I can't finally find it) which can calculate latitude/longitude of point B from another latitude/longitude point A with bearing and distance.



  1. Vincenty's formulae for direct problem


I'm glad to know if there are any algorithms which is lesser accurate, but faster than Vincenty's formulae.




Answer



How about a method which is both more accurate and faster? This is provided by GeographicLib. Comparative timings (C++ implementations on a 2.66GHz Intel processor, using g++) are:


Vincenty direct:                          1.11 us
GeographicLib::Geodesic::Direct: 0.88 us
GeographicLib::GeodesicLine::Position: 0.37 us
GeographicLib::GeodesicLine::ArcPosition: 0.31 us

The accuracy of Vincenty's formulas is about 0.1 mm, while the accuracy of the GeographicLib algorithms about 0.01 um. Geodesic::Direct does a straight solution of the direct problem. It's somewhat faster than Vincenty because it's non-iterative and because it uses Clenshaw summation to evaluate the trigonometric series. GeodesicLine::Position allows you to calculate many points along a single geodesic about 2.4 times faster. If you merely want some points on a geodesic which are approximately equally spaced (e.g., for plotting it), you can use GeodesicLine::ArcPosition and shave a little extra time off the computation. You can reduce the time still further by reducing the order of the series used by GeographicLib from 6 to 3 by compiling with


-DGEOGRAPHICLIB_GEODESIC_ORDER=3


The accuracy is then 0.04 mm, i.e., comparable to, but slightly better than, Vincenty.


A cookbook recipe for solving the equivalent problem on a sphere is given by the Wikipedia entry on great-circle navigation.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...