Skip to content

Commit

Permalink
Add a flags tree
Browse files Browse the repository at this point in the history
(re: #4745)
  • Loading branch information
bhousel committed Dec 1, 2020
1 parent b16cc5f commit 3e6cd9d
Show file tree
Hide file tree
Showing 9 changed files with 325 additions and 20 deletions.
6 changes: 6 additions & 0 deletions config/trees.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@
"^tourism/hotel\\|(h(o|ô)tel\\s)?(grand|imperial|krone|palace|panorama|park|plaza|royal|victoria)\\s?(h(o|ô)tel)?$"
]
},
"flags": {
"emoji": "🚩",
"mainTag": "flag:wikidata",
"keepKV": ["^man_made/flagpole$"],
"discardKVN": []
},
"operators": {
"emoji": "💼",
"mainTag": "operator:wikidata",
Expand Down
269 changes: 269 additions & 0 deletions data/flags/man_made/flagpole.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
{
"flags/man_made/flagpole": [
{
"displayName": "Buddhist",
"id": "buddhist-e5dc93",
"locationSet": {"include": ["001"]},
"tags": {
"flag:name": "Buddhist",
"flag:type": "religious",
"flag:wikidata": "Q1130142",
"man_made": "flagpole",
"subject": "Buddhism",
"subject:wikidata": "Q748"
}
},
{
"displayName": "California",
"id": "california-85bb3f",
"locationSet": {"include": ["us"]},
"tags": {
"flag:name": "California",
"flag:type": "regional",
"flag:wikidata": "Q330517",
"man_made": "flagpole",
"subject": "California",
"subject:wikidata": "Q99"
}
},
{
"displayName": "Canada",
"id": "canada-e5dc93",
"locationSet": {"include": ["001"]},
"tags": {
"country": "CA",
"flag:name": "Canada",
"flag:type": "national",
"flag:wikidata": "Q80110",
"man_made": "flagpole",
"subject": "Canada",
"subject:wikidata": "Q16"
}
},
{
"displayName": "Christian",
"id": "christian-e5dc93",
"locationSet": {"include": ["001"]},
"tags": {
"flag:name": "Christian",
"flag:type": "religious",
"flag:wikidata": "Q1084035",
"man_made": "flagpole",
"subject": "Christianity",
"subject:wikidata": "Q5043"
}
},
{
"displayName": "Indiana",
"id": "indiana-85bb3f",
"locationSet": {"include": ["us"]},
"tags": {
"flag:name": "Indiana",
"flag:type": "regional",
"flag:wikidata": "Q673117",
"man_made": "flagpole",
"subject": "Indiana",
"subject:wikidata": "Q1415"
}
},
{
"displayName": "Kentucky",
"id": "kentucky-85bb3f",
"locationSet": {"include": ["us"]},
"tags": {
"flag:name": "Kentucky",
"flag:type": "regional",
"flag:wikidata": "Q590821",
"man_made": "flagpole",
"subject": "Kentucky",
"subject:wikidata": "Q1603"
}
},
{
"displayName": "Louisiana",
"id": "louisiana-85bb3f",
"locationSet": {"include": ["us"]},
"tags": {
"flag:name": "Louisiana",
"flag:type": "regional",
"flag:wikidata": "Q19374",
"man_made": "flagpole",
"subject": "Louisiana",
"subject:wikidata": "Q1588"
}
},
{
"displayName": "McDonald's",
"id": "mcdonalds-e5dc93",
"locationSet": {"include": ["001"]},
"tags": {
"flag:name": "McDonald's",
"flag:type": "advertising",
"flag:wikidata": "Q64300176",
"man_made": "flagpole",
"subject": "McDonald's",
"subject:wikidata": "Q38076"
}
},
{
"displayName": "Mexico",
"id": "mexico-e5dc93",
"locationSet": {"include": ["001"]},
"tags": {
"country": "MX",
"flag:name": "Mexico",
"flag:type": "national",
"flag:wikidata": "Q122462",
"man_made": "flagpole",
"subject": "Mexico",
"subject:wikidata": "Q96"
}
},
{
"displayName": "Ohio",
"id": "ohio-85bb3f",
"locationSet": {"include": ["us"]},
"tags": {
"flag:name": "Ohio",
"flag:type": "regional",
"flag:wikidata": "Q752559",
"man_made": "flagpole",
"subject": "Ohio",
"subject:wikidata": "Q1397"
}
},
{
"displayName": "POW/MIA",
"id": "powmia-e5dc93",
"locationSet": {"include": ["001"]},
"tags": {
"flag:name": "POW/MIA",
"flag:type": "organisation",
"flag:wikidata": "Q1463762",
"man_made": "flagpole",
"subject": "National League of POW/MIA Families",
"subject:wikidata": "Q6974069"
}
},
{
"displayName": "South Vietnam",
"id": "southvietnam-e5dc93",
"locationSet": {"include": ["001"]},
"tags": {
"country": "VN",
"flag:colour": "yellow",
"flag:name": "South Vietnam",
"flag:type": "national",
"flag:wikidata": "Q1740429",
"man_made": "flagpole",
"subject": "South Vietnam",
"subject:wikidata": "Q180573"
}
},
{
"displayName": "Texas",
"id": "texas-85bb3f",
"locationSet": {"include": ["us"]},
"tags": {
"flag:name": "Texas",
"flag:type": "regional",
"flag:wikidata": "Q19000",
"man_made": "flagpole",
"subject": "Texas",
"subject:wikidata": "Q1439"
}
},
{
"displayName": "United States",
"id": "unitedstates-e5dc93",
"locationSet": {"include": ["001"]},
"tags": {
"country": "US",
"flag:name": "United States",
"flag:type": "national",
"flag:wikidata": "Q42537",
"man_made": "flagpole",
"subject": "United States",
"subject:wikidata": "Q30"
}
},
{
"displayName": "United States Air Force",
"id": "unitedstatesairforce-85bb3f",
"locationSet": {"include": ["us"]},
"tags": {
"flag:name": "United States Air Force",
"flag:type": "military",
"flag:wikidata": "Q5456894",
"man_made": "flagpole",
"subject": "United States Air Force",
"subject:wikidata": "Q11223"
}
},
{
"displayName": "United States Army",
"id": "unitedstatesarmy-85bb3f",
"locationSet": {"include": ["us"]},
"tags": {
"flag:name": "United States Army",
"flag:type": "military",
"flag:wikidata": "Q5456898",
"man_made": "flagpole",
"subject": "United States Army",
"subject:wikidata": "Q9212"
}
},
{
"displayName": "United States Coast Guard",
"id": "unitedstatescoastguard-85bb3f",
"locationSet": {"include": ["us"]},
"tags": {
"flag:name": "United States Coast Guard",
"flag:type": "military",
"flag:wikidata": "Q5456895",
"man_made": "flagpole",
"subject": "United States Coast Guard",
"subject:wikidata": "Q11224"
}
},
{
"displayName": "United States Marine Corps",
"id": "unitedstatesmarinecorps-85bb3f",
"locationSet": {"include": ["us"]},
"tags": {
"flag:name": "United States Marine Corps",
"flag:type": "military",
"flag:wikidata": "Q5456897",
"man_made": "flagpole",
"subject": "United States Marine Corps",
"subject:wikidata": "Q11218"
}
},
{
"displayName": "United States Merchant Marines",
"id": "unitedstatesmerchantmarines-85bb3f",
"locationSet": {"include": ["us"]},
"tags": {
"flag:name": "United States Merchant Marines",
"flag:type": "military",
"flag:wikidata": "Q96912183",
"man_made": "flagpole",
"subject": "United States Merchant Marines",
"subject:wikidata": "Q1772052"
}
},
{
"displayName": "United States Navy",
"id": "unitedstatesnavy-85bb3f",
"locationSet": {"include": ["us"]},
"tags": {
"flag:name": "United States Navy",
"flag:type": "military",
"flag:wikidata": "Q5456899",
"man_made": "flagpole",
"subject": "United States Navy",
"subject:wikidata": "Q11220"
}
}
]
}
2 changes: 2 additions & 0 deletions lib/idgen.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module.exports = (item, tkv, locationID) => {
osmtags = ['name', 'name:en', 'network', 'network:en', 'operator', 'operator:en', 'brand', 'brand:en'];
} else if (t === 'operators') {
osmtags = ['name', 'name:en', 'operator', 'operator:en', 'brand', 'brand:en', 'network', 'network:en'];
} else if (t === 'flags') {
osmtags = ['flag:name', 'subject'];
} else { // brands
osmtags = ['name', 'name:en', 'brand', 'brand:en', 'operator', 'operator:en', 'network', 'network:en'];
}
Expand Down
20 changes: 10 additions & 10 deletions lib/matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,21 @@ module.exports = () => {
}


// Look for tags to insert..
let kvTags = [
`${thiskv}`,
`${k}/yes`, // #3454 - match some generic tags
'building/yes' // #3454 - match some generic tags
].concat(item.matchTags || []);

// Look for names to insert..
// key/value tagpairs to insert into the index..
let kvTags = [`${thiskv}`];
if (thiskv !== 'man_made/flagpole') {
kvTags.push(`${k}/yes`, 'building/yes'); // #3454 - match some generic tags
}
kvTags = kvTags.concat(item.matchTags || []);

// name variations to insert into the index..
let nameTags = [];
if (which === 'primary') {
nameTags = [/^name$/];
nameTags = [/^(flag:)?name$/];

} else if (which === 'secondary') { // #2732 - match alternate names
nameTags = [
/^(brand|operator|network)$/,
/^(brand|operator|network|subject)$/,
/^\w+_name$/, // e.g. `alt_name`, `short_name`
/^(name|brand|operator|network):\w+$/, // e.g. `name:en`, `name:ru`
/^\w+_name:\w+$/ // e.g. `alt_name:en`, `short_name:ru`
Expand Down
1 change: 1 addition & 0 deletions schema/items.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
},
"anyOf": [
{ "required": ["brand"] },
{ "required": ["flag:name", "flag:type"] },
{ "required": ["operator"] },
{ "required": ["network"] }
]
Expand Down
5 changes: 3 additions & 2 deletions scripts/build_dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ function buildTaginfo() {
for (const k in item.tags) {
let v = item.tags[k];

// skip value for many tags this project uses..
if (/name|brand|network|operator/.test(k)) {
// Skip value for many tags this project uses..
// ('tag matches any of these')(?!('not followed by :type'))
if (/(name|brand|network|operator|subject|flag)(?!(:type))/.test(k)) {
v = '*';
}

Expand Down
Loading

0 comments on commit 3e6cd9d

Please sign in to comment.