You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
GCSGUI/src/utils/DataIO.ts

25 lines
781 B
TypeScript

/**
2024/4/11 13:33
Zhaipeixiu
*/
import {Viewer, GeoJsonDataSource, Color, KmlDataSource} from "cesium";
export const inputGeoJson = (viewer: Viewer) => {
viewer.dataSources.add(GeoJsonDataSource.load("/js.json",{
stroke: Color.WHITE, //轮廓颜色,注意:颜色必须大写
strokeWidth: 5,
fill: Color.BLUE.withAlpha(0.3), //填充颜色,透明度
}))
}
export const inputKML = (viewer: Viewer) => {
let kmlUrl = "./Assets/gdpPerCapita2008.kmz";
let kmlDataPromise = KmlDataSource.load(kmlUrl);
console.log(kmlDataPromise);
kmlDataPromise.then(function (dataSource) {
console.log(dataSource);
viewer.dataSources.add(dataSource);
})
}