Adding Wikidata Tags - osmlab/name-suggestion-index GitHub Wiki


⚠️  April 2022 Update
The use of *:wikipedia tag has been discontinued (issue #6481)


Contributing the *:wikidata tag is a very useful task that anybody can help with. It involves a little bit of Internet research.

You can use the online file editor on GitHub to edit the category files under /data/* and send a Pull Request with your changes.

Example #1 - Worldwide / English brands…

  1. Find an entry in a file that is missing these tags:

    In data/brands/amenity/fast_food.json:

    {
      "displayName": "Chipotle",
      "id": "chipotle-658eea",
      "locationSet": { "include": ["us"] }
      "matchNames": ["chipotle mexican grill"],
      "tags": {
        "amenity": "fast_food",
        "brand": "Chipotle",
        "cuisine": "mexican",
        "name": "Chipotle"
      }
    },

     

  2. Google for that brand - if you are lucky, you might find a Wikipedia page right away.

    Google for Chipotle

     

  3. On the brand's Wikipedia page, you can also find its "Wikidata item" link. This appears under the "tools" menu in the sidebar.


    👉 Tip: @maxerickson has created a user script to make copying these values even easier - see #1881

    Chipotle Wikipedia

     

  4. On the brand's Wikidata page, you can identify the brand:wikidata value. It is a code starting with 'Q' and several numbers.

    Chipotle Wikidata

     

  5. Update the brand file, in this case brands/amenity/fast_food.json:

    We can add the "brand:wikidata" tags.

    {
      "displayName": "Chipotle",
      "id": "chipotle-658eea",
      "locationSet": { "include": ["us"] }
      "matchNames": ["chipotle mexican grill"],
      "tags": {
        "amenity": "fast_food",
        "brand": "Chipotle",
        "brand:wikidata": "Q465751",                            // added
        "cuisine": "mexican",
        "name": "Chipotle"
      }
    },

    (comments added for clarity)

     

  6. (optional) Rebuild and submit a pull request.

    • Run npm run build
    • If it does not fail with an error, you can submit a pull request with your changes (warnings are OK).

    If you don't have a local copy of the project for development, just send the pull request anyway. GitHub will test your changes, and a maintainer will run npm run build later.

 

Example #2 - Regional / non-English brands...

This example uses a brand "かっぱ寿司". I don't know what that is, so I will do some research.

  1. Find an entry in a brand file that is missing these tags:

    In data/brands/amenity/fast_food.json:

    {
      "displayName": "かっぱ寿司",
      "id": "e7198e-3e7699",
      "locationSet": {"include": ["jp"]},
      "tags": {
        "amenity": "fast_food",
        "brand": "かっぱ寿司",
        "name": "かっぱ寿司"
      }
    },

     

  2. Google for that brand - if you are lucky, you might find the Wikipedia page right away.


    👉 Tip: You might want to narrow you search by Googling with a site: filter: "かっぱ寿司 site:ja.wikipedia.org"

    From these results, we can know that the brand is "Kappa Sushi", owned by a Japanese company called "Kappa Create". We can also find the Wikipedia page.

    Google for かっぱ寿司

     

  3. As with English brands, you can identify the brand's wikipedia value from the URL. Because this is a Japanese brand, we will link to the Japanese Wikipedia page.

    Although I can not read Japanese, I can identify the "Wikidata item" link because it always appears in the sidebar and mouseover will show the Wikidata 'Q' code in the URL.

    Kappa Sushi Wikipedia

     

  4. On the brand's Wikidata page, you can identify the brand:wikidata value. It is a code starting with 'Q' and several numbers.

    Note: The Wikidata page looks a bit sparse - you can edit this too if you want to help!

    Kappa Sushi Wikidata

     

  5. Update the brand file, in this case brands/amenity/fast_food.json:

    We can add:

    • "brand:en" and "name:en" tags to contain the English name "Kappa Sushi"
    • "name:ja" and "brand:ja" tags to contain the local name "かっぱ寿司"
    • "brand:wikidata" tag
    • "cuisine": "sushi" OpenStreetMap tag
    • Also check the "locationSet" property to make sure it is accurate.

    It may seem redundant to add both "name": "かっぱ寿司" and also "name:ja": "かっぱ寿司" tags. We follow this convention because some validator software will complain if there is a name tag and no matching language tag, such as name:ja. See also issue #2245


    👉 Important: When an item has any name:xx language tags, make sure there exists a name:xx tag that matches the name tag. See https://wiki.openstreetmap.org/wiki/Multilingual_names#Repeating_name_with_language_specific_tag

    {
      "displayName": "かっぱ寿司",
      "id": "kappasushi-3e7699",
      "locationSet": {"include": ["jp"]},
      "tags": {
        "amenity": "fast_food",
        "brand": "かっぱ寿司",
        "brand:en": "Kappa Sushi",             // added
        "brand:ja": "かっぱ寿司",               // added
        "brand:wikidata": "Q11263916",        // added
        "cuisine": "sushi",                   // added
        "name": "かっぱ寿司",
        "name:en": "Kappa Sushi",             // added
        "name:ja": "かっぱ寿司"                 // added
      }
    },

    (comments added for clarity)

     

  6. (optional) Rebuild and submit a pull request.

    • Run npm run build
    • If it does not fail with an error, you can submit a pull request with your changes (warnings are OK).

    If you don't have a local copy of the project for developement, just send the pull request anyway. GitHub will test your changes, and a maintainer will run npm run build later.

 

Add missing brands

If it exists, we want to know about it!

Some brands haven't been mapped enough on OpenStreetMap (50+ times) to be automatically added to the index. If it is a notable brand, you can add it manually to establish a preferred tagging.

  1. Before adding a new brand, the minimum information you should know is the correct tagging required for instances of the brand (name, brand and what it is - e.g. amenity=fast_food). Ideally you also have brand:wikidata and brand:wikipedia tags for the brand and any other appropriate tags - e.g. cuisine.

  2. Add your new entry anywhere into the appropriate file under data/**/* (the files will be sorted alphabetically later) and using the "tags" key add all appropriate OSM tags. Refer to Category Files if you're not familiar with the syntax.

  3. If the brand only has locations in a known set of countries add them to the "locationSet" property. This takes an array of ISO 3166-1 alpha-2 country codes in lowercase (e.g. ["de", "at", "nl"]).

  4. If instances of this brand are commonly mistagged add the "matchNames": [] key to list these. Again, refer to Category Files for syntax.

  5. (optional) Run npm run build

    If you don't have a local copy of the project for developement, just send the pull request anyway. GitHub will test your changes, and a maintainer will run npm run build later.

⚠️ **GitHub.com Fallback** ⚠️