According to the article What are the most common city names in the world?, there are 1,716 locations with the name San Jose. How do I select the right one for the Weather app? It’s not clear what the format should be for homing in on a location.
I’m personally not using the app. Based on the API description of OpenWeatherMapAPI the following options are available:
- Call current weather data for one location
- By city name
- By city ID
- By geographic coordinates
- By ZIP code
Based on that I would recommend to visit the Open Weather Map website, search for your site by entering more detailed information, like “San Jose Mexico”, identify the right data, take the geo cordinates and use it to configure the map.
Thanks for replying @j-ed, but I really don’t think the app is currently that clever
Pretty much the only option the app offers is City Name and even then the format
city name, state, country code is only valid for USA locatons. For the rest of the world, it is
city name, country code
For a country like Australia, which is about the same size as continental USA, it’s not possible with the Weather app in its current form to differentiate between two cities with the same name (Bayswater, in my case), which are 1700 miles (2700 km) apart, as the crow flies, east to west.
There is already a feature request in that direction: https://github.com/nextcloud/weather/issues/2
You can try to patch the source code of the app and check if you get a valid result displayed until the function is being added to the app by default. It seems that the relevant url is being built in the following file:
As you can see it is only querying for a city name, etc. combination. Once you’ve identified the geo coordinates for your location, you can try to modify the code accordingly (replace “” and “” by the correct data):
Yes, the app needs some better handling of city names, the best way is to use geo coordinates or the city identifier to do that.
For now, if you are unsure which is the right city, you can go to www.openweathermap.org (where the Weather app gets its data from) and search for the city you want to add. There are only 5 or so different locations named “San Jose” or “San Antonio” (mostly in different countries) that you can add using the country code. For your town Bayswater, there is only one result in the UK and one in Australia. Maybe you could try to add a city that is next to your town?
… or you use the city id to identify your location:
City ID: 2176566
City ID: 2063523
Identifying the right city should be easy based on the current weather conditions
@j-ed Strange, the search only finds these two:
Have you tried “Bayswater, Australia”?! I first used Google Maps to lookup the different Baywater in Australia and played around with different search strings until I found the mentioned ones.
Yes, even then I only get one result:
But your second city id only refers to Perth,Australia if you search for it in this JSON file: http://bulk.openweathermap.org/sample/city.list.json.gz
if you enter Bayswater, Western Australia, Australia, for some inexplicable reason you get a list of all the first five Bayswater cities worldwide.
Like the app, I’m not that clever, but don’t tell anyone.
Yes, this is the next best thing. However, for a variety of reasons, I’m going to deinstall the Weather app. It feels like an app that’s in an early stage of development. There are more mature and visually interesting weather apps available outside the Nextcloud environment.
That seems like a bug in the Openweathermap API/search, not much the Nextcloud app can do about until they fix up their search.
Which ones did you think about? if you have some ideas on how to improve the app visually, please file an issue on the Github issue tracker:
Thanks @alfred. I was about to add something, but then realised they are all already listed as enhancements. There’s clearly a lot of interest in the Weather app. Address those and Nextcloud will have a weather app as good as anything available elsewhere.