-
Notifications
You must be signed in to change notification settings - Fork 1k
Contributing
The data/* folder contains a lot of files - one file per category.
Category files are organized in a tree/key/value path. Each category file contains all the items that share an OpenStreetMap key/value tag.
- tree - The highest level of organization - each tree contains categories that follow a similar approach to naming and linking to Wikidata.
- key - An OpenStreetMap tree key (e.g. "amenity")
- value - An OpenStreetMap tag value (e.g. "fast_food")
The name-suggestion-index currently supports these trees:
-
brands - Branded businesses like restaurants, banks, fuel stations, shops
identified by
brand/brand:wikidatatags -
operators - Organizations like post offices, police departments, hospitals
identified by
operator/operator:wikidatatags -
flags - Flagpoles hoisting common kinds of flags (national, regional, religious, advertising)
identified by
flag:wikidatatag -
transit - Transit networks (bus, rail, ferry, etc.) and related infrastructure
identified by
network/network:wikidatatags
For example:
-
data/brands/amenity/fast_food.jsonbrands/shop/supermarket.jsonoperators/amenity/post_office.jsonflags/man_made/flagpole.jsontransit/route/bus.json- and so on…
Each category file contains:
-
properties- Object containing category-wide properties -
items- Array containing the items in the category
For example brands/amenity/fast_food.json (comments added for clarity):
"properties": { // CATEGORY PROPERTIES:
"path": "brands/amenity/fast_food" // "path" - the tree/key/value path for this category
…
},
"items": [ // An array of items belonging to this category
…
{ // ITEM PROPERTIES:
"displayName": "McDonald's", // "displayName" - Name to display in summary screens and lists
"id": "mcdonalds-658eea", // "id" - a unique identifier added and generated automatically
"locationSet": {"include": ["001"]}, // "locationSet" - defines where this brand is valid ("001" = worldwide)
"tags": { // "tags" - OpenStreetMap tags that every McDonald's should have
"amenity": "fast_food", // The OpenStreetMap tag for a "fast food" restaurant
"brand": "McDonald's", // `brand` - Brand name in the local language (English)
"brand:wikidata": "Q38076", // `brand:wikidata` - Universal Wikidata identifier
"cuisine": "burger", // `cuisine` - What kind of fast food is served here
"name": "McDonald's" // `name` - Display name, also in the local language (English)
}
},
…There may also be items for McDonald's in other languages! For example, this is how McDonald's should be mapped in Japan:
…
{ // ITEM PROPERTIES:
"displayName": "マクドナルド", // "displayName" - Name to display in summary screens and lists
"id": "マクドナルド-3e7699", // "id" - a unique identifier added and generated automatically
"locationSet": { "include": ["jp"] }, // "locationSet" - defines where this brand is valid ("jp" = Japan)
"tags": {
"amenity": "fast_food",
"brand": "マクドナルド", // `brand` - Brand name in the local language (Japanese)
"brand:en": "McDonald's", // `brand:en` - For non-English brands, tag the English version too
"brand:ja": "マクドナルド", // `brand:ja` - Add at least one `brand:xx` tag that matches `brand`
"brand:wikidata": "Q38076", // `brand:wikidata` - Same Universal wikidata identifier
"cuisine": "burger",
"name": "マクドナルド", // `name` - Display name, also in the local language (Japanese)
"name:en": "McDonald's" // `name:en` - For non-English names, tag the English version too
"name:ja": "マクドナルド", // `name:ja` - Add at least one `name:xx` tag that matches `name`
}
},
…
The displayName can contain anything, but it should be a short text appropriate for display in lists or as preset names in editor software. This is different from the OpenStreetMap name tag.
By convention, if you need to disambiguate between multiple brands with the same name, we add text in parenthesis. Here there are 2 items named "Target", but they have been assigned different display names to tell them apart.
In brands/shop/department_store.json:
"items": [
…
{
"displayName": "Target (Australia)",
"id": "target-c93bbd",
"locationSet": {"include": ["au"]},
"tags": {
"brand": "Target",
"brand:wikidata": "Q7685854",
"name": "Target",
"shop": "department_store"
}
},
{
"displayName": "Target (USA)",
"id": "target-592fe0",
"locationSet": {"include": ["us"]},
"tags": {
"brand": "Target",
"brand:wikidata": "Q1046951",
"name": "Target",
"shop": "department_store"
}
},
…Each item has a unique id generated for it.
When adding new data, you don't need to add an id.
Running npm run build will generate the id automatically.
If you don't know how to run npm run build don't worry: a maintainer will be able to run it for you.
The identifiers are stable unless the name, key, value, or locationSet change.
Each item requires a locationSet to define where the item is available. You can define the locationSet as an Object with include and exclude properties:
"locationSet": {
"include": [ Array of locations ],
"exclude": [ Array of locations ]
}The "locations" can be any of the following:
-
Strings recognized by the country-coder library.
These include ISO 3166-1 2 or 3 letter country codes, UN M.49 numeric codes, and supported Wikidata QIDs.
Examples:"de","001","conus","gb-sct","Q620634"
👉 A current list of supported codes can be found at https://ideditor.codes -
Filenames for custom
.geojsonfeatures. If you want to use your own features, you need to add them under thefeatures/*folder of this project (see Feature Files for details)
EachFeaturemust have anidthat ends in.geojson.
Examples:"de-hh.geojson","us-nj.geojson" -
Circular areas defined as
[longitude, latitude, radius?]Array.
Radius is specified in kilometers and is optional. If not specified, it will default to a 25km radius.
Examples:[8.67039, 49.41882],[-88.3726, 39.4818, 32]
locationSet Tips:
- The M49 code for the whole world is
"001" - A current list of supported codes can be found at https://ideditor.codes
- You can view examples and learn more about working with
locationSetsin the @ideditor/location-conflation project. - You can test locationSets on this interactive map: https://ideditor.github.io/location-conflation/
States within the United States
The NSI project already has .geojson files for each state within the USA. These state names follow the ISO 3166-2:US standard, so if you wish to assign an area for Florida, you may use the .geojson file us-fl.geojson, for example:
"locationSet": {"include": ["us-fl.geojson"]}You can also use multiple states if need be, such as Florida & Georgia, for example:
"locationSet": {"include": ["us-ga.geojson","us-fl.geojson"]}Or exclude states, such as everywhere in the USA except for Florida & Georgia for example:
"locationSet": {
"include": ["us"],
"exclude": ["us-ga.geojson","us-fl.geojson"]
}The two exceptions are Alaska and Hawaii, which is built-in to the country-coder project, and can be referenced directly without the .geojson file extension, for example:
"locationSet": {"include": ["us-ak"]}
"locationSet": {"include": ["us-hi"]}Provinces in Canada
Similar to US States, Canadian Provinces are also available within the NSI, which follow the ISO_3166-2:CA naming convention, followed by the .geojson file extension.
States in Australia
Australian States are also available within the NSI, which follow the ISO_3166-2:AU naming convention, followed by the .geojson file extension.
The one exception is Tasmania, which is built-in to the country-coder project, and can be referenced directly without the .geojson file extension, for example:
"locationSet": {"include": ["au-tas"]}States in Germany
German States are also available within the NSI, which follow the ISO_3166-2:DE naming convention, followed by the .geojson file extension.
Regions in New Zealand
New Zealand Regions are also available within the NSI, which follow the ISO_3166-2:NZ naming convention, followed by the .geojson file extension.
List of available ISO_3166-2 compatible Features
Below is a simplified list of available ISO_3166-2 compatible features within the NSI, which all require a .geojson extension, with a couple of exceptions.
| Location | Features | ISO Standard | Exceptions (.geojson not needed) |
|---|---|---|---|
| United States | States within the United States | ISO_3166-2:US | Alaska (us-ak) Hawaii (us-hi) |
| Canada | Canadian Provinces | ISO_3166-2:CA | None |
| Australia | States within Australia | ISO_3166-2:AU | Tazmania (au-tas) |
| Germany | States within Germany | ISO_3166-2:DE | None |
| New Zealand | Regions within New Zealand | ISO_3166-2:ZN | None |
Each item requires a tags value. This is just an Object containing all the OpenStreetMap tags that should be set on the feature.
Note for brands, that common tags with additional details such as "website" or "facebook" is not accepted directly. Instead a tag referencing the brand's wikidata entry ("brand:wikidata") containing those details can be included. If no such exists, consider adding it.
Brands are often tagged inconsistently in OpenStreetMap. For example, some mappers write "International House of Pancakes" and others write "IHOP".
This project includes a "fuzzy" matcher that can match alternate names and tags to a single entry in the name-suggestion-index. The matcher keeps duplicate items out of the index and is used in the iD editor to help suggest tag improvements.
matchNames and matchTags properties can be used to list the less-preferred alternatives.
"properties": {
"path": "brands/amenity/fast_food" // all items in this file will match the tag `amenity=fast_food`
…
},
"items": [
…
{
"displayName": "Honey Baked Ham",
"id": "honeybakedham-4d2ff4",
"locationSet": { "include": ["us"] },
"matchNames": ["honey baked ham company"], // also match these less-preferred names
"matchTags": ["shop/butcher", "shop/deli"], // also match these less-preferred tags
"tags": {
"alt_name": "HoneyBaked Ham", // match `alt_name`
"amenity": "fast_food",
"brand": "Honey Baked Ham", // match `brand`
"brand:wikidata": "Q5893363",
"cuisine": "american",
"name": "Honey Baked Ham", // match `name`
"official_name": "The Honey Baked Ham Company" // match `official_name`
}
},
…👉 The matcher code also has some useful automatic behaviors…
You don't need to add matchNames for:
- variations in capitalization, punctuation, spacing (the middots common in Japanese names count as punctuation, so "V・ドラッグ" already matches "vドラッグ")
- variations that already appear in the
name,brand,operator,network. - variations that already appear in an alternate name tag (e.g.
alt_name,short_name,official_name, etc.) - variations that already appear in any international version of those tags (e.g.
name:en,official_name:ja, etc.) - variations in diacritic marks (e.g. "Häagen-Dazs" already matches "Haagen-Dazs")
- variations in
&vs.and
You don't need to add matchTags for:
- Tags assigned to match groups (defined in
config/matchGroups.json). For example, you don't need addmatchTags: ["shop/doityourself"]to every "shop/hardware" and vice versa. Tags in a match group will automatically match any other tags in the same match group.
👉 Bonus: The build script will automatically remove extra matchNames and matchTags that are unnecessary.
You can optionally add a note property to any item. The note can contain any text useful for maintaining the index - for example, information about the brand's status, or a link to a GitHub issue.
The notes just stay with the name-suggestion-index; they aren't OpenStreetMap tags or used by other software.
{
"displayName": "United Bank (Connecticut)",
"id": "unitedbank-28419b",
"locationSet": { "include": ["peoples_united_bank_ct.geojson"] },
"note": "Merged into People's United Bank (Q7165802) in 2019, see https://en.wikipedia.org/wiki/United_Financial_Bancorp",
"tags": {
…
}
},
Sometimes multiple brands use the same name - this is okay!
Make sure each entry has a distinct locationSet, and the index will generate unique identifiers for each one.
You should also give each entry a unique displayName, so everyone can tell them apart.
{
"displayName": "Price Chopper (Kansas City)",
"id": "pricechopper-9554e9",
"locationSet": { "include": ["price_chopper_ks_mo.geojson"] },
"tags": {
"brand": "Price Chopper",
"brand:wikidata": "Q7242572",
"name": "Price Chopper",
"shop": "supermarket"
}
},
{
"displayName": "Price Chopper (New York)",
"id": "pricechopper-f86a3e",
"locationSet": { "include": ["price_chopper_ny.geojson"] },
"tags": {
"brand": "Price Chopper",
"brand:wikidata": "Q7242574",
"name": "Price Chopper",
"shop": "supermarket"
}
},
Contributing to the index
- Feature Files (geofences)
- Using Overpass Turbo
- Config Files
- Property Reference
- Technical Details
Information for developers using the name-suggestion-index in another project.
Information for maintainers, including how to clone and build the project.