[OSM-talk] Advanced relationships

Robert (Jamie) Munro rjmunro at arjam.net
Wed Jun 13 13:58:11 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The more I use OpenStreetMap, the more I think it needs an Advanced
Relationships feature like MusicBrainz has (see
http://wiki.musicbrainz.org/AdvancedRelationships). The idea is that you
can link any two items in the database with a tag that describes the
connection. It would be implimented with 9 new tables in the database:

link_node_node
link_segment_node
link_way_node

link_node_segment
link_segment_segment
link_way_segment

link_node_way
link_segment_way
link_way_way

Each table would have around 4 columns:
from_id
to_id
key
value

The first two columns would reference the node, segment or way ID as
appropriate.
The primary key would be (from_id,to_id,key)

The value would be optional, and probably not needed very often.

Example uses:
* Turn restrictions between segments
* Place is in place between nodes (with a value if it has a special
significance, e.g. it's the capital)
* 3 ways: Road A, Railway B, Bridge C; two relationships A "is on" C, B
"is on" C where a road and railway share a bridge.
* Way "is border" of country, county or city node. Every county border
way is part of two counties - it may be possible to build rough county
maps by combining partial borders that we know about with delaunay
diagram guessed borders and a kind of join the dots approach. The nice
thing here is that if a county border is a river, you don't need to put
it in the database twice.

There would need to be extensions to the api to fetch relationships
from/to things, and the bbox query would return extra data containing
all the relationships that have one or other end inside the area that is
being fetched. It may be possible to impliment a backwards compatible
mode, where if an old client requests an object with a relationship,
they get the relationship expressed as a normal tag:

k=relto:[node|segment|way][id]  v="[key]:[value]"

if they were the from_id or:

k="relfrom:[node|segment|way][id]"  v="[key]:[value]"

if they were the to_id.

What do people think of the idea?

Robert (Jamie) Munro
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGb+ngz+aYVHdncI0RAje1AKDHJP/WNMHCuBsnFzODRs8rJ1kiwgCgptLE
eo7OGHpQLmgCwr7toXbNjGg=
=+PFy
-----END PGP SIGNATURE-----




More information about the talk mailing list