# CityGML clamped to Cesium World Terrain in Sandcastle but not in Unreal Engine

**URL:** <https://community.cesium.com/t/citygml-clamped-to-cesium-world-terrain-in-sandcastle-but-not-in-unreal-engine/16185>\
**Category:** Cesium for Unreal\
**Created:** [November 17, 2021, 3:23am UTC](https://community.cesium.com/t/citygml-clamped-to-cesium-world-terrain-in-sandcastle-but-not-in-unreal-engine/16185 "2021-11-17T03:23:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jill](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jill/32/4455_2.png) [@jill](https://community.cesium.com/u/jill)\
**Post date:** [November 17, 2021, 3:23am UTC](https://community.cesium.com/t/citygml-clamped-to-cesium-world-terrain-in-sandcastle-but-not-in-unreal-engine/16185/1 "2021-11-17T03:23:40Z")

</div>

My CityGML file was successfully converted into 3D tiles by Cesium ion. It clamps to terrain [here in Sandcastle](https://sandcastle.cesium.com/?src=Hello%20World.html&label=Showcases&code=eyJjb2RlIjoiLy8gR3JhbnQgQ2VzaXVtSlMgYWNjZXNzIHRvIHlvdXIgaW9uIGFzc2V0c1xuQ2VzaXVtLklvbi5kZWZhdWx0QWNjZXNzVG9rZW4gPSBcImV5SmhiR2NpT2lKSVV6STFOaUlzSW5SNWNDSTZJa3BYVkNKOS5leUpxZEdraU9pSm1ZekpqTlRGaU15MWpORE0zTFRRd09HVXRPRFE0WkMxak5tVTBORE16T1RFNVlXRWlMQ0pwWkNJNk56RTVNRGdzSW1saGRDSTZNVFl6TlRVMk9EUXlOSDAubkxWamZuUGJUTk9VOThJU2NveFRFN0xyTWhYWm5taldKZGdIMEJIWnU4b1wiO1xuXG52YXIgdmlld2VyID0gbmV3IENlc2l1bS5WaWV3ZXIoXCJjZXNpdW1Db250YWluZXJcIik7XG5cbnZhciB0aWxlc2V0ID0gdmlld2VyLnNjZW5lLnByaW1pdGl2ZXMuYWRkKFxuICBuZXcgQ2VzaXVtLkNlc2l1bTNEVGlsZXNldCh7XG4gICAgdXJsOiBDZXNpdW0uSW9uUmVzb3VyY2UuZnJvbUFzc2V0SWQoNjY2NDY5KSxcbiAgfSlcbik7XG5cbnRpbGVzZXQucmVhZHlQcm9taXNlXG4gIC50aGVuKGZ1bmN0aW9uICgpIHtcbiAgICB2aWV3ZXIuem9vbVRvKHRpbGVzZXQpO1xuXG4gICAgLy8gQXBwbHkgdGhlIGRlZmF1bHQgc3R5bGUgaWYgaXQgZXhpc3RzXG4gICAgdmFyIGV4dHJhcyA9IHRpbGVzZXQuYXNzZXQuZXh0cmFzO1xuICAgIGlmIChcbiAgICAgIENlc2l1bS5kZWZpbmVkKGV4dHJhcykgJiZcbiAgICAgIENlc2l1bS5kZWZpbmVkKGV4dHJhcy5pb24pICYmXG4gICAgICBDZXNpdW0uZGVmaW5lZChleHRyYXMuaW9uLmRlZmF1bHRTdHlsZSlcbiAgICApIHtcbiAgICAgIHRpbGVzZXQuc3R5bGUgPSBuZXcgQ2VzaXVtLkNlc2l1bTNEVGlsZVN0eWxlKGV4dHJhcy5pb24uZGVmYXVsdFN0eWxlKTtcbiAgICB9XG4gIH0pXG4gIC5vdGhlcndpc2UoZnVuY3Rpb24gKGVycm9yKSB7XG4gICAgY29uc29sZS5sb2coZXJyb3IpO1xuICB9KTtcbiIsImh0bWwiOiI8c3R5bGU+XG4gIEBpbXBvcnQgdXJsKC4uL3RlbXBsYXRlcy9idWNrZXQuY3NzKTtcbjwvc3R5bGU+XG48ZGl2IGlkPVwiY2VzaXVtQ29udGFpbmVyXCIgY2xhc3M9XCJmdWxsU2l6ZVwiPjwvZGl2PlxuPGRpdiBpZD1cImxvYWRpbmdPdmVybGF5XCI+XG4gIDxoMT5Mb2FkaW5nLi4uPC9oMT5cbjwvZGl2PlxuPGRpdiBpZD1cInRvb2xiYXJcIj48L2Rpdj5cbiJ9) but it does not clamp to Cesium World Terrain in Unreal Engine (see attached screenshots). The first screenshot shows the tiles as added into the project. I only start seeing the tops of the geometry upon giving the object a z location transform of 2000. The second screenshot is of the geometries at a z location transform of 10,000. All the geometries are the same height. The CityGML file is here:

> **[RS\_parcel.gml](https://drive.google.com/file/d/1YO5HHeWK3Q3YMqubQ0FUS32O-xQnMW_h/view?usp=sharing)**
>
> Google Drive file.

 ![Screenshot (69)](https://global.discourse-cdn.com/cesium/original/2X/a/ad0dc5e2f4afc70eec7b35c99465da4baf29396a.jpeg)  
 ![Screenshot (70)](https://global.discourse-cdn.com/cesium/original/2X/2/21f79f9453d8722ec887a5a3f638272e5f02551c.jpeg)

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [November 17, 2021, 3:49am UTC](https://community.cesium.com/t/citygml-clamped-to-cesium-world-terrain-in-sandcastle-but-not-in-unreal-engine/16185/2 "2021-11-17T03:49:36Z")

</div>

Hi @jill,

Can you please verify that both the Cesium World Terrain Actor and the GML tileset Actor have their Location property in the Unreal Editor set to (0, 0, 0)? The Actor Transform is applied after the georeferencing, so an offset there can cause the sort of misalignment you’re seeing.

Kevin

---

<div class="post-metadata">

**Author:** ![jill](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jill/32/4455_2.png) [@jill](https://community.cesium.com/u/jill)\
**Post date:** [November 17, 2021, 5:36am UTC](https://community.cesium.com/t/citygml-clamped-to-cesium-world-terrain-in-sandcastle-but-not-in-unreal-engine/16185/3 "2021-11-17T05:36:03Z")

</div>

Yes, they are both set to (0,0,0). The GML tileset aligns perfectly along the lat, lon coordinates as well.

---

<div class="post-metadata">

**Author:** ![jill](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jill/32/4455_2.png) [@jill](https://community.cesium.com/u/jill)\
**Post date:** [November 17, 2021, 7:05am UTC](https://community.cesium.com/t/citygml-clamped-to-cesium-world-terrain-in-sandcastle-but-not-in-unreal-engine/16185/4 "2021-11-17T07:05:07Z")

</div>

I redid my CityGML file and uploaded it to Cesium ion and now I am clamping successfully to the Cesium World Terrain. Not sure what was wrong with the original CityGML file that I posted here. I do know that I used a different CRS for the CityGML file (EPSG:2229). Maybe I did not check “Clamp to terrain” when uploading to Cesium ion for conversion to 3D tiles.

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [November 17, 2021, 10:01am UTC](https://community.cesium.com/t/citygml-clamped-to-cesium-world-terrain-in-sandcastle-but-not-in-unreal-engine/16185/5 "2021-11-17T10:01:20Z")

</div>

Yeah I think that’s a good guess. The original tileset you shared seemed to be clamped to the ellipsoid rather than the terrain surface. Glad you hear you were able to get it working!
