<CF_GREATCIRCLE>
version 1.1
Home

Used to calculate great circle distance between two latitudes and longitudes on the surface of the earth.

Installation

Copy the GreatCircle.cfm file to your \cfusion\customtags\ folder, or the folder you'll be calling it from within your website.

Syntax

<CF_GREATCIRCLE UNITS = "NM,SM or KM"
   ROUND = "No"
   LAT1 = "starting latitude"
   LON1 = "starting longitude"
   LAT2 = "ending latitude"
   LON2 = "ending longitude">
Returns the variable #distance#

Attributes

UNITS

Optional. Unit of measure returned value will be in. Defaults to Nautical Miles.

  • NM - Nautical miles (default)
  • SM - Statute miles
  • KM - Kilometers
ROUND

Optional. Determines if result will be rounded to nearest mile or not. If any FALSE value (FALSE, 0, No) answer will NOT be rounded. Any other value will round the answer. DEFAULT IS FALSE.

NOTE: You can format the result to your desired accuracy with the NumberFormat and the appropriate mask if you tell CF_GREATCIRCLE NOT to round the answer.

LAT1

Required. Latitude of starting point in degrees and minutes with North (N) or South (S).

MAY contain an "N" or "S", including zero latitude. If "N" or "S" is missing, DEFAULTS TO "N"

LON1

Required. Longitude of starting point in degrees and minutes with East (E) or West (W).

MAY contain an "E" or "W", including zero longitude. If "E" or "W" is missing, DEFAULTS TO "W"

LAT2

Required. Latitude of ending point in degrees and minutes with North (N) or South (S).

MAY contain an "N" or "S", including zero latitude. If "N" or "S" is missing, DEFAULTS TO "N"

LON2

Required. Longitude of ending point in degrees and minutes with East (E) or West (W).

MAY contain an "E" or "W", including zero longitude. If "E" or "W" is missing, DEFAULTS TO "W"

Example

<CF_GREATCIRCLE UNITS = "KM"
    ROUND = "No"
    LAT1 = "30.44N"
    LON1 = "20W"
    LAT2 = "0.05S"
    LON2 = "113.44E">
 

Distance from 30.44N 44.20W to 0.05S 113.44E is
<cfoutput>#distance#</cfoutput> kilometers

Home

Modified by: Tom Nunamaker
Copyright © 1998-2001, Paladin Computers, All rights reserved.