Not able color the feature entity

1. A concise explanation of the problem you're experiencing.

I am working on line of sight on tyhe new york 3D tile data. I want to project color over feature which are visible to human eye and color the building which is visble and give another color which are not visble to human eye

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

I have used 3dtileset data ,and tileload function to get an array of 3d tile and passing the content to another function where calculation is done for visibility. Here am not able to color the object building with matchin height or coordinates.
var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
       url: ‘https://beta.cesium.com/api/assets/1461?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkYWJmM2MzNS02OWM5LTQ3OWItYjEyYS0xZmNlODM5ZDNkMTYiLCJpZCI6NDQsImFzc2V0cyI6WzE0NjFdLCJpYXQiOjE0OTkyNjQ3NDN9.vuR75SqPDKcggvUrG_vpx0Av02jdiAxnnB1fNf-9f7s’,
     shadows: true,
     terrainShadows: Cesium.ShadowMode.ENABLED,
  /* classificationType : Cesium.ClassificationType.TERRAIN,*/
   tilesLoaded : true
   }));
   
   var tileset_data=;
   tileset.tileLoad.addEventListener(function(tile) {
    var content = tile.content;
  
  //console.log(“maincontent===”);console.log(content);
  
  //var l=0; console.log(“datacontent===”+content.getFeature(l).getProperty(‘latitude’));

    for (var i = 0; i < content.featuresLength; i++) {
  
        var feature = content.getFeature(i);
    
    tileset_data[i]=;
    tileset_data[i]['latitude']=content.getFeature(i).getProperty('latitude');
    tileset_data[i]['longitude']=content.getFeature(i).getProperty('longitude');
    tileset_data[i]['area']=content.getFeature(i).getProperty('area');
    tileset_data[i]['height']=content.getFeature(i).getProperty('height');
    tileset_data[i]['SOURCE_ID']=content.getFeature(i).getProperty('SOURCE_ID');
      tileset_data[i]['name']=content.getFeature(i).getProperty('name');
      
    }
  
  console.log(tileset_data,content);

function LOS(tileset_data,content);

// again i tried changing color for height more than 50
for (var l = 0; l < content.featuresLength; l++) {
  
       if(content.getFeature(l).getProperty >50){
       content.getFeature(l).color=Cesium.Color.LIME;
       }else{
      
      content.getFeature(l).color = Cesium.Color.CORAL;
        }
    
    }

});

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I am working on line of sight on tyhe new york 3D tile data. I want to project color over feature which are visible to human eye and color the building which is visble and give another color which are not visble to human eye.

4. The Cesium version you're using, your operating system and browser.

1.44 cesuim, windows 10

Hello,

If you want to color the whole building, 3D Tiles Styling would probably be your best approach. See the spec for the full guide to the styling language, and use Cesium3DTileset.style to set it.

Thanks,

Gabby

Hi Gabby,

i want to color the lat long of particular tile without picking. How can i add color without using this function “content.getFeature(j).color” .

When am using this function it is throwing an error.

Error: “cannot set the color property.”

Request to suggest me.

Regards

Dhana

HI Gabby,

As per suggestion have used 3D Tiles Styling , where am i trying match with lat long to display particular tile building in one color. and also tried and got in all buildings in same color and attached screenshot.

I want to display selected lat long to be in color.Please suggest me

below is code :

var tileset = new Cesium.Cesium3DTileset({ url: ‘https://beta.cesium.com/api/assets/1461?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkYWJmM2MzNS02OWM5LTQ3OWItYjEyYS0xZmNlODM5ZDNkMTYiLCJpZCI6NDQsImFzc2V0cyI6WzE0NjFdLCJpYXQiOjE0OTkyNjQ3NDN9.vuR75SqPDKcggvUrG_vpx0Av02jdiAxnnB1fNf-9f7s’ });

viewer.scene.primitives.add(tileset);

tileset.style = new Cesium.Cesium3DTileStyle({

color: {

conditions: [

["({latitude} === 0.7111619826184954 && {longitude} === -1.2913615274539367)", “color(‘blue’)”],

[“true”, “color(‘cyan’)”]

]

}

});

and another have tried with only latitude matchin:

tileset.style = new Cesium.Cesium3DTileStyle({

color: {

conditions: [

["${latitude} === 0.7111619826184954 ", “color(‘blue’)”],

[“true”, “color(‘cyan’)”]

]

}

});

Regards

Dhana

Here’s an example that works for me.