<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<br><div><div>On 26 Jul 2007, at 17:15, Chien Nguyen Khac wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>How you trim the ways before trim the segments? Because the segments appear in the planet.osm file before ways. Remember the planet.osm file is very huge > 5GB, you can not load it into memory. You need to read one line at a time and process one by one.</div> <div> </div></blockquote><div><br class="webkit-block-placeholder"></div><div>The way that I was thinking of doing it, would work when you are using some advanced SQL queries in a database. As you correctly point out, when reading from the planet file, this would be impractical. If incomplete ways was an issue, then the planet file could be re-read to include the segments and nodes that are missing.</div><div><br class="webkit-block-placeholder"></div><div>Shaun</div><br><blockquote type="cite"> <div>Regards,</div> <div><br><br><b><i>Shaun McDonald <<a href="mailto:shaunmcdonald131@gmail.com">shaunmcdonald131@gmail.com</a>></i></b> wrote:</div> <blockquote class="replbq" style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><br>On 26 Jul 2007, at 09:57, Steve Coast wrote:<br>>> [...]<br>>> My program need to do the following tasks:<br>>><br>>> 1. Open and read planet.osm xml file<br>>> 2. Trim all the nodes that are outside London's bounds --><br>>> write result to file<br>>> 3. Trim all segments that are outside London's bounds --><br>>> write result to file<br>>> 4. Trim all ways that are outside London's bounds --> write<br>>> result to file<br>>><br>>><br>>> Task 2 is very simple, just check the node's lat and lon within<br>>> the bounds --> after task 2 finish we have a set of nodes within<br>>> bounds<br>>> Task 3 is a little bit complicated, we need to check segment's<br>>> fromnodeid and tonodeid against the set of nodes within bounds --<br>>> > after task 3 finish we have a set of segments within bounds<br>>> Task 4 is extremely complicated, we need to check way's segment<br>>> against the set of segments within bounds.<br><br>You should swap the order of 3 and 4 as you could end up with <br>incomplete ways.<br><br>I could be wrong that this causes problems.<br><br>Shaun<br><br>>> [..]<br></blockquote><br><div> <br class="khtml-block-placeholder"></div><hr size="1">Be a better Globetrotter. <a href="http://us.rd.yahoo.com/evt=48254/*http://answers.yahoo.com/dir/_ylc=X3oDMTI5MGx2aThyBF9TAzIxMTU1MDAzNTIEX3MDMzk2NTQ1MTAzBHNlYwNCQUJwaWxsYXJfTklfMzYwBHNsawNQcm9kdWN0X3F1ZXN0aW9uX3BhZ2U-?link=list&sid=396545469">Get better travel answers </a>from someone who knows.<br>Yahoo! Answers - Check it out. </blockquote></div><br></body></html>