Files
iD/data/presets
2013-03-13 11:34:21 -07:00
..
2013-03-13 11:34:21 -07:00
2013-03-13 11:34:21 -07:00
2013-03-07 21:38:48 -08:00
2013-03-13 11:34:21 -07:00
2013-03-06 16:54:32 -05:00
2013-03-13 11:34:21 -07:00
2013-03-13 11:34:21 -07:00

Presets

iD uses a simple presets system based on JSON preset definitions and simple structure.

Individual Presets

Specific presets are located under data/presets/presets. For convenience, they're stored in sub-directories like data/presets/presets/leisure/park.json, but these have no effect on their final functionality.

Preset Format

A basic preset is of the form:

{
    "name": "park",
    "match": {
        // the geometry types for which this preset is valid.
        // options are point, area, line, and vertex.
        // vertexes are points that are parts of lines, like the nodes
        // in a road
        // lines are unclosed ways, and areas are closed ways
        "geometry": [
            "point", "area"
        ],
        // terms are synonyms for the preset - these are added to fuel
        // the search functionality. searching for 'woodland' will bring
        // up this 'park' preset
        "terms": [
            "esplanade",
            "village green",
            "woodland"
        ],
        // tags that automatically added to the feature when it's selected
        "tags": {
            "leisure": "park"
        }
    },
    // the icon in iD which represents this feature
    "icon": "park",
    // An array of field names. See the fields documentation for details of what's valid here.
    "fields": [
        "address"
    ]
}

Fields

Fields are, like presets, defined in JSON structures. A typical field is

{
    "key": "access",
    "type": "combo"
}

In which type is the fields's type. Valid field types are

  • textarea
  • radio
  • combo
  • check
  • address
  • defaultcheck - a checkbox that can be yes, no, or null - not filled

Building

Presets are built with the build.js script in iD's root. build.js combines all presets together with imagery data, deprecated and discarded tags into one file, data/data.js.