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接口
3854 0
|
API
最新!中国天气网api接口调用,key获取方式,数据请求秘钥获取,城市id获取方法
最新!中国天气网api接口调用,key获取方式,数据请求秘钥获取,城市id获取方法
10102 1
最新!中国天气网api接口调用,key获取方式,数据请求秘钥获取,城市id获取方法
|
9月前
|
人工智能 API 网络安全
阿里云计算巢一键部署OpenClaw+LINE集成+大模型千问API配置及避坑手册
OpenClaw(原Clawdbot)作为开源AI代理工具,支持通过LINE等社交平台实现智能交互,阿里云计算巢提供一键部署能力,大幅降低环境配置门槛。本文基于2026年最新版本,详细拆解计算巢部署流程、LINE官方账号创建与Webhook配置、Caddy反向代理实现HTTPS、阿里云千问大模型API对接,同时覆盖本地MacOS/Linux/Windows11部署步骤,所有代码可直接复制执行,助力用户快速搭建LINE端AI助手。
1067 3
|
前端开发 Docker 容器
写作利器,一款极简的Markdown 编辑器
WeChat Markdown Editor 是一款高度简洁的微信 Markdown 编辑器:支持 Markdown 语法、色盘取色、多图上传、一键下载文档、自定义 CSS 样式、一键重置等特性。
1426 70
写作利器,一款极简的Markdown 编辑器
|
存储 Java Go
Go 语言中如何操作二维码?
二维码(QR Code)在支付、登录和信息共享中广泛应用。本文介绍如何用Go语言实现二维码的识别与生成,通过工具库`gozxing`完成识别,支持多种格式和高效解码;同时借助`go-qrcode`生成二维码。文章从工具选择、代码实现到实用案例全面解析,手把手教你掌握二维码处理技术,助力开发更便捷的应用场景。
546 6
Go 语言中如何操作二维码?
|
人工智能 自然语言处理 前端开发
从0开始打造一款APP:前端+搭建本机服务,定制暖冬卫衣先到先得
通义灵码携手科技博主@玺哥超carry 打造全网第一个完整的、面向普通人的自然语言编程教程。完全使用 AI,再配合简单易懂的方法,只要你会打字,就能真正做出一个完整的应用。
12300 29
|
弹性计算 云计算
阿里云认证全新发布【Apsara Clouder云计算专项技能认证:云服务器ECS入门】
阿里云认证全新发布【Apsara Clouder云计算专项技能认证:云服务器ECS入门】
|
运维 安全 Linux
2024 主流的开源服务器面板推荐
随着云计算和虚拟专用服务器(VPS)的普及,服务器面板工具成为了企业和个人管理服务器的得力助手。一个优秀的服务器面板不仅可以简化服务器管理任务,还可以提升工作效率和安全性。本文将为您介绍并测评几款2024年全网热门的服务器面板,包括Websoft9、宝塔、cPanel、1Panel等,帮助您找到最适合自己的管理工具。
2024 主流的开源服务器面板推荐
|
Arthas 监控 数据可视化
jvm性能调优实战 - 61常用的JVM调优网站
jvm性能调优实战 - 61常用的JVM调优网站
1102 0