Per point attributes in cesiumjs.

386 views
Skip to first unread message

sank...@gmail.com

unread,
Dec 12, 2018, 1:02:04 AM12/12/18
to cesium-dev
How to access per point attributes of las file in cesium.Is there any data loss while converting las to 3dtiles in cesium ion.

Omar Shehata

unread,
Dec 12, 2018, 11:48:17 AM12/12/18
to cesium-dev
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:


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?

sank...@gmail.com

unread,
Dec 14, 2018, 1:28:27 AM12/14/18
to cesium-dev
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.



sank...@gmail.com

unread,
Dec 14, 2018, 5:06:15 AM12/14/18
to cesium-dev
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.

Omar Shehata

unread,
Dec 14, 2018, 9:07:21 AM12/14/18
to cesium-dev
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 (t...@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:


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.

l...@dronedeploy.com

unread,
Apr 5, 2019, 8:21:45 PM4/5/19
to cesium-dev
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?

pimpf...@gmail.com

unread,
Apr 8, 2019, 9:52:00 AM4/8/19
to cesium-dev
Hi,

I have nearly the same problem.

how did you check the classification information of your file?


sebastian

leo.fer...@gmail.com

unread,
Apr 8, 2019, 1:20:15 PM4/8/19
to cesium-dev
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).

l...@dronedeploy.com

unread,
Apr 8, 2019, 7:05:45 PM4/8/19
to cesium-dev
The issue with the code posted above is that you need === instead of ==. For instance:

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

That fixes the issue.

Omar Shehata

unread,
Apr 10, 2019, 9:20:08 AM4/10/19
to cesium-dev
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:

t...@friendsoffirst.org

unread,
May 1, 2020, 2:33:17 PM5/1/20
to cesium-dev
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

On Friday, December 14, 2018 at 8:07:21 AM UTC-6, Omar Shehata wrote:

Omar Shehata

unread,
May 4, 2020, 1:06:51 PM5/4/20
to cesium-dev
Heads up that the forum has transitioned over to Discourse and this Google Group will be put into read-only mode today. Details about the transition here.

This topic has been moved to the new forum, you can see my response here: https://community.cesium.com/t/per-point-attributes-in-cesiumjs/7795/11.
Reply all
Reply to author
Forward
0 new messages