From OpenStreetMap Wiki
Jump to: navigation, search

is it possible to have output files not gzipped? And parameter to specify output file will be nice.--Walley 18:56, 26 May 2009 (UTC)

Could not open file: *.osm.gz after running Splitter

Hi, I have a drama trying to run MKgmap after the splitter.

Could not open file: *.osm.gz (note, where * is the file name)

Exception in thread "main" java.lang.NullPointerException





I've tried saving the output files to various locations, thinking it's a file access problem. It doesn't matter what directory, nor where the files are (pointing to location)... have I missed something really silly? (note the o/p of the splitter is 8 .osm.gz files) I've not been able to find a result in the Wiki, Ubuntu forums or Google. Trenchtractor

Also posted in Talk:Mkgmap


When splitter is called with --mapid=0000001 (or any other mapid which starts with zero(s)) there is a bug in splitter.

the files generated have eight character names (i.e. 00000001.osm.gz, 00000002.osm.gz, etc.) but the templates.args contains lines like:

mapname: 1
description: OSM-Map 1
input-file: 1.osm.gz

mapname: 2
description: OSM-Map 2
input-file: 2.osm.gz

Thus mkgmap cannot find the tile files when using this template file as "-c" input. I wrote a small patch to fix this:

Index: src/uk/me/parabola/splitter/
--- src/uk/me/parabola/splitter/   (revision 161)
+++ src/uk/me/parabola/splitter/   (working copy)
@@ -164,7 +164,7 @@
                Reader r = null;
                areas = new ArrayList<Area>();
-               Pattern pattern = Pattern.compile("([0-9]{8}):" +
+               Pattern pattern = Pattern.compile("([0-9]{1,8}):" +
                " ([\\p{XDigit}x-]+),([\\p{XDigit}x-]+)" +
                " to ([\\p{XDigit}x-]+),([\\p{XDigit}x-]+)");
Index: src/uk/me/parabola/splitter/
--- src/uk/me/parabola/splitter/       (revision 161)
+++ src/uk/me/parabola/splitter/       (working copy)
@@ -491,12 +491,12 @@
                w.println("# for each one.");
                for (Area a : areas) {
-                       w.format("mapname: %d\n", a.getMapId());
+                       w.format("mapname: %08d\n", a.getMapId());
                       if (a.getName() == null)
-                               w.println("# description: OSM Map");
+                               w.format("description: OSM Map #08d\n", a.getMapId());
                               w.println("description: " + a.getName());
-                       w.format("input-file: %d.osm.gz\n", a.getMapId());
+                       w.format("input-file: %08d.osm.gz\n", a.getMapId());