diff options
author | Mathias Mayrhofer <mtmayr@mtmayr.com> | 2020-02-23 13:24:06 +0100 |
---|---|---|
committer | Mathias Mayrhofer <mtmayr@mtmayr.com> | 2020-02-23 13:24:06 +0100 |
commit | 8ff6be8e3ccd9deb069eae63428e5347149d0839 (patch) | |
tree | e9e1377739ea815913ac5b1be8c4b3de12a0791b /kml/convert_xml_kml.xsl | |
parent | 6086c26404d0a534f2ce212b7e9c8e669754e8b0 (diff) | |
parent | 6752d4defb195739c66a7dec94570d41ea8d295a (diff) |
Merge branch 'master' into stable
Diffstat (limited to 'kml/convert_xml_kml.xsl')
-rw-r--r-- | kml/convert_xml_kml.xsl | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/kml/convert_xml_kml.xsl b/kml/convert_xml_kml.xsl new file mode 100644 index 0000000..3217143 --- /dev/null +++ b/kml/convert_xml_kml.xsl @@ -0,0 +1,142 @@ +<?xml version='1.0' encoding='UTF-8'?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + +<xsl:template match="root"> + <kml xmlns="http://www.opengis.net/kml/2.2"> + <Document> + <name>Funkfeuer Graz</name> + <Style id="ffstyle_offline"> + <IconStyle id="myicon"> + <color>a0ffffff</color> + <scale>0.5</scale> + <Icon><href>https://juwelierkassa.at/dots/dot_red.png</href></Icon> + <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/> + </IconStyle> + <LabelStyle id="mylab"> + <color>a000ffff</color> + <scale>0.8</scale> + </LabelStyle> + </Style> + <Style id="ffstyle_online"> + <IconStyle id="myicon"> + <color>f0ffffff</color> + <scale>0.5</scale> + <Icon><href>https://juwelierkassa.at/dots/dot_green.png</href></Icon> + <hotSpot x="0.5" y="0.5" xunits="fraction" yunits="fraction"/> + </IconStyle> + <LabelStyle id="mylab"> + <color>f000ffff</color> + <scale>0.9</scale> + </LabelStyle> + </Style> + <Style id="ffstyle_link"> + <LabelStyle id="mylab_link"> + <color>f099ffff</color> + <scale>0.9</scale> + </LabelStyle> + <LineStyle> + <color>7099ff00</color> + <width>1</width> + </LineStyle> + <PolyStyle> + <color>70eeff00</color> + <colorMode>normal</colorMode> + <fill>1</fill> + </PolyStyle> + </Style> + <Style id="ffstyle_vpn"> + <LabelStyle id="mylab_vpn"> + <color>f0ff99ff</color> + <scale>0.9</scale> + </LabelStyle> + <LineStyle> + <color>709900ff</color> + <width>1</width> + </LineStyle> + <PolyStyle> + <color>70ee00ff</color> + <colorMode>normal</colorMode> + <fill>1</fill> + </PolyStyle> + </Style> + <xsl:apply-templates select="nodes"/> + <xsl:apply-templates select="links"/> + </Document> + </kml> +</xsl:template> + +<xsl:template match="nodes"> + <Folder> + <name>Online</name> + <visibility>1</visibility> + <xsl:apply-templates select="node" mode="online"/> + </Folder> + <Folder> + <name>Offline</name> + <visibility>0</visibility> + <xsl:apply-templates select="node" mode="offline"/> + </Folder> +</xsl:template> + +<xsl:template match="links"> + <Folder> + <name>Links</name> + <visibility>1</visibility> + <xsl:apply-templates select="link" mode="links"/> + </Folder> +</xsl:template> + +<xsl:template match="node" mode="online"> + <xsl:if test="@state='online' or @state='tunnel'"> + <Placemark id="{@id}"> + <name><xsl:value-of select="@name"/></name> + <description><br><xsl:value-of select="@gallery_link"/></br><br><xsl:value-of select="@router_links"/></br><br>#<xsl:value-of select="@id"/> = <xsl:value-of select="@state"/></br></description> + <styleUrl>#ffstyle_online</styleUrl> + <Point> + <extrude>1</extrude> + <altitudeMode>relativeToGround</altitudeMode> + <coordinates> + <xsl:value-of select="@lng"/>,<xsl:value-of select="@lat"/>,60 + </coordinates> + </Point> + </Placemark> + </xsl:if> +</xsl:template> + +<xsl:template match="node" mode="offline"> + <xsl:if test="@state='offline'"> + <Placemark id="{@id}"> + <name><xsl:value-of select="@name"/></name> + <description><br><xsl:value-of select="@gallery_link"/></br><br><xsl:value-of select="@router_links"/></br><br>#<xsl:value-of select="@id"/> = <xsl:value-of select="@state"/></br></description> + <visibility>0</visibility> + <styleUrl>#ffstyle_offline</styleUrl> + <Point> + <extrude>1</extrude> + <altitudeMode>relativeToGround</altitudeMode> + <coordinates> + <xsl:value-of select="@lng"/>,<xsl:value-of select="@lat"/>,60 + </coordinates> + </Point> + </Placemark> + </xsl:if> +</xsl:template> + +<xsl:template match="link" mode="links"> + <Placemark id="{@id}"> + <name><xsl:value-of select="@from"/> - <xsl:value-of select="@to"/> [<xsl:value-of select="@value"/>]</name> + <styleUrl> + <xsl:choose><xsl:when test="@value='-1'">#ffstyle_vpn</xsl:when><xsl:otherwise>#ffstyle_link</xsl:otherwise></xsl:choose> + </styleUrl> + <LineString> + <extrude>1</extrude> + <tessellate>1</tessellate> + <altitudeMode>relativeToGround</altitudeMode> + <coordinates> + <xsl:value-of select="@lngfrom"/>,<xsl:value-of select="@latfrom"/>,50 + <xsl:value-of select="@lngto"/>,<xsl:value-of select="@latto"/>,50 + </coordinates> + </LineString> + </Placemark> +</xsl:template> + +</xsl:stylesheet> |