Generalize the address field type

Add `amenity=letter_box` preset with `post:*` field (close #6718)
This commit is contained in:
Quincy Morgan
2019-08-07 09:48:19 -05:00
parent bd04c22ded
commit b065de0550
9 changed files with 122 additions and 8 deletions
+8
View File
@@ -1525,6 +1525,9 @@ en:
population:
# population=*
label: Population
post:
# 'post:block_number=*, post:city=*, post:block_number=*, post:conscriptionnumber=*, post:county=*, post:country=*, post:county=*, post:district=*, post:floor=*, post:hamlet=*, post:housename=*, post:housenumber=*, post:neighbourhood=*, post:place=*, post:postcode=*, post:province=*, post:quarter=*, post:state=*, post:street=*, post:subdistrict=*, post:suburb=*, post:unit=*'
label: Delivery Address
power:
# power=*
label: Type
@@ -2828,6 +2831,11 @@ en:
name: Language School
# 'terms: esl'
terms: '<translate with synonyms or related terms for ''Language School'', separated by commas>'
amenity/letter_box:
# amenity=letter_box
name: Letter Box
# 'terms: curbside delivery box,home delivery box,direct-to-door delivery box,letter hole,letter plate,letter slot,letterbox,letterhole,letterplate,letterslot,mail box,mail hole,mail slot,mailbox,mailhole,mailslot,through-door delivery box'
terms: '<translate with synonyms or related terms for ''Letter Box'', separated by commas>'
amenity/library:
# amenity=library
name: Library
+2 -1
View File
@@ -3,7 +3,7 @@
"access_simple": {"key": "access", "type": "combo", "label": "Allowed Access", "options": ["yes", "permissive", "private", "customers", "permit", "no"]},
"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"}}}},
"addr/interpolation": {"key": "addr:interpolation", "type": "combo", "label": "Type", "strings": {"options": {"all": "All", "even": "Even", "odd": "Odd", "alphabetic": "Alphabetic"}}},
"address": {"type": "address", "keys": ["addr:block_number", "addr:city", "addr:block_number", "addr:conscriptionnumber", "addr:county", "addr:country", "addr:county", "addr:district", "addr:floor", "addr:hamlet", "addr:housename", "addr:housenumber", "addr:neighbourhood", "addr:place", "addr:postcode", "addr:province", "addr:quarter", "addr:state", "addr:street", "addr:subdistrict", "addr:suburb", "addr:unit"], "reference": {"key": "addr"}, "icon": "address", "label": "Address", "strings": {"placeholders": {"block_number": "Block Number", "block_number!jp": "Block No.", "city": "City", "city!jp": "City/Town/Village/Tokyo Special Ward", "city!vn": "City/Town", "conscriptionnumber": "123", "country": "Country", "county": "County", "county!jp": "District", "district": "District", "district!vn": "Arrondissement/Town/District", "floor": "Floor", "hamlet": "Hamlet", "housename": "Housename", "housenumber": "123", "housenumber!jp": "Building No./Lot No.", "neighbourhood": "Neighbourhood", "neighbourhood!jp": "Chōme/Aza/Koaza", "place": "Place", "postcode": "Postcode", "province": "Province", "province!jp": "Prefecture", "quarter": "Quarter", "quarter!jp": "Ōaza/Machi", "state": "State", "street": "Street", "subdistrict": "Subdistrict", "subdistrict!vn": "Ward/Commune/Townlet", "suburb": "Suburb", "suburb!jp": "Ward", "unit": "Unit"}}},
"address": {"type": "address", "key": "addr", "keys": ["addr:block_number", "addr:city", "addr:block_number", "addr:conscriptionnumber", "addr:county", "addr:country", "addr:county", "addr:district", "addr:floor", "addr:hamlet", "addr:housename", "addr:housenumber", "addr:neighbourhood", "addr:place", "addr:postcode", "addr:province", "addr:quarter", "addr:state", "addr:street", "addr:subdistrict", "addr:suburb", "addr:unit"], "icon": "address", "label": "Address", "strings": {"placeholders": {"block_number": "Block Number", "block_number!jp": "Block No.", "city": "City", "city!jp": "City/Town/Village/Tokyo Special Ward", "city!vn": "City/Town", "conscriptionnumber": "123", "country": "Country", "county": "County", "county!jp": "District", "district": "District", "district!vn": "Arrondissement/Town/District", "floor": "Floor", "hamlet": "Hamlet", "housename": "Housename", "housenumber": "123", "housenumber!jp": "Building No./Lot No.", "neighbourhood": "Neighbourhood", "neighbourhood!jp": "Chōme/Aza/Koaza", "place": "Place", "postcode": "Postcode", "province": "Province", "province!jp": "Prefecture", "quarter": "Quarter", "quarter!jp": "Ōaza/Machi", "state": "State", "street": "Street", "subdistrict": "Subdistrict", "subdistrict!vn": "Ward/Commune/Townlet", "suburb": "Suburb", "suburb!jp": "Ward", "unit": "Unit"}}},
"admin_level": {"key": "admin_level", "type": "number", "minValue": 1, "label": "Admin Level"},
"aerialway": {"key": "aerialway", "type": "typeCombo", "label": "Type"},
"aerialway/access": {"key": "aerialway:access", "type": "combo", "label": "Access", "strings": {"options": {"entry": "Entry", "exit": "Exit", "both": "Both"}}},
@@ -272,6 +272,7 @@
"playground/min_age": {"key": "min_age", "type": "number", "minValue": 0, "label": "Minimum Age"},
"polling_station": {"key": "polling_station", "type": "check", "label": "Polling Place"},
"population": {"key": "population", "type": "text", "label": "Population"},
"post": {"type": "address", "key": "post", "keys": ["post:block_number", "post:city", "post:block_number", "post:conscriptionnumber", "post:county", "post:country", "post:county", "post:district", "post:floor", "post:hamlet", "post:housename", "post:housenumber", "post:neighbourhood", "post:place", "post:postcode", "post:province", "post:quarter", "post:state", "post:street", "post:subdistrict", "post:suburb", "post:unit"], "label": "Delivery Address"},
"power_supply": {"key": "power_supply", "type": "check", "label": "Power Supply"},
"power": {"key": "power", "type": "typeCombo", "label": "Type"},
"preschool": {"key": "preschool", "type": "check", "label": "Preschool"},
+1 -1
View File
@@ -1,5 +1,6 @@
{
"type": "address",
"key": "addr",
"keys": [
"addr:block_number",
"addr:city",
@@ -24,7 +25,6 @@
"addr:suburb",
"addr:unit"
],
"reference": {"key": "addr"},
"icon": "address",
"label": "Address",
"strings": {
+29
View File
@@ -0,0 +1,29 @@
{
"type": "address",
"key": "post",
"keys": [
"post:block_number",
"post:city",
"post:block_number",
"post:conscriptionnumber",
"post:county",
"post:country",
"post:county",
"post:district",
"post:floor",
"post:hamlet",
"post:housename",
"post:housenumber",
"post:neighbourhood",
"post:place",
"post:postcode",
"post:province",
"post:quarter",
"post:state",
"post:street",
"post:subdistrict",
"post:suburb",
"post:unit"
],
"label": "Delivery Address"
}
+1
View File
@@ -133,6 +133,7 @@
"amenity/karaoke": {"icon": "maki-karaoke", "fields": ["name", "operator", "address", "building_area", "opening_hours", "website"], "moreFields": ["air_conditioning", "email", "fax", "payment_multi", "phone", "smoking", "wheelchair"], "geometry": ["point", "area"], "terms": ["karaoke club", "karaoke room", "karaoke television", "KTV"], "tags": {"amenity": "karaoke_box"}, "name": "Karaoke Box"},
"amenity/kindergarten": {"icon": "maki-school", "fields": ["name", "operator", "address", "phone", "preschool"], "moreFields": ["email", "fax", "opening_hours", "payment_multi", "website", "wheelchair"], "geometry": ["point", "area"], "terms": ["kindergarden", "pre-school"], "tags": {"amenity": "kindergarten"}, "name": "Preschool/Kindergarten Grounds"},
"amenity/language_school": {"icon": "maki-school", "fields": ["name", "operator", "operator/type", "address", "building_area", "opening_hours", "language_multi"], "moreFields": ["email", "fax", "internet_access", "internet_access/fee", "internet_access/ssid", "payment_multi", "phone", "website", "wheelchair"], "geometry": ["point", "area"], "terms": ["esl"], "tags": {"amenity": "language_school"}, "name": "Language School"},
"amenity/letter_box": {"icon": "temaki-letter_box", "fields": ["post", "access_simple", "collection_times", "height"], "moreFields": ["covered", "indoor", "lit", "manufacturer", "material", "operator", "wheelchair"], "geometry": ["point", "vertex"], "tags": {"amenity": "letter_box"}, "terms": ["curbside delivery box", "home delivery box", "direct-to-door delivery box", "letter hole", "letter plate", "letter slot", "letterbox", "letterhole", "letterplate", "letterslot", "mail box", "mail hole", "mail slot", "mailbox", "mailhole", "mailslot", "through-door delivery box"], "name": "Letter Box"},
"amenity/library": {"icon": "maki-library", "fields": ["name", "operator", "operator/type", "building_area", "address", "ref/isil", "internet_access", "internet_access/fee", "internet_access/ssid"], "moreFields": ["access_simple", "air_conditioning", "email", "fax", "opening_hours", "payment_multi", "phone", "polling_station", "website", "wheelchair"], "geometry": ["point", "area"], "terms": ["book"], "tags": {"amenity": "library"}, "name": "Library"},
"amenity/love_hotel": {"icon": "maki-heart", "fields": ["name", "operator", "address", "building_area", "rooms", "internet_access", "internet_access/fee"], "moreFields": ["smoking", "payment_multi", "internet_access/ssid", "website", "phone", "email", "fax", "wheelchair"], "geometry": ["point", "area"], "tags": {"amenity": "love_hotel"}, "name": "Love Hotel"},
"amenity/marketplace": {"icon": "maki-shop", "fields": ["name", "operator", "address", "building", "opening_hours"], "moreFields": ["website", "phone", "email", "fax", "wheelchair"], "geometry": ["point", "area"], "tags": {"amenity": "marketplace"}, "name": "Marketplace"},
@@ -0,0 +1,45 @@
{
"icon": "temaki-letter_box",
"fields": [
"post",
"access_simple",
"collection_times",
"height"
],
"moreFields": [
"covered",
"indoor",
"lit",
"manufacturer",
"material",
"operator",
"wheelchair"
],
"geometry": [
"point",
"vertex"
],
"tags": {
"amenity": "letter_box"
},
"terms": [
"curbside delivery box",
"home delivery box",
"direct-to-door delivery box",
"letter hole",
"letter plate",
"letter slot",
"letterbox",
"letterhole",
"letterplate",
"letterslot",
"mail box",
"mail hole",
"mail slot",
"mailbox",
"mailhole",
"mailslot",
"through-door delivery box"
],
"name": "Letter Box"
}
+21
View File
@@ -135,6 +135,7 @@
{"key": "amenity", "value": "karaoke_box", "description": "🄿 Karaoke Box", "object_types": ["node", "area"], "icon_url": "https://cdn.jsdelivr.net/gh/mapbox/maki/icons/karaoke-15.svg"},
{"key": "amenity", "value": "kindergarten", "description": "🄿 Preschool/Kindergarten Grounds", "object_types": ["node", "area"], "icon_url": "https://cdn.jsdelivr.net/gh/mapbox/maki/icons/school-15.svg"},
{"key": "amenity", "value": "language_school", "description": "🄿 Language School", "object_types": ["node", "area"], "icon_url": "https://cdn.jsdelivr.net/gh/mapbox/maki/icons/school-15.svg"},
{"key": "amenity", "value": "letter_box", "description": "🄿 Letter Box", "object_types": ["node"], "icon_url": "https://cdn.jsdelivr.net/gh/bhousel/temaki/icons/letter_box.svg"},
{"key": "amenity", "value": "library", "description": "🄿 Library", "object_types": ["node", "area"], "icon_url": "https://cdn.jsdelivr.net/gh/mapbox/maki/icons/library-15.svg"},
{"key": "amenity", "value": "love_hotel", "description": "🄿 Love Hotel", "object_types": ["node", "area"], "icon_url": "https://cdn.jsdelivr.net/gh/mapbox/maki/icons/heart-15.svg"},
{"key": "amenity", "value": "marketplace", "description": "🄿 Marketplace", "object_types": ["node", "area"], "icon_url": "https://cdn.jsdelivr.net/gh/mapbox/maki/icons/shop-15.svg"},
@@ -1566,6 +1567,26 @@
{"key": "max_age", "description": "🄵 Maximum Age"},
{"key": "min_age", "description": "🄵 Minimum Age"},
{"key": "population", "description": "🄵 Population"},
{"key": "post:block_number", "description": "🄵 Delivery Address"},
{"key": "post:city", "description": "🄵 Delivery Address"},
{"key": "post:conscriptionnumber", "description": "🄵 Delivery Address"},
{"key": "post:county", "description": "🄵 Delivery Address"},
{"key": "post:country", "description": "🄵 Delivery Address"},
{"key": "post:district", "description": "🄵 Delivery Address"},
{"key": "post:floor", "description": "🄵 Delivery Address"},
{"key": "post:hamlet", "description": "🄵 Delivery Address"},
{"key": "post:housename", "description": "🄵 Delivery Address"},
{"key": "post:housenumber", "description": "🄵 Delivery Address"},
{"key": "post:neighbourhood", "description": "🄵 Delivery Address"},
{"key": "post:place", "description": "🄵 Delivery Address"},
{"key": "post:postcode", "description": "🄵 Delivery Address"},
{"key": "post:province", "description": "🄵 Delivery Address"},
{"key": "post:quarter", "description": "🄵 Delivery Address"},
{"key": "post:state", "description": "🄵 Delivery Address"},
{"key": "post:street", "description": "🄵 Delivery Address"},
{"key": "post:subdistrict", "description": "🄵 Delivery Address"},
{"key": "post:suburb", "description": "🄵 Delivery Address"},
{"key": "post:unit", "description": "🄵 Delivery Address"},
{"key": "power_supply", "description": "🄵 Power Supply"},
{"key": "preschool", "description": "🄵 Preschool"},
{"key": "produce", "description": "🄵 Produce"},
+7
View File
@@ -3692,6 +3692,9 @@
"population": {
"label": "Population"
},
"post": {
"label": "Delivery Address"
},
"power_supply": {
"label": "Power Supply"
},
@@ -4903,6 +4906,10 @@
"name": "Language School",
"terms": "esl"
},
"amenity/letter_box": {
"name": "Letter Box",
"terms": "curbside delivery box,home delivery box,direct-to-door delivery box,letter hole,letter plate,letter slot,letterbox,letterhole,letterplate,letterslot,mail box,mail hole,mail slot,mailbox,mailhole,mailslot,through-door delivery box"
},
"amenity/library": {
"name": "Library",
"terms": "book"
+8 -6
View File
@@ -14,6 +14,8 @@ export function uiFieldAddress(field, context) {
var wrap = d3_select(null);
var _isInitialized = false;
var _entity;
// needed for placeholder strings
var addrField = context.presets().field('address');
function getNearStreets() {
var extent = _entity.extent(context.graph());
@@ -159,8 +161,8 @@ export function uiFieldAddress(field, context) {
.property('type', 'text')
.attr('placeholder', function (d) {
var localkey = d.id + '!' + countryCode;
var tkey = field.strings.placeholders[localkey] ? localkey : d.id;
return field.t('placeholders.' + tkey);
var tkey = addrField.strings.placeholders[localkey] ? localkey : d.id;
return addrField.t('placeholders.' + tkey);
})
.attr('class', function (d) { return 'addr-' + d.id; })
.call(utilNoAuto)
@@ -220,8 +222,8 @@ export function uiFieldAddress(field, context) {
var tags = {};
wrap.selectAll('input')
.each(function (field) {
tags['addr:' + field.id] = this.value || undefined;
.each(function (subfield) {
tags[field.key + ':' + subfield.id] = this.value || undefined;
});
dispatch.call('change', this, tags, onInput);
@@ -230,8 +232,8 @@ export function uiFieldAddress(field, context) {
function updateTags(tags) {
utilGetSetValue(wrap.selectAll('input'), function (field) {
return tags['addr:' + field.id] || '';
utilGetSetValue(wrap.selectAll('input'), function (subfield) {
return tags[field.key + ':' + subfield.id] || '';
});
}