Example:
// On mouse over, display all the properties for a feature in the console log.
handler.setInputAction(function(movement) {
const feature = scene.pick(movement.endPosition);
if (feature instanceof Cesium.Cesium3DTileFeature) {
const propertyIds = feature.getPropertyIds();
const length = propertyIds.length;
for (let i = 0; i < length; ++i) {
const propertyId = propertyIds[i];
console.log(`{propertyId}: ${feature.getProperty(propertyId)}`);
}
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
Members
Gets or sets the highlight color multiplied with the feature's color. When
this is white, the feature's color is not changed. This is set for all features
when a style's color is evaluated.
Color.WHITE
Get the feature ID associated with this feature. For 3D Tiles 1.0, the
batch ID is returned. For EXT_mesh_features, this is the feature ID from
the selected feature ID set.
Experimental
This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
Experimental
This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
All objects returned by
Scene#pick have a
primitive property. This returns
the tileset containing the feature.
Gets or sets if the feature will be shown. This is set for all features
when a style's show is evaluated.
true
Gets the tileset containing the feature.
Methods
Returns a copy of the feature's property with the given name, examining all
the metadata from 3D Tiles 1.0 formats, the EXT_structural_metadata and legacy
EXT_feature_metadata glTF extensions, and the metadata present either in the
tileset JSON (3D Tiles 1.1) or in the 3DTILES_metadata 3D Tiles extension.
Metadata is checked against name from most specific to most general and the
first match is returned. Metadata is checked in this order:
- Batch table (structural metadata) property by semantic
- Batch table (structural metadata) property by property ID
- Content metadata property by semantic
- Content metadata property by property
- Tile metadata property by semantic
- Tile metadata property by property ID
- Subtree metadata property by semantic
- Subtree metadata property by property ID
- Group metadata property by semantic
- Group metadata property by property ID
- Tileset metadata property by semantic
- Tileset metadata property by property ID
- Otherwise, return undefined
For 3D Tiles Next details, see the 3DTILES_metadata Extension
for 3D Tiles, as well as the EXT_structural_metadata Extension
for glTF. For the legacy glTF extension, see EXT_feature_metadata Extension
| Name |
Type |
Description |
content |
Cesium3DTileContent
|
The content for accessing the metadata |
batchId |
number
|
The batch ID (or feature ID) of the feature to get a property for |
name |
string
|
The semantic or property ID of the feature. Semantics are checked before property IDs in each granularity of metadata. |
Returns:
The value of the property or undefined if the feature does not have this property.
Experimental
This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
Returns a copy of the value of the feature's property with the given name. This includes properties from this feature's
class and inherited classes when using a batch table hierarchy.
| Name |
Type |
Description |
name |
string
|
The case-sensitive name of the property. |
Returns:
The value of the property or undefined if the feature does not have this property.
Example:
// Display all the properties for a feature in the console log.
const propertyIds = feature.getPropertyIds();
const length = propertyIds.length;
for (let i = 0; i < length; ++i) {
const propertyId = propertyIds[i];
console.log(`{propertyId}: ${feature.getProperty(propertyId)}`);
}
See:
Returns an array of property IDs for the feature. This includes properties from this feature's
class and inherited classes when using a batch table hierarchy.
| Name |
Type |
Description |
results |
Array.<string>
|
optional
An array into which to store the results. |
Returns:
The IDs of the feature's properties.
See:
Returns whether the feature contains this property. This includes properties from this feature's
class and inherited classes when using a batch table hierarchy.
| Name |
Type |
Description |
name |
string
|
The case-sensitive name of the property. |
Returns:
Whether the feature contains this property.
See:
Sets the value of the feature's property with the given name.
If a property with the given name doesn't exist, it is created.
| Name |
Type |
Description |
name |
string
|
The case-sensitive name of the property. |
value |
*
|
The value of the property that will be copied. |
Throws:
-
DeveloperError
: Inherited batch table hierarchy property is read only.
Examples:
const height = feature.getProperty('Height'); // e.g., the height of a building
const name = 'clicked';
if (feature.getProperty(name)) {
console.log('already clicked');
} else {
feature.setProperty(name, true);
console.log('first click');
}