This discussion is archived

# Function to Calculate the Distance Between  Latitude & Longitude

Currently Being Moderated
hi,

Experts thanks in Advance for the Response
I need to calculate the Distance Between Latitude & Longitude
The Latitude & Longitude Values are as Follows

Latitude: 24.757222 Longitude: 46.720556

in the Following URL

On Placing the Below Values as Follows in the Serach Area of the Above Link We can get the Location

24.757222,46.720556

Many thanks

Edited by: FZ13 on Feb 1, 2010 12:28 PM
• ###### 1. Re: Function to Calculate the Distance Between  Latitude & Longitude
Currently Being Moderated
Do you mean, you have two sets of Longitude and Latitude coordinates, and you want to calculate the shortest distance around the earth's surface between them?

The SDO_GEOM package has the SDO_DISTANCE function that takes two geometries (e.g. points), a tolerance value and optional units value. E.g. to find the distance between your coordinates and (24.2,46.3):

SELECT SDO_GEOM.SDO_DISTANCE(
SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(24.2,46.3,NULL),NULL,NULL),
SDO_GEOMETRY(2001,8307,SDO_POINT_TYPE(24.757222,46.720556,NULL),NULL,NULL),
0.0001,'unit=km') AS DISTANCE_BETWEEN_POINTS
FROM DUAL

#### Legend

• Correct Answers - 10 points