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

标签 android weather forecasting

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/

相关文章:

引入天气形状的 Excel VBA - 尝试在重新运行之前删除形状

neural-network - 如何理解 Keras 1D Convolution 输入形状和过滤器

r - 如何在 R 中以原始单位绘制转换后的时间序列 ETS 预测?

java - 多次使用ListView

android - 对话框背景填充的默认颜色是什么?

android - 如何从雅虎的天气API解析日期到Java Date

在 R 中构建更新数据集后重用 ts 模型(预测包)

android - 绘制图形多平台(IOS、WindowsPhone、Android)库

android - YouTube播放器观看缓冲的视频丢失

ios - 只需 iOS 即可获取自定义位置的 7 天预测日期