One of our most versatile functions of the Mesonet API is the
stations/nearesttime? service. This service allows you to make powerful queries for both time and location.
The base URL for this feature is:
The benefit of the
/nearesttime? is the ability to query the observations around a particular date and time. The only required parameter (other than an API token) is
&attime=YYYYMMDDhhmm, with the date string being the time for which you want the observations to be returned. Building on what we have, you can also add the query string
&within=60 which will return all observations for 60 minutes before and after the time specified by
Pro tip, you can query a defined range both before and after the
&attime. By passing
&within=20,15 you would get the closest time within 20 minutes before and 15 after the
You can further customize your query by adding additional parameters to filter the data in terms of variables, location, or units. For even more versatility in using the
/stations/nearestime? feature, see our blog post on utilizing the Location Services of the API or our API documentation.
Query all observations, within 25 miles of Salt Lake Airport, for when a tornado hit Salt Lake City on August 11, 1999:
Get the wind gust speeds when Hurricane Sandy made landfall in New Jersey on October 29, 2012: