Query Weather Data from the Weather Stations feature layer provided in order to display weather conditions on the map.
How to Setup (Weather Sample Level)
- Open the RealTimeWeather level.
- Click on the ArcGISMap in the Hierarchy panel.
- Set your API key under the Authentication section in the Inspector Window.
- Click Play and select a city from the list.
How to Setup (Sample Viewer)
- Click Play in Unity Editor.
- Input your API key under the API Key Drop-down.
- Click the Sample Drop-Down and select Weather Query.
How it works
- Create a new C# script and make an HTTP request to query a feature layer.
- Create a new C# script
- Create the function to place the data returned from the Weather Query.
- Create a function to spawn the weather data class according to the data received in the query.
- Attach the ArcGIS Location Component to the weather weather data Game Object.
- Add additional functionality to spawn/show different Unity VFX based on the current weather data returned from the Weather Query.
- Create a UI for the viewport so users can select a city from the list fed from the feature service.
Note: You can use Unity Console
to print log messages in the Console window and see if you are gathering the data properly from the feature service.
About the data
Data for Current Weather in the United States is fetched from a Feature Layer hosted by Esri. Elevation data is loaded from the Terrain 3D elevation layer hosted by Esri. Rain Sound effect Snow Sound Effect Thunder 1 Sound Effect Thunder 2 Sound Effect Thunder 3 Sound Effect
Tags
Feature Layer, Data Collection