Cesium加载Geojson

<body>
    <div id="cesiumContainer"></div>
    <script>
    //加载geojson
    var viewer = new Cesium.Viewer('cesiumContainer');
    var viewPosition =     
    viewer.dataSources.add(Cesium.GeoJsonDataSource.load('../../Apps/china.geojson', {
    stroke: Cesium.Color.BLACK,
    fill: Cesium.Color.RED,
    strokeWidth: 3,
    markerSymbol: '?'
    }));
    viewer.flyTo(viewPosition);
    //其过程如下:
    //var dataSource = Cesium.GeoJsonDataSource.load('./Geojson/gq.geojson');
	//viewer.dataSources.add(dataSource);
	//viewer.dataSources.add(Cesium.GeoJsonDataSource.load('./Geojson/gq.geojson', {
		//stroke: Cesium.Color.HOTPINK,
		//fill: Cesium.Color.PINK,
		//strokeWidth: 3,
		//markerSymbol: '?'
	//}));
    </script>
</body>

记录一下,后续参考

转载自:https://blog.csdn.net/leijie0322/article/details/81076170

You may also like...