iD editor preset and field types are defined in [JSON](http://en.wikipedia.org/wiki/JSON)
files located under the `data/presets` folder of the iD repository.
#### Preset Files
Presets are defined in JSON files located under `data/presets/presets`. They're organized in a
directory hierarchy based on OSM key/value pairs. For example, the preset that matches
the tag `leisure=park` is in the file `data/presets/presets/leisure/park.json`.
#### Preset Schema
A basic preset is of the form:
```javascript
{
// The icon in iD which represents this feature.
"icon":"maki-park",
// The names of fields that will appear by default in the editor sidebar.
// See the fields documentation for details of what's valid here.
"fields":[
"address"
],
// The names of fields that the user can add manually. These will also
// appear if the corresponding tags are present.
"moreFields":[
"phone",
"website"
],
// The geometry types for which this preset is valid.
// options are point, area, line, and vertex.
// vertices 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 are added to the feature when selecting the preset,
// and also used to match the preset against existing features.
// You can use the value "*" to match any value.
"tags":{
"leisure":"park"
},
// English language display name for this map feature.
"name":"Park"
}
```
The complete JSON schema for presets can be found in [`data/presets/schema/preset.json`](schema/preset.json)
#### Preset Properties
##### `name`
The primary name of the feature type in American English.
Upon merging with `develop`, this is sent to Transifex for translating to other localizations. Changing the name of an existing preset will require it to be re-translated to all localizations.
This property is required. There is no default.
##### `geometry`
An array of possible geometry types that a feature must have in order to match this preset.
*`point`: an OSM node that is not a member of any way
*`vertex`: an OSM node that is a member of one or more ways
*`line`: an OSM way that is not an area
*`area`: an OSM way that is closed/circular (the first and last nodes are the same) or a `type=multipolygon` relation
*`relation`: an OSM relation
Closed ways can be treated as both `line` or `area` geometry. If a preset allows both, iD will add an additional `area=yes` tag when choosing the preset for an area feature.
The geometry types should be listed in order of preference. For example, the preset for `leisure=swimming_pool` lists `area` before `point`.
This property is required. There is no default.
##### `tags`
An object with the `"key": "value"` tags a feature must have to match this preset. A `"*"` wildcard value can be set to have this preset match any value for that key.
A features can only match one preset even if its tags and geometry could technically match more than one. iD will pick the best match based on `matchScore`, the number of tags, and the use of wildcard values.
This property is required. There is no default.
##### `addTags`
The tags that are added to the feature when selecting this preset. Defaults to `tags`. If needed, this property will typically be a superset of `tags`.
iD's validator will recommend that users add missing tags from `addTags` to matching features. For example, the Bridge preset has these properties:
```
"tags": {
"man_made": "bridge"
},
"addTags": {
"man_made": "bridge",
"layer": "1"
},
```
When adding a feature with this preset, it will be given the tags `man_made=bridge` and `layer=1`. The user could then change `layer` to `3`, for instance, and the feature would still match the preset because it still has `man_made=bridge`. If the user removes the `layer` tag altogether, iD will recommend adding it back with a value of `1`.
##### `removeTags`
The tags that are removed from the feature when deselecting this preset. Defaults to `addTags` or if this is also not defined, to `tags`.
##### `fields`/`moreFields`
Both these properties are arrays of field paths (e.g. `description` or `generator/type`).
`fields` are shown by default and `moreFields` are shown if manually added by the
user or if a matching tag is present. Note that some fields have a `prerequisiteTag`
property that limits when they will be shown.
A preset can reference the fields of another by using that preset's name contained in
brackets, like `{preset}`. For example, `shop/books` references and extends the fields
of `shop`:
```javascript
"fields":[
"{shop}",
"internet_access"
],
"moreFields":[
"{shop}",
"internet_access/fee",
"internet_access/ssid"
],
"tags":{
"shop":"books"
}
```
If `fields` or `moreFields` are not defined, the values of the preset's "parent"
preset are used. For example, `shop/convenience` automatically uses the same
fields as `shop`.
In both explicit and implicit inheritance, fields for keys that define the
preset are generally not inherited. E.g. the `shop` field is not inherited by `shop/…` presets.
##### `icon`
The name of a local SVG icon file. You can use icons from any of the following icon sets. When specifying an icon, use the prefixed version of the name, for example `"icon": "maki-park"`.
The URL of a remote image file. This does not fully replace `icon`—both may be shown in the UI.
For example, `imageURL` is used to specify the logos of brand presets from the [name-suggestion-index](https://github.com/osmlab/name-suggestion-index).
Bitmap images should be at least 100x100px to look good at 50x50pt on high-resolution screens.
##### `searchable`
Deprecated or generic presets can include the property `"searchable": false`.
This means that they will be recognized by iD when editing existing data,
but will not be available as an option when adding new features.
By convention, unsearchable presets have filenames that begin with an underscore
(e.g. `data/presets/presets/landuse/_farm.json`)
##### `matchScore`
A number that ranks this preset against others that match the feature.
For example, a feature with `amenity=cafe` and `building=commercial` will match the Cafe preset instead of the Commercial Building preset because Commercial Building has a lower `matchScore`.
The default is `1.0`.
##### `countryCodes`
An array of two-letter, lowercase [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes. The preset will only be searchable when the user is editing over the specified, whitelisted countries. The locale and language of iD are not factors, just the position of the map.
By default, presets are available everywhere.
##### `notCountryCodes`
An array of two-letter, lowercase [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes. Similar to `countryCodes` except a blocklist.
##### `replacement`
The ID of a preset that is preferable to this one. iD's validator will flag features matching this preset and recommend that the user upgrade the tags.
When possible, use `deprecated.json` instead to specify upgrade paths for old tags. This property is meant for special cases, such as upgrades with geometry requirements.
##### `reference`
A key and optionally a value to link to the wiki documentation for this preset. Only necessary if the preset consists of several tags.
For example,
```javascript
"reference":{
"key":"tower:type",
"value":"communication"
}
```
## Fields
Fields are reusable form elements that can be associated with presets.
#### Field Files
Fields are defined in JSON files located under `data/presets/fields`.
The field files are typically named according to their associated OSM key.
For example, the field for the tag `sport=*` is stored in the file
`data/presets/fields/sport.json`. When a field has multiple versions that
depend on which preset is active, we add a suffix to the filename:
If a combo field does not specify `options` or `strings`, the field will fetch
common tag values from the Taginfo service to use as dropdown values.
##### `snake_case`
For combo fields, spaces are replaced with underscores in the tag value if `snake_case` is `true`. The default is `true`.
##### `caseSensitive`
For combo fields, case-sensitive field values are allowed if `caseSensitive` is `true`. The default is `false`.
##### `minValue`
For number fields, the lowest valid value. There is no default.
##### `maxValue`
For number fields, the greatest valid value. There is no default.
##### `increment`
For number fields, the amount the stepper control increases or decreases the value. The default is `1`.
##### `prerequisiteTag`
An object defining the tags the feature needs before this field will be displayed. It may have this property:
-`key`: The key for the required tag.
And may optionally be combined with one of these properties:
-`value`: The value that the key must have.
-`valueNot`: The value that the key must not have.
Alternatively, the object may contain a single property:
-`keyNot`: The key that must not be present.
For example, this is how we show the Internet Access Fee field only if the feature has an `internet_access` tag not equal to `no`.
```js
"prerequisiteTag":{
"key":"internet_access",
"valueNot":"no"
}
```
If a feature has a value for this field's `key` or `keys`, it will display regardless of the `prerequisiteTag` property.
##### `countryCodes`
An array of two-letter, lowercase [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes. The field will only be available for features in the specified, whitelisted countries.
By default, fields are available everywhere.
##### `notCountryCodes`
An array of two-letter, lowercase [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes. Similar to `countryCodes` except a blocklist.
##### `urlFormat`
For `identifier` fields, the permalink URL of the external record. It must contain a `{value}` placeholder where the tag value will be inserted. For example:
"access":{"keys":["access","foot","motor_vehicle","bicycle","horse"],"reference":{"key":"access"},"type":"access","label":"Allowed Access","placeholder":"Not Specified","strings":{"types":{"access":"All","foot":"Foot","motor_vehicle":"Motor Vehicles","bicycle":"Bicycles","horse":"Horses"},"options":{"yes":{"title":"Allowed","description":"Access allowed by law; a right of way"},"no":{"title":"Prohibited","description":"Access not allowed to the general public"},"permissive":{"title":"Permissive","description":"Access allowed until such time as the owner revokes the permission"},"private":{"title":"Private","description":"Access allowed only with permission of the owner on an individual basis"},"designated":{"title":"Designated","description":"Access allowed according to signs or specific local laws"},"destination":{"title":"Destination","description":"Access allowed only to reach a destination"},"dismount":{"title":"Dismount","description":"Access allowed but rider must dismount"},"permit":{"title":"Permit","description":"Access allowed only with a valid permit or license"}}}},
"blind":{"key":"blind","type":"radio","strings":{"options":{"yes":"Yes","limited":"Limited","no":"No"}},"label":"Blind Person Access","terms":["sight impairment","vision impairment"]},
"comment":{"key":"comment","type":"textarea","label":"Changeset Comment","usage":"changeset","placeholder":"Brief description of your contributions (required)"},
"cycleway":{"keys":["cycleway","cycleway:left","cycleway:right"],"reference":{"key":"cycleway"},"type":"cycleway","label":"Bike Lanes","placeholder":"none","strings":{"types":{"cycleway:left":"Left side","cycleway:right":"Right side"},"options":{"none":{"title":"None","description":"No bike lane"},"lane":{"title":"Standard bike lane","description":"A bike lane separated from auto traffic by a painted line"},"shared_lane":{"title":"Shared bike lane","description":"A bike lane with no separation from auto traffic"},"track":{"title":"Bike track","description":"A bike lane separated from traffic by a physical barrier"},"share_busway":{"title":"Bike lane shared with bus","description":"A bike lane shared with a bus lane"},"opposite_lane":{"title":"Opposite bike lane","description":"A bike lane that travels in the opposite direction of traffic"},"opposite":{"title":"Contraflow bike lane","description":"A bike lane that travels in both directions on a one-way street"}}}},
"gnis/feature_id":{"key":"gnis:feature_id","type":"identifier","label":"GNIS Feature ID","urlFormat":"https://geonames.usgs.gov/apex/f?p=gnispq:3:::NO::P3_FID:{value}","pattern":"^[0-9]{1,}$","countryCodes":["us"],"terms":["Federal Geographic Names Information Service","United States Board on Geographic Names","USA"]},
"horse_scale":{"key":"horse_scale","type":"combo","label":"Horseback Riding Difficulty","placeholder":"Difficult, Dangerous...","strings":{"options":{"common":"Easy: No problems or difficulties. (default)","demanding":"Use with caution: Uneven way, occasional difficult passages.","difficult":"Difficult: Way narrow and exposed. May contain obstacles to step over and narrow passages.","critical":"Borderline: Passable only for experienced riders and horses. Major obstacles. Bridges should be examined carefully.","dangerous":"Dangerous: Passable only for very experienced riders and horses and only in good weather. Dismount.","impossible":"Impassable: Way or bridge not passable for horses. Too narrow, insuffient support, obstacles like ladders. Danger of life."}}},
"mtb/scale":{"key":"mtb:scale","type":"combo","label":"Mountain Biking Difficulty","placeholder":"0, 1, 2, 3...","strings":{"options":{"0":"0: Solid gravel/packed earth, no obstacles, wide curves","1":"1: Some loose surface, small obstacles, wide curves","2":"2: Much loose surface, large obstacles, easy hairpins","3":"3: Slippery surface, large obstacles, tight hairpins","4":"4: Loose surface or boulders, dangerous hairpins","5":"5: Maximum difficulty, boulder fields, landslides","6":"6: Not rideable except by the very best mountain bikers"}}},
"oneway_yes":{"key":"oneway","type":"onewayCheck","label":"One Way","strings":{"options":{"undefined":"Assumed to be Yes","yes":"Yes","no":"No","reversible":"Reversible","alternating":"Alternating"}}},
"oneway":{"key":"oneway","type":"onewayCheck","label":"One Way","strings":{"options":{"undefined":"Assumed to be No","yes":"Yes","no":"No","reversible":"Reversible","alternating":"Alternating"}},"terms":["bidirectional","oneway","unidirectional"]},
"oneway/bicycle":{"key":"oneway:bicycle","type":"check","label":"One Way (Bicycles)","prerequisiteTag":{"key":"oneway"}},
"piste/grooming_downhill":{"key":"piste:grooming","type":"combo","label":"Grooming","strings":{"options":{"classic":"Classic","mogul":"Mogul","backcountry":"Backcountry - no grooming"}}},
"piste/grooming_nordic":{"key":"piste:grooming","type":"combo","label":"Grooming","strings":{"options":{"classic":"Classic","backcountry":"Backcountry, no grooming","classic+skating":"Classic and Skating","scooter":"Scooter/Snowmobile","skating":"Skating"}}},
"piste/grooming":{"key":"piste:grooming","type":"combo","label":"Grooming","strings":{"options":{"classic":"Classic","mogul":"Mogul","backcountry":"Backcountry","classic+skating":"Classic and Skating","scooter":"Scooter/Snowmobile","skating":"Skating"}}},
"pump":{"key":"pump","type":"combo","label":"Pump","strings":{"options":{"yes":"Yes","manual":"Manual Hand Pump","powered":"Machine-Powered Pump","no":"None"}}},
"second_hand":{"key":"second_hand","type":"combo","label":"Sells Used","placeholder":"Yes, No, Only","strings":{"options":{"yes":"Yes","no":"No","only":"Only"}}},
"tracktype":{"key":"tracktype","type":"combo","label":"Track Type","placeholder":"Solid, Mostly Solid, Soft...","strings":{"options":{"grade1":"Solid: paved or heavily compacted hardcore surface","grade2":"Mostly Solid: gravel/rock with some soft material mixed in","grade3":"Even mixture of hard and soft materials","grade4":"Mostly Soft: soil/sand/grass with some hard material mixed in","grade5":"Soft: soil/sand/grass"}}},
"trail_visibility":{"key":"trail_visibility","type":"combo","label":"Trail Visibility","placeholder":"Excellent, Good, Bad...","strings":{"options":{"excellent":"Excellent: unambiguous path or markers everywhere","good":"Good: markers visible, sometimes require searching","intermediate":"Intermediate: few markers, path mostly visible","bad":"Bad: no markers, path sometimes invisible/pathless","horrible":"Horrible: often pathless, some orientation skills required","no":"No: pathless, excellent orientation skills required"}}},
"visibility":{"key":"visibility","type":"combo","label":"Visibility","strings":{"options":{"house":"Up to 5m (16ft)","street":"5 to 20m (16 to 65ft)","area":"Over 20m (65ft)"}}},
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.