Constraints
This page documents the idea of adding constraints to OSM data.
Rationale
Some (if not most) mappers think and map in terms of spatial relationships, e.g. "this speed bump lines up with the corner of this building", or "this tree is at the exact edge of these two (connected) buildings."
If such relationships were added to OSM, this knowledge could be codified, and (through editor support) transparently used by future mappers.
In some situations, constraints already exist on OSM. For instance, a node (such as a tap, a surveillance camera, a door) attached to a building way gets moved if the building is moved.
Types of constraints
We propose the following kinds of constraints -
1. Linear - two or more nodes lie along the same plane. If either of the nodes is moved, so is the other.
- This could be modeled as a way connecting the two nodes. The way has the tags constraint:linear=yes.
2. Angle - two adjacent segments of a way are at a fixed angle.
- This can be useful for buildings. For example, after a building geometry is modified, the need for manual squaring is rendered unnecessary if 90° angles are specified as constraints.
- For ways, the angle may be associated with a node which is only part of a single way (i.e. not shared by any other way), by tagging the node with constraint:angle=*. For open ways, this could refer to the angle formed to the left of the way's direction. For closed ways, this could always refer to the inner rather than the outer angle.
- More generally, an angle constraint could be modeled as a relation having the tags type=constraint + constraint=angle + angle=*, with the three adjacent nodes (demarcating the segments) as members.
- The relation can contain more than 3 nodes, as long as they are adjacent. For instance, all four nodes of a rectangular building could be present in a single type=constraint + constraint=angle + angle=90 relation.
- How should a direction be specified for the angle relation?
3. Length - a way with a fixed length.
- e.g. the edge of a building and a drain could be connected by a constraint way, which specifies that they have a certain distance at a certain point.
- This could be modeled as a way with the tags constraint:length=*.
The above constraint types can be used in any combination.
Rendering
Constraints would only be of interest to mappers, and thus only rendered by editors and inspection tools.
To avoid increasing the learning curve of contributing to OSM, new mappers may be prevented from adding or editing constraints.