cesium加载geojson面、面轮廓、线

cesium版本1.104

加载geojson面

加载面并增加面的轮廓

Cesium.GeoJsonDataSource.load("xxx.json").then(dataSource=> {
        let entities = dataSource.entities.values;
        for (let i = 0; i < entities.length; i++) {
            let entity = entities[i];
            let positions = entity.polygon.hierarchy._value.positions;
            // 设置面轮廓
            entity.polyline = new Cesium.PolylineGraphics({
                positions: positions,
                clampToGround: true,	// 贴地
                width: 10,
                material: Cesium.Color.fromCssColorString('#ff1111ff')
            });
            viewer.entities.add(entity)
        }
    });

加载线

Cesium.GeoJsonDataSource.load("xxx.json").then(dataSource=> {
        let entities = dataSource.entities.values;
        for (let i = 0; i < entities.length; i++) {
            let entity = entities[i];
             entity.polyline.clampToGround: true,	// 贴地
             entity.polyline.width: 10,
             // 设置线条颜色
             entity.polyline.material: Cesium.Color.fromCssColorString('#ff1111ff')
            viewer.entities.add(entity)
        }
    });

你可能感兴趣的:(cesium,js,cesium,前端,js,javascript)