I am using the Cesium.GeoJsonDataSource to load geojson file. I noticed that on the document (https://cesiumjs.org/Cesium/Build/Documentation/GeoJsonDataSource.html) there is a method called "show" to control whether to show the data. Could you please show me an example of how to use it?
There are some polylines in the geojson data. How to show the polyline's properties when I click on it?
The code I wrote is like this:
const shapeLayer = Cesium.GeoJsonDataSource.load('url_to_XXX.geojson', {
stroke: Cesium.Color.HOTPINK,
strokeWidth: 3,
// do I add "show" here?
// show: false
});
// do I add "show" here?
// shapeLayer.show = false;
this.viewer.dataSources.add(shapeLayer);
Sorry you had trouble figuring this out. This is a good reference example on loading GeoJSONs and applying custom styling/changing properties of the loaded entities:
The only options available on load are listed here:
If you’re asking about showing/hiding everything in the datasource, you can do that by waiting on the promise to resolve, and then setting that after. So in the example in your first post, it would be: