Please avoid repeated downloads.
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
The United States Postal Service (USPS) provides zip code data for a fee, and I do not subscribe to those products. The United States Census Bureau provides a zip code listing created in 1999 with latitudes and longitudes, but no longer issues updates. I have found no other source and I do not include zip code data in my download files.
I am not aware of another free source for place names cross-referenced against weather sites. The weather reports on this page use the runtime file availble via the link above. My webcam page uses similar XML files to present conditions and forecasts for upstate NY.
My ZIP files each contain an XML file that cross-references USGS locations 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 ZIP files contain essentially the same
data, but in different formats. You may need
software to extract the XML files from the ZIP files.
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
XML file details:
- icao-usgs-full-20101018.zip contains icao-usgs-full.xml
<IcaoUsgs> <State name="AK"> <Usgs name="Ester" 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" /> </Usgs> ...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.
- icao-usgs-runtime-20101018.zip contains icao-usgs-runtime.xml
<IcaoUsgs> <State name="AK"> <U f="Ester" a="64.85" o="-148.01"> <I i="PAFA" c="E" d="4.8" /> <I i="PAFB" c="E" d="11.7" /> <I i="PAEI" c="E" d="29.7" /> </U> ...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 and "o" for longitude. 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.
- icao-usgs-resx-20101018.zip contains icao-usgs.resx
<data name="Ester, AK"> <value>64.85|-148.01@PAFA|E|4.8@PAFB|E|11.7@PAEI|E|29.7</value> </data> ...The "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. 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 and longitude 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.