【问题标题】:KML Linestring plotting problemsKML 线串绘图问题
【发布时间】:2013-05-10 22:12:20
【问题描述】:

我目前有一个带有一些坐标的 XML 文件。 此 XML 被转换,将 XSLT 文件转换为 KML 文件(仅带有地标)。我已经在 Google 地球上对其进行了测试,并且运行良好。 现在,我正在尝试使用与地标相同的坐标,以绘制连接地标的线串,但是,如下图所示,该线串未正确绘制。如您所见,我的线串似乎在前后移动。 知道这可能是什么吗?

我用于创建线串的 XSLT 代码如下

<Style id="rangecolour">
            <LineStyle><color>660000FF</color><width>1</width></LineStyle>
            <PolyStyle><color>660000FF</color></PolyStyle>
        </Style>
        <Style id="linecolour">
            <LineStyle><color>660000FF</color><width>3</width></LineStyle>
        </Style>
        <Placemark>
            <name>distribution/range</name>
            <description></description>
            <styleUrl>#linecolour</styleUrl>
            <LineString>
                <tessellate>1</tessellate>
                <altitudeMode>clampToGround</altitudeMode>
                <coordinates>
                    <xsl:for-each select="xs:experience/xs:data/xs:provider">
                        <xsl:value-of select="xs:longitude"/>,<xsl:value-of select="xs:latitude"/>,<xsl:value-of select="xs:altitude"/><xsl:text>
</xsl:text>
                    </xsl:for-each>
                </coordinates>
            </LineString>
        </Placemark>

生成的线串 KML 部分如下:

    <Style id="rangecolour">
  <LineStyle>
    <color>660000FF</color>
    <width>1</width>
  </LineStyle>
  <PolyStyle>
    <color>660000FF</color>
  </PolyStyle>
</Style>
<Style id="linecolour">
  <LineStyle>
    <color>660000FF</color>
    <width>3</width>
  </LineStyle>
</Style>
<Placemark>
  <name>distribution/range</name>
  <description/>
  <styleUrl>#linecolour</styleUrl>
  <LineString>
    <tessellate>1</tessellate>
    <altitudeMode>clampToGround</altitudeMode>
    <coordinates>-9.275993,38.757603,210.2
    -9.276027,38.757572,228.1
    ...
    -9.257803,38.75908,159.5
    -9.256753,38.75883,159.5
    </coordinates>
  </LineString>
</Placemark>

非常感谢任何有用的帮助。

【问题讨论】:

    标签: xml xslt kml google-earth


    【解决方案1】:

    LineString 是按照提供的坐标顺序绘制的,因此您可能需要重新排列坐标以便按照您的喜好绘制 LineString。

    如果没有看到您在 KML 中的实际坐标,这将是我的猜测。

    【讨论】:

    • 这里是坐标:docs.google.com/document/d/… 请注意,如果你在谷歌地图上可视化它,纬度和经度必须切换(每行的前两个值),高度(第三个)忽略.但是,如果您在 Google 地球或本网站 (display-kml.appspot.com) 上试用它,它应该可以正常工作。谢谢你:)
    猜你喜欢
    • 1970-01-01
    • 2012-06-03
    • 1970-01-01
    • 1970-01-01
    • 2013-08-06
    • 1970-01-01
    • 1970-01-01
    • 2021-11-29
    • 1970-01-01
    相关资源
    最近更新 更多