# OSM Buildings switch terrain

**URL:** <https://community.cesium.com/t/osm-buildings-switch-terrain/9892>\
**Category:** CesiumJS\
**Created:** [June 13, 2020, 10:38am UTC](https://community.cesium.com/t/osm-buildings-switch-terrain/9892 "2020-06-13T10:38:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fran\_Raga](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/fran_raga/32/2231_2.png) [@Fran\_Raga](https://community.cesium.com/u/Fran_Raga)\
**Post date:** [June 13, 2020, 10:38am UTC](https://community.cesium.com/t/osm-buildings-switch-terrain/9892/1 "2020-06-13T10:38:35Z")

</div>

Hi.

I was testing the new layer of buildings added to Cesium Ion, and I was wondering how the buildings can be adapted when we change the terrain (Add or remove cesiumTerrainProvider).

I was looking at these [3D Tiles Adjust Height](https://sandcastle.cesium.com/?src=3D%20Tiles%20Adjust%20Height.html&label=3D%20Tiles)

> **[Cesium Sandcastle](https://sandcastle.cesium.com/?src=3D%20Tiles%20Adjust%20Height.html&label=3D%20Tiles)**
>
> The Cesium Sandcastle provides an interactive environment for testing Cesium code.

And above all this great [example](https://sandcastle.cesium.com/index.html?#c=fVZtTxs5EP4re3xho0YOkOv1jgC6ElIuiAQKKaWQqnJ2nayL187Z3qCk4r/f+GXf8nKWot3YzzOeGT8z6wWWQRdLTRTFvB2cBl14y1JUznXGfMxbreBSYq798tV9gKOIKBVoESxFJgMqeICVIlqNuTfRFxzFZIozpj9a8Ei8EA5b7JPlVTK5jOgNvep/WfUPh7Sv+vzufdTt/9F/mT8+dK/+QgD6N758MSA6GJ3/HB712gN60H66fHq5Ht0l39K+vvnaWw27h/RmFP+8ueitBqvB+8FqRq+7V/MnMDa8+Kz6KUtieB+MPv8+/Am/i8HBoH2AztvdD0NBlu2n28do+uHHp8fz3rdXKiN91J6qLyS64/eHR5+YHv65b3OwgFRFNrQRkRJTfivFgsZEllmLJMGafBWSxR4TNjqOSRijcyVovEnm5DU30NuBsmacoQUlr+u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IthQrUkGQcIhKmVoJ62cdBLTRUDj0/He2v1vvBdEDG7lsDLNGLunKzLeOztpAb5GY6Bu+ArfLIhkeGkgyeHZtZtECJ204O8mSwvBJlhWLP4H)

But OSM buildings \_rtcCenter is undefined.I tried using tile.boundingSphere.center as a center, but it doesn’t work either.

Is there any draft or idea how to adjust this ion layer when changing the terrain?

Cheers,  
Fran Raga

---

<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:** [June 15, 2020, 5:38pm UTC](https://community.cesium.com/t/osm-buildings-switch-terrain/9892/2 "2020-06-15T17:38:11Z")

</div>

Hey Fran,

Cesium OSM Buildings are clamped to Cesium World Terrain, so using it on other terrain is going to present issues as mentioned here [https://github.com/CesiumGS/cesium-ion-community/issues/321](https://github.com/CesiumGS/cesium-ion-community/issues/321) and moving the entire tileset won’t be correct because the individual buildings need to be clamped to the new terrain.

One thing on our roadmap is to support tiling OSM data directly, that way you can upload a subset of the city/area from OSM and clamp that to your custom terrain on ion. See: [https://github.com/CesiumGS/cesium-ion-community/issues/232](https://github.com/CesiumGS/cesium-ion-community/issues/232)

---

<div class="post-metadata">

**Author:** ![Fran\_Raga](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/fran_raga/32/2231_2.png) [@Fran\_Raga](https://community.cesium.com/u/Fran_Raga)\
**Post date:** [June 15, 2020, 6:47pm UTC](https://community.cesium.com/t/osm-buildings-switch-terrain/9892/3 "2020-06-15T18:47:05Z")

</div>

But if we take the land away, the buildings are floating.  
It’s easy to reproduce it. We load OSM buildings with the ion ground and then remove the ground, the buildings float.  
Can you adapt the height like the before samples?

---

<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:** [June 16, 2020, 4:58pm UTC](https://community.cesium.com/t/osm-buildings-switch-terrain/9892/4 "2020-06-16T16:58:54Z")

</div>

You are correct that you currently must use Cesium OSM Buildings with Cesium World Terrain to get the correct results. It doesn’t yet support switching to other terrain providers.

It is possible to move the entire 3D Tileset ([here’s an example Sandcastle](https://sandcastle.cesium.com/#c=tVVNbxs3EP0rhHrICpAo2VWSWlaM1m6BBGjsonVz0oW7HK0Ic8kFOZStFPrvGe6Xdi21hwI5CNjhvHnz+EiOdsKxnYJncOwDM/DM7sCrUPAv1VqyHmVVfGcNCmXArUfj67VZm7qG+wwM8FzbFLiEEreP4PGXnKAeH8E5+iBedAHqqqbbZytBU+KftWFsCyrf4pLNJ2tzqGCNhidjsycbkKMT2VPSFY47LrRWpyJKlzYLBRjkOeBvGuLn7f6TpA00mFr4a2ZRlnp/q4xUJvfHDpOWuddKafCA1KrhyBwIhAdf3Aal6/oa3SA55eX+D2cL5SHuk+MWTLIJJkNlDUsa3Lh2gbGBpaVThUK1A8+FlB32OkIP44rOEp97JvIeJ1luXceYWeOtBq5t3mSa+nMuV5zk3kPqwe1EqqHvx3pUHxPZWAF9SH3mVNpvXiO67nVIht2HIqW71KSv66zasET5e3Hfrnd1jDnA4EwDPEStlT90CplwaHMnyq3Kjkdx11vlG3I8LlBKmKSl7CGrxI8V7lfIHYBPpu8XfH5xNWGLOX93dXE5Ye/fzsd1bSs4tvfBbUQGw849vj+FpG/fde3LpVMwucIgYXI+LXCYnfP5qQK72Qxu4fcU0Jz4iQZ6jsZHtDVnhdDdiC8WOxW16I63cbGLe2PnyJK8sr99VUW8j58FOvVybF7Hi8qCx6O6pKd0cPUHTy0TBTjBN3r/aJPqDkoaYspUZcv/dXOqrVmnaAo1LN2bEHFULHvCtxxte2yXTSljpcJs+2+waYs7xJE5vmZxT6PJaOVxr+Gm9fVnVZTWIQtOJ5zPEIqSvAA/S0P2RFZm3rfuMvZDO0u7V8hYSmM3dzYYuWQuT0WyoP21vzn/6VhNgmlMVTtblC+95dQ6CW7qSHnww+ThpLUyZcC+gB04VJnQU6FVTi4WSkoNp12naMsluxx0blOpRbTFMNu0Xs36hq2k2jElP5z5z2OZFt5TZhO0/kt9hfXoZjUj/EmpttUBP5ByLfYRtr24+b1e5JyvZhSer+z+p7rzi7mbj9Uj7JdQojYK9yVQId3xnASROYai6cU8Dg4KxQuFbeQRyhjSpxQopin951G8EzrAsnnpE1aFf5eEoMU3VZc3fUGDvggvGJnJDore/hdzx9Hfxzc)) but this is not a correct solution because each individual building needs to be moved depending on the new underlying terrain.

---

<div class="post-metadata">

**Author:** ![Fran\_Raga](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/fran_raga/32/2231_2.png) [@Fran\_Raga](https://community.cesium.com/u/Fran_Raga)\
**Post date:** [June 18, 2020, 7:00am UTC](https://community.cesium.com/t/osm-buildings-switch-terrain/9892/5 "2020-06-18T07:00:16Z")

</div>

Ok,I’ve already tried that. Well then it can’t be done for now.  
cheers

---

<div class="post-metadata">

**Author:** ![plaulhe1](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/plaulhe1/32/14000_2.png) [@plaulhe1](https://community.cesium.com/u/plaulhe1)\
**Post date:** [September 25, 2024, 6:21pm UTC](https://community.cesium.com/t/osm-buildings-switch-terrain/9892/6 "2024-09-25T18:21:43Z")

</div>

Hi @omar ,

How are you?

I know this topic is quite old, and I’m sure that over the past 4 years, you have found a solution. Is it now possible to clamp OSM buildings onto a custom terrain?

thanks a lot
