mkgmap problem: Can anyone find an error in this short script?

Presently, I am trying to make my windows script to generate garmin maps more flexible. Here is the script, that stops with an error at the very end:


set drive=%cd:~0,3%
set tilesdir=%drive%map\OSM_Tiles
set centraleuropepath=%drive%map\Centraleurope.osm
set templateargspath=%tilesdir%\template.args
set mkgmapoutputdir=%drive%map\Output

set osmosispath=%drive%map\Osmosis-0.39
set splitterpath=%drive%map\Splitter-r171
set mkgmappath=%drive%map\mkgmap-r1908

cd %drive%map

wget http://download.geofabrik.de/osm/europe.osm.bz2

7za e -y europe.osm.bz2

java -Xmx1600m -cp "%osmosispath%\lib\default\plexus-classworlds-2.2.2.jar" -Dapp.home="%osmosispath%" -Dclassworlds.conf="%osmosispath%\config\plexus.conf" org.codehaus.classworlds.Launcher --read-xml file="europe.osm" --bounding-box idTrackerType=BitSet top=60 left=4 bottom=47 right=16 --write-xml file=%centraleuropepath%

cd %splitterpath%
java -Xmx1600m -jar splitter.jar --cache=.\temp --max-areas=70 --max-nodes=1000000 --output-dir=%tilesdir% %Centraleuropepath%

cd %mkgmappath%
java -Xmx1600m -jar mkgmap.jar --output-dir=%mkgmapoutputdir% --max-jobs --index --reduce-point-density=10 --description=OSM_DE --country-name=centraleurope --country-abbr=EU --name-tag-list="name:de,name,int_name" --style-file=%drive%map\My_Style_13\ --generate-sea=multipolygon --family-id=1331 --product-id=1 --series-name=OSM_Germany --family-name=OSM_Germany --area-name=Germany --overview-mapname=OSM_Centraleurope --net --gmapsupp --tdbfile --route --add-pois-to-areas --road-name-pois=0x640a --draw-priority=25 --latin1 --make-opposite-cycleways --remove-short-arcs -c %templateargspath% %drive%map\My_13.typ

pause

The script stops at the end of the mkgmap-task (after all files were generated) with an error:

Exception in thread “main” java.lang.IllegalArgumentException
at java.nio.ByteBuffer.allocate(Unknown Source)
at uk.me.parabola.imgfmt.sys.Directory.sync(Directory.java:176)
at uk.me.parabola.imgfmt.sys.ImgFS.sync(ImgFS.java:230)
at uk.me.parabola.imgfmt.sys.ImgFS.close(ImgFS.java:240)
at uk.me.parabola.mkgmap.combiners.GmapsuppBuilder.onFinish(GmapsuppBuilder.java:124)
at uk.me.parabola.mkgmap.main.Main.endOptions(Main.java:419)
at uk.me.parabola.mkgmap.CommandArgsReader.readArgs(CommandArgsReader.java:126)
at uk.me.parabola.mkgmap.main.Main.main(Main.java:129)

I have tested an older version of mkgmap, but it also leads to a (different) error here. If the result is installed in MapSource by MapSetToolkit, there is a tile in the baltic sea showing no water and a tile in south sweden showing only water with towns in it.

Any ideas, what went wrong here?

I think one of the tiles generated by splitter still has too many nodes/data and should be split again until Mkgmap manages to compile the data into a map.

I have also tested to reduce the tiles to 600 000 nodes, but also got (another) error.

Therefore I suspected the original OSM-file (downloaded from geofabrik) to be damaged and loaded an actual one. The result lets me hope. The script now runs error-free (using tiles of 900 000 nodes).

Unfortunately, the sea (or water) is still displayed wrong over whole tiles in mapsource and also on my eTrex (as described in the original post). Any ideas where this might come from? Can I influence that with the generate-sea-option?

It depends on what extract you’re using. Flooded areas happen when the coastline doesn’t hit the edge of the tile, or if the coastline has gaps in it. You can try:
generate-sea:no-sea-sectors,extend-sea-sectors,close-gaps=1000

and see if that fixes it, if not you will have to check your OSM extract to make sure the coastline hits the boundaries.

The option --generate-sea=no-sea-sectors,extend-sea-sectors,close-gaps=1000 produces an error during map calculation here.

The option --generate-sea=multipolygon,extend-sea-sectors as well as --generate-sea=multipolygon,extend-sea-sectors,close-gaps=1000 produce no errors. Both produce less sea-artifacts as in the beginning. But in all versions , a big tile in the north east corner shows completely water where is is mainly land (south sweden).

What do you mean with this? Here the right (east) boundary is intersecting the baltic sea and the upper (north) boundary lies within sweden, norway and the north sea. So I would say, that the coastline hits the boundaries. Can you explain this in more detail?

Update: I just recognized that the option “floodblocker” improves the situation. The big tile in the upper right corner now becomes land.