Edit Metadata OSM buildings/3D tiles

Hi,

I’m wondering if it is possible to edit the metadata/add fields to the OSM buildings tile layer within Cesium e.g. a ‘for sale’ or ‘under construction’ (booleans) which would enable me to style the colour of buildings depending on this feature/turn buildings on & off etc.

Thanks,

You can add or modify any property in a 3D Tileset by using feature.setProperty. So when you click on a building, you can get the feature, create a new property like forSale, and then if you have a style based on that property it’ll automatically updated.

To have those changes persist when you close the app and open it again, or for other users, you can use a database that stores that building’s properties by its unique ID. And then when you load the app, you can use the tileLoad event to retrieve those properties for each building loaded.

Here’s a code example showing how this can be done. It uses the browser’s local storage as a database, so the changes will persist only in the same browser, but you can swap that out with your own database or server.

2 Likes