Supplementary Software

Table Of Contents

Chart Conversion Manual

Table Of Contents

imgkap

To convert a chart picture to a BSB chart, libbsb was for a long time the only choice.
With the arrival of "imgkap", there is an alternative with updated features.
Read more about imgkap here: www.dacust.com/inlandwaters/imgkap/

Picture to Chart, some details


For both tiff2bsb(libbsb) and imgkap there must be a user supplied "header" file containing information and Geo-referencing of the chart picture. This file can be produced in different ways. From simple handcrafting, to a method described on the page "Conversion Using Linux", which actually applies to windows as well in many parts.

To see a real header, just open a chart file (whatever.kap) in a text-editor.
The first part of the text in the beginning us user supplied, then comes a text part created by libbsb or imgkap an then the binary part.
Whatever method is used for conversion it is important to understand the header.
Here is a commented header file originating from the NGA project, that describes the essential items in a basic version.


VER/2.0 [0]
BSB/NA= [1]
    NU=[2],RA=[3],[4],DU=72
KNP/SC=[5],GD=[6],PR=[7]
    PP=[8],PI=UNKNOWN,SP=UNKNOWN,SK=[8a],TA=[8b]
    UN=[9],SD=[10],DX=000,DY=000[11]
CED/SE=[12],RE=[13],ED=[14]
OST/1
REF/1,[16]
REF/2,
REF/3,
REF/4,
PLY/1,[17]
PLY/2,
PLY/3,
PLY/4,
DTM/0.00,0.00 [18]
CPH/0.0 [19]




0. The BSB version used
1. *Name of chart from the chart. Warning do not use commas ",".
2. *Chart number. Plan A on 23456 should be named 23456_A
3.  Size of picture Pixel x coordinate
4.  Size of picture Pixel y coordinate
5. *Scale of the chart from the chart.
6. *Geodetic datum, for example WGS84, from the chart. I not defined on the chart write "UNKNOWN" No guesswork, it is either stated, or said to be a local datum, that cannot be related to WGS84. Charts released earlier than 1990 (?) and conforming to
World Geodetic System should be WGS72, unless stated otherwise. The difference between WGS 84 and WGS 72 is minor.
7. *Projection, almost always MERCATOR, a few charts are TRANSVERSE MERCATOR. We should not bother with other projections, GNOMONIC small scale great circle charts etc. If we come across large scale plans with GNOMONIC projection this should be used, say
 1:50,000 or larger. High latitude "Lambert Conformal Conic Projection" should be skipped, for now. OpenCPN only handles Mercator and  Transversal Mercator. I don't think th Polyconic charts.
8. *For Mercator charts this is the latitude where the scale is valid. If available on the chart, use that value.
If it is not available on the chart use the average value of the latitude of the upper and lower edge, to the nearest 1/10 of a degree.
For Transverse Mercator charts use the average _longitude_  of the eastern and western edge.
Treat a possible large scale gnomonic as a Mercator chart.
8a. SK is the skew angle of charts that are not "North Up". For North Up the value is 0.0
8b.TA is he text angle, more or less always 90.0
9. Unit for soundings from the chart, mostly METERS
10. Datum for soundings from the chart, for ex MLWS, LAT
11. x and y resolution, meters per pixel. Not necessary for us to compute. OpenCPN andles this.
12. Chart edition date copied from the chart,inf in SW corner, except, there must be _no_ commas.
13. Our release edition.
14. Our release date.
16. Geo-referencing, standard case - simple 4 corner chart, use the 4 corners, starting in the SW corner proceeding clockwise.
Format: x pix,y pix, lat, long. Lat & long i decimal degrees, to 8 decimals, where N lat and E long are positive.
One reason to use all 4 corners is to catch  skewed and warped charts, and calculate SK (8a), also to calculate a rotating angle for charts that are not properly aligned.
17. Standard case, just copy the lat & long from the REFs.
18. Corrections in seconds of arc to bring the chart to WGS84. This is generally given on the chart(if they exist), in a format where the corrections are in minutes of arc for plotting a WGS84 position on the chart. This correction must be transformed to seconds of arc and the signs reversed.(we are doing the reverse to the case stated on the charts). These values are sometimes difficult to find on the chart.
19. If a chart  spans the 180th meridian = > CPH/180.0, else => CPH/0.0. So CPH/ is 0.0 for most charts. Note that OpenCPN handles transiting the 180:th meridian while a few other plotters don't.

**IFM** is not used as tif2bsb and imgkap calculates this value and ads it to the header on the final kap, together with other values such as RGB. Any manually entered values will be overwritten.

One great advantage with imgkap, compared to libbsb, is that generally the original format for the chart picture can be used directly.
To calibrate a chart can be as simple as composing the headerfile , a text file with the extension ".txt". Often the Lat&Long of the SW and NE corners are printed on the charts.
Use, for example GIMP, to find the pixelcoordinates for each corner.

For example, to the chart picture BA1121.jpg we write the header file  BA1121.txt.
To create the chart file with the extension ".kap", issue the command:

imgkap BA1121.jpg BA1121.txt BA1121.kap




libBSB

LibBSB is an older alternative to imgkap, for converting chart pictures to usable BSB type charts.

Full documentation and source code is available at libbsb.sourceforge.net.

Only binary packages for Debian based Linux distros and Windows are available for download here.  There may be packages available for alternative operating systems elsewhere.

libbsb-tools_0.0.7_i386.deb

libbsb-tools_0.0.7_amd64.deb

libbsb-0.0.7-win32.zip

 

 

Conversion Using Linux

How to convert your chart images to a format that OpenCPN will read using Linux

Do you have a bunch of scanned charts of your area, in graphical format (jpg, tiff, etc.) and OpenCPN won't read them?
Here's how you can – with a bit of work, sure, but worth the effort – convert them into usable electronic charts.

The tools:

  1. ImageMagick: http://www.imagemagick.org/ (Binary releases are available for a few distributions, for Ubuntu just get it with the package manager, it's in the repositories.)
  2. Libbsb: http://libbsb.sourceforge.net (You will need some version of libtiff-dev and libpng-dev installed to build it. A .deb package that worked fine for me can be found here.
  3. mc2bsbh: you can get it here.
    1. Get the c++ source file, and from its directory, type:
    2. g++ -Wall -s -O2 mc2bsbh.cpp -o mc2bsbh
    3. It compiled without any problem on my (very standard) Karmic. I personally put it in /usr/local/bin, which I own as user, so it's in the PATH and can be called from anywhere, if you leave it in the working directory, use ./mc2bsbh
  4. MapCal: part of the free navigation package SeaClear .
    1. Note: I had some problems running it with Wine (saving the calibration) but I can't reproduce the error and now it works fine. One suggestion is, make the directory you're going to write the calibration in world-writable before running MapCal.
  5. The pcx2tif script (optional) , found here.  This is a great little shell script by "taifun" used to convert old Maptech-style formats of tiled charts. If you find your chart is made of little bits instead of a whole file, this will stitch them all together in TIFF format.
    1. Instructions for use are in the tarball.

Once we have the tools all set up, we can get to work. The process in in five steps:

  1. Convert a chart image to tiff with imagemagick.
  2. Convert it again to png with the same (you'll need both files).
  3. Load the png version of the chart in Mapcal and calibrate it.
  4. Generate the chart header with mc2bsbh, and make the .kap version of the chart, with libbsb.
  5. Copy the resulting .kap into opencpn's chart dir, and reload the chart database.

Let's see them in detail:

Steps 1 and 2:

Say you have a chart in jpeg format called chart.jpg.

From the command line, use:
 convert chart.jpg -colors 127 chart.gif

and then again,
 convert chart.gif -colors 127 chart.tif

and then again,
 convert chart.jpg -colors 127 chart.png

(there is a script that does this for multiple files, get it here , just remove the .doc extension, this is the example)
Throw away the .gif file. Don't ask me why you need to generate it in the first place, but apparently you do, it's an imagemagick thing. Keep the .tif and the .png ones a while longer, though. You'll be even happier to get rid of them when you've finished.

Step 3:

  • Open MapCal.
  • File, Open Image. Open the .png version of your chart. Ignore the data window for the moment, you'll do that later, click OK. You should see your chart.
  • To calibrate it, choose a point near a corner for which it is easy to know lat/lon. Right-click on it, and choose Add New Cal. Point. To zoom in and out use the little + and – buttons at the bottom.
  • Ignore the fact that Latitude has three integer figures, we're still talking about the Earth. Enter the coordinates and proceed for at least three more points, near the corners.
  • Click Activate Changes. Check that the grid makes sense. Click Border, draw a border around the chart (that part is easy).
  • You should also enter some data for the chart: Edit, Chart Information.
  • The Chart Name will show up in OpenCPN to remind you of all your hard work, choose it well.
  • For this example we'll just use “chart”.
  • You should also enter at least Scale (found on the chart) Depth Units, Projection (Mercator most likely) and Datum (WGS84 most likely, but be careful with older charts). All of this information should be found on the chart itself.
  • For more details, you have the SeaClear Manual.
  • File, Save Calibration. Repeat ad-lib for any other charts and exit. If everything went well, you'll find a file called CHARTCAL.DIR in the same directory as you loaded your png chart from. This is used to (finally) make your calibrated chart that OpenCPN will use, as detailed in

Step 4:

  • Generate the chart header from the command line:
    • mc2bsbh CHARTCAL.DIR
  • You should see:
    • Create CHART.hdr
      (the .hdr file must have DOS newlines)
  • So type:
    • tif2bsb -c 127 CHART.hdr chart.tif chart.kap
  • At which point you should have a chart.kap file that OpenCPN will happily use.
      This can be done for many charts at a time by using the tif2bsb batch script from the mc2bsbh page. If it gives you any problem with lowercase-uppercase names, try: 
      for i in `find * -depth`; do (mv $i `echo $i|tr [:upper:] [:lower:]`); done
      which will convert all files in the current directory to lowercase (works great for me).
      If you get an error like /bin/bash^M, no such shell (I did), it's a cr/lf thing, just edit it, type [enter] at the end of each line (there's only 7) and get rid of the blank ones.

Note 1: you can also make the .hdr file “manually”, using a template and entering the calibration data with a text editor, but I won't go into that for the moment.

Note 2 (about the commands, so if there's any problem you know what to look for) :

    convert is a command from imagemagick.
    tif2bsb is a command from libbsb.
    mc2bsbh is a standalone thing.

Note 3: (by Jonasberg, on the colors in the conversions) :

    The "127" is the number of individual colors used. Sometimes it pays of to reduce this number to get a smaller file size, say, if you start with a bitmapped format like png that contains fewer colors.
Note 4: On the joinpcx script:

If you use it "standalone" and not as part of the "charts" script,  change the lines,
convert new1.gif - colors 127 $1.tif
(and .png) to
convert new1.gif -colors 127 `basename $PWD`.tif

(and .png)
because the "$1" will not create files with [directory_name].tif and .png, it won't create any files at all.
Using `basename $PWD`will make files called [current directory name].tif (and .png).
So just edit the script to whatever suits you best.

Alarm Sounds

A selection of alarm sound files to use as AIS and Anchor alarm.
www.policeinterceptor.com/navysounds.htm

Celestial Navigation

Application: Astronavigation
The Running Fix problem is easily solved using Astronavigation.exe
 animated gif
 

Circles of position or Circles of equal altitude. General scale.


Fix and confidence ellipse. Coastal scale.
Pack overview
Software is available for free, for non-commercial use, at:
  http://sites.google.com/site/navigationalalgorithms/ (Only for Windows®)
Plotting circles of equal altitude:  Method explained
 

Chart Conversion

BSB Lib
http://libbsb.sourceforge.net/
libbsb is a portable C library for reading and writing BSB format image files, typically used for nautical charts.
A number of utilities to convert and work with BSB charts are included in the libbsb package. Sample files and instructions on using these tools are available on the Examples page.
The mc2bsbh Utility
http://www.dacust.com/inlandwaters/mapcal/
This is a utility to take an image of a chart that has been calibrated with MapCal, and convert it into a BSB chart that can be displayed in many marine navigation programs.
 
KAP-File Utility
http://www.cruisersforum.com/forums/f134/kap-file-utility-38725.html
GUI for the several command line tools such as mc2bsbh and the libbsb tools, (for Windows, sorry Linux and Mac guys).
 
For Google Earth
GE2KAP
http://www.gdayii.ca/Downloads/ (password to decompress the archives: phiggins)
GE2KAP - Creates .KAP charts from Google Earth
GERoute - Follows a route to load the Google Earth cache.
C2GPXKML - Converts navigation routes and tracks to different formats.
 
 
Port detail generated by GE2KAP
ChartAid
http://www.bellwoodgroup.com/marine/chartaid/index.htm
Many people have found Google Earth and Google Maps printable images helpful in supplementing their knowledge of a particular area or specific location. The ChartAid program offers you the ability to save Google Maps printable images as Raster Charts or Photo Charts, in BSB/KAP file format.
 
Overlay NOAA raster charts in Google Earth
http://matrixmariner.com/geRasterOverlay
 
Script to Convert MaxSea Routes to GPX
http://www.cruisersforum.com/forums/f134/script-to-convert-maxsea-routes-to-gpx-41010.html

Chart Work

Using the GPX utility and the Chart Work family of programs is it possible to do on an electronic nautical chart the work you do in a traditional way.
The three programs are:

  1. Lines of position and Great Circle sailings (orthodromic).
  2. Piloting: Currents and coastal fix.
  3. Search & Rescue search patterns.
GPX output includes:

Coastal navigation LoP

  • Bearing
  • Range
  • Horizontal angle
Celestial navigation LoP
  • Marcq St. Hilaire Line of Position
  • Circle of Position
Radionavigation LoP
  • RDF bearing
Route
  • Great Circle
  • Composite
Piloting and coastal fix
  • Currents Drift and Set
  • Lasheras
  • Ciclonic method
  • Fix by simultaneous Distance and Bearing of same object. Geographic Range, D( waterline, top of object )
  • Fix by 2 simultaneous Horizontal Angles
SAR search patterns – Patrones de búsqueda SAR
  • Expanding Square
  • Sector Search
  • Parallel Search for one ship
Resources:

Chart Work - Lines of Position & GC sailing

 

Chart Work - Traditional paper chart work on an ECS.

Coastal navigation

the three types of lines of position used are:

  • Bearing
  • Range
  • Horizontal angle

 


Fix by three simultaneous bearings.

Fix by three simultaneous bearings. Detail.
 

Celestial navigation

Offshore navigators use celestial navigation,sextant observations, as a backup for the GPS. Use a sextant for taking the altitude of a celestial body and OpenCPN to plot the celestial circle of position instead the LoP -Line of Position-. Repeat this and take at least three sights. You easily can check if any danger is near your fix, and the uncertainty in your position.


Parameters of a circle of position in astronavigation.


Route using the three types of sailings

  • Rhumb Line. Direct with OpenCPN (And also using Plugin Route_pi).
  • Great Circle(Direct in OpenCPN using using Plugin Route_pi).
  • Composite(Direct in OpenCPN using using Plugin Route_pi).
The three types of sailing are also available in ChartWork

Composite Route.


Composite Route plot with OpenCPN.

Radionavigation

RDF or radiogoniometer provide a bearing. Its line of position may be plot using GPX input. Two options:

  • RDF onboard
  • RDF on station
 

Fix by two RDF bearings with OpenCPN.


Chart Work - Piloting

Using the OpenCPN GPX utility and the Chart Work - Piloting program is it possible to do on an electronic nautical chart the work you do in a traditional way.


Piloting and coastal fix

Advanced piloting techniques - Currents

  • Currents Drift and Set
  • Lasheras
  • Ciclonic method (820. Determining Track Made Good by Plotting Running Fixes. Bowditch-American Practical Navigator.)

Coastal navigation
 

  • Fix by simultaneous Distance and Bearing of same object. Distance by:
Geographic Range
D( waterline, top of object ) 
  • Fix by 2 simultaneous Horizontal Angles

Chart Work - SAR search patterns

Search & Rescue utility that generates a GPX file for OpenCPN or Google Earth.



Search Pattern:
  • Expanding Square
  • Sector Search
  • Parallel Search for one ship
  • Parallel Search for two ships

Orientation as an input to takes into account tide, wind and drift.
Number of legs and its length may be configurable.



Free software to create the GPX file that serves as an input to OpenCPN is available at http://sites.google.com/site/navigationalalgorithms/ (Only for Windows®)

GRIB Data and Software

Ugrib

http://www.grib.us
Freeware application Ugrib allows instant and fully customizable access to global weather data. Within one simple to use interface you can download and view weather data right on your desktop.
The data being served at http://www.grib.us/GribData.aspx is from the US GFS global weather model. Its has a native resolution of 0.5 degrees and includes surface winds and barometric pressure. The forecast you get from the webpage is a 7 day forecast with a 3 hour timestep. 

zyGrib

http://www.zygrib.org
Graphical software for Linux, Mac OS X and Windows (GPL3, Qt) to download and display GRIB 1 files.

NMEA Instruments

For NMEA instruments on your onboard PC/laptop, you may wish to try one of the following:
  1. NavMonPC: Closed source, windows only, but reportedly excellent gauges for wind instruments, GPS, AIS display, anchor alarm, etc.
  2. PolarCOM: Closed source, windows, linux, mac; visually appealing gauges for wind instruments, GPS, anchor alarm, etc.
  3. CapCode: Free software, Java-based navigation programme with sailing/regatta focus, supports wind instruments, polars, VMG etc.
  4. Matrix Mariner GPS: Free software, Window and Linux, visually appealing GPS display, some features for GPS handling including live gps output to Google Earth. (Windows version includes VSPE kernel mode virtual serial driver).
  5. VSPE: Closed source freeware, windows only, Virtual Serial Port Emulator enables you to use data from one serialport (such as GPS or NMEA data) simultaneously with several programs. You can run PolarCom, NavMonPC, OpenCPN and other navigation programs at the same time without COMport conflict.
  6. gpsview:Tool for analyse NMEA textual data, allows to load NMEA log files and view data in table, graph and track forms.
  7. Muplex: Open source under GPL, a Linux soft multiplexer that can mix different input flows of real or emulate serial (USB, bluetooth)  NMEA datas and share it between multiple applications, creating virtual serial port and TCP/IP local loop or network, as VSPE for windows.
  8. OSD_Depth: Open source under GPL, a Linux echo-sounder repeater which uses the OSD technique (On Screen Display, everytime "ontop" above any application, using big digits) to display the water depth from NMEA sentences as DBT or DPT in meters, feet, fathoms.

  9. kplex: Open source (GPLv3) software NMEA 0183 multiplexer for Linux, OS X and FreeBSD. Handles serial, pty, TCP/IPv4, TCP/IPv6, broadcast UDP and file inputs and outputs and performs optional sentence filtering, checksumming and data source prioritisation/failover.

 

Tides

Official sources
1. France, SHOM - http://www.shom.fr/fr_page/fr_serv_prediction/ann_marees.htm
2. United Kingdom, easytide UKHO - http://easytide.ukho.gov.uk/EASYTIDE/EasyTide/SelectPort.aspx
3. United Kingdom, NOC - http://www.pol.ac.uk/ntslf/tidalp.html
4. The Netherlands, Min. V&W - http://live.getij.nl/index.cfm?page=getijvoorspellingen2 (including export functions)
5. The Netherlands, RWS - iCalendar Tide Wizard: http://live.getij.nl/outlookgadget/php/index.php?field_language=en
6. Germany, BSH - http://www.bsh.de/de/Meeresdaten/Vorhersagen/Gezeiten/index.jsp
7. United States, NOAA - http://tidesandcurrents.noaa.gov/gmap3/
8. Canada, CHS (pdf files) You will find the pdfs on the tide station page -http://www.waterlevels.gc.ca/eng/data/predictions/2013
9. Canada, CHS - http://www.marees.gc.ca/cgi-bin/tide-shc.cgi?queryType=showFrameset&zone=1&language=english&region=4&stnnum=3250
10.  ... and links for Canada (broken!), Denmark, France, Israël, New Zealand, Portugal and Spain are shown here:
         http://live.getij.nl/index.cfm?page=links&linkcat=4

Not for navigation!
XTide -  Harmonic tide clock and tide predictor. Work with X-windows, plain text terminals, or the web.
http://www.flaterco.com/xtide/

WXTide32 - a free Windows tide and current prediction program.
http://www.wxtide32.com/

WXTides Stations - tcdata, (HARMONIC, HARMONIC.IDX), for OpenCPN
http://fserv.skill-club.com/get_1088_156a.html

cTide: tide prediction software for PocketPC's
http://airtaxi.net/ctide/

JTides - an advanced, accurate, easy-to-use tide and current prediction Java MDI (Multi-Document Interface) application.
http://www.arachnoid.com/JTides/

QuickTide - a free Windows tide program specifically made for The Netherlands, especially for the tidal area of the Waddenzee. For Linux: runs under Wine. In Dutch only.
http://www.quicktide.nl/

Weather Routing

These programs do weather routing, and produce a route that can be exported to OpenCPN in GPX format.

OtVlm is a free, opensource, weather routing program, for Linux, Mac and Windows.
QtVlm Documentation and installation
QtVlm Sourceforge Download
OpenCpn Weather Routing Notes on working with qtVlm
OpenCpn Summary of Routes Transfer between OpenCpn and qtVlm, see bottom of page.
OpenCpn Grib Weather Plugin




Bluewater Racing is another free tool (currently only available on windows):

Magnetic compass

Usually a gyrocompass is not available at a yacht. Instead one or more magnetic compasses serve for steering. The reading of this kind of compass must be corrected for variation and deviation.
OpenCPN uses true course over ground. The course to steer is calculated taking into account the wind, the current and the compass correction: magnetic variation + magnetic deviation:
 

Deviation curve of magnetic compass

An analytic method for obtaining the deviation curve of a magnetic compass allowing obtaining the value of the deviation for any course.
Magnetic deviation

Magnetic Variation

Magnetic variation, or magnetic declination, is shown on paper and raster charts, but can also be calculated using the World Magnetic Model. C source code for any platform is available at: http://www.ngdc.noaa.gov/geomag/WMM/soft.shtml

For Windows OS, compilations with a graphical user interface (GUI) are available at:
  1. http://www.ngdc.noaa.gov/geomag/WMM/wmm_gdownload.shtml and at
  2. http://sites.google.com/site/navigationalalgorithms/

A World Magnetic Data PlugIn is available for OpenCPN since 2011.04.03 (version 0.1) at:
http://www.cruisersforum.com/forums/f134/world-magnetic-model-plugin-58167.html#post658775

In the example hereunder (from GUI no. 2 above) the nautical translation of "Declinacion magnética y Variación anual" is: "Magnetic variation and annual change".