- Java
- set JAVACMD_OPTIONS="-Xmx2g" or other memory size when osmosis starts to complain.
- osmium for filtering and splitting .pbf files
- osmosis for splitting .pbf and creating .map files
- mapsforge-map-writer plugin for osmosis to create .map files
- osmfilter for filtering pois and ways
- osmconvert for converting .pbf and .o5m files
- Cruiser app to view .map files on PC
Download the mapsforge-map-writer plugin, click on "file_download" and select "jar-with-dependecies.jar". Put the .jar in one of these directories. Create it when it doesn't exist.
- Linux/macOS
~/.openstreetmap/osmosis/plugins
- Windows
C:\Documents and Settings\(Username)\Application Data\Openstreetmap\Osmosis\Plugins
Download the .osm.pbf file for your region. By clicking on the "Sub Region" name you can get smaller files.
Without this step I was running out of memory when creating .map
files. Only data with those tags are saved to a file, it makes it smaller and now osmosis works without running out of memory. Those tags come from original .map
files that I found, maybe there are more?
osmconvert <your.osm.pbf> -o=<your.o5m>
osmfilter <your.o5m> \
--keep="access= admin_level= aerialway= \
aeroway= barrier= boundary= bridge= highway= \
natural= oneway= place= railway= tracktype= \
tunnel= waterway=" \
-o=<filtered-your.o5m>
osmconvert <your.o5m> -o=<filtered-your.osm.pbf>
osmium tags-filter <your.osm.pbf> \
access admin_level aerialway aeroway barrier boundary \
bridge highway natural oneway place railway tracktype \
tunnel waterway \
-o <filtered-your.osm.pbf>
The device uses Slippy map tilenames to store all map files. Split the big .osm.pbf
with osmosis to get all the tile data we need.
Get the X and Y from the tiles you want with this map grid tool, make sure you keep z at 8.
OR
Get the stable apk url from version.json, download and extract the .apk
. It contains assets/maps/mappack-gzip.json
. The tile_coordinates
are the X and Y.
Convert the X and Y to coordinates with this tool. Do this twice to get bottom, left, top and right. The second time do X+1 and Y+1.
$BOTTOM = lat value of y+1
$LEFT = lon value of x
$TOP = lat value of y
$RIGHT = lon value of x+1
Use $BOTTOM
, $LEFT
, $TOP
, $RIGHT
, X
and Y
in the commands below. Don't type \
at the end of the line in commands, those are just used to make it easier to read.
osmosis --rb <filtered-your.osm.pbf> \
--bounding-box bottom=$BOTTOM left=$LEFT top=$TOP right=$RIGHT \
completeWays=yes completeRelations=yes \
--wb file=<X-Y.osm.pbf>
osmium extract \
-b $LEFT,$BOTTOM,$RIGHT,$TOP \
<filtered-your.osm.pbf>
-o <X-Y.osm.pbf>
Merge splitted files from more countries where borders cross to make a complete .map
file.
osmconvert <a.osm.pbf> <b.osm.pbf> -o=<c.osm.pbf>
Download land-polygons-split-4326.zip and extract it. Two more programs are needed to convert the polygons to osm data.
- ogr2ogr
- shape2osm.py from that Github repository.
- python3
ogr2ogr -overwrite -progress -skipfailures -spat $LEFT $BOTTOM $RIGHT $TOP X-Y-land.shp land-polygons-split-4326/land_polygons.shp
python3 shape2osm.py -l "$WORK_PATH/land" "$WORK_PATH/land.shp"
Sea.osm is a simple file from mapsforge-creator repository. The $BOTTOM $LEFT $TOP $RIGHT values need to be replaced with the current values.
cp sea.osm <X-Y-sea.osm>
sed -i "s/\$BOTTOM/$BOTTOM/g" <X-Y-sea.osm>
sed -i "s/\$LEFT/$LEFT/g" <X-Y-sea.osm>
sed -i "s/\$TOP/$TOP/g" <X-Y-sea.osm>
sed -i "s/\$RIGHT/$RIGHT/g" <X-Y-sea.osm>
osmosis --rb <X-Y.osm.pbf> \
--rx file=<X-Y-land.osm> --s --m \
--rx <X-Y-sea.osm> --s --m \
--buffer \
--wb <merged-X-Y.osm.pbf> omitmetadata=true
osmium merge <X-Y.osm.pbf> <X-Y-land.osm> <X-Y-sea.osm> -o <merged-X-Y.osm.pbf>
The original .map
files had one zoom-interval
configuration, this resulted in matching output files.
osmosis --rb <merged-X-Y.osm.pbf> \
--mw file=<X-Y.map> \
bbox=$BOTTOM,$LEFT,$TOP,$RIGHT \
zoom-interval-conf=10,0,17 \
tag-conf-file=tag-wahoo.xml
Changing or removing anything in this file will result in different .map
files.
Make sure to also change the osmfilter
--keep
command to filter poi or way tags that got added or remove.
Some documentation about the config file.
- default config from Mapsforge
- modified.
This resulted in
.map
files that had the same pois and ways as the original files.
Note: Using this config won't give the same result as the original. Wahoo used custom zoom-appear levels. Maybe mapsforge-bolt.xml or mapsforge-roam.xml can be used to get more info about zoom-appear levels.
Compress the generated .map
file with lzma. Use lzma
on macOS or Linux and 7zip on Windows.
Connect the Wahoo device to your PC with usb and copy the file to the correct directory and file name and reboot the device.
Like: maps/tiles/8/X/Y.map.lzma
.