OpenSprinkler Forums OpenSprinkler Unified Firmware Couple of questions relating to weather control Reply To: Couple of questions relating to weather control



Okay, good news. I have figured out how to properly get the sublocality shown while still using Google Geocoding so I can avoid Weather Underground station names (which contain UTF-8 errors).

Now the future app updates will show: Spinaceto, Lazio. The logic behind the naming is as follows for anyone interested:

1) Grab the observation coordinates of the weather station (this is given to me from Weather Underground)
2) I use Google Geolocate by providing the same coordinates and getting a list of addresses
3) Sort through the results by selecting the first result with a sub-locality (if available) or locality
4) Dissect the address components looking for the sub-locality (if available) or locality and also identify the administrative_level_1 (in the USA this is the state name for Italy this is the main level and for you it’s Lazio)
5) If no administrative level is given, use the country name
6) Combine the (sub)locality and the top administrative level into a comma separated string

Thanks for the data and hope this provides the solution needed. Expect this in 1.4.2.