diff --git a/index.html b/index.html
index 06d3fa16c..1631cd634 100644
--- a/index.html
+++ b/index.html
@@ -32,7 +32,6 @@
-
@@ -158,6 +157,10 @@
+
+
+
+
@@ -186,12 +189,15 @@
var id = iD();
- iD.util.asyncMap(['keys.json', 'presets/presets.json'], d3.json, function(err, data) {
+ iD.util.asyncMap(['keys.json', 'presets/presets.json', 'presets/defaults.json'], d3.json, function(err, data) {
id.connection()
.keys(data[0]);
- id.presetData()
- .data(data[1]);
+ id.presets()
+ .load({
+ presets: data[1],
+ defaults: data[2]
+ });
d3.select("#iD")
.call(id.ui());
diff --git a/js/id/id.js b/js/id/id.js
index 5e10fcb74..5c8fa442d 100644
--- a/js/id/id.js
+++ b/js/id/id.js
@@ -96,10 +96,10 @@ window.iD = function () {
context.zoomOut = map.zoomOut;
/* Presets */
- var presetData = iD.presetData();
+ var presets = iD.presets(context);
- context.presetData = function() {
- return presetData;
+ context.presets = function() {
+ return presets;
};
context.container = function(_) {
diff --git a/js/id/presetdata.js b/js/id/presetdata.js
deleted file mode 100644
index be021ebb8..000000000
--- a/js/id/presetdata.js
+++ /dev/null
@@ -1,79 +0,0 @@
-iD.presetData = function() {
-
- var other = {
- name: 'other',
- title: 'Other',
- icon: 'marker-stroked',
- match: {
- tags: {},
- type: ['node', 'line', 'area']
- },
- form: []
- };
-
- var presets = {},
- data = [other],
- categories = [],
- defaults = {
- node: [],
- area: [],
- line: []
- };
-
- function getPreset(name) {
- return _.find(data.concat(categories), function(d) {
- return d.name === name;
- });
- }
-
- presets.data = function(_) {
- if (!arguments.length) return data;
- data = _.presets.concat([other]);
- categories = _.categories;
- defaults = _.defaults;
- return presets;
- };
-
- presets.defaults = function(entity) {
- var type = entity.type === 'node' ? 'node' : entity.geometry();
- return defaults[type].map(getPreset);
- };
-
- presets.categories = function(category) {
- if (!arguments.length) return categories;
- return _.find(categories, function(d) {
- return d.name === category;
- }).members.map(getPreset);
- };
-
- presets.match = function(entity) {
- var type = entity.type === 'node' ? 'node' : entity.geometry();
- return data.concat(categories).filter(function(d) {
- return _.contains(d.match.type, type);
- });
- };
-
- presets.matchTags = function(entity) {
- var tags, count, best,
- maxcount = -1;
-
- for (var i = 0; i < data.length; i++) {
- count = 0;
- tags = data[i].match.tags;
-
- for (var k in tags) {
- if (entity.tags[k] === tags[k] || (tags[k] === '*' && k in entity.tags)) count++;
- else break;
- }
-
- if (Object.keys(tags).length === count && count > maxcount) {
- best = data[i];
- maxcount = count;
- }
- }
-
- return best;
- };
-
- return presets;
-};
diff --git a/js/id/presets.js b/js/id/presets.js
new file mode 100644
index 000000000..d9dc2439b
--- /dev/null
+++ b/js/id/presets.js
@@ -0,0 +1,44 @@
+iD.presets = function(context) {
+
+ var other = {
+ name: 'other',
+ title: 'Other',
+ icon: 'marker-stroked',
+ match: {
+ tags: {},
+ type: ['point', 'vertex', 'line', 'area']
+ },
+ form: []
+ },
+ all = iD.presets.Collection(context, [iD.presets.Preset(other)]),
+ defaults = {};
+
+ all.load = function(d) {
+ if (d.presets) {
+ d.presets.forEach(function(d) {
+ all.collection.push(iD.presets.Preset(d));
+ });
+ }
+ if (d.categories) {
+ d.categories.forEach(function(d) {
+ all.collection.push(iD.presets.Category(d, all));
+ });
+ }
+ if (d.defaults) {
+ var getItem = _.bind(all.item, all);
+ defaults = {
+ area: iD.presets.Collection(context, d.defaults.area.map(getItem)),
+ line: iD.presets.Collection(context, d.defaults.line.map(getItem)),
+ point: iD.presets.Collection(context, d.defaults.point.map(getItem)),
+ vertex: iD.presets.Collection(context, d.defaults.vertex.map(getItem))
+ };
+ }
+ };
+
+ all.defaults = function(entity) {
+ return defaults[entity.geometry(context.graph())];
+ };
+
+
+ return all;
+};
diff --git a/js/id/presets/preset.js b/js/id/presets/preset.js
new file mode 100644
index 000000000..9264ac8b0
--- /dev/null
+++ b/js/id/presets/preset.js
@@ -0,0 +1,17 @@
+iD.presets.Preset = function(preset) {
+
+ preset.matchType = function(entity, resolver) {
+ return preset.match.type.indexOf(entity.geometry(resolver)) >= 0;
+ };
+
+ preset.matchTags = function(entity) {
+ var tags = preset.match.tags;
+ for (var t in tags) {
+ if (entity.tags[t] !== tags[t] &&
+ (tags[t] !== '*' || t in entity.tags)) return -1;
+ }
+ return Object.keys(preset.match.tags).length;
+ };
+
+ return preset;
+};
diff --git a/js/id/presets/presets.js b/js/id/presets/presets.js
new file mode 100644
index 000000000..7dd0fc5e7
--- /dev/null
+++ b/js/id/presets/presets.js
@@ -0,0 +1,80 @@
+iD.presets.Collection = function(context, collection) {
+
+ var presets = {
+
+ collection: collection,
+
+ load: function(_) {
+ if (_.presets) {
+ _.presets.forEach(function(d) {
+ collection.push(iD.presets.Preset(d));
+ });
+ }
+ if (_.categories) {
+ _.categories.forEach(function(d) {
+ collection.push(iD.presets.Category(d, presets));
+ });
+ }
+ },
+
+ item: function(id) {
+ return _.find(collection, function(d) {
+ return d.name === id;
+ });
+ },
+
+ matchType: function(entity) {
+ var newcollection = collection.filter(function(d) {
+ return d.matchType(entity, context.graph());
+ });
+
+ return iD.presets.Collection(context, newcollection);
+
+ },
+
+ matchTags: function(entity) {
+
+ var best = -1,
+ match;
+
+ for (var i = 0; i < collection.length; i++) {
+ var score = collection[i].matchTags(entity);
+ if (score > best) {
+ best = score;
+ match = collection[i];
+ }
+ }
+
+ return match;
+ },
+
+ search: function(value) {
+ if (!value) return this;
+
+ value = value.toLowerCase();
+
+ // Uses levenshtein distance, with a couple of hacks
+ // to prioritize exact substring matches
+ return iD.presets.Collection(context, collection.sort(function(a, b) {
+ var ia = a.name.indexOf(value) >= 0,
+ ib = b.name.indexOf(value) >= 0;
+
+ if (ia && !ib) {
+ return -1;
+ } else if (ib && !ia) {
+ return 1;
+ }
+
+ return iD.util.editDistance(value, a.name) - iD.util.editDistance(value, b.name);
+ }).filter(function(d) {
+ return iD.util.editDistance(value, d.name) - d.name.length + value.length < 3 ||
+ d.name === 'other';
+ }));
+ }
+
+
+
+ };
+
+ return presets;
+};
diff --git a/js/id/ui/preset_grid.js b/js/id/ui/preset_grid.js
index c43f86ba9..c4697cad2 100644
--- a/js/id/ui/preset_grid.js
+++ b/js/id/ui/preset_grid.js
@@ -1,14 +1,14 @@
iD.ui.PresetGrid = function(context) {
var event = d3.dispatch('choose'),
entity,
- presetData = context.presetData(),
+ presets = context.presets(),
taginfo = iD.taginfo();
function presetgrid(selection, preset) {
selection.html('');
- var viable = presetData.match(entity);
+ presets = presets.matchType(entity);
var messagewrap = selection.append('div')
.attr('class', 'message inspector-inner fillL');
@@ -21,7 +21,7 @@ iD.ui.PresetGrid = function(context) {
var grid = selection.append('div')
.attr('class', 'preset-grid fillD inspector-body ' + entity.geometry(context.graph()))
- .call(drawGrid, filter(''));
+ .call(drawGrid, context.presets().defaults(entity));
var search = searchwrap.append('input')
.attr('class', 'preset-grid-search')
@@ -31,11 +31,15 @@ iD.ui.PresetGrid = function(context) {
if (d3.event.keyCode === 13) {
choose(grid.selectAll('.grid-entry:first-child').datum());
} else {
- var value = search.property('value'),
- presets = filter(value);
- message.text(t('inspector.results', {n: presets.length, search: value}));
- grid.call(drawGrid, presets);
- grid.classed('filtered', value.length);
+ var value = search.property('value');
+ if (value.length) {
+ var results = presets.search(value);
+ message.text(t('inspector.results', {n: results.length, search: value}));
+ grid.call(drawGrid, results);
+ grid.classed('filtered', value.length);
+ } else {
+ grid.call(drawGrid, context.presets().defaults(entity));
+ }
}
});
search.node().focus();
@@ -46,31 +50,6 @@ iD.ui.PresetGrid = function(context) {
.call(drawButtons);
}
- function filter(value) {
- if (!value) return presetData.defaults(entity);
-
- value = value.toLowerCase();
-
- // Uses levenshtein distance, with a couple of hacks
- // to prioritize exact substring matches
- return viable.sort(function(a, b) {
- var ia = a.name.indexOf(value) >= 0,
- ib = b.name.indexOf(value) >= 0;
-
- if (ia && !ib) {
- return -1;
- } else if (ib && !ia) {
- return 1;
- }
-
- return iD.util.editDistance(value, a.name) - iD.util.editDistance(value, b.name);
- }).filter(function(d) {
- return iD.util.editDistance(value, d.name) - d.name.length + value.length < 3 ||
- d.name === 'other';
- });
- }
-
-
function choose(d) {
// Category
if (d.members) {
@@ -90,7 +69,7 @@ iD.ui.PresetGrid = function(context) {
var entries = selection
.selectAll('button.grid-entry')
- .data(presets.slice(0, 12), name);
+ .data(presets.collection.slice(0, 12), name);
var entered = entries.enter()
.append('button')
diff --git a/js/id/ui/tag_editor.js b/js/id/ui/tag_editor.js
index 27e0d0319..35eea1e12 100644
--- a/js/id/ui/tag_editor.js
+++ b/js/id/ui/tag_editor.js
@@ -1,6 +1,6 @@
iD.ui.TagEditor = function(context) {
var event = d3.dispatch('changeTags', 'choose', 'close'),
- presetData = context.presetData(),
+ presets = context.presets(),
entity,
tags,
name,
@@ -44,7 +44,7 @@ iD.ui.TagEditor = function(context) {
}
}
- presetMatch = preset || presetMatch || presetData.matchTags(entity);
+ presetMatch = preset || presetMatch || presets.matchType(entity).matchTags(entity);
selection.html('');
@@ -163,7 +163,7 @@ iD.ui.TagEditor = function(context) {
if (presetUI && tagList) {
// change preset if necessary (undos/redos)
- var newmatch = presetData.matchTags(entity.update({ tags: tags }));
+ var newmatch = presets.matchType(entity).matchTags(entity.update({ tags: tags }));
if (newmatch !== presetMatch) {
return tageditor(selection_, newmatch);
}
diff --git a/presets/defaults.json b/presets/defaults.json
new file mode 100644
index 000000000..8df2a2de0
--- /dev/null
+++ b/presets/defaults.json
@@ -0,0 +1,47 @@
+{
+ "area": [
+ "building",
+ "park",
+ "water",
+ "parking",
+ "hospital",
+ "place of worship",
+ "cafe",
+ "restaurant",
+ "bar",
+ "fast food",
+ "bank",
+ "other"
+ ],
+ "line": [
+ "residential road",
+ "primary road",
+ "secondary road",
+ "tertiary road",
+ "foot path",
+ "cycle path",
+ "motorway",
+ "trunk highway",
+ "service road",
+ "river",
+ "rail",
+ "other"
+ ],
+ "point": [
+ "bus stop",
+ "park",
+ "hospital",
+ "place of worship",
+ "cafe",
+ "restaurant",
+ "bar",
+ "fast food",
+ "bank",
+ "cinema",
+ "supermarket",
+ "other"
+ ],
+ "vertex": [
+ "other"
+ ]
+}
diff --git a/presets/presets.json b/presets/presets.json
index b3e301f41..7f9d27782 100644
--- a/presets/presets.json
+++ b/presets/presets.json
@@ -1,709 +1,667 @@
+[
{
- "presets": [
- {
- "title": "Cafe",
- "name": "cafe",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "amenity": "cafe"
- }
- },
- "icon": "cafe",
- "form": [
- {
- "key": "cuisine",
- "type": "combo",
- "indexed": true
- },
- {
- "key": "internet_access",
- "title": "Internet Access",
- "type": "select",
- "options": ["yes", "no", "wlan", "wired", "terminal"]
- },
- {
- "key": "building",
- "type": "select",
- "options": ["yes", "no"],
- "default": {
- "area": "yes"
- }
- },
- {
- "type": "address",
- "title": "Address"
- }
- ]
- },
- {
- "title": "Park",
- "name": "park",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "leisure": "park"
- }
- },
- "icon": "park",
- "form": []
- },
- {
- "title": "Water",
- "name": "water",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "natural": "water"
- }
- },
- "icon": "",
- "form": []
- },
- {
- "title": "Supermarket",
- "name": "supermarket",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "shop": "supermarket"
- }
- },
- "icon": "grocery",
- "form": [
- {
- "key": "operator",
- "type": "text"
- },
- {
- "key": "building",
- "type": "select",
- "options": ["yes", "no"],
- "default": {
- "area": "yes"
- }
- },
- {
- "type": "address",
- "title": "Address"
- }
- ]
- },
- {
- "title": "Restaurant",
- "name": "restaurant",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "amenity": "restaurant"
- }
- },
- "icon": "restaurant",
- "form": [
- {
- "key": "cuisine",
- "type": "combo"
- },
- {
- "key": "building",
- "type": "select",
- "options": ["yes", "no"],
- "default": {
- "area": "yes"
- }
- },
- {
- "type": "address",
- "title": "Address"
- }
- ]
- },
- {
- "title": "Place of worship",
- "name": "place of worship",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "amenity": "place_of_worship"
- }
- },
- "icon": "place-of-worship",
- "form": [
- {
- "key": "religion",
- "type": "select",
- "options": ["christian", "muslim", "buddhist", "jewish", "hindu", "shinto", "taoist"]
- },
- {
- "key": "denomination",
- "type": "combo"
- },
- {
- "key": "building",
- "type": "select",
- "options": ["yes", "no"],
- "default": {
- "area": "yes"
- }
- },
- {
- "type": "address",
- "title": "Address"
- }
- ]
- },
- {
- "title": "School",
- "name": "school",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "amenity": "school"
- }
- },
- "icon": "school",
- "form": [
- {
- "key": "operator",
- "type": "text"
- },
- {
- "key": "building",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "type": "address",
- "title": "Address"
- }
- ]
- },
- {
- "title": "Parking",
- "name": "parking",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "amenity": "parking"
- }
- },
- "icon": "parking",
- "form": [
- {
- "key": "fee",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "key": "access",
- "type": "combo"
- },
- {
- "type": "address",
- "title": "Address"
- }
- ]
- },
- {
- "title": "Bank",
- "name": "bank",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "amenity": "bank"
- }
- },
- "icon": "bank",
- "form": [
- {
- "key": "atm",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "key": "building",
- "type": "select",
- "options": ["yes", "no"],
- "default": {
- "area": "yes"
- }
- },
- {
- "type": "address",
- "title": "Address"
- }
- ]
- },
- {
- "title": "Fast food",
- "name": "fast food",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "amenity": "fast_food"
- }
- },
- "icon": "fast-food",
- "form": [
- {
- "key": "cuisine",
- "type": "combo"
- },
- {
- "key": "building",
- "type": "select",
- "options": ["yes", "no"],
- "default": {
- "area": "yes"
- }
- },
- {
- "type": "address",
- "title": "Address"
- }
- ]
- },
- {
- "title": "Bar",
- "name": "bar",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "amenity": "bar"
- }
- },
- "icon": "bar",
- "form": [
- {
- "key": "building",
- "type": "select",
- "options": ["yes", "no"],
- "default": {
- "area": "yes"
- }
- },
- {
- "type": "address",
- "title": "Address"
- }
- ]
- },
- {
- "title": "Bus stop",
- "name": "bus stop",
- "match": {
- "type": ["node"],
- "tags": {
- "highway": "bus_stop"
- }
- },
- "icon": "bus",
- "form": [
- {
- "key": "operator",
- "type": "text"
- },
- {
- "key": "shelter",
- "type": "select",
- "options": ["yes", "no"]
- }
- ]
- },
- {
- "title": "Cinema",
- "name": "cinema",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "amenity": "cinema"
- }
- },
- "icon": "cinema",
- "form": [
- {
- "key": "building",
- "type": "select",
- "options": ["yes", "no"],
- "default": {
- "area": "yes"
- }
- },
- {
- "type": "address",
- "title": "Address"
- }
- ]
- },
- {
- "title": "Hospital",
- "name": "hospital",
- "match": {
- "type": ["node", "area"],
- "tags": {
- "amenity": "hospital"
- }
- },
- "icon": "hospital",
- "form": [
- {
- "key": "emergency",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "key": "building",
- "type": "select",
- "options": ["yes", "no"],
- "default": {
- "area": "yes"
- }
- },
- {
- "type": "address",
- "title": "Address"
- }
- ]
- },
- {
- "title": "River",
- "name": "river",
- "match": {
- "type": ["line"],
- "tags": {
- "waterway": "river"
- }
- },
- "icon": "waterway-river",
- "form": []
- },
- {
- "title": "Motorway",
- "name": "motorway",
- "match": {
- "type": ["line"],
- "tags": {
- "highway": "motorway"
- }
- },
- "icon": "highway-motorway",
- "form": [
- {
- "key": "oneway",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "key": "access",
- "type": "combo"
- },
- {
- "key": "maxspeed",
- "type": "combo"
- }
- ]
- },
- {
- "title": "Residential road",
- "name": "residential road",
- "match": {
- "type": ["line"],
- "tags": {
- "highway": "residential"
- }
- },
- "icon": "highway-residential",
- "form": [
- {
- "key": "oneway",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "key": "access",
- "type": "combo"
- },
- {
- "key": "maxspeed",
- "type": "combo"
- }
- ]
- },
- {
- "title": "Primary Road",
- "name": "primary road",
- "match": {
- "type": ["line"],
- "tags": {
- "highway": "primary"
- }
- },
- "icon": "highway-primary",
- "form": [
- {
- "key": "oneway",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "key": "access",
- "type": "combo"
- },
- {
- "key": "maxspeed",
- "type": "combo"
- }
- ]
- },
- {
- "title": "Secondary Road",
- "name": "secondary road",
- "match": {
- "type": ["line"],
- "tags": {
- "highway": "secondary"
- }
- },
- "icon": "highway-secondary",
- "form": [
- {
- "key": "oneway",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "key": "access",
- "type": "combo"
- },
- {
- "key": "maxspeed",
- "type": "combo"
- }
- ]
- },
- {
- "title": "Tertiary Road",
- "name": "tertiary road",
- "match": {
- "type": ["line"],
- "tags": {
- "highway": "tertiary"
- }
- },
- "icon": "highway-tertiary",
- "form": [
- {
- "key": "oneway",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "key": "access",
- "type": "combo"
- },
- {
- "key": "maxspeed",
- "type": "combo"
- }
- ]
- },
- {
- "title": "Service Road",
- "name": "service road",
- "match": {
- "type": ["line"],
- "tags": {
- "highway": "service"
- }
- },
- "icon": "highway-service",
- "form": [
- {
- "key": "oneway",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "key": "access",
- "type": "combo"
- },
- {
- "key": "maxspeed",
- "type": "combo"
- }
- ]
- },
- {
- "title": "Rail",
- "name": "rail",
- "match": {
- "type": ["line"],
- "tags": {
- "railway": "rail"
- }
- },
- "icon": "railway-rail",
- "form": []
- },
- {
- "title": "Trunk highway",
- "name": "trunk highway",
- "match": {
- "type": ["line"],
- "tags": {
- "highway": "trunk"
- }
- },
- "icon": "highway-trunk",
- "form": [
- {
- "key": "oneway",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "key": "access",
- "type": "combo"
- },
- {
- "key": "maxspeed",
- "type": "combo"
- }
- ]
- },
- {
- "title": "Foot path",
- "name": "foot path",
- "match": {
- "type": ["line"],
- "tags": {
- "highway": "footway"
- }
- },
- "icon": "highway-footway",
- "form": [
- {
- "key": "oneway",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "key": "access",
- "type": "combo"
- },
- {
- "key": "maxspeed",
- "type": "combo"
- }
- ]
- },
- {
- "title": "Cycle path",
- "name": "cycle path",
- "match": {
- "type": ["line"],
- "tags": {
- "highway": "cycleway"
- }
- },
- "icon": "highway-cycleway",
- "form": [
- {
- "key": "oneway",
- "type": "select",
- "options": ["yes", "no"]
- },
- {
- "key": "access",
- "type": "combo"
- },
- {
- "key": "maxspeed",
- "type": "combo"
- }
- ]
- },
- {
- "title": "Building",
- "name": "building",
- "match": {
- "type": ["area"],
- "tags": {
- "building": "*"
- }
- },
- "icon": "warehouse",
- "form": [
- {
- "key": "building",
- "type": "combo",
- "default": {
- "area": "yes"
- }
- },
- {
- "type": "address",
- "title": "Address"
- }
- ]
+ "title": "Cafe",
+ "name": "cafe",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "amenity": "cafe"
}
- ],
-
- "defaults": {
- "area": [
- "building",
- "park",
- "water",
- "parking",
- "hospital",
- "place of worship",
- "cafe",
- "restaurant",
- "bar",
- "fast food",
- "bank",
- "other"
- ],
- "line": [
- "residential road",
- "primary road",
- "secondary road",
- "tertiary road",
- "foot path",
- "cycle path",
- "motorway",
- "trunk highway",
- "service road",
- "river",
- "rail",
- "other"
- ],
- "node": [
- "bus stop",
- "park",
- "hospital",
- "place of worship",
- "cafe",
- "restaurant",
- "bar",
- "fast food",
- "bank",
- "cinema",
- "supermarket",
- "other"
- ]
},
- "categories": [
- {
- "match": {
- "type": "line"
- },
- "icon": "road",
- "name": "roads",
- "members": [
- "residential road",
- "primary road"
- ]
+ "icon": "cafe",
+ "form": [
+ {
+ "key": "cuisine",
+ "type": "combo",
+ "indexed": true
+ },
+ {
+ "key": "internet_access",
+ "title": "Internet Access",
+ "type": "select",
+ "options": ["yes", "no", "wlan", "wired", "terminal"]
+ },
+ {
+ "key": "building",
+ "type": "select",
+ "options": ["yes", "no"],
+ "default": {
+ "area": "yes"
}
+ },
+ {
+ "type": "address",
+ "title": "Address"
+ }
+ ]
+},
+{
+ "title": "Park",
+ "name": "park",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "leisure": "park"
+ }
+ },
+ "icon": "park",
+ "form": []
+},
+{
+ "title": "Water",
+ "name": "water",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "natural": "water"
+ }
+ },
+ "icon": "",
+ "form": []
+},
+{
+ "title": "Supermarket",
+ "name": "supermarket",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "shop": "supermarket"
+ }
+ },
+ "icon": "grocery",
+ "form": [
+ {
+ "key": "operator",
+ "type": "text"
+ },
+ {
+ "key": "building",
+ "type": "select",
+ "options": ["yes", "no"],
+ "default": {
+ "area": "yes"
+ }
+ },
+ {
+ "type": "address",
+ "title": "Address"
+ }
+ ]
+},
+{
+ "title": "Restaurant",
+ "name": "restaurant",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "amenity": "restaurant"
+ }
+ },
+ "icon": "restaurant",
+ "form": [
+ {
+ "key": "cuisine",
+ "type": "combo"
+ },
+ {
+ "key": "building",
+ "type": "select",
+ "options": ["yes", "no"],
+ "default": {
+ "area": "yes"
+ }
+ },
+ {
+ "type": "address",
+ "title": "Address"
+ }
+ ]
+},
+{
+ "title": "Place of worship",
+ "name": "place of worship",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "amenity": "place_of_worship"
+ }
+ },
+ "icon": "place-of-worship",
+ "form": [
+ {
+ "key": "religion",
+ "type": "select",
+ "options": ["christian", "muslim", "buddhist", "jewish", "hindu", "shinto", "taoist"]
+ },
+ {
+ "key": "denomination",
+ "type": "combo"
+ },
+ {
+ "key": "building",
+ "type": "select",
+ "options": ["yes", "no"],
+ "default": {
+ "area": "yes"
+ }
+ },
+ {
+ "type": "address",
+ "title": "Address"
+ }
+ ]
+},
+{
+ "title": "School",
+ "name": "school",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "amenity": "school"
+ }
+ },
+ "icon": "school",
+ "form": [
+ {
+ "key": "operator",
+ "type": "text"
+ },
+ {
+ "key": "building",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "type": "address",
+ "title": "Address"
+ }
+ ]
+},
+{
+ "title": "Parking",
+ "name": "parking",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "amenity": "parking"
+ }
+ },
+ "icon": "parking",
+ "form": [
+ {
+ "key": "fee",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "key": "access",
+ "type": "combo"
+ },
+ {
+ "type": "address",
+ "title": "Address"
+ }
+ ]
+},
+{
+ "title": "Bank",
+ "name": "bank",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "amenity": "bank"
+ }
+ },
+ "icon": "bank",
+ "form": [
+ {
+ "key": "atm",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "key": "building",
+ "type": "select",
+ "options": ["yes", "no"],
+ "default": {
+ "area": "yes"
+ }
+ },
+ {
+ "type": "address",
+ "title": "Address"
+ }
+ ]
+},
+{
+ "title": "Fast food",
+ "name": "fast food",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "amenity": "fast_food"
+ }
+ },
+ "icon": "fast-food",
+ "form": [
+ {
+ "key": "cuisine",
+ "type": "combo"
+ },
+ {
+ "key": "building",
+ "type": "select",
+ "options": ["yes", "no"],
+ "default": {
+ "area": "yes"
+ }
+ },
+ {
+ "type": "address",
+ "title": "Address"
+ }
+ ]
+},
+{
+ "title": "Bar",
+ "name": "bar",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "amenity": "bar"
+ }
+ },
+ "icon": "bar",
+ "form": [
+ {
+ "key": "building",
+ "type": "select",
+ "options": ["yes", "no"],
+ "default": {
+ "area": "yes"
+ }
+ },
+ {
+ "type": "address",
+ "title": "Address"
+ }
+ ]
+},
+{
+ "title": "Bus stop",
+ "name": "bus stop",
+ "match": {
+ "type": ["point"],
+ "tags": {
+ "highway": "bus_stop"
+ }
+ },
+ "icon": "bus",
+ "form": [
+ {
+ "key": "operator",
+ "type": "text"
+ },
+ {
+ "key": "shelter",
+ "type": "select",
+ "options": ["yes", "no"]
+ }
+ ]
+},
+{
+ "title": "Cinema",
+ "name": "cinema",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "amenity": "cinema"
+ }
+ },
+ "icon": "cinema",
+ "form": [
+ {
+ "key": "building",
+ "type": "select",
+ "options": ["yes", "no"],
+ "default": {
+ "area": "yes"
+ }
+ },
+ {
+ "type": "address",
+ "title": "Address"
+ }
+ ]
+},
+{
+ "title": "Hospital",
+ "name": "hospital",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "amenity": "hospital"
+ }
+ },
+ "icon": "hospital",
+ "form": [
+ {
+ "key": "emergency",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "key": "building",
+ "type": "select",
+ "options": ["yes", "no"],
+ "default": {
+ "area": "yes"
+ }
+ },
+ {
+ "type": "address",
+ "title": "Address"
+ }
+ ]
+},
+{
+ "title": "River",
+ "name": "river",
+ "match": {
+ "type": ["line"],
+ "tags": {
+ "waterway": "river"
+ }
+ },
+ "icon": "waterway-river",
+ "form": []
+},
+{
+ "title": "Motorway",
+ "name": "motorway",
+ "match": {
+ "type": ["line"],
+ "tags": {
+ "highway": "motorway"
+ }
+ },
+ "icon": "highway-motorway",
+ "form": [
+ {
+ "key": "oneway",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "key": "access",
+ "type": "combo"
+ },
+ {
+ "key": "maxspeed",
+ "type": "combo"
+ }
+ ]
+},
+{
+ "title": "Residential road",
+ "name": "residential road",
+ "match": {
+ "type": ["line"],
+ "tags": {
+ "highway": "residential"
+ }
+ },
+ "icon": "highway-residential",
+ "form": [
+ {
+ "key": "oneway",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "key": "access",
+ "type": "combo"
+ },
+ {
+ "key": "maxspeed",
+ "type": "combo"
+ }
+ ]
+},
+{
+ "title": "Primary Road",
+ "name": "primary road",
+ "match": {
+ "type": ["line"],
+ "tags": {
+ "highway": "primary"
+ }
+ },
+ "icon": "highway-primary",
+ "form": [
+ {
+ "key": "oneway",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "key": "access",
+ "type": "combo"
+ },
+ {
+ "key": "maxspeed",
+ "type": "combo"
+ }
+ ]
+},
+{
+ "title": "Secondary Road",
+ "name": "secondary road",
+ "match": {
+ "type": ["line"],
+ "tags": {
+ "highway": "secondary"
+ }
+ },
+ "icon": "highway-secondary",
+ "form": [
+ {
+ "key": "oneway",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "key": "access",
+ "type": "combo"
+ },
+ {
+ "key": "maxspeed",
+ "type": "combo"
+ }
+ ]
+},
+{
+ "title": "Tertiary Road",
+ "name": "tertiary road",
+ "match": {
+ "type": ["line"],
+ "tags": {
+ "highway": "tertiary"
+ }
+ },
+ "icon": "highway-tertiary",
+ "form": [
+ {
+ "key": "oneway",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "key": "access",
+ "type": "combo"
+ },
+ {
+ "key": "maxspeed",
+ "type": "combo"
+ }
+ ]
+},
+{
+ "title": "Service Road",
+ "name": "service road",
+ "match": {
+ "type": ["line"],
+ "tags": {
+ "highway": "service"
+ }
+ },
+ "icon": "highway-service",
+ "form": [
+ {
+ "key": "oneway",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "key": "access",
+ "type": "combo"
+ },
+ {
+ "key": "maxspeed",
+ "type": "combo"
+ }
+ ]
+},
+{
+ "title": "Rail",
+ "name": "rail",
+ "match": {
+ "type": ["line"],
+ "tags": {
+ "railway": "rail"
+ }
+ },
+ "icon": "railway-rail",
+ "form": []
+},
+{
+ "title": "Trunk highway",
+ "name": "trunk highway",
+ "match": {
+ "type": ["line"],
+ "tags": {
+ "highway": "trunk"
+ }
+ },
+ "icon": "highway-trunk",
+ "form": [
+ {
+ "key": "oneway",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "key": "access",
+ "type": "combo"
+ },
+ {
+ "key": "maxspeed",
+ "type": "combo"
+ }
+ ]
+},
+{
+ "title": "Foot path",
+ "name": "foot path",
+ "match": {
+ "type": ["line"],
+ "tags": {
+ "highway": "footway"
+ }
+ },
+ "icon": "highway-footway",
+ "form": [
+ {
+ "key": "oneway",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "key": "access",
+ "type": "combo"
+ },
+ {
+ "key": "maxspeed",
+ "type": "combo"
+ }
+ ]
+},
+{
+ "title": "Cycle path",
+ "name": "cycle path",
+ "match": {
+ "type": ["line"],
+ "tags": {
+ "highway": "cycleway"
+ }
+ },
+ "icon": "highway-cycleway",
+ "form": [
+ {
+ "key": "oneway",
+ "type": "select",
+ "options": ["yes", "no"]
+ },
+ {
+ "key": "access",
+ "type": "combo"
+ },
+ {
+ "key": "maxspeed",
+ "type": "combo"
+ }
+ ]
+},
+{
+ "title": "Basketball court",
+ "name": "basketball court",
+ "match": {
+ "type": ["point", "area"],
+ "tags": {
+ "leisure": "pitch",
+ "sport": "basketball"
+ }
+ },
+ "icon": "basketball",
+ "form": [
+ {
+ "key": "surface",
+ "type": "combo"
+ }
+ ]
+},
+{
+ "title": "Building",
+ "name": "building",
+ "match": {
+ "type": ["area"],
+ "tags": {
+ "building": "*"
+ }
+ },
+ "icon": "warehouse",
+ "form": [
+ {
+ "key": "building",
+ "type": "combo",
+ "default": {
+ "area": "yes"
+ }
+ },
+ {
+ "type": "address",
+ "title": "Address"
+ }
]
}
+]