问题标签 [openweathermap]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2125 浏览

javascript - OpenWeatherMap - 地图只显示莫斯科

我正在尝试获取某些城市的天气信息(城市正在动态出现),我遇到了这个非常容易集成的地图 api。但是一旦我尝试过,即使我给出了另一个城市的纬度和经度,它也只显示莫斯科,比如慕尼黑。

这是代码:

我只想为我的服务器节省一些加载能量,并在前端使用 js 解决这个天气问题。如果这可行,那就太好了,如果可以,请提供帮助。即使给出不同的纬度和经度,我为什么还要在这里坚持莫斯科。这是 api 的链接:http: //openweathermap.org/tutorial/openlayers

0 投票
2 回答
1703 浏览

php - 将 XML 数据解析为 PHP 变量

从 openweathermap 获取天气数据失败。这是我的代码:

当我回声时,我什么也得不到。帮助表示赞赏!

0 投票
1 回答
1029 浏览

jquery - Openweathermaps解析json jquery预测

我想显示天气预报。到目前为止,我只设法展示了一天。

HTML & Jquery 代码: http: //pastebin.com/cpZ0pE7G

json 以这种格式显示。

我只能解析第一行。我如何解析其他行?

0 投票
2 回答
1319 浏览

ruby-on-rails - rails解析来自openweathermap的xml数据

我尝试从 XML 文件中读取 openweathermap 数据

XML 代码:

我用这个代码来阅读这个

当我读取数据一天但当我尝试读取此数据时,它的工作原理

它读了三遍数据

如何使用 nokogiri 从 3 个不同的日子读取单独的数据?

0 投票
3 回答
14171 浏览

api - OpenWeatherMap API 2.5 中的降水场

我正在使用Open Weather Map API进行天气预报。当前可用的版本是 2.5 这是一段 XML

这是API 请求

有谁知道田间降水的单位?

2.5毫米的雨?也许是概率?

提前致谢。

0 投票
1 回答
3236 浏览

javascript - 使用openweathermap api进行时间预报

我正在使用 openweathermap api 使用提供的 api 将预报打印到屏幕上。

我想要做的是获取未来或过去给定时间的预测,我可以在 api 调用的结果中看到这些信息。我不确定如何获得这些信息?它看起来是 unix 时间戳和人类可读格式,但我可以看到如何在 api 中打印出给定时间的预测?

谢谢

0 投票
6 回答
52270 浏览

javascript - How do I calculate the temperature in celsius returned in openweathermap.org JSON?

I'm getting the weather for a city using openweathermap.org.

The jsonp call is working and everything is fine but the resulting object contains the temperature in an unknown unit:

Here is a demo that console.log's the full object.

I don't think the resulting temperature is in fahrenheit because converting 290.38 fahrenheit to celsius is 143.544.

Does anyone know what temperature unit openweathermap is returning?

0 投票
1 回答
1282 浏览

ios - Openweathermap API:如何获取多个城市过去 30 天的历史记录?

我正在使用openweathermap API 来获取过去 30 天的历史记录。通过使用“ http://api.openweathermap.org/data/2.5/history/city?q=London&APPID=9a1782c0d83dde6f33f8d9977khgjdskhe82ef&type=day&cnt=30这个API调用,我可以一次成功地获取一个城市的天气历史。

但是我想获取多个城市的天气历史,例如伦敦和纽约,然后我如何调用这个 API。我不想通过更改城市名称来调用相同的 API 两次。请给我一个方便的方法。

0 投票
1 回答
991 浏览

javascript - 使用 openweathermap 显示天气数据

我使用 openweathermap 为我的网站构建了一个天气小部件。JS & html 是
--JS-->

HTML -->/*

//

如果没有任何“选择”选项,它可以在“达卡”城市正常工作。我想使用选择选项更改城市名称并显示更改的天气数据。如何使用 jquery.change() 。请帮帮我。

0 投票
0 回答
495 浏览

android - 使用 Aysnctask,android 时出现 nullPointerException

我正在编写一个 android 应用程序来使用 latitude 获取当前天气,longitude 使用 openWeatherMap API。我使用 Aysnctask 来获取天气,但是应用程序崩溃并且它给了我一个 nullPointerException。

这里是aysnctask:

doInBackground 方法的参数应该是当前的纬度,经度。我这样称呼aysnktask:

我像这样连接到 openWeatherMap:

nullPointerException 在这一行:

这是logCat:

这是 getWeather 方法: