OpenWeatherMap API提供的结果不准确

时间:2018-08-13 13:43:48

标签: openweathermap

我正在尝试像这样查询api:

http://api.openweathermap.org/data/2.5/weather?q=kuwait&APPID=[key]&units=metric&type=like

但是,它给了我与国家“ PE”相关的结果。.我下载了站点上引用的国家代码json文件,并在所有城市中搜索了单词:科威特,只有1个城市是:“科威特市”和一个国家,即“科威特”。为什么在搜索“科威特”时API会返回国家“ PE”?

我还使用了&type = like,所以我可能会获得正确的数据,但是不起作用。

1 个答案:

答案 0 :(得分:0)

搜索时,请尝试搜索“科威特国”,它对我有用。

对于链接,将“ q =“更改为“ id = 285570”

“ id”:285570,

“名称”:“科威特国”,

“国家”:“ KW”,

“坐标”:{

“ lon”:47.75,

“纬度”:29.5

http://api.openweathermap.org/data/2.5/forecast?id=285570&APPID=[Key]&units=metric&type=like

http://api.openweathermap.org/data/2.5/weather?id=285570&APPID=[Key]&units=metric&type=like