Tech: Making charts for use with OpenCPN

Recently I've been playing around with OpenCPN, a neat chart plotting and navigation application which is open source and free. My ultimate goal is to hook it up to Arriba's SeaTalk NG network via a NMEA2000/USB gateway, where I intend to run it as a backup to my Raymarine MFD.

Like most navigation software, OpenCPN does not come with any pre-installed charts - except for a low-resolution map of the world which is unsuitable for navigation - so it's up to the user to find and install charts. The folks at OpenCPN have kindly compiled this list of free charts to make the task easier. Sadly, you're out of luck if you live in a country, such as Australia, where the government does not release free electronic versions of nautical charts. (BTW, given that taxpayers have funded government agencies to produce these charts, this data should rightfully be available to the public, especially in view of the fact that widespread dissemination of high-quality charts can only enhance maritime safety.)

I already own Navionics charts but that's in a proprietary format that OpenCPN can't read. The solution is to make your own electronic charts from paper charts that you own. I unfurled my massive "Aus 780" chart of southern Gulf St. Vincent, then scanned a section of Kangaroo Island using a flat bed scanner. The crucial thing is to ensure that longitude lines are perfectly vertical (as required of a Mercator projection), which may require a couple of scanning attempts to get right. OpenCPN can't use the scanned image directly, since it requires a geo-referenced, or calibrated, chart in KAP format. I used imgkap, a free command-line utility for converting KAP files from images, as follows:

 imgkap chart.jpg chart.txt chart.kap

The first parameter is your scanned image, and the last parameter is the output KAP file. The middle parameter is a text file which specifies the KAP header. You can manually create the text file using any text editor, but it involves about 20 lines of cryptic parameters and it's easy to make a mistake.

To make it easier, I wrote this simple web app to overlay the chart using the Google Maps API Ground Overlay feature, and then automatically generate the KAP header text. Of course the generated KAP header is only as accurate as the bounding box coordinates, which you should be able to obtain from the original paper map, along with the scale. You can also align the chart with the Google Maps satellite view, but bear in mind that the accuracy of the latter's coordinates varies considerably, ranging from a few meters to tens of meters.
Overlaying chart for Eastern Cove, Kangaroo Island.
Here is the link to produce the above chart. Once the chart is aligned, simply copy and paste the KAP header file into a text file, run the imgkap command, and import the KAP file into OpenCPN. Voila!
Chart imported into OpenCPN.
Please give it a try and let me know what you think.

OVER.