Notices


Reply
Thread Tools
Posts: 40 | Thanked: 18 times | Joined on May 2008
#1
Hi there,

Some of you may be interested in using maemo-mapper for sailing navigation. There was already an attempt made to bring nautical charts into maemo-mapper (http://forums.internettablettalk.com...&highlight=bsb). The script presented there was based on libbsb tools. So, I gave it a try this summer.

Unfortunately, it didn't work well with European charts I have. For example, Croatian charts use their local datum, which is somewhat shifted against the standard WGS84. These charts are not perfectly aligned to the north as well. Another problem was that each chart covers a relatively small area, hence I would really like to be able to combine a few charts into a single maemo-mapper tile set.

I made a little investigation on BSB charts format and discovered that .KAP file header has an information how to bring charts into WGS84 datum. The header also has at least 3 geo-refererences, which should be enough to compensate the chart's skew. Besides, I found that all my chart headers describe a border outside which the raster does not contain useful data (margins, etc).

Apparently, libbsb does not take this information into account, more over it looks like the development of this library has stopped a few years ago. I looked around and discovered that GDAL library (http://www.gdal.org) also has BSB charts driver. Moreover, this suite seemed to have all the tools I would need to convert BSB charts into maemo-mapper-compatible tile set.

Here is how the work-flow should look like:
1) run gdal_translate to convert BSB's palleted raster into GDAL's 'virtual' RGB raster;
2) combine a few virtual rasters into one with gdalbuildvrt to cover a bigger area;
3) create a tile pyramid with gdal2tiles.py;
4) convert the tile pyramid into Google-compatible form with a custom script;

Unfortunately, it didn't work well either. There are a number of bugs there found in the versions of GDAL from the recent distributions. But the GDAL library is under active development, so I've submitted there a couple of bug reports. I hope they will be fixed in their future releases. Meanwhile I've created a few little 'workaroud' scripts which allowed me get a rather useful result out of it (see attachment).

Here is how it looks like at the moment:
1) kap2vrt.sh -- creates GDAL .vrt file with modified geo-reference, and 'virtually' cut RGB raster;
2) gdal2tiles-p.sh -- merely runs a couple of gdal2tiles.py in parallel; I create only the base zoom level with this, as gdal2tiles.py doesn't like 'virtually cut' rasters; gdal2tiles.py also creates a couple html files, so the result can be checked with a browser.
3) zoom-out.sh -- makes a tile pyramid out of base zoom level;
4) merge-tiles.sh -- sequentially merges a few tile pyramids in a single one;
5) optpng-r.sh -- compresses png tiles into a palleted form;
6) tms2gtiles.sh -- symlinks a tiles structure created by gdal2tiles.py into a Google-compatible form.

The resultant directory tree is to be fed into a web server (I used boa), so to download it from by the maemo-mapper.

I found it rather useful during my last trip in September.

Cheers
V
Attached Files
File Type: gz bsb2tiles.tar.gz (3.4 KB, 185 views)

Last edited by vadp; 2009-12-07 at 13:19. Reason: the attachment contained the wrong script. the tar ball re-uploaded and description corrected
 

The Following 3 Users Say Thank You to vadp For This Useful Post:
Posts: 40 | Thanked: 18 times | Joined on May 2008
#2
I've found that the atachment contained the wrong script, so I've corrected the original message
 
Posts: 5 | Thanked: 1 time | Joined on Dec 2009
#3
Thanks for this work. I played around with developing a Python-based KAP reader for the N810, but never finished it. This looks like a better approach.
 
Posts: 40 | Thanked: 18 times | Joined on May 2008
#4
Cheers!

AFAIK GDAL KAP reader may be fixed at version 1.7.0. There was an issue with gdal2tiles.py, but again, the development version seems to work better.
 
Reply


 
Forum Jump


All times are GMT. The time now is 03:08.