DISTANCE
Returns the distance (in kilometers) between two points. You specify the latitude and longitude of both the starting point and the ending point. You can also specify the radius of curvature for greater accuracy when using an ellipsoidal model.
Behavior Type
Syntax
DISTANCE ( lat0, lon0, lat1, lon1, radius_of_curvature )
Parameters
lat0 |
Specifies the latitude of the starting point. |
lon0 |
Specifies the longitude of the starting point. |
lat1 |
Specifies the latitude of the ending point |
lon1 |
Specifies the longitude of the ending point. |
radius_of_curvature |
Specifies the radius of the curvature of the earth at the midpoint between the starting and ending points. This parameter allows for greater accuracy when using an ellipsoidal earth model. If you do not specify this parameter, it defaults to the WGS-84 average r1 radius, about 6371.009 km. |
Example
This example finds the distance in kilometers for 1 degree of longitude at latitude 45 degrees, assuming earth is spherical.
SELECT DISTANCE(45,0, 45,1); DISTANCE ---------------------- 78.6262959272162 (1 row)