In my last post, I found out how to check if a GPS point resides an area. In addition, I need to calculate the distance between two GPS points. Again, I am using samples from my neighborhood. The distance between train stations in Fredrikstad and Sarpsborg. Now I will only calculate the distance air wise, but this can be extended to use Bing data services to calculate how far this distance is in walking, driving and maybe by travelling by train.
DECLARE @p3 GEOGRAPHY; DECLARE @p4 GEOGRAPHY; SET @p3 = geography::Parse('POINT(59.209111 10.950330)'); SET @p4 = geography::Parse('POINT(59.286441 11.116841)'); SELECT @p3.STDistance(@p4) as Meters1;