Cruisers & Sailing Forums (
-   OpenCPN (
-   -   Charts (

cagney 29-09-2009 10:21

I think there is a need for a separate thread to discuss issues relating to charts. Many of these issues are not directly related to the development of OpenCPN, but highly relevant for the practical use of the program, especially outside the US and Brazil.
One of these issues is - how can one use the excellent free, .tiff chart pictures published in New Zealand?


sinbad7 29-09-2009 10:36

The easiest way would be to develop a normal raster map calibration facility for OpenCPN, found in most of the other well known nav progs. I am sure that would be well within the capabilities of our learned fellow boaters. BSB conversion is still a great problem,both technically as well as legally.

I have already prepared several of the NZ raster charts,reduced them to a manageable physical size,compressed them and finally calibrated them in Fugawi,Oziexplorer and SeaClear formats. Have a look:

cagney 29-09-2009 10:46

Tiff2Bsb, beyond a concept....
2 Attachment(s)
I am now able to convert the NZ .tiff pictures, relatively easy, to .kap chart files that works fine with OpenCPN. These charts are of very good quality, as you can see for yourself below. The .tiff pictures are scanned in 300dpi, which I have kept when making these sample charts. View the details of the anchorage of Alofi on the Island of Niue zoomed in x6, for example. Also I just had to get a picture of a part of the Hauraki Gulf off Auckland for Sinbad7 :D.

I have dumped the raster2bsb program as this did not rely work for me. As I said before, it just took to long time, I persisted, once, and produced a chart of bad quality after waiting for an hour and a half ...

I found that by using tiff2bsb, part of libbsb, on the command line
I can make a chart in less than 2 seconds.

The basic command is:

$  tif2bsb -color 127 template.kap path_to_downloaded_tiff  path_to_produced_chart
For example I used this command to make the chart over the Hauraki Gulf.

$  tif2bsb -color 127 template.kap Downloads/nz53.tif NZ53.kap
This produced the chart NZ53.kap in my home-directory.

Where you have to put in some effort is in handcrafting the template.kap file containing all relevant info about the chart.

I will tell you exactly how to produce a basic version of this file in my next post. Meanwhile .. have a look here.


sinbad7 29-09-2009 10:52


I stand corrected, and, Gratulations!!! Where can I download the NZ53.kap file you made for me?

P.S. I would suggest you could use the for a storage place for this and future charts. Initially you get 2 GIGA of FREE space,which can reasonably be expanded later.

cagney 29-09-2009 11:49

2 Attachment(s)
Below I have attached a sample template file that can only be used with nz53.tif, without editing. I will refer to the line numbers in the picture.
To produce a template file you have to open the .tiff in a program such as Gimp in Linux or even Paint in WinXP . The main thing to do is geo-referencing. I draw a simple square and write lat at top and bottom, and long left and right. On the Nz charts you have an easy reference for the inside of the chart at lower left corner and upper right corner. At the same time, write down the pixel-count that corresponds to lat & long.
Lets go through it line by line:
1/ Name of the chart
2/ NU is just any number you prefer. RA is the total pixel width and height of the whole tiff picture incl white-space outside the chart proper.
3/ SC is the scale of the chart. Check the link in previous post for more about line 3,4 and 5
6/ release number and date
8-11/ The format here for each line is
long in pix,lat in pix,lat,long
Lat and long as deg.dddd not deg min.ddd
I start in the lower left corner( line 8 ) and work clockwise to lower right corner.
12-15 is lat,long as above starting in lower right corner clockwise to upper right corner.
16 IFS is "Depth of the colormap"

That is the short version. I'm not sure about all the details, and I am learning all the time. I'm sure thing can be done different and better
Hopefully this will get some of you going. Together we can, hopefully, fine-tune the art of writing a template file.

If you try NZ14061 eq INT61 you will have no luck on windows until next beta. For Linux use latest CVS. I had the pleasure :D, to serve Dave another "Mole" as this was probably the first ever bsb chart spanning the 180:th meridian that OpenCPN encountered.
Also with this very small scale chart, 1:10.000.000, other problems pops up. The latitude is out 15 miles at the top of the chart with only 4 reference points.

This is what Dave has to say about this:

Latitude: This will be a special concern for small-scale charts. If we just have 4 corner reference points, then we can only do a simple linear scaling of pixels to latitude. Of course, for a mercator chart covering a large range of latitude, this leads to large georeferencing errors. You will notice the orange title bar on the NZ chart, signifying poor georeferencingas analyzed by opencpn.

Ideally, we need as many as 8 points in the latitude direction, at both longitude extremes, for small scale charts. Less for larger scale.
More in a few days.


sinbad7 29-09-2009 14:22

So I take it this BSB converting facility is NOT yet available for Windows? and, we're back to my previous #2 message for all Windows users here. What about the finished converted BSB chart,is that readable by Windows versions of OpenCPN?

sinbad7 29-09-2009 15:24


Having downloaded the 'libbsb',I created a CMD file as follows:

D:\PROGRAM FILES\LIBBSB\libbsb-0.0.3\tif2bsb -color 127 template.kap\LIBBSB\Auckland.tif NZ-AUCKLAND.kap

I executed the above 'testconv.cmd' command line but without ANY results. What am I doing wrong?

cagney 30-09-2009 12:43


Originally Posted by sinbad7 (Post 339199)

Having downloaded the 'libbsb',I created a CMD file as follows:

D:\PROGRAM FILES\LIBBSB\libbsb-0.0.3\tif2bsb -color 127 template.kap\LIBBSB\Auckland.tif NZ-AUCKLAND.kap

I executed the above 'testconv.cmd' command line but without ANY results. What am I doing wrong?

Libbsb is indeed available for the win32 platform. You can download (the latest available release) here.
Instructions for installing libbsb is in the "README" file once you have unzipped the downloaded file. The installation is not a trivial "windows installer" kind of operation, but seemingly not to complicated for someone used to compile and install similar programs. Your mileage may vary .....I have not done it myself.

Once the installation is clear, the commands ought to be identical to Linux, except, of course for the different paths.


sinbad7 30-09-2009 13:04

I am not much into programing,is it also necessary to install C+++ in order to use the libbsb? I think I need a step by step orientation if I am to proceed.

I was not able to access/unpack the NZ53.kap.tar.gz file. I tried just re-naming to NZ.kap and the OpenCPN installed it ok in the register but nothing was accessable or showing the BSB outline. What needs to be done?

sinbad7 30-09-2009 15:44


Using Alpha Zip and 7Z, I finally managed to unpack the file but neither OpenCPN,nor SeaClear or Fugawi will accept the resulting .kap file.

Beverly Stayart 30-09-2009 16:16

Thanks for this very helpful info.

barnakiel 30-09-2009 17:26

I believe the way to go is to have Open CPN work with calibrated (gifs, tifs, jpg, bmps, you name it). Then we can use the NZ charts, our paper scans, Google dumps, weather faxes, etc.

And I would love to see the feature where two charts could be layered (with transparency) so that say I can see the Google dump over a tiff chart. This would be very, very cool (and useful - at least to me).

Hugs to community,

sinbad7 01-10-2009 04:50

1 Attachment(s)
How can Cagney in message #3 display charts when you are removing my message #13? This chart shows successful transformation of a .tif raster chart to the .kap standard for personal use.

I am well within the stated size limit of the -jpg file. I keep having messages removed here and I'd like to know the reason. The theme of this thread is charts used with OpenCPN so i IS topical... answer please.....

cagney 01-10-2009 11:05


Originally Posted by barnakiel (Post 339864)
I believe the way to go is to have Open CPN work with calibrated (gifs, tifs, jpg, bmps, you name it). Then we can use the NZ charts, our paper scans, Google dumps, weather faxes, etc.


Hugs to community,

I think that we are already there, we just need some more testing and finding the best way to do it.
The program Raster2Bsb which is a frontend to libbsb uses the program "convert" from the ImageMagic suite, to convert chart pictures to .tif files. You can do the same thing manually from the command line instead.
On Debian/*buntu

$sudo apt-get install imagemagick
To use convert simply

$ convert chart.jpeg chart.tif
...and you will have a .tif to use with tif2bsb. The same command works for .bmp, .gif and .png.
In this simple form convert tend to produce very large tiffs, but I'm sure that digging into the mile-long list of options could fix that, if necessary.


barnakiel 01-10-2009 15:08

Debian/buntu - what are these?

In practice - I have a file and want to use it in OpenCPN

- which software to download,
- how to add geo reference and convert to OpenCPN format?

ImageMagic - why do I need it?


All times are GMT -7. The time now is 00:46.

Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.