onthegomap/planetiler

Prefer name statements over Wikidata labels

Opened this issue · 2 comments

1ec5 commented

Wikidata fetches the label of each linked Wikidata item in each available language:

JsonNode label = row.get("label");
map.put(
label.get("xml:lang").asText(),
label.get("value").asText()
);

This is suboptimal because Wikidata labels are technically mainly for labeling items on the Wikidata site. Even though a label usually corresponds to a concept’s common name, it may sometimes contain some modifications to be recognizable on the site. (The closest analogy in OSM would be the name of a route relation that a mapper has optimized for display in the osm.org sidebar or JOSM’s relation list.)

A better alternative is the name (P2561) property. When an item has statements for this property, the query should prefer those statements. If there’s no statement for a given language, it should fall back to the label in that language.

If there are multiple name statements in a given language, the query should prefer the one with preferred rank, or without an end time (P582). Better yet, it should prefer the statement with the object has role (P3831) qualifier set to map label (Q104642575). For example, this will avoid adding an extra “D.C.” disambiguator to Washington, D.C. (which is correct in most written mediums, just not maps).

/ref openmaptiles/openmaptiles-tools#437 osm-americana/openstreetmap-americana#592 (comment)

Thanks @1ec5 - We want the default behavior to match openmaptiles, so I think we'd want to wait for a decision there to replicate it downstream to planetiler-openmaptiles. But if we run into any issues with that or want to do it sooner we can change that behavior in planetiler/planetiler-openmaptiles and enable the behavior change behind a command-line flag.

Also this is helpful: openmaptiles/openmaptiles-tools#437 (comment)

The current query is:

SELECT ?id ?label where {
  VALUES ?id { wd:Q1 wd:Q2 ... } ?id (owl:sameAs* / rdfs:label) ?label
}
1ec5 commented

Out of curiosity, is the owl:sameAs* having a significant impact on the quantity or quality of results? OpenMapTiles doesn’t include that path in its query.