NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

I have a very large 2GB osm file that I need to split up into <=50K feature chunks.

I have attempted to use splitter, which is a great tool. you can set the # of nodes within each split file. Splitter then creates x amount of polygons to ensure there are no more then the requested # of nodes within each split file. The problem is splitter duplicates ways across overlapping changesets so that it does not cut them at intersection points. I am trying to find a solution that simply splits the osm file up without worrying about location of features.

Is there a tool to simply split an osm file based on # of features that ignores the location of features.

Any insight is welcome.

asked 19 Jul '16, 16:50

Cellington's gravatar image

Cellington
21691015
accept rate: 0%

edited 19 Jul '16, 18:20

I've linked to mkgmap's tile splitter - I presume that's what you meant.

Unfortunately I don't know an answer (and have no idea what you'd do with relations).

(19 Jul '16, 17:57) SomeoneElse ♦

Yes, I was talking about mkgmap's splitter.jar tool. I hadn't thought of relations.

(19 Jul '16, 18:26) Cellington

Generally it doesn't make much sense to split up OSM files into chunks without taking geometry into account, because you would end up with lots of ways and relations without the nodes and members they are referring to. About the only thing I can think of where this would make sense is when you are trying to transport the data over some "link" that doesn't support large files, but you will re-assemble the file on the other end before using it as a whole again. For instance if you only have a small USB stick or so. But then you can just use any normal file splitting program that can work with binary data, on Linux you can use 'split' for this.

Using splitter seems to be the right approach here, maybe you can cut the ways after using splitter somehow? Osmosis can cut ways, but you'd have to figure out the bounding box of each splitter output file in some way. Maybe it would be easier to write a small script that calls osmosis with different parameters splitting into a reglar grid? The same could be accomplished using the OSM history splitter. Maybe you can tell us why you want to do the splitting in the way you describe and we have a better way to help you.

permanent link

answered 20 Jul '16, 07:13

Jochen%20Topf's gravatar image

Jochen Topf
5.2k55074
accept rate: 31%

So my ultimate goal is to get a 2gb osm file into my personal API db. This file contains nearly 7 million total features (nodes, ways, relations). The proper way to get this into my OSM server is through the use of Osmosis using the upload change command (I also use osmosis to convert this file into a create changeset)

I use negative ids in my osm file so that when running the upload command, the data gets pushed into my database with the correct ids.

The osmosis upload command is limited to 50K features per changeset. This is why I am trying to split apart my file into many smaller files.

Ideally I would like to create a script that would parse through the large xml file and write multiple small xmls up to a max feature count while retaining the proper relationships between nodes, ways and relations.

(20 Jul '16, 19:09) Cellington

Have a look at http://wiki.openstreetmap.org/wiki/Import/Software . There are multiple programs there that might help you.

(20 Jul '16, 21:24) Jochen Topf

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×710
×34
×16

question asked: 19 Jul '16, 16:50

question was seen: 5,817 times

last updated: 20 Jul '16, 21:24

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum