Relations/Proposed/Defaults

From OpenStreetMap Wiki
Jump to: navigation, search
defaults
Status: Draft (under way)
Proposed by: FrViPofm
Tagging: type=defaults
Applies to: relation
Definition: Relation for defining default values
Rendered as: Not rendered
Draft start: 2010-05-28
RFC start:
Vote start:
Vote end:

As the author of this proposal is not very skillful in English, corrections to this page are welcome. Discussion may take place on the talk page.

Contents

Why defaults?

There are, for the same kind of objects, several default values at the country or lower administrative level (e.g. state, province, county, city). These include things like speed limits and holiday periods. Routing engines currently need to retrieve these defaults from other sources, which can be difficult to code, and of varying availability, timeliness, and quality.

It has been suggested somewhere that an XML file could be written to store those default values for renderers, routing engines, etc. It seems easier to insert those metadata into the database in a special kind of relation.

This is the aim of the relation type defaults. This relation can be added as a member of other relations with a role of defaults.

In this way, the default values are:

Note: The "defaults" are not tags that would apply to the object itself but instead to objects contained in its area. So, a timezone or a currency that are properties of a country or a state should not be tagged using defaults, for they are not default values inside this area, but values of this area.

Tags

Syntax

The proposed syntax for a default tag is in three parts:

(keyword)  'def' +  ':'
[
 condition [ (osm_primitive) 'node'|'way'|'relation' + '/' ] (tag_key)  'key' +  '=' +  'value' + 
 [ '&'
  + condition [ (osm_primitive) 'node'|'way'|'relation' + '/' ] (tag_key) 'key' + '=' + value' + ';' +
  ] 
 + ';' +
]
(tag_key) 'new_key'
[ ',' metadata 'meta']

For example : def:highway=motorway;maxspeed.

Note that, at first, you may be confused by:

Key Value Discussion
type defaults
name a name for those defaults optional
description a description of this set optional but welcome
def:[(condition) <key=value>;] new_key [, meta] value

Members

Way or Node Role Occurrence Discussion
Relation apply_to at least one Polygons in which those defaults apply as default values

Questions to be resolved

Syntax

Such a string is allowed in XML files. Is it allowed in the osm DTD [2]

How can we define a default value for an object that is within an area (urban)? def:highway=residential[landuse=residential]:maxspeed?

How can we reuse the syntax of the XAPI?

Loops

A relation:boundary can include a relation:defaults as member with the role defaults. The relation:defaults can have the relation:boundary with the role apply_to as member.

The information is redundant. If the editors don't manage well the relation:defaults, the information may be asymmetric.

For engines that do not manage well the relations of relations, the risk is an infinite loop.

Collision

The risk is that an object has several defaults members with the same definition, but with different values. Which would be applied?

They are two replies to your question : if you talk about putting two times the same members in the relation, it's a global risk that we have in all relation objects. Just watch them and fix. If you talk about the same node or way that is surrounded by different default values embedded in different polygons, it's a bit more complicated. Defaults shall apply to an element defining an area, most probably a boundary relation, with a hierarchy. The defaults defined for the smallest area are superseding the defaults of the bigger area. What we need is a kind of 'defaults' consistency checker application verifying that two overlapping areas with the same importance (for instance, two boundaries admin_level 4) are not defining different values. This would be a show stopper for software applications looking for such defaults. -- Pieren 12:55, 30 May 2010 (UTC)
First, I hope that two level 4 boundaries will not overlap, and that shouldn't be a problem any more. I think that Pieren has it almost right with "The defaults defined for the smallest area are superseding the defaults of the bigger area", but I would change it to "the defaults defined by the contained area are superseding defaults of the containing area". (and no, both proposition are not equivalent, mine imply Pieren's, but the opposite is not true )
Question remains : is it technically "very" easy, and if yes, how much easy sletuffe 13:02, 30 May 2010 (UTC)

Examples

with one apply_to member : the relation:boundary France Relation.png 11980 (XML, check, manage, JOSM, history, view, gpx )
with several subscribers as apply_to members

List of existing defaults relations

France

Notes & Links

  1. When several conditions are given, the default value applies to elements that match all of them. The | is not used. It seems simpler to create another rule than writing complex definitions.
  2. 2.0 2.1 Must the & be stored as & or &amp; in the database?
  3. See [1]
  4. 4.0 4.1 SH is the keyword taken in the opening hours for the school holidays.

Personal tools
Namespaces
Variants
Actions
site
Toolbox