From 588b32bef8d987259b7a4834af4d94973bb442d5 Mon Sep 17 00:00:00 2001 From: arch0345 Date: Wed, 29 Dec 2021 18:54:51 -0800 Subject: [PATCH 1/3] Add denominations tree Added existing denomination presets from id-tagging-schema --- app/src/Category.jsx | 4 +- app/src/CategoryInstructions.jsx | 5 ++ app/src/CategoryRow.jsx | 11 ++++ app/src/Header.jsx | 4 +- app/src/Overview.jsx | 3 ++ app/src/OverviewInstructions.jsx | 3 ++ config/trees.json | 9 ++++ .../amenity/place_of_worship.json | 52 +++++++++++++++++++ dist/filtered/denominations_discard.json | 8 +++ dist/filtered/denominations_keep.json | 8 +++ schema/categories.json | 1 + scripts/build_index.js | 18 +++++-- 12 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 data/denominations/amenity/place_of_worship.json create mode 100644 dist/filtered/denominations_discard.json create mode 100644 dist/filtered/denominations_keep.json diff --git a/app/src/Category.jsx b/app/src/Category.jsx index c5137f5cf4b..fc4b098a324 100644 --- a/app/src/Category.jsx +++ b/app/src/Category.jsx @@ -69,7 +69,9 @@ export default function Category(props) { let wikidataTag; if (t === 'brands') { wikidataTag = 'brand:wikidata'; - } else if (t === 'flags') { + } else if (t === 'denominations') { + wikidataTag = 'denomination:wikidata'; + }else if (t === 'flags') { wikidataTag = 'flag:wikidata'; } else if (t === 'operators') { wikidataTag = 'operator:wikidata'; diff --git a/app/src/CategoryInstructions.jsx b/app/src/CategoryInstructions.jsx index b4320031cb8..c2df98eaf97 100644 --- a/app/src/CategoryInstructions.jsx +++ b/app/src/CategoryInstructions.jsx @@ -11,6 +11,11 @@ export default function CategoryInstructions(props) { itemType = 'brand'; logo = 'logos'; wikidataTag = 'brand:wikidata'; + } else if (t === 'denominations') { + a = 'a'; + itemType = 'denomination'; + logo = 'a commons logo'; + wikidataTag = 'denomination:wikidata'; } else if (t === 'flags') { a = 'a'; itemType = 'flag'; diff --git a/app/src/CategoryRow.jsx b/app/src/CategoryRow.jsx index b375e99b049..01a5491c516 100644 --- a/app/src/CategoryRow.jsx +++ b/app/src/CategoryRow.jsx @@ -54,6 +54,17 @@ relation[${k}=${v}][brand=${bn}][brand:wikidata=${qid}] { color:green; fill-color:green; } }}`; +} else if (t === 'denominations') { + n = item.tags.denomination; + kvn = `${k}/${v}|${n}`; + tags = item.tags || {}; + qid = tags['denomination:wikidata']; + overpassQuery = `[out:json][timeout:100]; +(nwr["denomination"="${n}"];); +out body; +>; +out skel qt;`; + } else if (t === 'flags') { n = item.tags['flag:name']; kvn = `${k}/${v}|${n}`; diff --git a/app/src/Header.jsx b/app/src/Header.jsx index ac1c53a009b..b7521d1b068 100644 --- a/app/src/Header.jsx +++ b/app/src/Header.jsx @@ -31,6 +31,8 @@ function Title(props) { let fallbackIcon; if (t === 'brands') { fallbackIcon = 'https://cdn.jsdelivr.net/npm/@mapbox/maki@6/icons/shop-15.svg'; + } else if (t === 'denominations') { + fallbackIcon = 'https://cdn.jsdelivr.net/npm/@mapbox/maki@6/icons/place-of-worship-15.svg'; } else if (t === 'flags') { fallbackIcon = 'https://cdn.jsdelivr.net/npm/@mapbox/maki@6/icons/embassy-15.svg'; } else if (t === 'operators') { @@ -77,7 +79,7 @@ function Title(props) { function TreeSwitcher(props) { const t = props.t; - const others = ['brands', 'flags', 'operators', 'transit'].filter(d => d !== t); + const others = ['brands', 'denominations', 'flags', 'operators', 'transit'].filter(d => d !== t); const links = others.map(t => (
  • {t}/
  • )); const list = links.length ? (<> see also: ) : null; diff --git a/app/src/Overview.jsx b/app/src/Overview.jsx index 52714a6cb4f..20a43dc4ebe 100644 --- a/app/src/Overview.jsx +++ b/app/src/Overview.jsx @@ -21,6 +21,9 @@ export default function Overview(props) { if (t === 'brands') { fallbackIcon = 'https://cdn.jsdelivr.net/npm/@mapbox/maki@6/icons/shop-15.svg'; wikidataTag = 'brand:wikidata'; + } else if (t === 'denominations') { + fallbackIcon = 'https://cdn.jsdelivr.net/npm/@mapbox/maki@6/icons/place-of-worship-15.svg'; + wikidataTag = 'denomination:wikidata'; } else if (t === 'flags') { fallbackIcon = 'https://cdn.jsdelivr.net/npm/@mapbox/maki@6/icons/embassy-15.svg'; wikidataTag = 'flag:wikidata'; diff --git a/app/src/OverviewInstructions.jsx b/app/src/OverviewInstructions.jsx index 012df705568..45f2874c18d 100644 --- a/app/src/OverviewInstructions.jsx +++ b/app/src/OverviewInstructions.jsx @@ -9,6 +9,9 @@ export default function OverviewInstructions(props) { if (t === 'brands') { itemType = 'brand'; wikidataTag = 'brand:wikidata'; + } else if (t === 'denominations') { + itemType = 'denomination'; + wikidataTag = 'denomination:wikidata'; } else if (t === 'flags') { itemType = 'flag'; wikidataTag = 'flag:wikidata'; diff --git a/config/trees.json b/config/trees.json index 68d2ac6b7dd..fca24a32029 100644 --- a/config/trees.json +++ b/config/trees.json @@ -9,6 +9,15 @@ "alternate": "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$" } }, + "denominations": { + "emoji": "🛐", + "mainTag": "denomination:wikidata", + "sourceTags": ["denomination"], + "nameTags": { + "primary": "^(denomination|denomination:\\w+|name|name:\\w+)$", + "alternate": "^(operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$" + } + }, "flags": { "emoji": "🚩", "mainTag": "flag:wikidata", diff --git a/data/denominations/amenity/place_of_worship.json b/data/denominations/amenity/place_of_worship.json new file mode 100644 index 00000000000..652c414ecf5 --- /dev/null +++ b/data/denominations/amenity/place_of_worship.json @@ -0,0 +1,52 @@ +{ + "properties": { + "path": "denominations/amenity/place_of_worship", + "skipCollection": true, + "exclude": {"generic": ["^place of worship$"]} + }, + "items": [ + { + "displayName": "Kingdom Hall of Jehovah's Witnesses", + "id": "kingdomhallofjehovahswitnesses-0274e6", + "locationSet": {"include": ["001"]}, + "tags": { + "amenity": "place_of_worship", + "denomination": "jehovahs_witnesses", + "denomination:wikidata": "Q35269", + "denomination:wikipedia": "en:Jehovah's Witnesses", + "name": "Kingdom Hall of Jehovah's Witnesses", + "religion": "christian" + } + }, + { + "displayName": "La Luz del Mundo Temple", + "id": "laluzdelmundotemple-0274e6", + "locationSet": {"include": ["001"]}, + "matchNames": [ + "iglesia del dios vivo columna y apoyo de la verdad la luz del mundo", + "the light of the world" + ], + "tags": { + "amenity": "place_of_worship", + "denomination": "la_luz_del_mundo", + "denomination:wikidata": "Q3497836", + "denomination:wikipedia": "en:La Luz del Mundo", + "name": "La Luz del Mundo Temple", + "religion": "christian" + } + }, + { + "displayName": "Quaker Friends Meeting House", + "id": "quakerfriendsmeetinghouse-0274e6", + "locationSet": {"include": ["001"]}, + "tags": { + "amenity": "place_of_worship", + "denomination": "quaker", + "denomination:wikidata": "Q170208", + "denomination:wikipedia": "en:Quakers", + "name": "Quaker Friends Meeting House", + "religion": "christian" + } + } + ] +} diff --git a/dist/filtered/denominations_discard.json b/dist/filtered/denominations_discard.json new file mode 100644 index 00000000000..e5a3cd1f67f --- /dev/null +++ b/dist/filtered/denominations_discard.json @@ -0,0 +1,8 @@ +{ + "_meta": { + "version": "6.0.20211227", + "generated": "2021-12-30T02:32:55.989Z", + "url": "https://raw.githubusercontent.com/osmlab/name-suggestion-index/main/dist/filtered/denominations_discard.json", + "hash": "67171c3e38738edca797a69625f2bc43", + "collectionDate": "20211218" + },"discard": {}} diff --git a/dist/filtered/denominations_keep.json b/dist/filtered/denominations_keep.json new file mode 100644 index 00000000000..184ab9d259d --- /dev/null +++ b/dist/filtered/denominations_keep.json @@ -0,0 +1,8 @@ +{ + "_meta": { + "version": "6.0.20211227", + "generated": "2021-12-30T02:32:55.990Z", + "url": "https://raw.githubusercontent.com/osmlab/name-suggestion-index/main/dist/filtered/denominations_keep.json", + "hash": "1ed61f6101f797667ffa054fca25885b", + "collectionDate": "20211218" + },"keep": {}} diff --git a/schema/categories.json b/schema/categories.json index 990791b8dc9..343b8ec1c14 100644 --- a/schema/categories.json +++ b/schema/categories.json @@ -226,6 +226,7 @@ ], "anyOf": [ { "required": ["brand"] }, + { "required": ["denomination", "religion"] }, { "required": ["flag:name", "flag:type"] }, { "required": ["operator"] }, { "required": ["network"] } diff --git a/scripts/build_index.js b/scripts/build_index.js index c092676aacf..d47d4205c0f 100644 --- a/scripts/build_index.js +++ b/scripts/build_index.js @@ -38,6 +38,7 @@ let _cache = {}; loadIndex(); checkItems('brands'); +checkItems('denominations'); checkItems('flags'); checkItems('operators'); checkItems('transit'); @@ -464,6 +465,9 @@ function mergeItems() { if (t === 'brands') { name = tags.brand || tags.name; + } else if (t === 'denominations') { + name = tags.denomination || tags.name; + } else if (t === 'flags') { name = tags['flag:name']; @@ -500,7 +504,7 @@ function mergeItems() { // https://www.regular-expressions.info/unicode.html if (/[\u0590-\u05FF]/.test(name)) { // Hebrew // note: old ISO 639-1 lang code for Hebrew was `iw`, now `he` - if (!item.locationSet) item.locationSet = { include: ['il'] }; + if (!item.locationSet) item.locationSet = { include: ['iw'] }; setLanguageTags(tags, 'he'); } else if (/[\u0E00-\u0E7F]/.test(name)) { // Thai if (!item.locationSet) item.locationSet = { include: ['th'] }; @@ -575,10 +579,11 @@ function mergeItems() { console.timeEnd(END); function setLanguageTags(tags, code) { - if (tags.name) tags[`name:${code}`] = tags.name; - if (tags.brand) tags[`brand:${code}`] = tags.brand; - if (tags.operator) tags[`operator:${code}`] = tags.operator; - if (tags.network) tags[`network:${code}`] = tags.network; + if (tags.name) tags[`name:${code}`] = tags.name; + if (tags.denomination) tags[`name:${code}`] = tags.denomination + if (tags.brand) tags[`brand:${code}`] = tags.brand; + if (tags.operator) tags[`operator:${code}`] = tags.operator; + if (tags.network) tags[`network:${code}`] = tags.network; } } @@ -661,6 +666,9 @@ function checkItems(t) { case 'amenity/restaurant': if (!tags.cuisine) { warnMissingTag.push([display(item), 'cuisine']); } break; + case 'amenity/place_of_worship': + if (!tags.religion) { warnMissingTag.push([display(item), 'religion']); } + break; case 'amenity/training': if (!tags.training) { warnMissingTag.push([display(item), 'training']); } break; From eb420c50a1398729bca3c6f0cc13df38c6640c22 Mon Sep 17 00:00:00 2001 From: arch0345 Date: Wed, 29 Dec 2021 19:05:59 -0800 Subject: [PATCH 2/3] Add missing semicolon --- scripts/build_index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_index.js b/scripts/build_index.js index d47d4205c0f..8ef533f528c 100644 --- a/scripts/build_index.js +++ b/scripts/build_index.js @@ -580,7 +580,7 @@ function mergeItems() { function setLanguageTags(tags, code) { if (tags.name) tags[`name:${code}`] = tags.name; - if (tags.denomination) tags[`name:${code}`] = tags.denomination + if (tags.denomination) tags[`name:${code}`] = tags.denomination; if (tags.brand) tags[`brand:${code}`] = tags.brand; if (tags.operator) tags[`operator:${code}`] = tags.operator; if (tags.network) tags[`network:${code}`] = tags.network; From 7a5d59d2dc5c32265e3a8a6678f9f417a4618596 Mon Sep 17 00:00:00 2001 From: arch0345 Date: Sat, 6 Aug 2022 14:34:37 -0700 Subject: [PATCH 3/3] Update idgen.js, remove wikipedia tags --- data/denominations/amenity/place_of_worship.json | 3 --- dist/filtered/denominations_discard.json | 8 ++++---- dist/filtered/denominations_keep.json | 8 ++++---- lib/idgen.js | 2 ++ 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/data/denominations/amenity/place_of_worship.json b/data/denominations/amenity/place_of_worship.json index 652c414ecf5..42fdfff3551 100644 --- a/data/denominations/amenity/place_of_worship.json +++ b/data/denominations/amenity/place_of_worship.json @@ -13,7 +13,6 @@ "amenity": "place_of_worship", "denomination": "jehovahs_witnesses", "denomination:wikidata": "Q35269", - "denomination:wikipedia": "en:Jehovah's Witnesses", "name": "Kingdom Hall of Jehovah's Witnesses", "religion": "christian" } @@ -30,7 +29,6 @@ "amenity": "place_of_worship", "denomination": "la_luz_del_mundo", "denomination:wikidata": "Q3497836", - "denomination:wikipedia": "en:La Luz del Mundo", "name": "La Luz del Mundo Temple", "religion": "christian" } @@ -43,7 +41,6 @@ "amenity": "place_of_worship", "denomination": "quaker", "denomination:wikidata": "Q170208", - "denomination:wikipedia": "en:Quakers", "name": "Quaker Friends Meeting House", "religion": "christian" } diff --git a/dist/filtered/denominations_discard.json b/dist/filtered/denominations_discard.json index e5a3cd1f67f..6278d016e63 100644 --- a/dist/filtered/denominations_discard.json +++ b/dist/filtered/denominations_discard.json @@ -1,8 +1,8 @@ { "_meta": { - "version": "6.0.20211227", - "generated": "2021-12-30T02:32:55.989Z", + "version": "6.0.20220801", + "generated": "2022-08-06T21:22:19.790Z", "url": "https://raw.githubusercontent.com/osmlab/name-suggestion-index/main/dist/filtered/denominations_discard.json", - "hash": "67171c3e38738edca797a69625f2bc43", - "collectionDate": "20211218" + "hash": "3bc984d771638a851ec8af8c16b3f3d6", + "collectionDate": "20220801" },"discard": {}} diff --git a/dist/filtered/denominations_keep.json b/dist/filtered/denominations_keep.json index 184ab9d259d..67aa95a4d88 100644 --- a/dist/filtered/denominations_keep.json +++ b/dist/filtered/denominations_keep.json @@ -1,8 +1,8 @@ { "_meta": { - "version": "6.0.20211227", - "generated": "2021-12-30T02:32:55.990Z", + "version": "6.0.20220801", + "generated": "2022-08-06T21:22:19.791Z", "url": "https://raw.githubusercontent.com/osmlab/name-suggestion-index/main/dist/filtered/denominations_keep.json", - "hash": "1ed61f6101f797667ffa054fca25885b", - "collectionDate": "20211218" + "hash": "e37f5545a1fdb56699f8721a6f39ca17", + "collectionDate": "20220801" },"keep": {}} diff --git a/lib/idgen.js b/lib/idgen.js index 146c91a67e3..68e1545c7ad 100644 --- a/lib/idgen.js +++ b/lib/idgen.js @@ -22,6 +22,8 @@ export function idgen(item, tkv, locationID) { osmtags = ['name', 'name:en', 'operator', 'operator:en', 'brand', 'brand:en', 'network', 'network:en']; } else if (t === 'flags') { osmtags = ['flag:name', 'subject']; + } else if (t === 'denominations') { + osmtags = ['name', 'name:en', "denomination", "operator", "operator:en"]; } else { // brands osmtags = ['name', 'name:en', 'brand', 'brand:en', 'operator', 'operator:en', 'network', 'network:en']; }