final String FORECAST_BASE_URL =
"http://api.openweathermap.org/data/2.5/forecast/daily?";
final String QUERY_PARAM = "q";
你好。 我正在制作天气预报应用程序。但是当我使用“http://openweathermap.org”的 API 时, 我的存货有问题 我怎样才能得到城市代码或 ID“q”? 我试图找到城市 ID,但找不到。
示例代码按城市 ID 调用:
api.openweathermap.org/data/2.5/forecast/daily?id=524901
而且我听说“q”也用于“id”。 我是说
api.openweathermap.org/data/2.5/forecast/daily?q=524901
也是可以的。我想这样做。
那么,如何找到城市id? 有人知道吗?
最佳答案
OpenWeatherMap 支持中心也提出了类似的问题。这是链接 OpenWeatherMap
此外,这里是城市列表及其各自 ID 的链接(只需按 CTRL + F 即可找到您想要的城市):List of Cities & IDs
关于android - 如何查找天气预报城市ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27883777/