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

Unclaimed Territory Logic is Broken #30

Closed silentDjay closed 5 years ago

silentDjay commented 5 years ago

Previously, the geolocation data that Google Maps delivered would return a consistent data payload for a click that didn't return country data. Now, the logic returns information about some bodies of water (and possibly other features). I've seen click data returned for the following geographic features:

There are bound to be others. It appears that the "types" : [ "establishment", "natural_feature" ] feature is new. I should leverage that to fix the functionality for a non-counting click.

Here is an example of the payload for a click on the Mediterranean Sea:

/**/_xdc_._1qu7rv && _xdc_._1qu7rv( {
   "plus_code" : {
      "global_code" : "8F8X9488+4R"
   },
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Mediterranean Sea",
               "short_name" : "Mediterranean Sea",
               "types" : [ "establishment", "natural_feature" ]
            }
         ],
         "formatted_address" : "Mediterranean Sea",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 45.7600288,
                  "lng" : 36.1979765
               },
               "southwest" : {
                  "lat" : 30.26984689999999,
                  "lng" : -6.004411999999999
               }
            },
            "location" : {
               "lat" : 34.5531284,
               "lng" : 18.0480105
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 45.7600288,
                  "lng" : 36.1979765
               },
               "southwest" : {
                  "lat" : 30.26984689999999,
                  "lng" : -6.004411999999999
               }
            }
         },
         "place_id" : "ChIJnzxHHLghFBMRQPjM_opZky4",
         "types" : [ "establishment", "natural_feature" ]
      }
   ],
   "status" : "OK"
}
 )

This requires a fix.

silentDjay commented 5 years ago

This was addressed with this update: https://github.com/silentDjay/Mapstery/commit/448d905c0dc168be81427bdb7b3c262141d27210

If the recognized (by reverse geolocation) geographic feature that is clicked (it's always a body of water, as far as I can tell), the user will be told what they clicked on and the click will not be counted towards their total. Clicks with unrecognized data will continue to be described as such.