Nav library

derez

Expert
Licensed User
Longtime User
Nav is a library with some algorithms for use in a navigation application.

The names of the main methods are:
  • GeoDistanceBearing
  • GeoDistance
  • UTMDistanceBearing
  • FlatArea
  • FlatArea2
  • SphericalArea
  • SphericalArea2
  • GeoRouteLength
  • GeoRouteLength2
  • UTMRouteLength
  • UTMRouteLength2

Tha attached file includes Help, example program and the cs file.

Edit: version 1.1 includes the function Atan2 which helps to define azimuth (the same as Atan but for the whole circle).

Edit: version 1.2 includes Map method for getting the x-y coordinates for image map, based on four points data. enables the use of large maps which are not rectangular , or even rotated.

Edit: Version 1.31 includes MagneticData class, provides magnetic declination (variation), Inclination and Grid-Variation for point defined by its coordinates.
 

Attachments

  • kineret2.jpg
    kineret2.jpg
    73.2 KB · Views: 120
  • NAV1.3.zip
    94 KB · Views: 133
Last edited:

Zambody

Member
Licensed User
Longtime User
Thanks for the lib,

looks vy good. I'm new in this forum and to Basic4ppc. Got my licence a few days ago.
Back to Basic after more than 15 years of teaching C++.
 

derez

Expert
Licensed User
Longtime User
The library is updated to ver 1.2, with the addition of Map method. It enables the use of large maps in navigation programs.
The map is calibrated by dual (lat-long + x-y ) coordinates of four points, and returns the x - y of a input lat-long, the local rotation from north, and the horizontal and vertical ratios of the map (map/real).

I'll be glad to further explain if this + the help isn't clear enough.
 
Last edited:

derez

Expert
Licensed User
Longtime User
Map calibration program

Attached to the first post - a desktop program to help in performing the four-point calibration of a map, for use with Map method.
Operation is simple:
1.prepare the map as a photo
2.run the program
3.load the map
4.go to "map" form and mark the four points, moving by mouse clicks and marking by the buttons there.
5.return to "input" form and fill the lat-long coordinates for the points (Google Earth may help here...)
6.check with another point coordinates to see if it appears in the map form in the center.
7.save a text file for use in the navigation program.
 
Last edited:

derez

Expert
Licensed User
Longtime User
It looks as too much work to translate it to the library. sorry.
If anyone would do the translation I'll be glad to include it in Nav.
 

mjcoon

Well-Known Member
Licensed User
It looks as too much work to translate it to the library. sorry.

Sorry to hear that. Is the problem that plain "C" (as the NOAA code is) is not compatible with a C# environment (as it is with C++)?

(I was able to build and run the older 2005-era code under Visual C++ 2005 Express Edition.)

Mike.
 

derez

Expert
Licensed User
Longtime User
I shall try to work on the fortran version, it is more understandable to me.
It will take time.
 

mjcoon

Well-Known Member
Licensed User
I shall try to work on the fortran version, it is more understandable to me.
It will take time.

Thanks David. I've been looking at the various versions too. It does seem rather complex, and I don't think that any of the calculations other than declination/variation would be of interest...

Mike.
 

derez

Expert
Licensed User
Longtime User
Version 1.3 includes MagneticData class, provides magnetic declination (variation), Inclination and Grid-Variation for point defined by its coordinates.:)

It is based on an algorithm found here World Magnetic Model - Software Download
thanks to mjcoon !
Please read the notes there about the accuracies. Remember that the algorithm does not consider local effects of the materials in the ground, and this may cause a much larger difference than the accuracy.

The results are quite close to what this site computes: http://www.magnetic-declination.com/

The data file is valid until 2015.
 
Last edited:

mjcoon

Well-Known Member
Licensed User
Version 1.3 includes MagneticData class, provides magnetic declination (variation), Inclination and Grid-Variation for point defined by its coordinates.:)
...
The results are quite close to what this site computes: Magnetic Declination

Terrific, thanks David. I confirm that I get the same value for declination for my location as I get from the various versions at or downloaded from the NOAA web site.

I guess since the data needs to be refreshed ever five years (!) it is better to keep it separate rather than incorporating it inside the DLL as a resource.

Now I can (for the moment) stop trying to dredge up what I used to know about C++ and try incorporating what you have done into (my version of) GPS4PPC.

BTW although your latest nav.chm does include the new magnetic value methods, the overview section misses out mention of version 1.3.

Mike.
 

mjcoon

Well-Known Member
Licensed User
Hi David, I've spotted an ommission from the suite of test code that you included: trying to load Geo_Mapcal2.sbp (just to see what it does!) I get a message that module mAbout.bas is missing. No doubt it isn't crucial unless you click the "About" menu item...

Mike.
 

derez

Expert
Licensed User
Longtime User
Thank you, I replaced the program with a new one which use about.dll instead of the module (included).
 
Top