[postgis-users] upgraded distance-on-ellipse calculations

David Blasby dblasby at refractions.net
Thu Feb 5 12:46:58 PST 2004


I tested and modified the distance-on-ellipse calculations (in 
postgis_proj.c).  This affects the length_ellipse(linestring), 
length3d_ellipse(linestring), and distance_ellipse(point,point) functions.

I tested it on 9 million point-to-point calculations and compared it to 
the PROJ4 'geod' function.  They agreed to about 1mm accuracy in all but 
two case (3.5mm difference).

I also noticed that both the postgis method (orginally done by Dave Skea 
- see code) and the PROJ4 method break down when the actual distance is 
very small (<10cm).  In order to handle this case, I added code that 
looks at the curvature of the earth at one of the points.  It works very 
well (see complete description for the distance_sphere_method()) in this 
case.

Currently, its setup to first try the accurate method.  If this fails, 
then it tries the curvature method.

dave
ps. The curvature method is about 20* quicker than the more accurate 
method.  99.999% of the time the curvature method is within 0.1% of the 
PROJ4/Skea method.




More information about the postgis-users mailing list