Saturday, January 30, 2016

Converting Weather Maps to BSB echarts

Our goal is to convert weather maps to echarts for use in forecast evaluation (overlaying model forecasts) and general route planning. We started with the easy ones, namely the color maps from OPC that have a nice lat-lon grid on them that lets us scale the margins of the charts. This way we can make a prescription for doing this that does not involve trimming the charts for each conversion.

Underway, however, we are most likely to have access to the black and white tif maps that we can get from saildocs in reduced file size.  The problem that comes up immediately is these maps do not have a nice lat-lon grid; it is shown only every 10ยบ with large blank margins. Thus are simple approach of making the header files by hand does not work for these maps.  I have tried numerous tricks that I thought would work around this, but none succeeded. We are standing by for an easier solution if someone has it. Just post a comment.

One approach that does work is to call up two more custom programs and built the map in several steps.

Step 1. This always has to be done: download the map and convert to a png, and read the dimensions of the chart viewed upright—we typically get the maps sideways as tifs.

Step 2. Georeference the chart and define the borders using MapCal_2, and save what it calls chartcal.dir, which is a text file you can open in notepad.  This step is illustrated here:

Video Note: watching carefully you will see a blunder being made on the bottom right cal point, but it got caught and corrected during a simple check at the end.... nice to have such things to see how this works!  There is also an error early on calling a png file a gif file. Unfortunately, nothing to learn from that if we rule out author evaluations. 

Step 3. Use the program mc2bsbh to build the header from the chartcal.dir. The extension of the header made this way is .hdr.  We need to change that to .kap before using imgkap (you could also create one with the right name, but this is just as easy).

Step 4. Proceed to convert the png to a kap file with the header just created using imgkap.

In an earlier video-illustrated post we did this making the header file by hand, which worked for easy to scale charts that have a full lat-lon grid. That does not work for these BW maps with large vacant borders and few reference lines, which is why we move to this procedure.... at least till we learn a better way. On the other hand, once you have these utility programs in a folder, it is probably fastest to use this present method for all charts.

( I should mention for completeness, that if one has the high-end navigation program called Expedition, you don't need any of this. You just import the image, georeference two opposite corners with a slick, fast interface they have, and you are done, and ready to view the map as an interactive chart.  It is then saved for later use or for overlaying model forecasts, etc. One minute would be a long estimate of the time it takes from beginning to end! )

In principle, there is a package of utilities called kapgen that will do all of what we describe above at once, but I have not had any luck yet with using that.

It took long enough to learn to do what we do here that I want to document this process before I forget the details; later we might return to figuring out what we are doing wrong with kapgen.

All of these methods are described in the OpenCPN manual or FAQ, or links they provide. It seems easy enough when reading about it, but there are nuances that I hope we point out here.

Program sources:

imgkap.exe from

mc2bsbh.exe from

MapCal_2.exe comes from installing the program SeaClear. Install the program, then look in the Programs Files directory, and from their you can make a shortcut to MapCal_2.exe for your desktop or other folder you are usin for the conversions.


For reference, here is the header file we created for the epac surface analysis, a map that is 1446 x 1728. With this, all you need is imgkap to make a chart out of any epac surface analysis. This is for the full size maps. We need to make another one for the saildocs versions that are half this size.

! Created by mc2bsbh beta09 - Use at your own risk!

1 comment:

  1. Good Day :
    What do mayor alphabet letters "BSB" actually stand for ?