Call now: (800) 766-1884  


 SQL Server Tips
 SQL Server Training

 SQL Server Consulting
 SQL Server Support
 SQL Server Remote DBA

 SQL Server Scripts
 Scripts Menu





SQL Server

SQL Server Tips by Gama and Naughter Consulting



A common need in GIS databases is to determine the distance between two geographical points as measured along the Earth’s surface. If the Earth’s surface was spherical then this could be determined relatively easily using standard spherical trigonometry. To obtain high accuracy we must again consider the Earth’s shape as an ellipsoid. The algorithm used by XP_GIS_DISTANCE_BETWEEN is provided by H. Abdoyer and is described in the book “Astronomical Algorithms” Second Edition by Jean Meeus. The calculation is implemented in the helper function “DistanceBetweenPoints“. This XP takes 5 parameters. The first parameter is the first point’s latitude, the second is the first point’s longitude, the third is the second point’s latitude and the fourth parameter is the second point’s longitude. Upon return from this XP the fifth and final parameter contains the distance between the two points in meters. If you would prefer this value in the Imperial measurement system as statute miles, then simply divide the value by 1609.

The above book excerpt is from:

Super SQL Server Systems
Turbocharge Database Performance with C++ External Procedures

ISBN: 0-9761573-2-2
Joseph Gama, P. J. Naughter





Burleson Consulting Remote DB Administration







Burleson is the America's Team

Note: The pages on this site were created as a support and training reference for use by our staff of DBA consultants.  If you find it confusing, please exit this page.

Errata?  SQL Server technology is changing and we strive to update our SQL Server support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:and include the URL for the page.

Burleson Consulting
SQL Server database support


Copyright © 1996 -  2013 by Vaaltech Web Services. All rights reserved.

Hit Counter