This guide walks you through the minimum code needed to pull a live daily weather forecast into a Godot 4 scene. By the end you will have a script that configures a U.S. location, requests a forecast from the National Weather Service, and prints each period’s name, temperature, and conditions to the output panel. From there you can wire the same data into labels, textures, or any other game logic you like.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/OdintheDoggo/GodotNWS/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Godot 4.1 or later
- GodotNWS installed and enabled (the
Nwsautoload appears in Project → Project Settings → Autoload)
Steps
Connect to location_setup_complete and call Nws.setup()
The
Nws singleton needs to resolve your coordinates against the NWS grid before any fetches will work. The resolution is asynchronous, so you must connect to the location_setup_complete signal before calling setup().setup() accepts a latitude: float and longitude: float. The call returns immediately; the signal fires once the NWS grid lookup completes and Nws.SetUp becomes true.Request the forecast inside the location handler
Inside Pass
_on_location_ready, connect to forecast_fetched and call fetch_forecast(). Passing false skips downloading the weather icon images, which is faster when you only need text data.true to fetch_forecast() if you also want each ForecastPeriod to have its icon property populated as an ImageTexture.Complete Example Script
Attach this script to any node in your scene. It is self-contained and demonstrates the full signal chain from location setup through forecast display.Automatic geolocation with
setup_ip(): If you want GodotNWS to detect the player’s approximate location automatically, call Nws.setup_ip() instead of Nws.setup(lat, lon). It queries a third-party IP geolocation service to determine latitude and longitude before proceeding with the NWS grid lookup. Explicit coordinates via setup() are generally more accurate and are recommended when you know the target location in advance.Next Steps
The forecast is just one of many data sources GodotNWS exposes. Explore the other guides to learn how to use:fetch_hourly_forecast()— hour-by-hour conditions with dewpoint and relative humidityfetch_current_observations()— live station readings including pressure, visibility, and wind gustfetch_alerts()— active NWS watches, warnings, and advisories for the configured locationfetch_radar_gif()— animated radar loops returned as a raw GIF bufferfetch_weather_stories(),fetch_graphicast(),fetch_radio_broadcast(), and more