SecUSo / privacy-friendly-weather

Privacy Friendly App for Android that can display weather for cities.
GNU General Public License v3.0
114 stars 29 forks source link

Improve location add function #145

Open Tyler-2 opened 3 years ago

Tyler-2 commented 3 years ago

In the U.S.A, most people, when prompted to enter their location, will provide their ZIP / postal code. Weather doesn't appear to support that, as entering a zip code doesn't produce anything in the dropdowns. As a fallback, I decided to enter my city... But the dropdown list provides 5 or 6 matches for my city, none specific enough. For instance: "Buena Vista, US", with lat/longs for each, because there are many states in the US with a city called Buena Vista. Most folks don't know their lat/long. It would be more typical here to say "Buena Vista, TX, US".

It would be best to get zip codes working. But at a minimum, the state that a city is in should be shown.

sleep-yearning commented 3 years ago

Thanks for your comment @Tyler-2, unfortunately we had to ditch the ZIP codes, as the newer OWM database doesn't contain them anymore. The map view should help with choosing the specific entry, not? It would be possible to add a town to ZIP code library, is the map view not enough though?

Tyler-2 commented 3 years ago

I didn't find the map view particularly useful. Search, for instance, for Fairfax. It seems like I'd have to click each Fairfax, see where it is on the small map, and then go back up, backspace away the autocomplete until the list comes up again, try again, repeat...

It sounds like OWM doesn't even support States...

Search engine is very flexible. How it works:

To make it more precise put the city's name, comma, 2-letter country code (ISO3166). You will get all proper cities in chosen country.
The order is important - the first is city name then comma then country. Example - London, GB or New York, US.

No mention of states. That's.... really rough for US users. We have a lot of city names that are common in a lot of states.

The only thing I can think of if OWM can't return this data is passing the geo coords for U.S. cities into an OSM function that returns the state.

sleep-yearning commented 3 years ago

Would a display of multiple results on the map solve this? So you could view all of the remaining cities in the list on the map at the same time.

Tyler-2 commented 3 years ago

Yeah, that would help.

woheller69 commented 3 years ago

what about using a free geocoder API like this https://photon.komoot.io/ ?

woheller69 commented 3 years ago

I played around a little with this API, maybe I am going to use it in future in RadarWeather even though it will be quite some work to adapt the app to completely work without a city ID...

If you want to play with the search tool you can try this little app: https://github.com/woheller69/AutoSuggestTextViewAPICall

woheller69 commented 3 years ago

I implemented it in V3.0 of RadarWeather. Works great. Once activated in settings you can find any place in the world that is in OpenStreetMap - also via ZIP code

sleep-yearning commented 3 years ago

Another approach could (optionally) filter the results for geographic closeness to current location (if the location feature would get implemented).

woheller69 commented 3 years ago

The photon API would also allow such filtering but I don't think it is necessary. It works very fast with few clicks