当前位置:网站首页>Unity is connected to the weather system
Unity is connected to the weather system
2022-07-04 05:01:00 【Jiubencai】

I used the weather forecast interface of Gaode open platform to access Unity in .
Gaud open platform | Gould map API Gaode open platform official website https://lbs.amap.com/ After registering Gaode open platform , After moving the mouse to the avatar in the upper right corner, you will find application management , Click on Application Management , Then click create new application .

Click Add ,Web The service can use the weather API.

After the creation, you can see the corresponding Key

Then we can easily get the weather data by looking at the development documents .
Weather query API Service address :
URL | https://restapi.amap.com/v3/weather/weatherInfo?parameters |
Request mode | GET |
parameters The parameters represented include mandatory parameters and optional parameters . All parameters use the and character (&) separation . The following list enumerates these parameters and their usage rules .
- Request parameters
Parameter name | meaning | Rule description | Whether must | The default value | |
|---|---|---|---|---|---|
key | Request service permission id | The user is on the official website of Gaode map apply web service API type KEY | Required | nothing | |
city | City Code | Enter the name of the city adcode,adcode Information is available for reference City code table | Required | nothing | |
extensions | Weather type | Optional value :base/all base: Return to the real weather all: Return to the weather forecast | Optional | nothing | |
output | Returns the format | Optional value :JSON,XML | Optional | JSON | |
Here is the data I got .


Note that real-time weather and weather forecast are two interfaces .
Code example , This code can get the weather json data , adopt json The obtained data can be displayed in UI Yes .
IEnumerator GetBase()
{
UnityWebRequest webRequest = UnityWebRequest.Get(urlBase);
yield return webRequest.SendWebRequest();
if (webRequest.isHttpError || webRequest.isNetworkError)
Debug.Log(webRequest.error);
else
{
// Debug.Log(webRequest.downloadHandler.text);
}
}
边栏推荐
- Zhongke Panyun - data analysis and forensics packet flag
- 【MATLAB】MATLAB 仿真数字基带传输系统 — 双极性基带信号(第 I 类部分响应波形)的眼图
- 附件五:攻击过程简报.docx
- 【Go】数据库框架gorm
- 《Cross-view Transformers for real-time Map-view Semantic Segmentation》论文笔记
- Test cs4344 stereo DA converter
- 6-4 vulnerability exploitation SSH banner information acquisition
- Trie数-字典树
- 【无标题】
- Zhongke Panyun - 2022 Guangxi reverse analysis ideas
猜你喜欢

技术管理 - 学习/实践

Headache delayed double deletion

中科磐云—模块A 基础设施设置与安全加固 评分标准

KMP匹配字符串

National vocational college skills competition (secondary vocational group) network security competition questions - Analysis

Deep understanding of redis -- bloomfilter

Capturing and sorting out external Fiddler -- Conversation bar and filter

Create ASM disk through DD

Unity中RampTex介绍和应用: 溶解特效优化

6-5 vulnerability exploitation SSH weak password cracking and utilization
随机推荐
分享一些我的远程办公经验
TCP状态转换图
Fault analysis | mongodb 5.0 reports an error, and the legal instruction solves it
appliedzkp zkevm(11)中的EVM Proof
2022年6月总结
练习-冒泡排序
关于solidworks standard无法获得许可 8544问题的总结
【QT】定时器
DCDC电源电流定义
【MATLAB】通信信号调制通用函数 — 带通滤波器
红队视角下的防御体系突破之第一篇介绍、阶段、方法
模拟小根堆
简单g++和gdb调试
Annex V: briefing on the attack process docx
Exercise bubble sort
Detailed comparison of Hynix emmc5.0 and 5.1 series
Zhongke Panyun - 2022 Guangxi reverse analysis ideas
【MATLAB】MATLAB 仿真 — 低通高斯白噪声
Sécurité du réseau dans les écoles professionnelles secondaires - preuve de mémoire
Zhongke panyun-2022 Guangdong Trojan horse information acquisition and analysis