![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||||
| |||||
|
|
Hi this is a 10gR2 Standard Edition question. The requirement is to be able to calculate the distance between two co- oordinates expressed as latitude and longitude. |
|
Q1) How would the latitude and longitude be stored in an Oracle table (what data types)? |
|
Q2) What would an example query look like? |
|
Q3) Is this even possible with 10gR2 Standard Edition? |
|
Just to be clear (!) this is the sort of simplistic representation I guess item lat long ---- --- ---- P1 50.716667 -1.883333 P2 51.023332 -1.872231 The format of the lat/long are as I have been informed they are recorded in a remote system with which we are needing to integrate. I would want to be able to calculate the straight line distance between P1 and P2. Thanks for any pointers! |
#3
| |||
| |||
|
|
Hi this is a 10gR2 Standard Edition question. The requirement is to be able to calculate the distance between two co- oordinates expressed as latitude and longitude. Q1) How would the latitude and longitude be stored in an Oracle table (what data types)? Q2) What would an example query look like? Q3) Is this even possible with 10gR2 Standard Edition? Just to be clear (!) this is the sort of simplistic representation I guess item * * * * * lat * * * * *long ---- * * * * * --- * * * * *---- P1 * * * * * * 50.716667 * *-1.883333 P2 * * * * * * 51.023332 * *-1.872231 The format of the lat/long are as I have been informed they are recorded in a remote system with which we are needing to integrate. I would want to be able to calculate the straight line distance between P1 and P2. Thanks for any pointers! -- jeremy |
#4
| |||
| |||
|
|
Hi this is a 10gR2 Standard Edition question. The requirement is to be able to calculate the distance between two co- oordinates expressed as latitude and longitude. Q1) How would the latitude and longitude be stored in an Oracle table (what data types)? Q2) What would an example query look like? Q3) Is this even possible with 10gR2 Standard Edition? Just to be clear (!) this is the sort of simplistic representation I guess item * * * * * lat * * * * *long ---- * * * * * --- * * * * *---- P1 * * * * * * 50.716667 * *-1.883333 P2 * * * * * * 51.023332 * *-1.872231 The format of the lat/long are as I have been informed they are recorded in a remote system with which we are needing to integrate. I would want to be able to calculate the straight line distance between P1 and P2. Thanks for any pointers! -- jeremy |
#5
| |||
| |||
|
|
I vaguely remember teaching a class how to do this calculation of distance around a spherical object in the early 1990s (with only a calculator) - I could probably search and find the lesson plan which is probably right next to the proof that 1=2. While I am searching for that lesson plan, see if the following article is helpful: http://www.movable-type.co.uk/scripts/latlong.html |
#6
| |||
| |||
|
|
The easiest way is to assume that the Earth is flat. In that case, you have Pythagorean theorem and linear algebra. If anyone tries to contradict, they should expect the Spanish inquisition. I know that nobody expects Spanish inquisition whose primary weapons are.... |
#7
| |||
| |||
|
|
I found the lesson plan. I see that part of the point of the lesson was to destroy Euclid's Elements, which were introduced 23 centuries ago. |
#8
| |||
| |||
|
|
On Jun 10, 12:15*pm, Jeremy <jeremy0... (AT) gmail (DOT) com> wrote: Hi this is a 10gR2 Standard Edition question. The requirement is to be able to calculate the distance between two co- oordinates expressed as latitude and longitude. Q1) How would the latitude and longitude be stored in an Oracle table (what data types)? Q2) What would an example query look like? Q3) Is this even possible with 10gR2 Standard Edition? Just to be clear (!) this is the sort of simplistic representation I guess item * * * * * lat * * * * *long ---- * * * * * --- * * * * *---- P1 * * * * * * 50.716667 * *-1.883333 P2 * * * * * * 51.023332 * *-1.872231 The format of the lat/long are as I have been informed they are recorded in a remote system with which we are needing to integrate. I would want to be able to calculate the straight line distance between P1 and P2. Thanks for any pointers! -- jeremy This sounds suspiciously like homework but if I were you I would do some research on Oracle Spatial perhaps. |
|
If lat and long are numbers then ... geez ... wonder what data type would be used? |
|
When in doubt try http://asktom.oracle.com ... |
#9
| |||
| |||
|
|
On Jun 10, 12:15*pm, Jeremy <jeremy0... (AT) gmail (DOT) com> wrote: Hi this is a 10gR2 Standard Edition question. The requirement is to be able to calculate the distance between two co- oordinates expressed as latitude and longitude. I vaguely remember teaching a class how to do this calculation of distance around a spherical object in the early 1990s (with only a calculator) - I could probably search and find the lesson plan which is probably right next to the proof that 1=2. While I am searching for that lesson plan, see if the following article is helpful: http://www.movable-type.co.uk/scripts/latlong.html |
#10
| |||
| |||
|
|
On Jun 10, 6:00*pm, Mladen Gogala <n... (AT) email (DOT) here.invalid> wrote: The easiest way is to assume that the Earth is flat. In that case, you have Pythagorean theorem and linear algebra. If anyone tries to contradict, they should expect the Spanish inquisition. I know that nobody expects Spanish inquisition whose primary weapons are.... I found the lesson plan. I see that part of the point of the lesson was to destroy Euclid's Elements, which were introduced 23 centuries ago. :-) Even though the lesson plan is 3 pages long, the details are a little sketchy. Distance in miles: c0 = cos^-1*(cos(90-alpha1)*cos(90-alpha2) + sin(90-alpha1)*sin(90- alpha2)*cos(theta1-theta2)) distance = c0 * (2pi/360) * 3960 miles The above appears to be similar to one of the Excel formulas found on the webpage that I referenced: =ACOS(SIN(lat1)*SIN(lat2)+COS(lat1)*COS(lat2)*COS( lon2-lon1))*6371 KM My notes state that it is important to use radian measurements because those measurements have a direct correspondence with arc distances. For verification: Prague (14 degrees 26 minutes east, 50 degrees 5 minutes north) Rio de Janeiro (43 degrees 12 minutes west, 22 degrees 57 minutes south) = 6152 miles (119 degrees 48 minutes west, 36 degrees 44 minutes north) (88 degrees 30 minutes west, 42 degrees south) = 5789.38 miles Wow, I sure have forgotten a lot of math! |

![]() |
| Thread Tools | |
| Display Modes | |
| |