imgkap and the kap file
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.
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
From OpenCPN 3.3.1117 skewed charts without this parameter set, are handled internally, and showed correctly. This is only to handled commercially issued charts that are not correctly coded.
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