Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make preset data an external dependency #8175

Merged
merged 7 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
59 changes: 59 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,62 @@ var id = iD.coreContext()
```

This should be set with caution for performance reasons. The OpenStreetMap API has a limitation of 50000 nodes per request.


### Custom Presets

iD supports deployments which use a custom set of presets. You can supply presets via
the `presets` accessor:

```js
var id = iD.coreContext().presets({
presets: { ... },
fields: { ... },
defaults: { ... },
categories: { ... }
});
```

All four parts (presets, fields, defaults, and categories) must be supplied. In addition,
several base presets and fields must be included.

Basic geometric presets must be included so that every feature matches at least one preset.
For example:

```js
"area": {
"name": "Area",
"tags": {},
"geometry": ["area"],
"matchScore": 0.1
},
"line": {
"name": "Line",
"tags": {},
"geometry": ["line"],
"matchScore": 0.1
},
"point": {
"name": "Point",
"tags": {},
"geometry": ["point", "vertex"],
"matchScore": 0.1
},
"relation": {
"name": "Relation",
"tags": {},
"geometry": ["relation"],
"matchScore": 0.1
}
```

A "name" field must be included:

```js
"name": {
"key": "name",
"type": "localized",
"label": "Name",
"placeholder": "Common name (if any)"
}
```
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,10 @@ same format as the rest, include your new corresponding `docKey` in
[/modules/ui/help.js](/modules/ui/help.js) and call `npm run build`.


## Adding or Refining Presets
## Editing Presets or Tagging

Presets save time for iD users by automatically showing them the tags they are
likely to add for a given feature. They are stored in `data/presets/presets`. If
you're going to update the presets, [review the Presets README](/data/presets/README.md).
iD's knowledge of OpenStreetMap tags is mostly handled by the [iD Tagging Schema](https://github.com/openstreetmap/id-tagging-schema)
project, which has its own opportunities to contribute.


## Contributing Code
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ iD also bundles portions of the following open source software.
* [editor-layer-index (CC-BY-SA 3.0)](https://github.com/osmlab/editor-layer-index)
* [Font Awesome (CC-BY 4.0)](https://fontawesome.com/license)
* [Maki (CC0 1.0)](https://github.com/mapbox/maki)
* [Temaki (CC0 1.0)](https://github.com/ideditor/temaki)
* [Mapillary JS (MIT)](https://github.com/mapillary/mapillary-js)
* [iD Tagging Schema (ISC)](https://github.com/openstreetmap/id-tagging-schema)
* [name-suggestion-index (BSD-3-Clause)](https://github.com/osmlab/name-suggestion-index)
* [osm-community-index (ISC)](https://github.com/osmlab/osm-community-index)

Expand Down
Loading