exportKml

exportKml(options)Promise.<Object>

将EntityCollection导出为KML文档。仅点、广告牌、模型、路径、多边形、折线几何图形 将被导出。请注意,没有实体属性到KML要素属性的1对1映射。为 例如,在KML中是时间动态的但不能是动态的实体属性的值是在导出的 选项.时间或EntityCollection时间间隔的开始(如果未指定)。时间动态特性 在KML中支持的,如果它是SampledProperty,则使用samples,否则我们使用 这个options.sampleDuration选项. 点,公告牌,模型和路径几何与时间动态位置将被导出 作为gx:跟踪特征。并不是所有的材料都可以用KML来表示,所以对于更先进的材料来说,只是初级的 使用颜色。画布对象将导出为PNG图像。
Name Type Description
options Object 具有以下属性的对象:
Name Type Default Description
entities EntityCollection 要导出为KML的EntityCollection。
ellipsoid Ellipsoid Ellipsoid.WGS84 optional 输出文件的椭球体。
modelCallback exportKml~ModelCallback optional 将使用ModelGraphics实例调用的回调,并应返回要在KML中使用的URI。如果实体集合中存在模型,则为必需。
time JulianDate entities.computeAvailability().start optional 用于获取KML中不随时间变化的属性的时间值。
defaultAvailability TimeInterval entities.computeAvailability() optional 如果实体没有可用性,将采样的间隔。
sampleDuration Number 60 optional 以KML为单位对属性进行采样的秒数。
kmz Boolean false optional 如果是真的KML和外部文件将被压缩到kmz文件中。
Returns:
一个承诺,它解析为一个包含KML字符串和外部文件blob字典的对象,或者一个kmz文件作为blob,如果选项.kmz是真的。
Example:
Cesium.exportKml({
     entities: entityCollection
 })
  .then(function(result) {
    // The XML string is in result.kml

    var externalFiles = result.externalFiles
    for(var file in externalFiles) {
      // file is the name of the file used in the KML document as the href
      // externalFiles[file] is a blob with the contents of the file
    }
  });
Demo:

Type Definitions

ModelCallback(model, time, externalFiles)String

由于KML不支持glTF模型,所以需要此回调来指定KML文档中模型使用的URL。 它还可以用于向externalFiles对象添加其他文件,616668165对象是嵌入在导出KMZ中的文件列表, 或在导出时与KML字符串一起返回。
Name Type Description
model ModelGraphics 实体的ModelGraphics实例。
time JulianDate 应该使用任何时间来获取属性。
externalFiles Object 将文件名映射到Blob或解析为Blob的承诺的对象。
Returns:
KML文档中用于href的URL。