silentDjay / Mapstery

A geography game inspired by my long history of spending hours on end staring at maps
http://silentdjay.github.io/Mapstery/
6 stars 3 forks source link

Some addresses with 'country' address data also contain `natural_feature` data #32

Closed silentDjay closed 4 years ago

silentDjay commented 4 years ago

Initially I assumed that any address that included a 'natural_feature' component would not reveal any country data, so I dismiss it based on that fact. I need to introduce more logic to filter that address information and determine the country clicked.

here's an example of returned address information from a click on Ngazidja, Comoros. There are many more examples - including one in Cape Verde

        "address_components" : [
            {
               "long_name" : "Ngazidja",
               "short_name" : "Ngazidja",
               "types" : [ "establishment", "natural_feature" ]
            },
            {
               "long_name" : "Ngazidja",
               "short_name" : "Ngazidja",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Comoros",
               "short_name" : "KM",
               "types" : [ "country", "political" ]
            }
         ],
silentDjay commented 4 years ago

This has been addressed with these changes: https://github.com/silentDjay/Mapstery/commit/0851383292ad08f6adf0da75b84064aa7f679560

if a click has any country data associated with it, it will check that country data agains the target value.