【问题标题】:Google Earth and Google Maps KML MismatchGoogle 地球和 Google 地图 KML 不匹配
【发布时间】:2014-02-17 04:56:33
【问题描述】:

我正在研究 KML。我生成了以下 KML,它适用于 Google 地球,但不适用于 Google 地图。

问题是所有图标都没有显示。 URL中输入的所有图标都是32x32的。

http://theinternallight.com/KML/GetAllCountryScalars%20(47).kml

谁能告诉我我做错了什么。

提前致谢

【问题讨论】:

标签: google-maps kml google-earth sharpkml


【解决方案1】:

当 KML 显示不正确时,首先要检查的是 KML 是否符合标准。 KML 中的元素顺序具有严格的顺序,例如,Style 元素必须位于 Point 几何图形之前,因此 KML 无效。可以在here 中找到具有元素排序的 KML 地标的正确结构。

这是在原始 KML 中找到的一个顺序错误的示例:

<Placemark>
    <Point>
        <coordinates>180,-5,0</coordinates>
    </Point>
    <Style id="-5180.png">
        <IconStyle>
            <Icon>
                <href>http://theinternallight.com/KML/IconLatLong/-5180.png</href>
            </Icon>
        </IconStyle>
    </Style>
</Placemark>

此外,从严格的 XML 角度来看,“id”属性必须是有效的 NCNAME 数据类型,它以字母数字字符而不是“-”开头,但为了简化,您可以从内联样式中删除“id”属性地标——这些不是必需的。

你可以改写如下:

<Placemark>
    <Style>
        <IconStyle>
            <Icon>
                <href>http://theinternallight.com/KML/IconLatLong/-5180.png</href>
            </Icon>
        </IconStyle>
    </Style>
    <Point>
        <coordinates>180,-5,0</coordinates>
    </Point>
</Placemark>

您应该进行更改,然后使用 Galdos KML Validator 验证 KML。如果您想要一个独立的命令行 KML 验证器,那么您可以使用 XML Validate 工具。

【讨论】:

猜你喜欢
  • 2013-09-15
  • 2018-05-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-11-18
  • 2011-08-06
  • 2015-02-19
相关资源
最近更新 更多