[OSM-newbies] Definition of ways, dupes, etc.

Andy Allan gravitystorm at gmail.com
Fri Aug 10 14:22:28 BST 2007


On 8/9/07, Sascha Silbe <sascha-ml-gis-osm-newbies at silbe.org> wrote:
> Hi!
>
> I'm currently writing a simple (offline) map viewer with support for OSM
> data in an SQL database.
> While trying to add OSM support, I encountered a few issues. If my
> questions have been answered before, please just direct me to the exact
> location of the answer. Since I'm curently behind a 33k6 modem, browsing
> the archives is no fun at all. I've read most of the Wiki (regarding the
> questions asked here, at least), though.
>
> 1. There are loads of dupes for each element type (i.e. nodes, segments,
> segment references; haven't checked ways for equality yet). Is this
> intended? What's the reason?

Generally those are unintended.

> 2. What about the negative IDs? Do they indicate something special?

They are for objects in editors that haven't been uploaded yet, and
hence don't have a global reference. I'm not sure if you mean there
are negative IDs in the main database?

> I'm also puzzled about the relationship between real-life ways and the
> OSM element type "way". To get an idea of it, I'll ask some questions:
>
> 1. How are a full motorway (with differing number of lanes) and its
> links represented in OSM (esp. if it has bridges over other ways)?

Depends who added it and how they chose to do it. Generally a given
motorway will be sequences of segments adjacent to one another,
pointing in the direction of traffic flow. There will be many separate
ways that make up the overall motorway since each way needs to end
when any of the tags change (e.g. lanes) and are also kept to a rough
"maximum" length for convenience of editing.

> 2. How is a circular way (e.g. "Berliner Ring" in Tübingen) represented
> in OSM?

Segments will join each node in a circle, and the way will contain all
segments. If a road is particularly long, it may be broken into a
series of separate ways.

> 3. How are tags set that apply to the full way (e.g. highway=motorway)?

They are assigned to the way - I think you need to look at either the
API or the source of a planet file.

http://wiki.openstreetmap.org/index.php/OSM_Protocol_Version_0.4#Get_way_by_ID
http://planet.openstreetmap.org

> 4. How are tags set that apply only to parts of the way (e.g. lanes=2)?

It doesn't work like that - each section with different tags is a different way

> 5. How is an area (e.g. a park) represented in OSM?

Same as a circular way. It is up to the processor to work out which is
supposed to be an area and what is a linear way with start=end.

> 6. How do I determine all the segments (and only those) of a given
> motorway?

You need to first work out all the ways belonging to a motorway, since
there would be many and they aren't referenced together. You need to
interpret the data to work out which ways reference a complete
motorway. This is non-trivial. When you have all the ways, they
contain references to all the segments, which is trivial.

> 7. How do I determine the area and tags belonging to a given park?

Treat it the same as other ways. There's no difference in the data structure.

> 8. When rendering, how do I determine if a way represents a "real" way
> (see circular way example above) or an area?

Usually by examining tags. Circular ways that have e.g. landuse tags
are areas, linear ways that are e.g motorways are not.

> 9. What do segments that are not part of ways represent?

Nothing in particular. People use them for different things, but they
can often just be ignored, especially if they have no tags. They are
often a work in progress.

> 10. What do ways without a highway tag represent?

Any other linear or area feature. If you mean ways with no tags at
all, then a linear or area feature that hasn't been completely mapped
yet.

> BTW, why is the "highway" tag called that instead of something more
> generic (like "class" or "type")? "highway=track" looks funny. :)

"highway" in OSM is generally representing a linear feature used for
travel, of one kind or another.

Hope this helps,
Andy




More information about the newbies mailing list