distgeocode(geocode1, geocode2 [, method] )

The distgeocode function calculates the distance, in miles, between two given geocodes. It uses the "Great Circle" method for calculation by default, which is very accurate. A faster, but less accurate, calculation can be done with the Pythagorean theorem. It is not designed for distances on a sphere, however, and becomes somewhat inaccurate at larger distances and on paths that approach the poles. To use the Pythagorean theorem, pass a third string parameter, "pythagorean", to force that method. "greatcircle" can also be specified as a method.

For example:

  • New York (JFK) to Cleveland (CLE), the Pythagorean method is off by .8 miles (.1%)

  • New York (JFK) to Los Angeles (LAX), the Pythagorean method is off by 22.2 miles (.8%)

  • New York (JFK) to South Africa (PLZ), the Pythagorean method is off by 430 miles (5.2%)

For examples of using distgeocode, see the geocode script in the texis/samples directory.

For a very fast method that leverages geocodes for selecting cities within a certain radius, see the <code2geo> and <geo2code> functions in the Vortex manual.

Copyright © Thunderstone Software     Last updated: Tue Feb 21 13:46:30 EST 2017
Copyright © 2017 Thunderstone Software LLC. All rights reserved.