Recently, I wanted to convert a NOAA chart to a different format, so that I could plot one of my GPS courses on top of the chart, to create a cool looking overlay.
I settled on MBTiles as the format, which stores raster or vector tilesets in a SQLite database. Initially, I attempted to convert to a GeoTIFF, but the program I use to view maps was not reading it correctly, so I moved on to MBTiles.
For converting the KAP Nautical Chart, I used The Geospatial Data Abstraction Library, or GDAL for short.
Converting the file is pretty easy, but if you want it to be zoomable, there is an additional step.
First convert the file using gdal_translate, which converts a raster file to a different format:
gdal_translate -expand rgba -of MBTILES input_file.KAP output_file.mbtiles
At this point, you should have a mbtiles file called output_file.mbtiles, which you can open and view. However, by default gdal_translate generates it at the max zoom level and so if you attempt to zoom in or out, it will not work properly.
So, using gdaladdo, we can generate overview images for various zoom levels:
gdaladdo -r cubicspline output_file.mbtiles
* Note that you may want to play with the ‘-r’ option and use a different resampling algorithm. ‘nearest’ may be faster. See here for supported algorithms.
The result should be a zoomable mbtiles file, which you can load into a viewer, such as Viking or GPXSee, to view a map and then zoom in/out of it.
Add a Comment