How to get properties from 3dtiles next data when click

I have a new 3dtiles next data for test today. I add a left click listener and I find that I can only get a object that contains content, detail and primitive instead of a Cesium3DTileFeature instance before.

I can use feature.getPropery('some name') before, but now, how to do the same?

Hi @Gu-Miao,

I would call var propertyNames = feature.getPropertyNames(); to ensure that you are querying the correct value when calling getProperty. Acording to our documentation, feature.getPropery('some name') is still part of our API.


Hi @sam.rothstein

I know that. But what I said is I can’t get a instance of Cesium3DTileFeature when call viewer.scene.pick(). Instead, I get a object which has content, detail and primitive. And I can’t get properties from them.

Also, I check 3dtiles next examples on sandcastle, I find all of them can get a feature instance when click. So I aslo have a doubt that the data may have some problems if I can’t get a feature instance?

It’s indeed hard to say exactly what might be the reason. Is it possible to share the data set, maybe as a ZIP file, so that others can have a look? (Otherwise, I could try to have a look at other existing 3D Tiles Next samples, and try to find possible reasons for why you are not receiving a Cesium3DTileFeature there…)

1 Like

Hi @Gu-Miao,

First of all, thanks for trying out 3D Tiles Next!

The reason you’re getting an object with detail and primitive rather than a Cesium3DTileFeature is that it’s not finding your feature IDs for some reason, so it falls back to picking the entire glTF model representing the tile.

Feature ID picking in CesiumJS does have a couple open issues that may be the cause of this problem. These issues are under active development right now:

Like @Marco13 said, knowing more about your data would be helpful here. In particular, I’m curious:

  1. What types of feature IDs (attribute, implicit attribute, or texture) are you using?
  2. How many sets of feature IDs are stored in each primitive? Only the first set of feature ID attributes/textures will be used by default. In the near future, this will become easier to configure.

I just realized that you haven’t mentioned whether you’re using 3DTILES_metadata or the corresponding glTF extension (EXT_mesh_features). My comment above was referring to the latter.

If you’re asking about tileset or tile metadata from 3DTILES_metadata, it is possible to access the metadata, though you have to use the private API a bit.

I opened a new issue Streamline the API for accessing tileset/tile metadata when picking · Issue #10015 · CesiumGS/cesium · GitHub about this. The issue includes code snippets of how to access the metadata with the current code.

An example sandcastle showing one possible way of obtaining per-tile metadata:

This shows the metadata of tiles in a tooltip, using the 3d-tiles-samples/next/TilesetWithTileMetadata at main · CesiumGS/3d-tiles-samples · GitHub as an example.

But note that the implementation of the obtainTileMetadata is preliminary, and some details might change here in future versions.

Hello @ptrgags @Marco13, Thanks for the answers!

It’s seem to be a problem of data itself. I show my back-end colleague this post and he tell me there are no feature ids nor metadata properties because he didn’t learn very futher yet. We’re learning further about that and we’d like to share if we find something new.

Your answers have given us great inspiration and useful information, thanks again!