|
-
Sep 8th, 2012, 06:42 PM
#1
Thread Starter
New Member
Problems with grid square distance?
locator.rar
Hello,
I have problem with calculations of latitude and longitude in my programm. Programm work, but at the finnish, distance in km is wrong, for short distance it's +- 1-2 km wrong, and for long distance is +- 4-7 km wrong.
Programm calculate distance between grid squares (Maidenhead grid squares).
This is formula from IARU Region 1 VHF Committee:
Distance = 111,2 * arccos(sin Latitude1 * sin Latitude2 + cos Latitude1 * cos Latitude2 * cos(Longitude1-Longitude2))
where the conversion factor is 111,2 km/deg.
Points rounding methods:
Distance Commenced km Math Truncation
0 km 1 0 0
43,2 km 44 43 43
56,7 km 57 57 56
Please, can anyone look at my code and help me to found error in code?
Thank you very much in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|