helgeerbe / picframe

Picture frame viewer for raspi, controlled via mqtt and automatticly integrated as mqtt device in homeassistant.
MIT License
113 stars 32 forks source link

What is the role of the key_list in geolocation? #420

Open sapnho opened 2 hours ago

sapnho commented 2 hours ago

I never really looked a at the geolocation settings at a deeper level before but I wonder what

  key_list: [
    ["tourism","amenity","isolated_dwelling"],
    ["suburb","village"],
    ["city","county"],
    ["region","state","province"],
    ["country"]]

this does?

jgodfrey commented 1 hour ago

It's a prioritized list of keys that are searched for a match as different keys may be used for location info in different countries. So, in the above example, it'll search for a match with tourism. If it finds a match, it moves to the next list and starts again. If it fails to find a tourism match, it'll advance to the next key in the same list (amenity) and try again. The final location string will consist of (at most) a single element from each list. By fine-tuning the keys you have some control over the location elements that are returned for an image...

Ah, I see that Paddy commented on this here.

sapnho commented 1 hour ago

Ah, thanks much, ghosts from the past, I didn't remember that thread anymore, thanks for pointing it out, @jgodfrey!

Finetuning sounds tricky because of the different address formats that countries have. In England, many houses have their own names, and then there are many subdivisions of the town, district, county, and whatever. Other countries probably have their peculiarities.

jgodfrey commented 58 minutes ago

Agreed - the normalization of international location information is a messy business...