Serval Maps Utils - Map File Tester

The purpose of the MapFileTester application is to create test a repository of map data files to ensure they are valid files. The map data files were converted from OpenStreetMap data to the mapsforge format using the Convert from OpenStreetMap to Mapsforge using Osmosis tool from OpenStreetMap.

Using the Application

This application is written in Java and uses a command-line interface. The application supports the following command line options.

Option Description Allowed Values Required
-input the path to the top level directory of the map file repository a file system path yes

The application will recursively look for map data files, those ending with an extension of .map, starting at the directory specified by the -input parameter.

Each file will be opened and tested for validity be reading the header from the mapsforge file. If the file can be successfully opened metadata for the file is printed to the screen. If it cannot be opened an error is printed to the screen with some additional diagnostic information.

Using the Output from the Application

The output of invoking this application is printed to the console. Standard messages are printed to stdout while any error messages are printed to stderr.

It is possible to use grep to examine the output of the application to determine if any errors occurred using a command like this:

java -jar /path/to/MapFileTester.jar -input ~/path/to/mapdata/repo/ 2>&1 | grep -A 1 -B 1 -e "ERROR"

You will need to change the paths to those suitable for your circumstances.

Validating the mapsforge files

Following the advice of the mapsforge developers the following checks are conducted on each mapsforge file:

  1. opening the file and reading the header
  2. comparing the file size reported in the header with the actual size of the file