Distance between two points across the ground using sql server

I want to calculate the shortest distance between two points inside SQL Server 2008 based on the mass of the earth.

I used the geography data type along with STDistance () to work out point x to point y when the crow is flying, however sometimes it crosses the sea, which I am trying to avoid.

I also created a polygon around the border of the land mass that interests me.

I believe that I need to combine these two methods to ensure that STDistance always remains within the polygon - unless there is a simpler solution.

Thanks for any advice.

+5
source share

All Articles