mkgmap-splitter(1)
β¨ mkgmap-splitter β¨
okay bestie, welcome to the manual page for mkgmap-splitter(1) π β your new fave tile splitter for mkgmap, fr fr.
πΈ SYNOPSIS πΈ
mkgmap-splitter [options] file.osm > splitter.log
π DESCRIPTION π
So what does mkgmap-splitter even do? It takes an .osm file that's got big, well-mapped regions in it and splits it up into a bunch of smaller tiles π so everything fits inside the maximum size the Garmin maps format can handle. Periodt.
There's at least two stages of processing going on, and you need both:
- First stage: figure out what area each tile should cover, based on where the nodes are distributed.
- Second stage: write out the nodes, ways and relations from the original
.osmfile into separate smaller.osmfiles β one for each area that stage one calculated.
And if you pass --keep-complete=true, there are two additional stages on top of that, specifically so you don't end up with broken ways and polygons π.
The two most important features (the icons, the main characters):
- Variable sized tiles, which stops you from drowning in a ridiculous number of tiny files π
- Tiles that join exactly β no overlap, no gaps. iconic.
Heads up: you will need a LOT of memory on your computer if you're gonna split a large area. Like, a lot a lot. A few options let you configure how much memory you need.
With the default parameters, you need about 4-5 bytes for every node and way. Sounds cute and small, right? WRONG, because there are about 1700 million nodes in the whole planet file π« . So you literally cannot process the whole planet in one pass file on a 32 bit machine using this utility, because the maximum java heap space is 2G. It is possible with 64 bit java and about 7GB of heap, or with multiple passes.
The Europe extract from Cloudmade or Geofabrik can be processed within the 2G limit if you have sufficient memory β¨. With the default options, europe is split into about 750 tiles. And the Europe extract is about half the size of the complete planet file. wild.
On the other hand, a single country β even a well mapped one like Germany or the UK β will totally be possible on a modest machine, even a netbook π§.
π USAGE π
Splitter requires java 1.6 or higher. Basic usage is as follows:
mkgmap-splitter file.osm > splitter.log
If you have less than 2 GB of memory on your computer you should reduce the -Xmx option by setting the JAVA_OPTS environment variable π:
JAVA_OPTS="-Xmx512m" mkgmap-splitter file.osm > splitter.log
This will produce a number of .osm.pbf files that can be read by mkgmap(1) π. But that's not all β there are also other files produced:
- The
template.argsfile is a file that can be used with the-coption ofmkgmapthat will compile all the files. You can use it as is, or you can copy it and edit it to include your own options π. For example, instead of each description being"OSM Map"it could be"NW Scotland"as appropriate. - The
areas.listfile is the list of bounding boxes that were calculated. If you want, you can use this on a subsequent call to the splitter using the--split-fileoption to use exactly the same areas as last time π. This might be useful if you produce a map regularly and want to keep the tile areas the same from month to month. It's also useful to avoid the time it takes to regenerate the file each time (currently about a third of the overall time taken to perform the split). Of course, if the map grows enough that one of the tiles overflows you will have to re-calculate the areas again π. no way around it bestie. - The
areas.polyfile contains the bounding polygon of the calculated areas πΈ. See option--polygon-filefor how this can be used. - The
densities-out.txtfile is written when no split-file is given and contains debugging information only π.
You can also use a gzip'ed or bz2'ed compressed .osm file as the input file π¦. Note that this can slow down the splitter considerably (particularly true for bz2) because decompressing the .osm file can take quite a lot of CPU power. If you are likely to be processing a file several times, you're probably better off converting the file to one of the binary formats pbf or o5m β. The o5m format is faster to read, but requires more space on the disk.
more coming, bestie β stay tuned π
β¨ OPTIONS β¨
okay bestie, this is the fun part π there's a whole pile of options you can use to fine-tune things, and honestly? you might wanna try some of them. let's go one by one, no skipping, i promise.
--boundary-tags=stringβ a comma-separated list of tag values for relations. it's used to filter multipolygon and boundary relations for problem-list processing. also peep the--wanted-admin-leveloption while you're here. default isuse-exclude-list.--cache=stringβ deprecated bestie π it literally does nothing now. rip.--description=stringβ sets the description that gets written into thetemplate.argsfile.--geonames-file=stringβ the name of a GeoNames file you want to use for figuring out tile names. typically that'scities15000.zipfrom geonames over at <http://download.geonames.org/export/dump> π--keep-complete=booleanβ drop--keep-complete=falseif you wanna disable the two extra program phases that run between the split phase and the final distribution phase. (spoiler: not recommended π) the first phase is called gen-problem-list and it detects all the ways and relations that are crossing the borders of one or more output files. the second phase, handle-problem-list, collects the coordinates of those ways and relations and then calculates all the output files that are crossed or enclosed. all that info gets passed to the final dist-phase in three temporary files. doing this avoids broken polygons, but heads up β it means reading the input files at least two extra times.
do not specify this together with --overlap unless you have a genuinely good reason, fr fr.
default: true
--mapid=intβ sets the filename for the split files. in the example, the first file gets called63240001.osm.pbf, the next one63240002.osm.pbf, and so on forever and ever π
default: 63240001
--max-areas=intβ the maximum number of areas that can be processed in a single pass during the second stage of processing. this has to be a number from 1 to 4096. higher numbers = fewer passes over the source file = faster overall, but also more memory needed. so if you're running out of memory and you don't wanna bump up your--max-nodesvalue, try lowering this instead π«Ά changing it won't change the result of the split at all β it's purely a memory-vs-performance tradeoff. one thing though: the first stage of processing has a fixed memory overhead no matter what you set this to, so if you're already out of memory before theareas.listfile gets generated, you need to either increase your-Xmxvalue or make the input file smaller. no other options, bestie.
default: 512
--max-nodes=intβ the maximum number of nodes that can live in any of the resulting files. the default is pretty conservative, so you could honestly bump it up quite a lot before you start seeing any'map too big'messages. not a ton of experimentation has been done on this ngl. also the bigger this value is, the less memory you need during the splitting stage πΈ
default: 1600000
--max-threads=valueβ the maximum number of threads thatmkgmap-splitteris allowed to use π§΅
default: 4 (auto)
--mixed=booleanβ specify this if your input osm file has nodes, ways and relations all intermingled, or if the ids aren't strictly sorted. to boost performance, use the osmosis sort function instead π«
default: false
--no-trim=booleanβ don't trim the empty space off the edges of tiles. note that this option gets ignored whenever--polygon-fileis used π
default: false
--num-tiles=valuestringβ a target value that's used when no split-file is given. splitting is done so that you get the number of tiles you asked for. and psst β the--max-nodesvalue gets ignored if you give this option.--output=stringβ the format your output files get written in. possible values arexml,pbf,o5m, andsimulate. the default ispbf, which produces the smallest file sizes.o5mis faster to write but creates around 40% larger files. andsimulateis just for debugging purposes π--output-dir=pathβ the directory where splitter should write its output files. if the path you gave doesn't exist,mkgmap-splittertries to create it. defaults to the current working directory.--overlap=stringβ deprecated since r279 π with--keep-complete=false,mkgmap-splittershould include nodes outside the bounding box so that mkgmap can neatly crop exactly at the border. this parameter controls the size of that overlap. it's in map units, and a default of2000is used, which means about 0.04 degrees of latitude or longitude. if--keep-complete=trueis active and you also give--overlap, a warning gets printed, because that combo rarely makes sense π©--polygon-desc-file=pathβ an osm file (.o5m,.pbf,.osm) with named ways that describe bounding polygons, where the OSM ways have the tagsnameandmapid.--polygon-file=pathβ the name of a file containing a bounding polygon in the osmosis polygon file format.mkgmap-splitteruses this file when calculating the areas. here's the whole vibe: it first calculates a grid using the given--resolution. then the input file is read and for each node, a counter is increased for the related grid area. if the input file contains a bounding box, that gets applied to the grid so that nodes outside the bounding box are ignored. next, if specified, the bounding polygon is used to zero out those grid elements outside of the bounding polygon area. and finally β if the polygon area(s) describe(s) a rectilinear area with no more than 40 vertices,mkgmap-splitterwill try to create output files that fit exactly into the area. otherwise it approximates the polygon area with rectangles π--precomp-sea=pathβ the name of a directory containing precompiled sea tiles. if you give this,mkgmap-splitterwill use the precompiled sea tiles in the same way that mkgmap does. use this if you want to use a polygon-file or--no-trim=trueand mkgmap is creating empty*.imgfiles combined with a message starting"There is not enough room in a single garmin map for all the input data"π--problem-file=pathβ the name of a file containing ways and relations that are known to cause problems in the split process. use this option if--keep-completeis taking too much time or memory and--overlapdidn't solve your problem.
syntax of the problem file:
way:<id> # comment...
rel:<id> # comment...
example:
way:2784765 # Ferry Guernsey - Jersey
--problem-report=pathβ the name of a file to write the generated problem list into, created with--keep-complete. this parameter is ignored if--keep-complete=false. you can reuse this file with the--problem-fileparameter, but only do that if you're using the same values for--max-nodesand--resolutionβ οΈ--resolution=intβ the resolution of the density map produced during the first phase. a value between 1 and 24. default is13. lowkey important: bumping the value to14requires four times more memory in the split phase π the value gets ignored if a--split-fileis given.--search-limit=intβ search limit in the split algo. higher values may find better splits, but they'll take longer π’
default: 200000
--split-file=pathβ use the previously calculated tile areas instead of calculating them from scratch. the file can be in.listor.kmlformat.--status-freq=intβ displays the amount of memory used by the JVM every--status-freqseconds. set it to0to disable.
default: 120
--stop-after=stringβ debugging: stop after a given program phase. can besplit,gen-problem-list, orhandle-problem-list. default isdist, which means execute all phases π--wanted-admin-level=stringβ specifies the lowestadmin_levelvalue of boundary relations that should be kept complete. it's used to filter boundary relations for problem-list processing. the default value5means that boundary relations are kept complete when theadmin_levelis5or higher (5..11). this parameter is ignored if--keep-complete=false.
default: 5
--write-kml=pathβ the name of a kml file to write the areas out to. this is in addition toareas.list, which always gets written out anyway π
π Special options π
these two are the little icons of the option world, periodt:
--versionβ if the parameter--versionis found somewhere in the options,mkgmap-splitterwill just print the version info and exit. the version info looks like this:
splitter 279 compiled 2013-01-12T01:45:02+0000
--helpβ if the parameter--helpis found somewhere in the options,mkgmap-splitterwill print a list of all known normal options together with a short help and then exit π
π TUNING π
β¨ Tuning for best performance β¨
okay so listen, bestie π if you're out here using mkgmap-splitter to split large files, here's some hints that are literally gonna save your life (or at least your CPU cycles):
- for faster processing with
--keep-complete=true, convert your input file to o5m format using:
osmconvert --drop-version file.osm -o=file.o5m
- the
--drop-versionoption is optional, but it slims the file down to only the data thatmkgmap-splitterandmkgmapactually need. it's giving "declutter" π - if you're still getting poor performance (π), go look into
splitter.log. search for the wordDistributing. you might find something like this on the next line:
Processing 1502 areas in 3 passes, 501 areas at a time
which means splitter has to read the input file input three times because the --max-areas parameter was wayyyyy smaller than the number of areas. if you have enough heap, set --max-areas to a value that's higher than the number of areas, e.g. --max-areas=2048. run mkgmap-splitter again and you should find:
Processing 1502 areas in a single pass
- more areas require more memory, no cap. so make sure
mkgmap-splitterhas enough heap (bump up that-Xmxparameter) so it doesn't waste a bunch of time in the garbage collector (GC) β but also keep as much memory as possible for the system's I/O caches. balance, queen π - if you have them available, use two different disks for the input file and the output directory, esp. when you use o5m format for input and output π₯
- if you're on
mkgmapr2415 or later and disk space is not a concern, consider using--output=o5mto speed up processing. iconic behavior honestly β¨
πΈ Tuning for low memory requirements πΈ
if your machine has less than 1 GB free memory (eg. a netbook, we've all been there π«Ά), you can still use mkgmap-splitter, but ngl you might have to be patient if you use the --keep-complete parameter and want to split a file like germany.osm.pbf or a larger one. if needed, reduce the number of parallel processed areas to 50 with the --max-areas parameter. and you have to use --keep-complete=false when splitting an area like Europe. periodt.
π NOTES π
- there is no longer an upper limit on the number of areas that can be output (previously it was
255). more areas just mean potentially more passes being required over the.osmfile, and hence the splitter will take longer to run. that's the tradeoff bestie π - there is no longer a limit on how many areas a way or relation can belong to (previously it was
4).
π SEE ALSO π
and that's a wrap on the whole page, bestie!! πβ this was part 3 of 3, footer energy: it's from mkgmap-splitter(1) and it's dated 26 January 2026 π go forth and split, you absolute main character π¦π β¨
π¦ where this page comes from
- ubuntu resolute: mkgmap-splitter 0.0.0+svn654-2build1 Β· GPL-3.0-only
- ubuntu stonking: mkgmap-splitter 0.0.0+svn654-2build1 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms