# Programatically select a 3D building

**URL:** <https://community.cesium.com/t/programatically-select-a-3d-building/9077>\
**Category:** CesiumJS\
**Created:** [February 19, 2020, 10:50am UTC](https://community.cesium.com/t/programatically-select-a-3d-building/9077 "2020-02-19T10:50:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin.holmes7](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@martin.holmes7](https://community.cesium.com/u/martin.holmes7)\
**Post date:** [February 19, 2020, 10:50am UTC](https://community.cesium.com/t/programatically-select-a-3d-building/9077/1 "2020-02-19T10:50:01Z")

</div>

On initialisation and loading of a layer which has 3D buildings I want to select one or more buildings programatically.

Basically achieving the same result as single or double clicking a building

Is this possible?

thanks for any help!

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [February 19, 2020, 3:58pm UTC](https://community.cesium.com/t/programatically-select-a-3d-building/9077/2 "2020-02-19T15:58:45Z")

</div>

Do you have some ID for the building you want to highlight? If so, the easiest way would be to use the 3D Tiles styling language, to highlight the building:

[https://sandcastle.cesium.com/index.html?src=3D%20Tiles%20Feature%20Styling.html](https://sandcastle.cesium.com/index.html?src=3D%20Tiles%20Feature%20Styling.html)

If you want to do a post processing feature like here: [https://sandcastle.cesium.com/index.html?src=3D%20Tiles%20Feature%20Picking.html](https://sandcastle.cesium.com/index.html?src=3D%20Tiles%20Feature%20Picking.html)

You would need some way to get access to the Cesium3DTileFeature, which would involve iterating over all the tiles in view as discussed here:

[https://groups.google.com/d/msg/cesium-dev/epFY6Tqpbzc/Vc33tq14AAAJ](https://groups.google.com/d/msg/cesium-dev/epFY6Tqpbzc/Vc33tq14AAAJ)

Let me know which approach works for you.

---

<div class="post-metadata">

**Author:** ![martin.holmes7](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@martin.holmes7](https://community.cesium.com/u/martin.holmes7)\
**Post date:** [February 20, 2020, 7:22am UTC](https://community.cesium.com/t/programatically-select-a-3d-building/9077/3 "2020-02-20T07:22:12Z")

</div>

Hi

thank you for useful links I think it might help solve my requirement. However I have no reference to a Tileset as I am using the 3dCityDB code to initialise a CitydbKmlLayer.

I can’t find a way to get the tilesets. Do you know how to to get a reference to them?

thanks again.

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [February 20, 2020, 5:43pm UTC](https://community.cesium.com/t/programatically-select-a-3d-building/9077/4 "2020-02-20T17:43:16Z")

</div>

Have you tried uploading your CityGML buildings to Cesium ion ([https://cesium.com/ion/](https://cesium.com/ion/)) ? That will create a 3D Tileset of buildings.
