GIS Technology is truly incredible, with features that significantly improve our lives being taken for granted on a regular basis. Sometimes we need to realize that a good idea can become a great idea, and without much additional work. Such is the case for the many emerging outdoor apps that developers are creating for countless new use cases. From gaming, to adventure tourism, to enhanced hiking and exploration, outdoor apps show the marriage of high technology with our desire to step outside and enjoy the larger world around us. For most of these apps, there is some element of geospatial data involved in order to understand where the user is, or help them identify and explore places they’d like to go.
For normal apps, the environment is fairly self contained, but when the activity moves outside, everything becomes much more dependent on the weather. This can be at best frustrating when the weather surprises you as you go out to make use of an outdoors app, and can at worst be dangerous when you are caught unprepared in a situation that could cause harm.
Fortunately, for any developer working on an outdoor app, technology has advanced to the point that creating a real time weather app within your own outdoor app is incredibly easy, and can significantly increase the overall value of the app as it aids the user in an incredibly custom way, showing them their hyperlocal weather report and forecast to help them make the best decisions possible when using your outdoor app. By taking the geospatial data from the outdoor app, along with any additional needed prompts, you can deliver a feature for your app that seamlessly integrates with the user experience, and makes the user feel catered to with customized insights as they enjoy your app.
Table of Contents:
Creating A Weather API Request for Incorporation Into Geospatial-Based Apps
This tutorial will walk through the various steps to set up a basic API to weather insights/forecasts. We will use Tomorrow.io’s weather API because of its simplicity and customizable options so that you can fine tune exactly what your outdoor app needs.
In order to set up this API-driven weather app (full tutorial and code here), you need to configure the initialization lines shown here (1-3) that create a Node fetch-request. The remaining steps will help to customize and configure this request. While a single use case is shown in this example, if you are going to utilize a weather app with your geospatial driven app, you will need to use the geospatial data to determine the user’s current location and timezone. Other scenarios might include a user looking at other locations around the globe depending on the purpose of the app, and in those cases you can capture the geospatial data in the app and pass it along as inputs for the weather data request.
To use this free API connection, you must first sign up on the Tomorrow.io platform and get a key after you log in.
Select the Location (variable)
This step is flexible depending on how the geospatial app is set up. The weather call can accept either a latlong pair (separated by a comma), or a locationId variable that represents a predefined location (see the list here). Again, this is where the geospatial app will either pull the current location the user is at, or the location a user is interested in. For either case, it will capture the latlong or the locationId and pass it into the weather API call.
Select the Key Fields
The key fields you can request will depend on the context of your geospatial app, but could include several precipitation elements, wind characteristics (speed, gust, direction), temperature, cloud characteristics (cover, base, ceiling), and the weathercode itself.
Choose Unit Type
This item selects either imperial or metric units, and you could choose to pick it based on location, based on the user’s home country, or have the user select the unit type in the geospatial app settings.
The timestep is another context based element, and the data can be pulled for the current weather, the weather by hour, or the weather by day.
Configure the Timeframe
The timeframe allows you to select what type of forecast you want to see, up to six hours prior and up to 15 days out. This allows significant customization to give users exactly what they need to see for your app, and nothing more.
Similar to the location, this should be thought out to see if you want to present the weather as the current location time zone or somewhere else, depending on the purpose of a particular API call.
This final step allows you to compile the full list of query string parameters, then parse out the intervals of the timelines to get the data you want. As the result is raw data, be sure to enrich the result with data units.
Folding in weather updates and forecasts is incredibly easy, and can add significant value to a geospatial data-based outdoor app. As you develop new apps, think outside the box to see how to best enhance the user experience. Chances are, it might be easier than you think to find and incorporate those key insights.