Skip to content

Add 'split' command to split OSM data by type or tags/geometry - #321

Closed
miche101 wants to merge 1 commit into
osmcode:masterfrom
miche101:feature/split-command
Closed

miche101 wants to merge 1 commit into
osmcode:masterfrom
miche101:feature/split-command

Conversation

@miche101

Copy link
Copy Markdown
  • Split input files into nodes, ways, and relations (3 files)
  • Add --split-details (-d) to separate tags from geometry/references (6 files)
  • Add --skip-empty-tags (-e) to omit untagged objects from tag files
  • Support format options like add_metadata=false via comma parsing
  • Add unit tests, manpage, and zsh completions. (bash missing)

example:
./osmium split -v -d -e -f opl,add_metadata=false -p test_details ../test/split/input.osm

results in
test_details_nodes_geom.opl
test_details_nodes_tags.opl
test_details_relations_geom.opl
test_details_relations_tags.opl
test_details_ways_geom.opl
test_details_ways_tags.opl

I hope what I’ve added with the help of AI isn’t too bad.

Best regards, miche101

- Split input files into nodes, ways, and relations (3 files)

- Add --split-details (-d) to separate tags from geometry/references (6 files)

- Add --skip-empty-tags (-e) to omit untagged objects from tag files

- Support format options like add_metadata=false via comma parsing

- Add unit tests, manpage, and bash/zsh completions
@miche101

Copy link
Copy Markdown
Author

It works with a planet..
./osmium split -v -d -e -f pbf,add_metadata=false -p ./split/planet planet-261109.osm.pbf

performance
Nov 20 09:07 - Nov 20 09:36

29min on a Ryzen 5 3600 multicore with (sorry) 1TB hdd Drive ;)

[ 0:00] Started osmium split
[ 0:00] osmium version 1.19.1 (v1.19.1-22-gb5dcfd5-changed)
[ 0:00] libosmium version 2.23.1
[ 0:00] Command line options and default settings:
[ 0:00] input options:
[ 0:00] file name: planet-261109.osm.pbf
[ 0:00] file format:
[ 0:00] other options:
[ 0:00] output prefix: ./split3/planet
[ 0:00] output format: pbf,add_metadata=false
[ 0:00] overwrite: no
[ 0:00] fsync: no
[ 0:00] split details (6 files): yes
[ 0:00] skip empty tags: yes
[ 0:00] Opening input file...
[======================================================================] 100%
[28:54] Done.

planet-File
99965632126 Nov 15 16:09 planet-261109.osm.pbf

result
47698589900 Nov 20 09:36 planet_nodes_geom.pbf
2661069193 Nov 20 09:36 planet_nodes_tags.pbf
552651673 Nov 20 09:36 planet_relations_geom.pbf
270704094 Nov 20 09:36 planet_relations_tags.pbf
20051551461 Nov 20 09:36 planet_ways_geom.pbf
8703147801 Nov 20 09:36 planet_ways_tags.pbf

@joto

joto commented Nov 20, 2026

Copy link
Copy Markdown
Member

I hope what I’ve added with the help of AI isn’t too bad.

Sorry, my little time doesn't allow me to look at anything done with AI. Unless somebody is willing to pay for my time, I can't do that.

@joto joto closed this Nov 20, 2026
@miche101

Copy link
Copy Markdown
Author

I can’t pay for your time... because OSM doesn’t pay me for my changesets. So, I’ll pull it into my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants