gpt4 book ai didi

android - 如何查找天气预报城市ID?

转载 作者:太空宇宙 更新时间:2023-11-03 13:20:55 25 4
gpt4 key购买 nike

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com