Rajbir Singh
Rajbir Singh

Reputation: 1691

How to find the direction of a point with respect to other point by by using longitude and latitude in SQL Server 2008?

Here is my table.

Create table City
(
    CityName Nvarchar(250),
    Longitude Float,
    Latitude Float,
    GeoRef Geography
)

I want to find the direction of a location(north,south,east,west) with respect to other location by using longitude and latitude or geography datatype in SQL Server 2008.I have longitude and latitude of both the locations.

Thanks, rajbir

Upvotes: 2

Views: 281

Answers (1)

nickrobison
nickrobison

Reputation: 150

In the past I've used the equations from this website.

They're pretty easy to implement and you can wrap it into a UDF or sproc. Just remember to watch out for the difference in radians and degrees.

Upvotes: 1

Related Questions