Solved

# Northing Easting Calculations..

Posted on 2003-03-09

Im using a Postcode component giving me an OS grid Easting and Northing positions. I have 2 coordinates, I need to measure the distance between the 2 points and also get the direction of travel. I have sussed out the direction problem (I think) but im struggling with the direction travelled. I need the direction to be in degrees so I can then calculate if they are travelling North, South or North-East etc?

Here is the code for distance:

Public Function Distance(x1 As Double, y1 As Double, x2 As Double, y2 As Double) As Double

Dim lowX As Double

Dim lowY As Double

Dim highX As Double

Dim highY As Double

'Get highest first x

If x1 > x2 Then

highX = x1

lowX = x2

Else

highX = x2

lowX = x1

End If

'Get highest first y

If y1 > y2 Then

highY = y1

lowY = y2

Else

highY = y2

lowY = y1

End If

dDistance = Format(Sqr(((highX - lowX) ^ 2 + (highY - lowY) ^ 2)) / 1609.3, "0.00")

End Function

I would be gratefully of any help on this one please?