在cesium中加载shp文件,将shp文件打包为zip,直接加载zip文件,shp文件中需包含这四个文件
加载代码
var base = "/modeldata/demo.zip";
shp(base).then(function (data) {
let shpData = Cesium.GeoJsonDataSource.load(data);
shpData.then(function (dataSource) {
_viewer.dataSources.add(dataSource).then((res) => {
shpEntity = res;
});
var entities = dataSource.entities.values;
var colorHash = {};
_viewer._cesiumWidget._creditContainer.style.display = "none";
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
var name = entity.name;
var color = colorHash[name];
if (!color) {
color = Cesium.Color.fromRan