2Abendsegler / GClh

GC little helper II - Some little things to make life easy (on www.geocaching.com). Powerful, configurable tool to improve and expand the geocaching pages.
GNU General Public License v2.0
58 stars 38 forks source link

[Cache Listing] Add county (Landkreis) to cache information #2419

Open capoaira opened 11 months ago

capoaira commented 11 months ago

Is your feature request related to a problem? Please describe

Ich frage mich, ob es irgendwie möglich wäre, neben dem Land und der Region auch den Landkreis bzw. das County zu ermitteln und anzuzeigen? Ich weiß, dass die County-Informationen nicht direkt in den Geocaching-Daten verfügbar sind, aber wäre eine Ermittlung anhand der Koordinaten und beispielsweise den in OSM verwendeten Grenzen irgendwie machbar oder ist das zu komplex oder sogar utopisch?

From https://forums.geocaching.com/GC/index.php?/topic/343005-gc-little-helper-ii/&do=findComment&comment=6104073

There are many cachers how want to find a cache in every county. I think that is the intention for that request.

Describe the solution you'd like

Adding the information to the cache information to the state and country information.

Additional context

We can use the OSM API https://nominatim.openstreetmap.org/reverse?lat=<lat>&lon=<lon>&format=json For Example: GC8NA1H - https://nominatim.openstreetmap.org/reverse?lat=53.16217&lon=8.78133&format=json

{
   "place_id":156365213,
   "licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright",
   "osm_type":"way",
   "osm_id":66239382,
   "lat":"53.1618775",
   "lon":"8.781425113496578",
   "class":"building",
   "type":"yes",
   "place_rank":30,
   "importance":9.99999999995449e-06,
   "addresstype":"building",
   "name":"",
   "display_name":"31, Niederblockland, Blockland, Bremen-West, Bremen, 28357, Deutschland",
   "address":{
      "house_number":"31",
      "road":"Niederblockland",
      "hamlet":"Niederblockland",
      "suburb":"Blockland",
      "city_district":"Bremen-West",
      "city":"Bremen",
      "state":"Bremen",
      "ISO3166-2-lvl4":"DE-HB",
      "postcode":"28357",
      "country":"Deutschland",
      "country_code":"de"
   },
   "boundingbox":[
      "53.1616802",
      "53.1620029",
      "8.7810100",
      "8.7816326"
   ]
}

Or GCA4YT5 https://nominatim.openstreetmap.org/reverse?lat=53.16152&lon=8.79993&format=json

{
   "place_id":156415014,
   "licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright",
   "osm_type":"way",
   "osm_id":32781662,
   "lat":"53.16146762808175",
   "lon":"8.79992710925762",
   "class":"highway",
   "type":"unclassified",
   "place_rank":26,
   "importance":0.10000999999999993,
   "addresstype":"road",
   "name":"Höftdeich",
   "display_name":"Höftdeich, Lilienthal, Landkreis Osterholz, Niedersachsen, 28865, Deutschland",
   "address":{
      "road":"Höftdeich",
      "hamlet":"Höftdeich",
      "town":"Lilienthal",
      "county":"Landkreis Osterholz",
      "state":"Niedersachsen",
      "ISO3166-2-lvl4":"DE-NI",
      "postcode":"28865",
      "country":"Deutschland",
      "country_code":"de"
   },
   "boundingbox":[
      "53.1614669",
      "53.1648217",
      "8.7984862",
      "8.8151507"
   ]
}

As you see, if there is no county, we need a fallback to city. We might show the display_name as title, so that everything is displayed on hover

capoaira commented 10 months ago

I couldn't find a geocoding service which is 100% free, except Nominatim. But Nominatim has inconsistent data and return on different locations in the same county similar, but different names. (e.g. in Bremen, it returns "Bremen" or "Stadtgebiet Bremen")