[OSM-dev] Suggestion about design of OSM data structure

Shaun McDonald shaunmcdonald131 at gmail.com
Thu Jul 26 21:47:29 BST 2007


On 26 Jul 2007, at 17:15, Chien Nguyen Khac wrote:

> 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.
>

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.

Shaun

> Regards,
>
>
> Shaun McDonald <shaunmcdonald131 at gmail.com> wrote:
>
> On 26 Jul 2007, at 09:57, Steve Coast wrote:
> >> [...]
> >> My program need to do the following tasks:
> >>
> >> 1. Open and read planet.osm xml file
> >> 2. Trim all the nodes that are outside London's bounds -->
> >> write result to file
> >> 3. Trim all segments that are outside London's bounds -->
> >> write result to file
> >> 4. Trim all ways that are outside London's bounds --> write
> >> result to file
> >>
> >>
> >> Task 2 is very simple, just check the node's lat and lon within
> >> the bounds --> after task 2 finish we have a set of nodes within
> >> bounds
> >> Task 3 is a little bit complicated, we need to check segment's
> >> fromnodeid and tonodeid against the set of nodes within bounds --
> >> > after task 3 finish we have a set of segments within bounds
> >> Task 4 is extremely complicated, we need to check way's segment
> >> against the set of segments within bounds.
>
> You should swap the order of 3 and 4 as you could end up with
> incomplete ways.
>
> I could be wrong that this causes problems.
>
> Shaun
>
> >> [..]
>
>
> Be a better Globetrotter. Get better travel answers from someone  
> who knows.
> Yahoo! Answers - Check it out.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20070726/e02b0d2d/attachment.html>


More information about the dev mailing list