当前位置:网站首页>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);
}
}
边栏推荐
- 【MATLAB】MATLAB 仿真模拟调制系统 — DSB 系统
- [matlab] matlab simulates digital baseband transmission system eye diagram of bipolar baseband signal (class I part response waveform)
- Simple g++ and GDB debugging
- [matlab] matlab simulation of modulation system - power spectrum and coherent demodulation of AM modulated signal
- 附件一:202x年xxx攻防演习授权委托书
- The first introduction, stages and methods of defense system breakthrough from the perspective of the red team
- The paddlehub face recognition scheme is deployed, and the trained model is deployed and applied in pytchrom
- Zhongke Panyun - data analysis and forensics packet flag
- appliedzkp的zkevm(12)State Proof
- 中科磐云—2022广东木马信息获取解析
猜你喜欢
qt下开发mqtt的访问程序
Zhongke panyun-2022 Guangdong Trojan horse information acquisition and analysis
Use units of measure in your code for a better life
海力士EMMC5.0及5.1系列对比详解
Deep understanding of redis -- bloomfilter
Download kicad on Alibaba cloud image station
中科磐云—D模块解析以及评分标准
How to build your own knowledge engine? Community open application
Capturing and sorting out external Fiddler -- Conversation bar and filter
Fault analysis | mongodb 5.0 reports an error, and the legal instruction solves it
随机推荐
MAUI 入门教程系列(5.XAML及页面介绍)
Useful plug-ins for vscode
Simple g++ and GDB debugging
Zhengzhou zhengqingyuan Culture Communication Co., Ltd.: seven marketing skills for small enterprises
附件2-2保密承诺书.docx
Detailed comparison of Hynix emmc5.0 and 5.1 series
C basic (VII) document operation
附件六:防守工作簡報.docx
NTFS 安全权限
EVM proof in appliedzkp zkevm (11)
20000 words will take you to master multithreading
National vocational college skills competition (secondary vocational group) network security competition questions - Analysis
Can closed data be deleted by DBCA? can
YoloV6实战:手把手教你使用Yolov6进行物体检测(附数据集)
Create ASM disk through DD
[matlab] matlab simulation modulation system SSB system
Zkevm (12) state proof of appliedzkp
Capturing and sorting out external Fiddler -- Conversation bar and filter
RPC - gRPC简单的demo - 学习/实践
Operate the server remotely more gracefully: the practice of paramiko Library