[Openstreetmap-dev] New database schema for segments; keys and values?

nick at hogweed.org nick at hogweed.org
Wed Sep 21 11:55:42 BST 2005

Hello Steve and everyone,

Been looking at the Ruby code for handling GPX upload. The current schema only 
allows segments with two points, but multi-point segments would be better for 
longer roads (that way, you can just pull all the points from one segment 
using one query and do what you like with it).

What do you think of the following alternative schema which would also handle 
the keys and values?

Segments table at the moment:

uid, node_a, node_b, timestamp, user_uid, visible

Revised schema for segments table?

uid, timestamp, user_uid, visible, keyid, value

A new table segment_nodes, to store the nodes of segments?

segid : ID of parent segment
nodeid: ID of node
lat : Latitude
lon: Longitude

New table segment_keyvals, allowing addition of keys and values to segments?

segid: ID of segment
keyid: ID of key (see table below)
value: Value of key

New table keys

id: Key ID
name: Key name

If this schema (or something similar) is acceptable, then I can start hacking 
on this stuff.


More information about the dev mailing list