openweathermap-免费的天气预报接口

简介:

openweathermap-免费的天气预报接口

其官方网址为:http://www.openweathermap.org/api

静态截图:

具备以下的一些特点:

1. Current weather data   当前天气的数据

2. 5 and 16 day forecast   5到16天的天气预报

3. Historical data              以往的天气信息

4. Weather stations          气象站点

5. Weather map layers      详细的气象信息

以下是本人的测试结果(根据经纬度直接获取天气预报的信息的接口示例,返回的数据为JSON):

// http://www.openweathermap.org/api
    // http://www.openweathermap.org/current
    // http://www.openweathermap.org/forecast
    // http://www.openweathermap.org/weather-conditions
    NETWorkRequest *request = [[NETWorkRequest alloc] initWithUrlString:@"http://api.openweathermap.org/data/2.5/forecast/daily?lat=39.88293652833437&lon=116.4621119300779&lang=zh_cn"];
    
    NETWorkConnection *connection = [[NETWorkConnection alloc] initWithRequest:request];
    [connection infoBlock:^(NSDictionary *info, NETWorkConnection *myConnection) {
    } progressBlock:^(long long currentBytes, long long totalBytes, NETWorkConnection *myConnection) {
    } resultBlock:^(NSDictionary *info, NSData *data, NSError *error, NETWorkConnection *myConnection) {
        NSLog(@"%@", [data toPropertyList]);
    }];
    [connection start];

打印信息如下:

{

    city =     {

        coord =         {

            lat = "39.905281";

            lon = "116.599442";

        };

        country = CN;

        id = 1792520;

        name = Tongzhou;

        population = 0;

    };

    cnt = 7;

    cod = 200;

    list =     (

                {

            clouds = 48;

            deg = 254;

            dt = 1413860400;

            humidity = 49;

            pressure = "1018.75";

            speed = "2.06";

            temp =             {

                day = "290.15";

                eve = "289.23";

                max = "291.57";

                min = "279.75";

                morn = "285.15";

                night = "279.75";

            };

            weather =             (

                                {

                    description = "\U591a\U4e91";

                    icon = 03d;

                    id = 802;

                    main = Clouds;

                }

            );

        },

                {

            clouds = 44;

            deg = 184;

            dt = 1413946800;

            humidity = 56;

            pressure = "1016.36";

            speed = "1.71";

            temp =             {

                day = "287.61";

                eve = "287.9";

                max = "289.8";

                min = "277.35";

                morn = "277.35";

                night = "279.92";

            };

            weather =             (

                                {

                    description = "\U591a\U4e91";

                    icon = 03d;

                    id = 802;

                    main = Clouds;

                }

            );

        },

                {

            clouds = 0;

            deg = 214;

            dt = 1414033200;

            humidity = 0;

            pressure = "1003.24";

            speed = "1.89";

            temp =             {

                day = "291.47";

                eve = "281.35";

                max = "291.47";

                min = "277.05";

                morn = "278.44";

                night = "277.05";

            };

            weather =             (

                                {

                    description = "\U6674";

                    icon = 01d;

                    id = 800;

                    main = Clear;

                }

            );

        },

                {

            clouds = 0;

            deg = 162;

            dt = 1414119600;

            humidity = 0;

            pressure = "1002.31";

            speed = "1.98";

            temp =             {

                day = "293.07";

                eve = "284.09";

                max = "293.07";

                min = "279.56";

                morn = "280.17";

                night = "279.56";

            };

            weather =             (

                                {

                    description = "\U6674";

                    icon = 01d;

                    id = 800;

                    main = Clear;

                }

            );

        },

                {

            clouds = 1;

            deg = 84;

            dt = 1414206000;

            humidity = 0;

            pressure = "1009.16";

            speed = "6.79";

            temp =             {

                day = "292.6";

                eve = "285.1";

                max = "292.6";

                min = "279.54";

                morn = "282.6";

                night = "279.54";

            };

            weather =             (

                                {

                    description = "\U5c0f\U96e8";

                    icon = 10d;

                    id = 500;

                    main = Rain;

                }

            );

        },

                {

            clouds = 15;

            deg = 212;

            dt = 1414292400;

            humidity = 0;

            pressure = "1011.96";

            speed = "2.17";

            temp =             {

                day = "290.18";

                eve = "282.25";

                max = "290.18";

                min = "279.5";

                morn = "279.93";

                night = "279.5";

            };

            weather =             (

                                {

                    description = "\U6674";

                    icon = 01d;

                    id = 800;

                    main = Clear;

                }

            );

        },

                {

            clouds = 24;

            deg = 151;

            dt = 1414378800;

            humidity = 0;

            pressure = "1006.46";

            speed = "1.88";

            temp =             {

                day = "290.33";

                eve = "282.58";

                max = "290.33";

                min = "279.86";

                morn = "282.81";

                night = "279.86";

            };

            weather =             (

                                {

                    description = "\U6674";

                    icon = 01d;

                    id = 800;

                    main = Clear;

                }

            );

        }

    );

    message = "0.3612";

}

其他的就自己去看官方api了,不过是英文的。

目录
相关文章
|
JSON JavaScript 前端开发
免费实时天气预报api接口
免费实时天气预报api接口
1698 0
|
API
最新!中国天气网api接口调用,key获取方式,数据请求秘钥获取,城市id获取方法
最新!中国天气网api接口调用,key获取方式,数据请求秘钥获取,城市id获取方法
6940 1
最新!中国天气网api接口调用,key获取方式,数据请求秘钥获取,城市id获取方法
|
XML API 数据格式
天气预报API接口
原文:天气预报API接口 一、中央气象台API接口: 1.
19154 0
|
3月前
|
自然语言处理 语音技术 开发工具
IndexTTS2.0_ 情感表达与时长可控的自回归零样本语音合成突破
IndexTTS2 是首个实现自回归模型下**时长可控**、**情感与音色解耦**的零样本语音合成系统。支持语音克隆、情感迁移与文本驱动情绪控制,适用于影视配音、虚拟主播等场景。开源代码与模型已发布,提供完整本地部署方案,大幅提升语音合成的实用性与表现力。
1252 5
|
5月前
|
JSON API PHP
天气预报免费API接口【地址查询版】使用教程
本文介绍了如何使用中国气象局官方数据提供的免费天气预报API接口,通过省份和地点查询指定地区当日天气信息。该接口由接口盒子支持,提供JSON格式数据、GET/POST请求方式,并需注册获取用户ID和KEY进行身份验证。
2825 2
|
8月前
|
人工智能 开发框架 运维
Serverless MCP 运行时业界首发,函数计算让 AI 应用最后一公里提速
Serverless MCP 运行时业界首发,函数计算支持阿里云百炼 MCP 服务!阿里云百炼发布业界首个全生命周期 MCP 服务,无需用户管理资源、开发部署、工程运维等工作,5 分钟即可快速搭建一个连接 MCP 服务的 Agent(智能体)。作为云上托管 MCP 服务的最佳运行时,函数计算 FC 为阿里云百炼 MCP 提供弹性调用能力。
 Serverless MCP 运行时业界首发,函数计算让 AI 应用最后一公里提速
|
JavaScript API
【Vue 3】推荐 1 个简约且美丽的天气组件
【Vue 3】推荐 1 个简约且美丽的天气组件
|
JSON 监控 API
2024年7月免费天气API接口推荐
天气API对于开发人员来说是构建响应更快、安全性更高的应用程序的有力工具。使用天气API可以帮助开发者提供出色的用户体验,实现高效的数据管理。
1260 0
|
Unix API Apache
一站式解决 python打包代码,发布到pypi
本文是一份全面的Python项目打包并发布到PyPI的教程,涵盖了从PyPI账户注册、配置双因素认证、生成API Token,到准备代码、编写setup.py、选择LICENSE、构建包、上传包至PyPI,以及上传后的测试和库更新的详细步骤。
|
JavaScript 前端开发 C++
jupyter lab最强代码提示插件来了
jupyter lab最强代码提示插件来了
1211 0