<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I was thinking of running through OSM files and performing different actions,</div><div class="">depending on the location of nodes and ways.</div><div class=""><br class=""></div><div class="">Creating a reader for a planet file and calling osmium::apply directly on it takes a very long time.</div><div class="">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:</div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">while</span> (<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span> <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">osmium</span>::<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">memory</span>::<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">Buffer</span> buffer = reader.<span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">read</span>()) {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""> osmium::apply(buffer, location_handler, myHandler);</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class="">}</div></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">As far as I understood I need to apply the location_handler first so that another handler (like myHandler in this example)</span></div><div style="margin: 0px;" class="">is able to gain the location of a way’s nodes.</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Now that I think about it, it makes sense that the location handler also still has the information about the past loops.</div><div style="margin: 0px;" class="">Sorry for that.</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">But is this way of approaching it correct?</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">Or are there better ways?</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">Greetings</span></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;" class=""><span style="font-family: Helvetica; font-size: 12px;" class="">Rainer</span></div><br class=""><div><blockquote type="cite" class=""><div class="">On 02.03.2015, at 19:35, Jochen Topf <<a href="mailto:jochen@remote.org" class="">jochen@remote.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">On Mo, Mär 02, 2015 at 06:54:15 +0100, Rainer Schlönvoigt wrote:<br class=""><blockquote type="cite" class="">Does said handler also find node locations for nodes that have not ended up in the buffer during the same read?<br class=""></blockquote><br class="">Not sure what you are asking. You can re-use the handler for different reads<br class="">and the data will still be there, if thats what you are asking. But you have to<br class="">keep in mind that not all indexes used by the handler will keep their contents<br class="">sorted. If you are reading only one file thats usually not a problem, because<br class="">most OSM files are sorted, but if you are reading several files this could<br class="">bite you. The Dense* indexes are "self-sorting", the SparseMemTable ist also,<br class="">but the Sparse*Array indexes aren't.<br class=""><br class="">If you tell us a bit more about what you are trying to archieve, we might be<br class="">able to help you further.<br class=""><br class="">Jochen<br class="">-- <br class="">Jochen Topf <a href="mailto:jochen@remote.org" class="">jochen@remote.org</a> <a href="http://www.jochentopf.com/" class="">http://www.jochentopf.com/</a> +49-173-7019282<br class=""></div></blockquote></div><br class=""></body></html>