[OSM-dev] Osmium::handler::NodeLocationsForWays and buffered reading

Jochen Topf jochen at remote.org
Mon Mar 2 19:39:45 UTC 2015


On Mo, Mär 02, 2015 at 07:58:01 +0100, Rainer Schlönvoigt wrote:
> I was thinking of running through OSM files and performing different actions,
> depending on the location of nodes and ways.
> 
> Creating a reader for a planet file and calling osmium::apply directly on it takes a very long time.
> I would like to regain control every once in a while and as far as I can tell that only works when iterating using something like:
> while (const osmium::memory::Buffer buffer = reader.read()) {
>     osmium::apply(buffer, location_handler, myHandler);
> }
> 
> As far as I understood I need to apply the location_handler first so that another handler (like myHandler in this example)
> is able to gain the location of a way’s nodes.
> 
> Now that I think about it, it makes sense that the location handler also still has the information about the past loops.
> Sorry for that.
> 
> But is this way of approaching it correct?
> Or are there better ways?

Yes, this is the right approach for your case.

Jochen
-- 
Jochen Topf  jochen at remote.org  http://www.jochentopf.com/  +49-173-7019282



More information about the dev mailing list