KML文件格式或最低要求 [英] KML file format or minimum requirements

查看:152
本文介绍了KML文件格式或最低要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对XML的经验很少,而对KML则一无所知,我试图找到一些与程序在读取KML文件时所期望的类似的东西.

Having minimal experience with XML, and none whatsoever with KML, I try to find something along the lines of what a program expects when reading a KML file.

我正在编写一些软件来生成KML文件,但是当我尝试在Google Earth中打开该文件时,出现此错误:

I'm writing some software to generate a KML file, but when I try to open said file in Google Earth, I get this error:

Open of file "C:/blahblah/myFile.kml" failed: Parse error at line 21, column 0:

junk after document element

我已将myFile简化为以下内容,并且存在相同的错误.

I have reduced myFile down to the following, with the same error.

<? xml version="1.0" encoding="utf-8"?>
<Placemark>
</Placemark>
<Placemark>
</Placemark>

我缺少一些必不可少的元素吗?我可能错过了标准的一部分,该部分涉及如何正确地形成KML文件?

Am I missing something some required element? Is there a section of the standard I may have missed that deals with how to properly form a KML file?

推荐答案

KML是XML文件,因此可以验证为KML XML模式.验证KML文件的一种简单工具是 XML验证器.在 KML最佳做法 KML参考.

KML is an XML file and as such can be validated to the KML XML Schema. One simple tool to validate KML files is the XML Validator. Further details and examples of KML are found in KML Best Practice and the KML Reference.

多个地标需要文档"或文件夹"父元素.这样的KML文件 的结构如下:

Multiple placemarks require a Document or Folder parent element. Such a KML file would be structured as the following:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
    <Document>
        <Placemark>
        </Placemark>
        <Placemark>
        </Placemark>
    </Document>
</kml>

这篇关于KML文件格式或最低要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆