# Clamp to Ground Status

**URL:** <https://community.cesium.com/t/clamp-to-ground-status/3151>\
**Category:** CesiumJS\
**Created:** [October 6, 2015, 8:46am UTC](https://community.cesium.com/t/clamp-to-ground-status/3151 "2015-10-06T08:46:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erik\_Hellstedt](https://avatars.discourse-cdn.com/v4/letter/e/a9a28c/32.png) [@Erik\_Hellstedt](https://community.cesium.com/u/Erik_Hellstedt)\
**Post date:** [October 6, 2015, 8:46am UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/1 "2015-10-06T08:46:53Z")

</div>

Hi all,

I am interested in the current status of Clamp-to-Ground. I know it is a priority and there's been a lot of progress. But I haven't been able to keep straight which types of primitives currently use this feature.

Billboards  
Points  
Lines  
Polygons  
Models  
Ellipse

I am looking forward to move my model-heavy CZML dataSource from ellipsoid to STK world mesh (e.g. [http://www.geo-animate.com/category/world-war-ii/battle-for-normandy-1944/](http://www.geo-animate.com/category/world-war-ii/battle-for-normandy-1944/)).

Cheers, erik hellstedt

---

<div class="post-metadata">

**Author:** ![Erik\_Hellstedt2](https://avatars.discourse-cdn.com/v4/letter/e/4491bb/32.png) [@Erik\_Hellstedt2](https://community.cesium.com/u/Erik_Hellstedt2)\
**Post date:** [October 6, 2015, 8:59am UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/2 "2015-10-06T08:59:10Z")

</div>

Me again. Just to clarify my post, I meant to ask “Would someone provide a quick status update for each type of primitives?” Cheers, erik

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [October 6, 2015, 3:17pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/3 "2015-10-06T15:17:17Z")

</div>

Hello Erik,

So far, only the BillboardCollection and LabelCollection have the ability to set heightReference: Cesium.HeightReference.CLAMP\_TO\_GROUND.  
We also recently introduced the [GroundPrimitive](http://cesiumjs.org/Cesium/Build/Documentation/GroundPrimitive.html), which can be used for CircleGeometry, CorridorGeometry, EllipseGeometry, PolygonGeometry and RectangleGeometry on terrain.

Neither of these have been implemented in the Entity API, so they cannot be used from CZML yet.

I believe we plan on looking to do ground polylines next, but there is a lot of research that needs to be done first so I’m not sure how soon that will be finished. I’m not sure what the status is for models and other primitive types.

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![falco103](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@falco103](https://community.cesium.com/u/falco103)\
**Post date:** [October 7, 2015, 1:12am UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/4 "2015-10-07T01:12:32Z")

</div>

Will entity support likely come before or after comprehensive clamping support?

Or will we likely see some kind of global clamp/no clamp flag?

---

<div class="post-metadata">

**Author:** ![Greg\_Angevine](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Greg\_Angevine](https://community.cesium.com/u/Greg_Angevine)\
**Post date:** [November 1, 2016, 8:06pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/5 "2016-11-01T20:06:29Z")

</div>

Hi Hannah, has the Cesium dev team discussed Clamp to Ground on polygons any further? It would be really helpful to be able to clamp a CZML polygon to a hillside.

Cheers,

Greg

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [November 1, 2016, 8:21pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/6 "2016-11-01T20:21:35Z")

</div>

Hello Greg,

Yes, CZML polygons (and other ground geometry like ellipses and corridors) with 0 height clamp to terrain by default now. Here’s a code example:

var czml = [{  
“id” : “document”,  
“name” : “CZML Geometries: Polygon”,  
“version” : “1.0”  
}, {  
“id” : “redPolygon”,  
“name” : “Red polygon on surface”,  
“polygon” : {  
“positions” : {  
“cartographicDegrees” : [  
-119.5644, 37.7582, 0,  
-119.5593, 37.7382, 0,  
-119.5284, 37.7373, 0,  
-119.5317, 37.7642, 0  
]  
},  
“material” : {  
“solidColor” : {  
“color” : {  
“rgba” : [255, 0, 0, 124]  
}  
}  
}  
}  
}];

var viewer = new Cesium.Viewer(‘cesiumContainer’);  
var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({  
url : ‘[https://assets.agi.com/stk-terrain/world](https://assets.agi.com/stk-terrain/world)’,  
requestWaterMask : true,  
requestVertexNormals : true  
});  
viewer.terrainProvider = cesiumTerrainProviderMeshes;  
var dataSource = Cesium.CzmlDataSource.load(czml);  
viewer.dataSources.add(dataSource);  
viewer.zoomTo(dataSource);

``

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![Greg\_Angevine](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Greg\_Angevine](https://community.cesium.com/u/Greg_Angevine)\
**Post date:** [November 2, 2016, 4:15pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/7 "2016-11-02T16:15:17Z")

</div>

Thanks Hannah, what about polygons with height? Its simple to clamp a cube to terrain with KML in GE but it still seems impossible with Cesium, is that the case as you see it?

Many thanks,

Greg

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [November 2, 2016, 4:59pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/8 "2016-11-02T16:59:01Z")

</div>

Hi Greg,

There’s no support for polygons with height at this time. It’s a much more complicated graphics problem and we need to do some research to figure out the best way to do this. I think it will need to use a completely different approach than the surface polygons.

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![Greg\_Angevine](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Greg\_Angevine](https://community.cesium.com/u/Greg_Angevine)\
**Post date:** [November 3, 2016, 8:25am UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/9 "2016-11-03T08:25:40Z")

</div>

Thanks Hannah, that’s what I feared… its really a major impediment to using Cesium for urban modelling if you can’t clamp 3D geometry to terrain. Hopefully its at least being discussed by the team for future implementation.

Best,

Greg

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [November 3, 2016, 2:23pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/10 "2016-11-03T14:23:43Z")

</div>

Hi Greg,

For that kind of use case I would recommend using 3D Tiles. You can create tilesets that put buildings at a height based on the terrain. You can learn more about 3D tiles in this forum post: [https://groups.google.com/d/msg/cesium-dev/tCCooBxpZFU/7hxT\_E4pGgAJ](https://groups.google.com/d/msg/cesium-dev/tCCooBxpZFU/7hxT_E4pGgAJ)

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![MP11](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@MP11](https://community.cesium.com/u/MP11)\
**Post date:** [November 4, 2016, 12:28pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/11 "2016-11-04T12:28:50Z")

</div>

Hi Hannah,

I am referring this sample code of 3D tiles [https://github.com/AnalyticalGraphicsInc/cesium/blob/3d-tiles/Apps/Sandcastle/gallery/3D%20Tiles.html](https://github.com/AnalyticalGraphicsInc/cesium/blob/3d-tiles/Apps/Sandcastle/gallery/3D%20Tiles.html)

But I get error on line #74 saying “Uncaught TypeError: undefined is not a function”.

Also I am unable to find documentation for ‘Cesium3DTileset’ in document references.

Using latest Cesium version 1.27.

I am unable to figure out what’s going wrong there…

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [November 4, 2016, 2:16pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/12 "2016-11-04T14:16:21Z")

</div>

Hi MP,

You will need to check out the 3d-tiles branch in order for that example to work: [https://github.com/AnalyticalGraphicsInc/cesium/tree/3d-tiles](https://github.com/AnalyticalGraphicsInc/cesium/tree/3d-tiles)

See our build guide for instructions on checking out and building the code base: [https://github.com/AnalyticalGraphicsInc/cesium/tree/3d-tiles/Documentation/Contributors/BuildGuide](https://github.com/AnalyticalGraphicsInc/cesium/tree/3d-tiles/Documentation/Contributors/BuildGuide)

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![MP11](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@MP11](https://community.cesium.com/u/MP11)\
**Post date:** [November 7, 2016, 8:09am UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/13 "2016-11-07T08:09:59Z")

</div>

Thanks Hannah!

By when this branch will be merged with master and released?

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [November 7, 2016, 3:43pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/14 "2016-11-07T15:43:50Z")

</div>

There’s still a lot of work that needs to be done, but we’re hoping to get it merged by Spring 2017

-Hannah

---

<div class="post-metadata">

**Author:** ![Erik\_Hellstedt2](https://avatars.discourse-cdn.com/v4/letter/e/4491bb/32.png) [@Erik\_Hellstedt2](https://community.cesium.com/u/Erik_Hellstedt2)\
**Post date:** [November 7, 2016, 4:33pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/15 "2016-11-07T16:33:37Z")

</div>

Great news Hannah. Do you foresee this work including being able to clamp to the ground models that move through time from one point to another? Cheers, Erik

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [November 7, 2016, 7:24pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/16 "2016-11-07T19:24:37Z")

</div>

Hi Erik, I’m not sure if that’s going to be in the initial spec. Maybe that has been answered somewhere in the 3D tiles forum post: [https://groups.google.com/d/msg/cesium-dev/tCCooBxpZFU/7hxT\_E4pGgAJ](https://groups.google.com/d/msg/cesium-dev/tCCooBxpZFU/7hxT_E4pGgAJ)

-Hannah

---

<div class="post-metadata">

**Author:** ![MP11](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@MP11](https://community.cesium.com/u/MP11)\
**Post date:** [November 8, 2016, 7:12am UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/17 "2016-11-08T07:12:44Z")

</div>

Hi Hannah,

I have checked out this 3d-tiles branch but I am getting 404 errors for Cesium.js and Cesium.css for basic HelloWorld page.

And a long list of 404 errors in console for a 3d tiles page from sandcastle. Few of them are for files listed below:

Source/Shaders/AdjustTranslucentFS.js

Source/Shaders/Appearances/BasicMaterialAppearanceFS.js

Source/Shaders/Appearances/AllMaterialAppearanceVS.js

etc…

I am using Xampp server on Windows 7.

What am I missing to get this working? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![MP11](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@MP11](https://community.cesium.com/u/MP11)\
**Post date:** [November 8, 2016, 10:50am UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/18 "2016-11-08T10:50:25Z")

</div>

Hi Hannah,

The below issue happened as I haven’t built the project. Do you have any idea how to build it in XAMPP environment as I am not familiar with node.js?

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [November 8, 2016, 12:50pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/19 "2016-11-08T12:50:11Z")

</div>

Hello,

You will need to install node because it is used to run the build code and start the server we include with the project. You can follow these instructions: [https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Documentation/Contributors/BuildGuide#build-the-code](https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Documentation/Contributors/BuildGuide#build-the-code)

Best,

Hannah

---

<div class="post-metadata">

**Author:** ![s.plaenitz](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@s.plaenitz](https://community.cesium.com/u/s.plaenitz)\
**Post date:** [November 9, 2016, 8:02pm UTC](https://community.cesium.com/t/clamp-to-ground-status/3151/20 "2016-11-09T20:02:23Z")

</div>

Hey, is there now a possiblity to clamp Cesium3DTileset Models to Ground?  
If not, is it possible to use the modelMatrix to move it in hight for all?  
Please describe how it would work.

[Next page](https://community.cesium.com/t/clamp-to-ground-status/3151.md?page=2)
