Navigation systems to use in a boat is very expensive if you want a decent screen size and a nice user interface.
Example: GPSMAP® 720/720s
In addition I would need a svinger for the sonar and a map covering my area, an additional $400 or so.
Total cost: $1800

For me the solution is obvious: Buy a cheap chart plotter / sonar and hook it up with a small cheap netbook via a RS232 to USB converter. And then make a chart plotter program.

Cuda 350 chart plotter / sonar, svinger included:
I could probably get a cheap netbook for around $250, and a RS232 to USB for $20.
The maps I can grab for free.
Total cost: $480

Actually this is both cheaper aand a better solution for me as I will bring the netbook with me and dont have to sit in my boat to do trip planning and plot waypoints.

The Cuda sends GPS data using the NMEA 0183 protocol:
Longitude, Latitude is WGS 84, Degrees, Minutes and fractions of a minute. In my program I convert it to degrees and fractions of a degree and then convert it to an integer by ignoring the decimal point. The number of decimals is constant.

So far so good. But I ran into problems when trying to figure out how to calculate the distance between two Longitude, Latitude coordinates.
My math skills are really getting rusty.

I found this on Wikipedia:
Looking at the 'distance between two airports' example.
The degrees to radians part is easy, but the second formula is Greek to me.

Does anyone know what this formula means, example please?

Currently I assume the earth is flat (back to the middelages), but uses coordinates of the nearest place to reduce the error.

You can get what I have so far here:
Note that the map tiles has been blured as they are copyrighted material.
Use the Trip Log / Replay Trip to see me race around my neighbourhood with my car. Actually the replay is x10 so I am not driving very fast. The speed shown is in knots.

If there is any interest in this project I will post the sources when I am done.

Posted on 2010-07-25 16:09:40 by KetilO
Found it.

Spherical law of cosines:
d = acos(sin(lat1).sin(lat2)+cos(lat1).cos(lat2).cos(long2?long1)).R

This one I can translate into fpu instuctions.

Posted on 2010-07-25 20:55:12 by KetilO
"The Standard"TM now is to use Vincenty's Formula, not SLoC. SLoC gives very poor results for small distances. There's also Haversine Formula with its own problems, but at least it's better than SLoC.
And their speeds are as follows: SLoC vs Haversine vs Vincenty's.

Here's is the code in PHP. The author is Pawel Dubiel. He says that his version of Vincenty's Formula is is a modified version of this one (dead link).
Posted on 2010-07-26 00:05:52 by ti_mo_n