Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim wikidata #141

Merged
merged 1 commit into from
Mar 28, 2018
Merged

Trim wikidata #141

merged 1 commit into from
Mar 28, 2018

Conversation

frederoni
Copy link
Contributor

@frederoni frederoni commented Mar 28, 2018

Fixes #140

The wikidata field can contain a leading whitespace which triggers an assertion.

https://api.mapbox.com/geocoding/v5/mapbox.places/Nayara.json?proximity=-122.14094005,37.36921459&types=country,region,district,place,locality,neighborhood,address,poi&limit=10&language=en&access_token=<token>

{
    "id": "locality.15141320875275900",
    "wikidata": " Q10116",
    "text_en": "Jakarta Barat",
    "text": "Jakarta Barat"
}

Full response:

{
  "type": "FeatureCollection",
  "query": [
    "nayara"
  ],
  "features": [
    {
      "id": "locality.7614208079466220",
      "type": "Feature",
      "place_type": [
        "locality"
      ],
      "relevance": 0.9,
      "properties": {},
      "text_en": "Nayarambalam",
      "place_name_en": "Nayarambalam, North Paravur, Ernakulam, Kerala, India",
      "text": "Nayarambalam",
      "place_name": "Nayarambalam, North Paravur, Ernakulam, Kerala, India",
      "bbox": [
        76.1994210007976,
        10.0433100091989,
        76.2448449638604,
        10.089088483634
      ],
      "center": [
        76.218382,
        10.0471
      ],
      "geometry": {
        "type": "Point",
        "coordinates": [
          76.218382,
          10.0471
        ]
      },
      "context": [
        {
          "id": "place.11417127351396900",
          "wikidata": "Q3595582",
          "text_en": "North Paravur",
          "language_en": "en",
          "text": "North Paravur",
          "language": "en"
        },
        {
          "id": "district.2166058119450144",
          "wikidata": "Q1356097",
          "text_en": "Ernakulam",
          "language_en": "en",
          "text": "Ernakulam",
          "language": "en"
        },
        {
          "id": "region.26058",
          "short_code": "IN-KL",
          "wikidata": "Q1186",
          "text_en": "Kerala",
          "language_en": "en",
          "text": "Kerala",
          "language": "en"
        },
        {
          "id": "country.3146",
          "short_code": "in",
          "wikidata": "Q668",
          "text_en": "India",
          "language_en": "en",
          "text": "India",
          "language": "en"
        }
      ]
    },
    {
      "id": "place.16940807755466220",
      "type": "Feature",
      "place_type": [
        "place"
      ],
      "relevance": 0.9,
      "properties": {},
      "text_en": "Nayarambalam",
      "place_name_en": "Nayarambalam, Kerala, India",
      "text": "Nayarambalam",
      "place_name": "Nayarambalam, Kerala, India",
      "bbox": [
        76.195002655335,
        10.0342420777563,
        76.2494053976574,
        10.0778606929352
      ],
      "center": [
        76.234294,
        10.055683
      ],
      "geometry": {
        "type": "Point",
        "coordinates": [
          76.234294,
          10.055683
        ]
      },
      "context": [
        {
          "id": "district.2166058119450144",
          "wikidata": "Q1356097",
          "text_en": "Ernakulam",
          "language_en": "en",
          "text": "Ernakulam",
          "language": "en"
        },
        {
          "id": "region.26058",
          "short_code": "IN-KL",
          "wikidata": "Q1186",
          "text_en": "Kerala",
          "language_en": "en",
          "text": "Kerala",
          "language": "en"
        },
        {
          "id": "country.3146",
          "short_code": "in",
          "wikidata": "Q668",
          "text_en": "India",
          "language_en": "en",
          "text": "India",
          "language": "en"
        }
      ]
    },
    {
      "id": "locality.14996912098466220",
      "type": "Feature",
      "place_type": [
        "locality"
      ],
      "relevance": 0.9,
      "properties": {},
      "text_en": "Nayarambalam",
      "place_name_en": "Nayarambalam, Njarackal, Ernakulam, Kerala, India",
      "text": "Nayarambalam",
      "place_name": "Nayarambalam, Njarackal, Ernakulam, Kerala, India",
      "bbox": [
        76.19871384,
        10.04440797,
        76.22578584,
        10.06871301
      ],
      "center": [
        76.212953,
        10.056965
      ],
      "geometry": {
        "type": "Point",
        "coordinates": [
          76.212953,
          10.056965
        ]
      },
      "context": [
        {
          "id": "place.13751392024658340",
          "wikidata": null,
          "text_en": "Njarackal",
          "text": "Njarackal"
        },
        {
          "id": "district.2166058119450144",
          "wikidata": "Q1356097",
          "text_en": "Ernakulam",
          "language_en": "en",
          "text": "Ernakulam",
          "language": "en"
        },
        {
          "id": "region.26058",
          "short_code": "IN-KL",
          "wikidata": "Q1186",
          "text_en": "Kerala",
          "language_en": "en",
          "text": "Kerala",
          "language": "en"
        },
        {
          "id": "country.3146",
          "short_code": "in",
          "wikidata": "Q668",
          "text_en": "India",
          "language_en": "en",
          "text": "India",
          "language": "en"
        }
      ]
    },
    {
      "id": "address.1341669968",
      "type": "Feature",
      "place_type": [
        "address"
      ],
      "relevance": 0.9,
      "properties": {},
      "text_en": "Rua Nayara Bento Nóbrega",
      "place_name_en": "Rua Nayara Bento Nóbrega Patos - Paraíba, Brazil",
      "text": "Rua Nayara Bento Nóbrega",
      "place_name": "Rua Nayara Bento Nóbrega Patos - Paraíba, Brazil",
      "center": [
        -37.245618,
        -7.014111
      ],
      "geometry": {
        "type": "Point",
        "coordinates": [
          -37.245618,
          -7.014111
        ]
      },
      "context": [
        {
          "id": "place.8425345890973370",
          "wikidata": "Q1966384",
          "text_en": "Patos",
          "language_en": "en",
          "text": "Patos",
          "language": "en"
        },
        {
          "id": "region.216936",
          "short_code": "BR-PB",
          "wikidata": "Q38088",
          "text_en": "Paraíba",
          "language_en": "en",
          "text": "Paraíba",
          "language": "en"
        },
        {
          "id": "country.3100",
          "short_code": "br",
          "wikidata": "Q155",
          "text_en": "Brazil",
          "language_en": "en",
          "text": "Brazil",
          "language": "en"
        }
      ]
    },
    {
      "id": "poi.3733288165937940",
      "type": "Feature",
      "place_type": [
        "poi"
      ],
      "relevance": 0.9,
      "properties": {
        "landmark": true,
        "tel": "(021) 6255999",
        "category": "bakery, cafe, coffee, tea, tea house",
        "address": "Jalan Mangga Besar 1"
      },
      "text_en": "Nayara Cafe  Kota",
      "place_name_en": "Nayara Cafe Kota, Jalan Mangga Besar 1, Jakarta, 11180, Indonesia",
      "text": "Nayara Cafe  Kota",
      "place_name": "Nayara Cafe Kota, Jalan Mangga Besar 1, Jakarta, 11180, Indonesia",
      "center": [
        106.818666,
        -6.144083
      ],
      "geometry": {
        "type": "Point",
        "coordinates": [
          106.818666,
          -6.144083
        ]
      },
      "context": [
        {
          "id": "locality.15141320875275900",
          "wikidata": " Q10116",
          "text_en": "Jakarta Barat",
          "text": "Jakarta Barat"
        },
        {
          "id": "postcode.3589889840967590",
          "text_en": "11180",
          "text": "11180"
        },
        {
          "id": "place.226251",
          "short_code": "ID-JK",
          "wikidata": "Q3630",
          "text_en": "Jakarta",
          "language_en": "en",
          "text": "Jakarta",
          "language": "en"
        },
        {
          "id": "country.368",
          "short_code": "id",
          "wikidata": "Q252",
          "text_en": "Indonesia",
          "language_en": "en",
          "text": "Indonesia",
          "language": "en"
        }
      ]
    },
    {
      "id": "poi.1789325347218040",
      "type": "Feature",
      "place_type": [
        "poi"
      ],
      "relevance": 0.9,
      "properties": {
        "landmark": true,
        "tel": "(68) 3223-6337",
        "category": "cafe, coffee, fast food, restaurant, tea, tea house",
        "address": "Rua Cel Alexandrino, 635"
      },
      "text_en": "Nayara Lanches",
      "place_name_en": "Nayara Lanches, Rua Cel Alexandrino, 635, Rio Branco, Acre, Brazil",
      "text": "Nayara Lanches",
      "place_name": "Nayara Lanches, Rua Cel Alexandrino, 635, Rio Branco, Acre, Brazil",
      "center": [
        -67.808946,
        -9.962674
      ],
      "geometry": {
        "type": "Point",
        "coordinates": [
          -67.808946,
          -9.962674
        ]
      },
      "context": [
        {
          "id": "place.18254586106474430",
          "wikidata": "Q171612",
          "text_en": "Rio Branco",
          "language_en": "en",
          "text": "Rio Branco",
          "language": "en"
        },
        {
          "id": "region.3329",
          "short_code": "BR-AC",
          "wikidata": "Q40780",
          "text_en": "Acre",
          "language_en": "en",
          "text": "Acre",
          "language": "en"
        },
        {
          "id": "country.3100",
          "short_code": "br",
          "wikidata": "Q155",
          "text_en": "Brazil",
          "language_en": "en",
          "text": "Brazil",
          "language": "en"
        }
      ]
    },
    {
      "id": "poi.9581003593741440",
      "type": "Feature",
      "place_type": [
        "poi"
      ],
      "relevance": 0.9,
      "properties": {
        "landmark": true,
        "category": "alcohol, bar",
        "address": "Psg Iracema"
      },
      "text_en": "Nayara Bar",
      "place_name_en": "Nayara Bar, Psg Iracema, Belém, Pará 66623, Brazil",
      "text": "Nayara Bar",
      "place_name": "Nayara Bar, Psg Iracema, Belém, Pará 66623, Brazil",
      "center": [
        -48.447905,
        -1.401797
      ],
      "geometry": {
        "type": "Point",
        "coordinates": [
          -48.447905,
          -1.401797
        ]
      },
      "context": [
        {
          "id": "neighborhood.8139204745299400",
          "text_en": "Marambaia",
          "text": "Marambaia"
        },
        {
          "id": "locality.788309792534550",
          "text_en": "Entroncamento",
          "text": "Entroncamento"
        },
        {
          "id": "postcode.8402606209680000",
          "text_en": "66623",
          "text": "66623"
        },
        {
          "id": "place.3244708388876410",
          "wikidata": "Q47593",
          "text_en": "Belém",
          "language_en": "en",
          "text": "Belém",
          "language": "en"
        },
        {
          "id": "region.3731",
          "short_code": "BR-PA",
          "wikidata": "Q39517",
          "text_en": "Pará",
          "language_en": "en",
          "text": "Pará",
          "language": "en"
        },
        {
          "id": "country.3100",
          "short_code": "br",
          "wikidata": "Q155",
          "text_en": "Brazil",
          "language_en": "en",
          "text": "Brazil",
          "language": "en"
        }
      ]
    },
    {
      "id": "poi.14937815084241750",
      "type": "Feature",
      "place_type": [
        "poi"
      ],
      "relevance": 0.9,
      "properties": {
        "landmark": true,
        "tel": "(31) 3398-9949",
        "category": "pizza, restaurant",
        "address": "Avenida Virgínia Graciosi Pacelli, 2850",
        "maki": "restaurant"
      },
      "text_en": "Nayara R Ferreira",
      "place_name_en": "Nayara R Ferreira, Avenida Virgínia Graciosi Pacelli, 2850, Contagem, Minas Gerais 32004, Brazil",
      "text": "Nayara R Ferreira",
      "place_name": "Nayara R Ferreira, Avenida Virgínia Graciosi Pacelli, 2850, Contagem, Minas Gerais 32004, Brazil",
      "center": [
        -44.074689,
        -19.907542
      ],
      "geometry": {
        "type": "Point",
        "coordinates": [
          -44.074689,
          -19.907542
        ]
      },
      "context": [
        {
          "id": "postcode.1540981656308120",
          "text_en": "32004",
          "text": "32004"
        },
        {
          "id": "place.14293562085534410",
          "wikidata": "Q271333",
          "text_en": "Contagem",
          "language_en": "en",
          "text": "Contagem",
          "language": "en"
        },
        {
          "id": "region.3500",
          "short_code": "BR-MG",
          "wikidata": "Q39109",
          "text_en": "Minas Gerais",
          "language_en": "en",
          "text": "Minas Gerais",
          "language": "en"
        },
        {
          "id": "country.3100",
          "short_code": "br",
          "wikidata": "Q155",
          "text_en": "Brazil",
          "language_en": "en",
          "text": "Brazil",
          "language": "en"
        }
      ]
    },
    {
      "id": "poi.12478952827969220",
      "type": "Feature",
      "place_type": [
        "poi"
      ],
      "relevance": 0.9,
      "properties": {
        "landmark": true,
        "tel": "(770) 969-0308",
        "category": "restaurant",
        "address": "6715 Roosevelt Hwy",
        "maki": "restaurant"
      },
      "text_en": "Nayarat Mex American Food Store",
      "place_name_en": "Nayarat Mex American Food Store, 6715 Roosevelt Hwy, Union City, Georgia 30291, United States",
      "text": "Nayarat Mex American Food Store",
      "place_name": "Nayarat Mex American Food Store, 6715 Roosevelt Hwy, Union City, Georgia 30291, United States",
      "center": [
        -84.562394,
        33.576414
      ],
      "geometry": {
        "type": "Point",
        "coordinates": [
          -84.562394,
          33.576414
        ]
      },
      "context": [
        {
          "id": "neighborhood.32456",
          "text_en": "Shannon Chase",
          "text": "Shannon Chase"
        },
        {
          "id": "postcode.8313775338560480",
          "text_en": "30291",
          "text": "30291"
        },
        {
          "id": "place.10242103268712140",
          "wikidata": "Q3261692",
          "text_en": "Union City",
          "language_en": "en",
          "text": "Union City",
          "language": "en"
        },
        {
          "id": "region.219644",
          "short_code": "US-GA",
          "wikidata": "Q1428",
          "text_en": "Georgia",
          "language_en": "en",
          "text": "Georgia",
          "language": "en"
        },
        {
          "id": "country.3145",
          "short_code": "us",
          "wikidata": "Q30",
          "text_en": "United States",
          "language_en": "en",
          "text": "United States",
          "language": "en"
        }
      ]
    },
    {
      "id": "neighborhood.2782689291407010",
      "type": "Feature",
      "place_type": [
        "neighborhood"
      ],
      "relevance": 0.7200000000000001,
      "properties": {},
      "text_en": "Jardim Nayara",
      "place_name_en": "Jardim Nayara, Embu das Artes - São Paulo, Brazil",
      "text": "Jardim Nayara",
      "place_name": "Jardim Nayara, Embu das Artes - São Paulo, Brazil",
      "bbox": [
        -46.816302,
        -23.646094,
        -46.811524,
        -23.643198
      ],
      "center": [
        -46.814052,
        -23.644622
      ],
      "geometry": {
        "type": "Point",
        "coordinates": [
          -46.814052,
          -23.644622
        ]
      },
      "context": [
        {
          "id": "locality.11019472148849890",
          "wikidata": null,
          "text_en": "Embu",
          "text": "Embu"
        },
        {
          "id": "postcode.4465891094155590",
          "text_en": "06816",
          "text": "06816"
        },
        {
          "id": "place.19999903879916400",
          "wikidata": "Q651860",
          "text_en": "Embu das Artes",
          "language_en": "en",
          "text": "Embu das Artes",
          "language": "en"
        },
        {
          "id": "region.3664",
          "short_code": "BR-SP",
          "wikidata": "Q175",
          "text_en": "São Paulo",
          "language_en": "en",
          "text": "São Paulo",
          "language": "en"
        },
        {
          "id": "country.3100",
          "short_code": "br",
          "wikidata": "Q155",
          "text_en": "Brazil",
          "language_en": "en",
          "text": "Brazil",
          "language": "en"
        }
      ]
    }
  ],
  "attribution": "NOTICE: © 2017 Mapbox and its suppliers. All rights reserved. Use of this data is subject to the Mapbox Terms of Service (https://www.mapbox.com/about/maps/). This response and the information it contains may not be retained."
}

@mattficke @1ec5 @bsudekum

@bsudekum
Copy link

I think this should probably be fixed upstream as well.

@bsudekum bsudekum merged commit fd6f6e1 into master Mar 28, 2018
@bsudekum bsudekum deleted the fred/trim-wikidata branch March 28, 2018 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants