Weather data for developers

Please avoid repeated downloads.
Scroll down for XML details. ZIP (10.4MB) ZIP (4.9MB) ZIP (5.3MB)

The United State Geological Survey (USGS) provides a list of each "feature" in the USA with its latitude and longitude. The International Civil Aviation Organization (ICAO) provides a list of each registered aviation station (airport) around the world with its latitude and longitude. Many American stations feed weather observations to the National Oceanic and Atmospheric Administration (NOAA), which makes the observations available in the form of XML feeds and RSS feeds. United States Census Bureau offers downloadable files containing ZIP codes.
I am not aware of another free source for place names cross-referenced against weather sites. The weather reports on the main weather page use the resource files available via the link above.
My ZIP files each contain an XML file that cross-references USGS locations and USA zip codes with the closest NOAA-feeding ICAO stations. In other words, I wrote software (not available for download) to calculate the distance from selected USGS features to every US ICAO station that feeds weather data to NOAA. From the USGS National file, the software selects every feature with a class of "Populated Place" or "Civil". Certain feature name phrases are trimmed, such as "City of" and "(historical)". The ZIP files, together with NOAA's free services, effectively allow a web page developer to provide weather services for any place in the United States. The two ZIP files contain essentially the same data, but in different formats. You may need software to extract the XML files from the ZIP files.
My list of zip codes may not be complete because zip codes are only incidental to Census Bureau data. The USCB uses zip codes often enough to get a useful data set. The latitude and longitude of a zip code is assumed to be the same as its place name, but this is not always accurate. Some post offices serve multiple zip codes, and there are a few instances of duplicate place names within a state. If you really, really need accurate lat/lon values for a zip code, contact the United States Postal Service.
The XML files contained in the ZIP files begin with the EF BB BF byte order mark for UTF-8. I believe that UTF-8 is required and ASCII is insufficient, since Hawaiian names often contain characters outside of ASCII.
Statistics: Out of 3,673 ICAO stations in the USA (50 states plus DC and PR), 2,248 feed weather data to NOAA. There are about 10,000 stations around the world. 204,806 USGS features out of 2,267,084 in the National file refer to towns and other named regions. 38,804 zip codes were supplied with place names that could be compared to USGS features. The other features are mountains, schools and other features for which few end users would search for weather data or are potentially far from a weather station. My software first collects the list of zip codes and place names. Then, the software collects the list of weather feeds. Many ICAO stations do not feed weather data, but there is no way to tell without actually trying, and I retry failed hits a few times to weed out momentary network glitches. Second, the software calculates the distance and direction from each of the USGS features to each of the ICAO stations, using the available latitudes and longitudes. The formula to calculate the distance between two lat/lon points can be found on the web. My software's web hits, distance calculations and file I/O run for a couple hours.

XML file details:
● contains icao-usgs-full-20151126.xml
 <State name="AK">
  <Usgs name="Ester" zipcode="99725" latitude="64.8472222" longitude="-148.0144444">
   <Icao code="PAFA" name="FAIRBANKS" state="AK" latitude="64.8166667" longitude="-147.8666667"
          direction="E" distance="4.8250160" />
   <Icao code="PAFB" name="FORT WAINWRIGHT" state="AK" latitude="64.8333333" longitude="-147.6166667"
          direction="E" distance="11.7159581" />
   <Icao code="PAEI" name="EIELSON AFB" state="AK" latitude="64.6666667" longitude="-147.1000000"
          direction="E" distance="29.6720195" />
The "full" file provides friendly attribute names and 7 digits to the right of the decimal point. The USGS features are grouped by state (incouding DC and PR). The three closest ICAO sites to the USGS feature are included. At the time the file was generated, NOAA returned weather data for the ICAO sites. The direction and distance (miles) for each ICAO station are from the USGS feature to the ICAO station. In the example above, the FAIRBANKS ICAO station is 4.8 miles east of Ester.
● contains icao-usgs-runtime-20151126.xml
 <State name="AK">
  <U f="Ester" a="64.85" o="-148.01" z="99725">
   <I i="PAFA" c="E" d="4.8" />
   <I i="PAFB" c="E" d="11.7" />
   <I i="PAEI" c="E" d="29.7" />
In the "runtime" file, I trimmed out excess text and provide less numeric precision. The USGS elements are grouped by state. A "U" element is a USGS element, with attributes "f" for feature, "a" for latitude, "o" for longitude, "z" for zip code. Three ICAO sites are grouped within a U element. The ICAO elements are named "I", i.e., capital letter "eye". The attributes are "i" for ICAO code, "c" for (compass) direction and "d" for distance (miles). The latitude and the longitude are provided for the USGS features, but not for the ICAO stations.
● contains icaoUsgsAK-20151126.resx (a total of 52 state + DC + PR files).
<data name="Ester, AK">
● contains icaoUsgsZ0-20151126.resx (a total of 10 zip code files).
<data name="99725">
 <value>64.85|-148.01|Ester, AK@PAFA|E|5.0@PAFB|E|11.7@PAEI|E|29.7</value>
A "resx" file is a standard resource file suitable for inclusion in a Microsoft Visual Studio project. The name of the resource is the USGS feature name followed by a comma and a space and the state abbreviation, or a US Postal Service Zip Code. Visual Studio and .NET don't efficiently process huge resource files, so I split up the resources by state and zip code. The value of the resource is a delimited string. When software retrieves the value via a resource manager, the value must be split into its parts.
Split the value first on "@". This results in four parts. The first part contains the latitude, longitude and in the case of the zip code resource files, the zip code of the USGS feature separated by "|" (or-bar).
The other three parts are the three closest ICAO stations. Each of these parts contains the ICOA code, direction from the USGS feature and distance to the USGS feature in miles, separated by "|" (or-bar). The latitude and the longitude are provided for the USGS features, but not for the ICAO stations.

Gary's weather station: Just for kicks, here is a page with lots of data from my Davis Vantage Vue weather station.
Weather home ... Contact ... Sitemap ... Policies/terms ...  ©2024 Gary Gocek