Preparing Finnish Sea Maps to AFtrack

This note describes how I prepared Finnish sea maps to AFtrack ( in BSB/KAP-format. The source maps are delivered in ECW format with TAB header. The maps are copyrighted material and not delivered for free.

The workstation is Ubuntu Linux 10.04 LTS and the AFtrack is installed to Google Nexus 7 (Android 4.2).

The process is similar to preparing Finnish NLS maps to AFtrack. Please have a quick look to it before continuing. This note explains how to deal with the ECW files and presents the Perl script that automates the process.


The first phase of the process is to transfer ECW file to TIFF format. This is tricky as ECW library is not freely distributed and you have to find and compile it yourself. The latest versions have been offered by ERDAS (libecwj2) in their web site but currently the file has been removed. Luckily the older version (3.3) is distributed in a number of sites. It can be used with GPL in GPL software.

The other software needed in transfer is GDAL and its transfer utility gdal_translate. GDAL is free software but typical binaries do not support libecwj2.

Installing libecwj2

libecwj2 can be installed by following instructions at OpenStreetMap WIKI. Here is the beef:
patch -p0 < libecwj2-3.3-msvc90-fixes.patch
cd libecwj2-3.3/
patch -p0 < ../libecwj2-3.3-NCSPhysicalMemorySize-Linux.patch
The files can also be found at this site.

The build is straightforward:
sudo make install

Installing GDAL

Ubuntu/Debian has GDAL package. Unfortunately it does not support the libecwj2. Instead of compiling GDAL I used the UbuntuGIS PPA:
  1. Add "" to your repos.
  2. sudo apt-get install libgdal-ecw-src
  3. sudo gdal-ecw-build /usr/local/

Automated Process

Once you have the ability to read ECW files the rest is easy. The attached script makes the conversion for all files in a directory.

Before using you have to install some tools.
  1. Image::Resize - Ubuntu has this packaged, install by sudo apt-get install libimage-size-perl
  2. Geo::Coordinates::ETRSTM35FIN - Unfortunately this module does not have Ubuntu/Debian package. To install the module you have two options:
    1. If you have root privileges you can install the module system-wide.
    2. It is possible to install the module under your home directory. However, a more straightforward method is to grab the source package (Geo-Coordinates-ETRSTM35FIN-x.y.tar.gz) and place the containing folder Geo-Coordinates-ETRSTM35FIN-0.01/lib/Geo and its contents to a directory where you later execute


Updated 19-NOV-2011 / Matti Lattu