Per point attributes in cesiumjs

How to access per point attributes of las file in cesium.Is there any data loss while converting las to 3dtiles in cesium ion.

All per point attributes should be preserved when you convert to 3D Tiles. You can read more about the point cloud 3D Tiles pipeline here:

https://cesium.com/3d-tiling-pipeline/pointclouds/

You should be able to use the styling language to color or show/hide by attributes like in this example:

Although I’m not sure there’s a built in way to print out individual point’s attributes. Does your analysis or application require that? If so, can you tell me a bit more about it?

Thanks for the reply Omar.I want to classify the data based on vegetation,ground,building so i want perpoint attributes.Where can i download cesium-ion-point-cloud-tiler.zip.I found it in this link.Please share the link to download point cloud tiler.

How to pick the features of the 3d tiles point cloud in the example u gave https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=3D%20Tiles%20Point%20Cloud%20Styling.html.I tried a way to get the features with on click.But there was no result.

You can use the point cloud tiler is what Cesium ion (cesium.com/ion) uses when you upload your LAS files. To use it offline you’ll have to contact Tim (tim@cesium.com) that you’re interesting in buying the on-premise version.

You should be able to style your data with the 3D Tiles styling language like in that last Sandcastle you linked. The classification is stored in a variable called Classification (uppercase) in the tileset, so instead of:

addStyle(‘Color Ramp’, {
color : {
conditions : [
[’{temperature} < 0.1', "color('#000099')"], ['{temperature} < 0.2’, “color(’#00cc99’, 1.0)”],
[’{temperature} < 0.3', "color('#66ff33', 0.5)"], ['{temperature} < 0.4’, ‘rgba(255, 255, 0, 0.1)’],
[’{temperature} < 0.5', 'rgb(255, 128, 0)'], ['{temperature} < 0.6’, “color(‘red’)”],
[’{temperature} < 0.7', "color('rgb(255, 102, 102)')"], ['{temperature} < 0.8’, ‘hsl(0.875, 1.0, 0.6)’],
[’${temperature} < 0.9’, ‘hsla(0.83, 1.0, 0.5, 0.1)’],
[‘true’, “color(’#FFFFFF’, 1.0)”]
]
}
});

``

It might be something like:

addStyle(‘Color Ramp’, {

color : {

conditions : [

[’${Classification} == 0’, “color(’#000099’)”],

[’${Classification} == 1’, “color(’#00cc99’, 1.0)”],

[’${Classification} == 2’, “color(’#66ff33’, 0.5)”]

]

}

});

``

Where 0, 1 and 2 could be vegetation, ground and building, based on the original LAS file.

If you’re thinking of getting per point positions on mouse click, that’s something we haven’t added yet. I asked Sean who just opened an issue for it on GitHub:

https://github.com/AnalyticalGraphicsInc/cesium/issues/7408

Let me know if this works for you. Styling point clouds isn’t very well documented yet and it’s something I’ve been wanting to fix. Feel free to post a code example if you’ve tried it and it’s not working and I can help you more from there.

Hi Omar,

I tried to implement this with Cesium 1.55 but it fails with error "Style references a property "Classification" that does not exist or is not styleable.". I checked that the tiles have Classification information in their BATCH_TABLE. I have verified that the points have "Classification" in their features when loaded in CesiumJS. The tileset does not have any entries in "_styleableShaderAttributes". Is there any reason why the tileset wouldn't have "Classification" as styleable?

Hi,

I have nearly the same problem.

how did you check the classification information of your file?

sebastian

If you check the first part of your .pnts file (either with head or with your browser's dev tools) you can see something like: "pntsè,ì€+X{"BATCH_ID":{"byteOffset":..." which indicates that each point has a BATCH ID. Now if you look at the Batch Table of your file, (which in the case of this file that was made with the point-cloud-tiler binary is at the very end) you will find this string: '{"Classification":{"byteOffset":0,"componentType":"UNSIGNED_BYTE","type":"SCALAR"}}'.

Unfortunately it does not seem like CesiumJS supports styleable properties that are defined via batches: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/PointCloud.js#L458 so what is written above does not work for this type of files (which may or may not be your case).

The issue with the code posted above is that you need === instead of ==. For instance:

addStyle('Color Ramp', {
    color : {
        conditions : [
            ['\{Classification\} === 0&#39;, &quot;color\(&#39;\#000099&#39;\)&quot;\], &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\[&#39;{Classification} === 1', "color('#00cc99', 1.0)"],
            ['${Classification} === 2', "color('#66ff33', 0.5)"]
        ]
    }
});

That fixes the issue.

Thanks for posting your solution Leo! I was surprised to discover that == is not a valid operator in the styling language. I opened a feature request here to have better error handling so it’d be easy to catch syntax errors like this:

https://github.com/AnalyticalGraphicsInc/cesium/issues/7734

Omar,

In this SandCastle example how are the per point attributes added to the Lidar. We’re using the Extra Bytes VLR in the 1.4 spec. Is this what’s being used or are they added in a different way? Having difficulty accessing them in the way they are accessed in the example.

Tim

Tim,

The Cesium ion tiling pipeline currently only reads Intensity and Classification from LAS files. We are planning on extending this to more per-point attributes, we have this logged here: https://github.com/CesiumGS/cesium-ion-community/issues/286.

If Cesium ion isn’t picking up these two attributes, let me know the asset ID and I can take a look.

I guess I’m confused then. If intensity and classification are all that’s available where is temperature coming from in the sandcastle example referenced?

1 Like

Oh - yes, that was not generated from a LAS file with Cesium ion. So the 3D Tiles standard itself allows for any arbitrary per-point attributes, so other software could generate 3D Tiles.

So the Sandcastle example has a reference to a JSON that references a PNTS file
PointCloudWithPerPointProperties/tileset.json

How can we reference an ION Asset instead?

Like this point cloud from an LAS.