managing kml entities with html checkboxes

Hi,
I've thousands of kml datasources created by Google earth and these are associated with related checkbox html control.

I've no idea how managing single or multiple datasources and show or delete.

Until now i'm able to add Entities by cesiumviewer.dataSources.add() as I see in Docs.

Yes a possible solution is a html optiongroup in order to switch on any single or grouped Collection of entities, but is not my case.

THanks.

Hi there,

This example is very similar to what you want! Just replace the Cesium buttons with an checkbox.

Hope that helps,

  • Rachel

Ahhh that's good Thanks!!

exclamation mark the negation operand and the entity accessing the show property... Maybe the only solution. Thumb up.
Ok i'm going to modify this.

Bad news...
below the code focuses:

<input type="checkbox" onclick=" if (this.checked) {
      sorgente_dati_campi_detriti=Cesium.KmlDataSource.load('remote-kml-impact');
      var campi_detriti=new Cesium.Entity(sorgente_dati_campi_detriti);
      
      cesiumViewer.entities.add(campi_detriti);
      
      console.log(cesiumViewer.entities);
     
  } ">campi caduta detriti
      <br>

Maybe could be useful to inspect and fully manage any entity...

In the example on Sandcastle each entity is created by hand, there's not Datasources... Mah...

Hi Andrea,

You can actually just toggle visiblity for an entire datasource’s entity collection using kmlDataSource.show = false and kmlDataSource.show = true`. If you attach that code to html checkboxes, it should do what you need.

Hope that helps,

  • Rachel