Created
October 15, 2023 14:11
-
-
Save mcculley/d97e9cfc1cf59a508d85d24ec678a3e2 to your computer and use it in GitHub Desktop.
Convert the list of NOAA weather stations to a KML file. (e.g., curl https://w1.weather.gov/xml/current_obs/index.xml | xsltproc nws2kml.xslt - > NWS_stations.kml)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="xml"/> | |
<xsl:template match="/wx_station_index"> | |
<kml xmlns="http://www.opengis.net/kml/2.2"> | |
<Document> | |
<xsl:for-each select="station"> | |
<Placemark> | |
<name><xsl:value-of select="station_id"/></name> | |
<Point> | |
<coordinates><xsl:value-of select="longitude"/>,<xsl:value-of select="latitude"/>,0</coordinates> | |
</Point> | |
</Placemark> | |
</xsl:for-each> | |
</Document> | |
</kml> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment