There is a similar question that was asked in the OpenWeatherMap support center. Here is the link OpenWeatherMap
Also, here is a link to the list of cities and their respective ID's (just CTRL + F to find the city you want): List of Cities & IDs
Answer from freddiev4 on Stack OverflowThere is a similar question that was asked in the OpenWeatherMap support center. Here is the link OpenWeatherMap
Also, here is a link to the list of cities and their respective ID's (just CTRL + F to find the city you want): List of Cities & IDs
Answer from freddiev4 on Stack OverflowThere is a similar question that was asked in the OpenWeatherMap support center. Here is the link OpenWeatherMap
Also, here is a link to the list of cities and their respective ID's (just CTRL + F to find the city you want): List of Cities & IDs
A full list of CityID's can be downloaded from: http://bulk.openweathermap.org/sample/city.list.json.gz
You can manually search that file (after unzipping it) for your city name or search from the shell like:
grep -i "london" city.list.json
Regarding the "q" vs. "id" query tags: you can search by city (and country) using the "q" tag like this:
http://api.openweathermap.org/data/2.5/forecast/daily?q=London,GB
(note that the country code isn't necessarily required)
and that works as long as there is no question about which city. If there's multiple cities of the same name in a country, though, you can use the CityID to specify a certain one after you've found the correct identifier in the list linked above like this:
http://api.openweathermap.org/data/2.5/forecast/daily?id=2643743
which also returns London's weather, but ensures you don't accidentally get the weather for London, Kentucky, USA or London, Ohio, USA if you've chosen not to use the country code in the "q" tag.
Perhaps the OpenWeather Geocoding API was not available in 2021 but it is now. You can use this API to search for cities around the world from their weather database.
https://openweathermap.org/api/geocoding-api
If you query only the city name (without state and/or country) it returns a list of matches. For example if you search for "Dublin" and limit to 5 results, it returns Dublin, Ireland and 4 cities named Dublin in the USA. Then the user can select from a list to confirm the correct city.
http://api.openweathermap.org/geo/1.0/direct?q={city name},{state code},{country code}&limit={limit}&appid={API key}
This seems to be their recommended way to get the latitude and longitude of a city by name to then query the its forecast.
Hey in order to get that list , You have to programmatically create a tableview which will be the half of height of that main view(set it initially to be hidden) and it should be visible when someone interacts with the searchBar or TextField (you'll need to make it visible in one of the delegate methods of tableview or searchBar , whatever you are using) and render the city names in that tableview , that's it , it will be easy if you know a bit of Programmatic UI if not watch some YouTube videos by Sean Allen on programmatic UI and you should be good to Go !! Best of luck