Although every API query returns station metadata, such as STID, NAME, and TIMEZONE, to receive the complete listing of just metadata, we can query it directly with the request /stations/metadata?. By doing so we can query for many more stations at a time without worrying about running into a restriction or limitation. This can allow us to get useful information about all the stations for a certain state(s) or network(s).

Here’s an example of using Python to make a metadata query to get the latitude and longitude coordinates for two networks and then plot them onto Google Maps:

import requests, simplejson, gmplot

baseURL = 'http://api.mesowest.net/v2/'
queryParameters = 'stations/metadata?&network=1,2&status=active&token=demotoken'

r = requests.get(baseURL + queryParameters)
r1 = simplejson.loads(r.content)
lat = []
lon = []
for i in range(len(r1['STATION'])):
    try:
        lat.append(float(r1['STATION'][i]['LATITUDE']))
        lon.append(float(r1['STATION'][i]['LONGITUDE']))
    except:
        print('STATION '+r1['STATION'][i]['STID']+' has bad location')
        print(r1['STATION'][i]['LATITUDE'])
        print(r1['STATION'][i]['LONGITUDE'])
gmap = gmplot.GoogleMapPlotter(48, -98, 4)
gmap.scatter(lat, lon, 'r', marker=False, size=7000)
gmap.draw("my-metamap.html")

This query will return an .html file that, when opened in your web browser, looks like this:

metadata-map