L1 kml加载及设置

本段位加载kml,生成entity数据形式,并通过material属性来实现想要的线性。

一、加载kml的端口

Cesium.KmlDatasource.load();viewer.dataSources.add()

data Resource | String | Document | Blob A url, parsed KML document, or Blob containing binary KMZ data or a parsed KML document.
options Object An object with the following properties:
Name Type Default Description
camera Camera   The camera that is used for viewRefreshModes and sending camera properties to network links.
canvas Canvas   The canvas that is used for sending viewer properties to network links.
sourceUri String   optional Overrides the url to use for resolving relative links and other KML network features.
clampToGround Boolean false optional true if we want the geometry features (Polygons, LineStrings and LinearRings) clamped to the ground.
ellipsoid Ellipsoid Ellipsoid.WGS84 optional The global ellipsoid used for geographical calculations.

 var viewer = new Cesium.Viewer('cesiumContainer');

viewer.dataSources.add(Cesium.KmlDataSource.load("地址", { camera: viewer.scene.camera, canvas: viewer.scene.canvas,
     clampToGround:true//设置贴地 }) );

二、

猜你喜欢

转载自www.cnblogs.com/xiaoguniang0204/p/11746579.html