[OSM-talk] osmcut.c Some problems with my solution :-)

Michael Hufer michael.hufer at gmx.de
Tue Oct 28 20:24:32 GMT 2008


On Tuesday 28 October 2008 21:12:10 Frederik Ramm wrote:
> Hi,
>
> Michael Hufer wrote:
> > My solution:
> > The input.osm file is already read twice to add the nodes outside the
> > tile boundaries. But the ways were already written in the first pass. I
> > changed that so that the ways are also written to the tile osm-file in
> > the second pass not the first so that now all node elements are above the
> > ways elements they are used in. This solution unfortunately increases the
> > processing time as the current version stops when it reached the first
> > way element in the second parse pass of the input file. I.e. it processed
> > only the node elements in the second pass while this new version must
> > process node AND way elements in the second pass.
>
> Would it perhaps be a better option to simply open two files per tile
> instead of one (one for nodes, one for ways), then write some nodes and
> all ways on the first pass, and add a few nodes to the node file on the
> second pass (and stop parsing on reaching <way>); finally close the way
> file, re-open it for reading, and append all contents to the node file?

I thought about this, too. But then used this variant as it was a simple and a 
small change (one additional if construct and one additional argument to the 
process_way function) to the existing code.

> The drawback of this is that it uses a lot of file descriptors but since
> you don't seem to want to go planet-wide anyway...

It might work for small excerpts like germany but bigger ones - like the whole 
of europe - the number of file descriptors reach the system limits again...

	Micha H.




More information about the talk mailing list