# geojson not draped in the elevated region

**URL:** <https://community.cesium.com/t/geojson-not-draped-in-the-elevated-region/5682>\
**Category:** CesiumJS\
**Created:** [June 21, 2017, 5:50am UTC](https://community.cesium.com/t/geojson-not-draped-in-the-elevated-region/5682 "2017-06-21T05:50:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nigamricha17](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@nigamricha17](https://community.cesium.com/u/nigamricha17)\
**Post date:** [June 21, 2017, 5:50am UTC](https://community.cesium.com/t/geojson-not-draped-in-the-elevated-region/5682/1 "2017-06-21T05:50:37Z")

</div>

I have a shape (.shp) file of a particular area, which i converted to .geojson and rendered it over my map. This geojson has LineString features.  
Next, i change my openlayers3 to ol3cesium globe mode.

Since i have rendered elevations (.terrain) , i can see elevations of that same area.

But i dont see the linestrings draped on the elevated areas (hills), i can see them floating over them as a 2d.

What could be the issue?

---

<div class="post-metadata">

**Author:** ![Guillaume\_Beraudo](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/guillaume_beraudo/32/2985_2.png) [@Guillaume\_Beraudo](https://community.cesium.com/u/Guillaume_Beraudo)\
**Post date:** [June 21, 2017, 7:02am UTC](https://community.cesium.com/t/geojson-not-draped-in-the-elevated-region/5682/2 "2017-06-21T07:02:38Z")

</div>

Hi,

You need to set the clampToGround altitudeMode in the layer. See how it is done in the vector example:  
[https://github.com/openlayers/ol-cesium/blob/master/examples/vectors.js#L315](https://github.com/openlayers/ol-cesium/blob/master/examples/vectors.js#L315)

It will then use the corridor hack to render the lines on the terrain.

Not that the lines are only visible when you are close to the terrain.

BR,

Guillaume Beraudo

---

<div class="post-metadata">

**Author:** ![Rachel\_Hwang](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@Rachel\_Hwang](https://community.cesium.com/u/Rachel_Hwang)\
**Post date:** [June 21, 2017, 12:52pm UTC](https://community.cesium.com/t/geojson-not-draped-in-the-elevated-region/5682/3 "2017-06-21T12:52:25Z")

</div>

Hi there,

Here are some examples of ground clamping. Hope that helps! [http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Ground%20Clamping.html&label=Showcases](http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Ground%20Clamping.html&label=Showcases)

Note that height should not be set in order for ground clamping to work.

Hope that helps,

- Rachel

---

<div class="post-metadata">

**Author:** ![nigamricha17](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@nigamricha17](https://community.cesium.com/u/nigamricha17)\
**Post date:** [June 23, 2017, 6:26am UTC](https://community.cesium.com/t/geojson-not-draped-in-the-elevated-region/5682/4 "2017-06-23T06:26:52Z")

</div>

Hi,

I tried with a single rectangle, having hard-coded degrees. I could see draping of the polygon over the elevations.

Below is the code:

var rectangleInstance = new Cesium.GeometryInstance({

geometry: new Cesium.RectangleGeometry({

rectangle: Cesium.Rectangle.fromDegrees(-140.0, 30.0, -100.0, 40.0)

}),

id: ‘rectangle’,

attributes: {

color: new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 0.5)

}

});

this.scene.primitives.add(new Cesium.GroundPrimitive({

geometryInstances: rectangleInstance

}));

But now my query is how do i link my (polygon features) geojson file lat-lon degrees of many features to the above code?

---

<div class="post-metadata">

**Author:** ![richanigam17](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@richanigam17](https://community.cesium.com/u/richanigam17)\
**Post date:** [June 23, 2017, 1:29pm UTC](https://community.cesium.com/t/geojson-not-draped-in-the-elevated-region/5682/5 "2017-06-23T13:29:49Z")

</div>

Hi,  
I achieved polygon draping over elevations using altitudeMode = 'clampToGround' alone.

But not achieving the same for LineString geometry of geojson. How to do that?  
I added the same code in the Linestring features geojson vector layer. But lines are not draped over elevations.

---

<div class="post-metadata">

**Author:** ![Davor\_Fiedler](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/davor_fiedler/32/1987_2.png) [@Davor\_Fiedler](https://community.cesium.com/u/Davor_Fiedler)\
**Post date:** [June 24, 2017, 8:10pm UTC](https://community.cesium.com/t/geojson-not-draped-in-the-elevated-region/5682/6 "2017-06-24T20:10:42Z")

</div>

_Dana petak, 23. lipnja 2017. u 08:26:53 UTC+2, korisnik [nigamr...@gmail.com](mailto:nigamr...@gmail.com) napisao je:_

> _…_

> _But now my query is how do i link my (polygon features) geojson file lat-lon degrees of many features to the above code?_

This is working for me:  
[![](https://global.discourse-cdn.com/cesium/original/3X/1/2/129a4f7a1dc16f5fa0bb231815680d17324578bf.jpeg)](https://lh3.googleusercontent.com/-MTQDTZRNw0Q/WU7G0293-5I/AAAAAAAAECE/R-wyoFUwfSUi5sbOtFW2eA6QtIJOIEOjACLcBGAs/s1600/draping_poly_geojson.jpg)

…  
viewer.dataSources.add(Cesium.GeoJsonDataSource.load(‘…/geojson/NP\_poly.geojson’, {  
clampToGround : true,  
stroke: Cesium.Color.DARKGREEN,  
fill: Cesium.Color.GREEN.withAlpha(0.5),  
strokeWidth: 3,  
})  
…

---

<div class="post-metadata">

**Author:** ![nigamricha17](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@nigamricha17](https://community.cesium.com/u/nigamricha17)\
**Post date:** [June 26, 2017, 5:50am UTC](https://community.cesium.com/t/geojson-not-draped-in-the-elevated-region/5682/7 "2017-06-26T05:50:08Z")

</div>

Hi Davor,

Yes, I have successfully achieved polygon draping but haven’t achieved linestring draping using geojson.

I wrote the same in my last post.

---

<div class="post-metadata">

**Author:** ![nigamricha17](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@nigamricha17](https://community.cesium.com/u/nigamricha17)\
**Post date:** [June 26, 2017, 6:51am UTC](https://community.cesium.com/t/geojson-not-draped-in-the-elevated-region/5682/8 "2017-06-26T06:51:26Z")

</div>

Also, the linestrings are going underground, they are not visible over the map elevations, but can be seen on zooming a lot - below the ground.

---

<div class="post-metadata">

**Author:** ![Rachel\_Hwang](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@Rachel\_Hwang](https://community.cesium.com/u/Rachel_Hwang)\
**Post date:** [June 26, 2017, 2:35pm UTC](https://community.cesium.com/t/geojson-not-draped-in-the-elevated-region/5682/9 "2017-06-26T14:35:58Z")

</div>

Hi there,

This may be related to the fact that we don’t currently support ground clamping for polylines. As a workaround, you can use corridors instead.

Hope that helps,

- Rachel
