Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Total Distance Travelled

Author  Topic 

sureshms
Starting Member

1 Post

Posted - 2011-12-02 : 04:35:31
SQL Server 2000
I have a table Person, Lat, Lon, DateAndTime
Given a period how can i find i find total dist travelled by a person

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-12-02 : 04:56:50
Take consequtive date and time entries - calculate the distance between the locations (Pythagorus' theorum) then sum the results.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-02 : 05:39:28
quote:
Originally posted by sureshms

SQL Server 2000
I have a table Person, Lat, Lon, DateAndTime
Given a period how can i find i find total dist travelled by a person


what are datatypes of Lat and Lon?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2011-12-02 : 10:08:36
You can use this function to calculate the distance between two pairs of latitude and longitude.
Great Circle Distance Function - Haversine Formula
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81360

However, that will calculate the direct distance between the points, not how far they had to drive, fly, walk, etc.




CODO ERGO SUM
Go to Top of Page
   

- Advertisement -