# GeoServer and Cesium for Terrain Rendering

**URL:** <https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958>\
**Category:** CesiumJS\
**Created:** [January 28, 2014, 10:57am UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958 "2014-01-28T10:57:59Z")\
**Posts on this page:** 16\
**Page:** 3

<div class="post-metadata">

**Author:** ![ccyeh0901](https://avatars.discourse-cdn.com/v4/letter/c/91b2a8/32.png) [@ccyeh0901](https://community.cesium.com/u/ccyeh0901)\
**Post date:** [January 8, 2015, 10:31am UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/41 "2015-01-08T10:31:21Z")

</div>

i just download the geoserver and execute the startup.bat to run it. of course the Java is installed beforehand....btw, i changed the port from 8080 to 8090

the srtm data is preprocessed before and loaded into geoserver.

and in the same machine i use node.js to rin the web server. the port is 8080.

that is all....

---

<div class="post-metadata">

**Author:** ![abdou](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/abdou/32/2012_2.png) [@abdou](https://community.cesium.com/u/abdou)\
**Post date:** [January 8, 2015, 2:37pm UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/42 "2015-01-08T14:37:21Z")

</div>

Sorry I can't help you, I don't know how to manage CORS issue with geoserver in standalone application.

---

<div class="post-metadata">

**Author:** ![ccyeh0901](https://avatars.discourse-cdn.com/v4/letter/c/91b2a8/32.png) [@ccyeh0901](https://community.cesium.com/u/ccyeh0901)\
**Post date:** [January 9, 2015, 7:00am UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/43 "2015-01-09T07:00:05Z")

</div>

bobac...@gmail.com於 2015年1月8日星期四 UTC+8下午10時37分21秒寫道：

---

<div class="post-metadata">

**Author:** ![ccyeh0901](https://avatars.discourse-cdn.com/v4/letter/c/91b2a8/32.png) [@ccyeh0901](https://community.cesium.com/u/ccyeh0901)\
**Post date:** [January 9, 2015, 8:50am UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/44 "2015-01-09T08:50:45Z")

</div>

ccye...@gmail.com於 2015年1月9日星期五 UTC+8下午3時00分06秒寫道：

> bobac...@gmail.com於 2015年1月8日星期四 UTC+8下午10時37分21秒寫道：  
> \> \> i just download the geoserver and execute the startup.bat to run it. of course the Java is installed beforehand....btw, i changed the port from 8080 to 8090  
> \> \>  
> \> \> the srtm data is preprocessed before and loaded into geoserver.  
> \> \>  
> \> \> and in the same machine i use node.js to rin the web server. the port is 8080.  
> \> \>  
> \> \> that is all....  
> \>  
> \> Sorry I can't help you, I don't know how to manage CORS issue with geoserver in standalone application.
> 
> I see, so geoserver can be run in another form (not under JAVA), I got it!  
> May I ask you how you run your geoserver and how you treat your CORS issue under that.  
> Hope it doesn't bother you too much..^^

I guess I already found the mistake....  
because I run geoserver in different port (8090) and I run the Cesium web service in 8080 so the resource can't be shared ....

could you please tell me how to run these two service into one web server? (the same port )

---

<div class="post-metadata">

**Author:** ![abdou](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/abdou/32/2012_2.png) [@abdou](https://community.cesium.com/u/abdou)\
**Post date:** [January 9, 2015, 2:19pm UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/45 "2015-01-09T14:19:42Z")

</div>

I don't think that is the good approach. The easiest way is to install geoserver in a java application server (tomcat, jboss, jetty..) and after you configure the server to allow the resource share.  
On the same machine you can't have two applications listening the same port (8080 or 8090)

---

<div class="post-metadata">

**Author:** ![jai\_singla](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jai_singla/32/34875_2.png) [@jai\_singla](https://community.cesium.com/u/jai_singla)\
**Post date:** [July 26, 2016, 11:37am UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/46 "2016-07-26T11:37:14Z")

</div>

Hello farouk,

Trying to add terrain using geoserver using

Cesium.GeoserverTerrainProvider says it is not a function.

Please help.

regards  
Jai

---

<div class="post-metadata">

**Author:** ![abdou](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/abdou/32/2012_2.png) [@abdou](https://community.cesium.com/u/abdou)\
**Post date:** [July 26, 2016, 6:00pm UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/47 "2016-07-26T18:00:30Z")

</div>

Sorry,  
could you explain what you did?

---

<div class="post-metadata">

**Author:** ![jai\_singla](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/jai_singla/32/34875_2.png) [@jai\_singla](https://community.cesium.com/u/jai_singla)\
**Post date:** [July 27, 2016, 4:39am UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/48 "2016-07-27T04:39:36Z")

</div>

Previous error is gone now.

I included GeoServerTerrainProvider.js

but now facing a new challenge .

It says Uncaught typeerror : can not read property ‘getContext’ of undefined on var scene= new Cesium.Scene(canvas); line

I am using latest cesium version. Please, help.

---

<div class="post-metadata">

**Author:** ![abdou](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/abdou/32/2012_2.png) [@abdou](https://community.cesium.com/u/abdou)\
**Post date:** [July 27, 2016, 4:43am UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/49 "2016-07-27T04:43:34Z")

</div>

Could you send your code please?

---

<div class="post-metadata">

**Author:** ![ronak.ashar8399](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@ronak.ashar8399](https://community.cesium.com/u/ronak.ashar8399)\
**Post date:** [December 28, 2016, 10:14am UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/50 "2016-12-28T10:14:29Z")

</div>

\<html\>  
\<script src="Cesium-1.26/Build/Cesium/Cesium.js" type="text/javascript"\>\</script\>  
\<script src="Cesium-GeoserverTerrainProvider-master/GeoserverTerrainProvider.js" type="text/javascript"\>\</script\>  
&nbsp;&nbsp;\<style\>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@import url(./Cesium-1.26/Build/Cesium/Widgets/widgets.css);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;html, body, #cesiumContainer {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;\</style\>  
\<body\>  
\<canvas id="cesiumContainer"\>\</canvas\>  
\<script\>  
&nbsp;&nbsp;&nbsp;&nbsp;var canvas = document.getElementById('cesiumContainer');  
&nbsp;&nbsp;&nbsp;&nbsp;var scene = new Cesium.Scene(canvas);  
&nbsp;&nbsp;&nbsp;&nbsp;var primitives = scene.primitives;  
&nbsp;&nbsp;&nbsp;&nbsp;var globe = new Cesium.Globe(Cesium.Ellipsoid.WGS84);  
&nbsp;&nbsp;&nbsp;&nbsp;scene.globe=globe;s

&nbsp;&nbsp;&nbsp;&nbsp;var terrainProvider = new Cesium.GeoserverTerrainProvider({  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;url : "[http://localhost:8080/geoserver/wcs/wms](http://localhost:8080/geoserver/wcs/wms)",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layerName: "wcs:clip11(reproject)",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;waterMask:true  
&nbsp;&nbsp;&nbsp;&nbsp;});  
&nbsp;&nbsp;&nbsp;&nbsp;globe.terrainProvider = terrainProvider;  
&nbsp;&nbsp;&nbsp;&nbsp;var hand = new Cesium.ScreenSpaceEventHandler(canvas);  
&nbsp;&nbsp;&nbsp;&nbsp;// return altitude with double click in console.log!!  
hand.setInputAction(  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function (movement) {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(movement.position != null) {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var cartesian = scene.camera.pickEllipsoid(movement.position, ellipsoid);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (cartesian) {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var cartographic = ellipsoid.cartesianToCartographic(cartesian);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cartographic.height=globe.getHeight(cartographic);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log("lat= "+(cartographic.latitude\*180/Math.PI)+"°; long="+(cartographic.longitude\*180/Math.PI)+"°; altitude="+cartographic.height+" meters")  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}, Cesium.ScreenSpaceEventType.LEFT\_DOUBLE\_CLICK);  
\</script\>

\</body\>  
\</html\>

this is my code. I get the same error as mentioned above

Uncaught typeerror : can not read property 'getContext' of undefined on var scene= new Cesium.Scene(canvas)

---

<div class="post-metadata">

**Author:** ![abdou](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/abdou/32/2012_2.png) [@abdou](https://community.cesium.com/u/abdou)\
**Post date:** [December 29, 2016, 11:09am UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/51 "2016-12-29T11:09:57Z")

</div>

Hello and sorry, I can’t reproduce your issue.  
For information you should use [http://localhost:8080/geoserver/ows](http://localhost:8080/geoserver/ows) instead of [http://localhost:8080/geoserver/wcs/wms](http://www.google.com/url?q=http%3A%2F%2Flocalhost%3A8080%2Fgeoserver%2Fwcs%2Fwms&sa=D&sntz=1&usg=AFQjCNHA9FSXAV2ZosgrjBF1h_KpTWHz4Q)

---

<div class="post-metadata">

**Author:** ![Scott\_Haynes](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/scott_haynes/32/2063_2.png) [@Scott\_Haynes](https://community.cesium.com/u/Scott_Haynes)\
**Post date:** [June 13, 2018, 12:05am UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/52 "2018-06-13T00:05:51Z")

</div>

I need to get a demo working with Cesium and Geoserver. Is there a link with the latest info about having the two technologies working together? Is the GeoserverTerrainProvider the best bet? This post is a couple of year old at this point, so I was wondering if there was any new information.

Scott

---

<div class="post-metadata">

**Author:** ![abdou](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/abdou/32/2012_2.png) [@abdou](https://community.cesium.com/u/abdou)\
**Post date:** [June 13, 2018, 4:18pm UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/53 "2018-06-13T16:18:18Z")

</div>

Hello, I try to maintain GeoserverTerrainProvider in compliance with Cesium version. But I can’t say if it’s the best plugin for your use case.

---

<div class="post-metadata">

**Author:** ![basant1431](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/basant1431/32/3476_2.png) [@basant1431](https://community.cesium.com/u/basant1431)\
**Post date:** [May 31, 2022, 12:24pm UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/54 "2022-05-31T12:24:54Z")

</div>

Hi @abdou, does your plugin work for latest cesium js version (1.89)? As I tried it but I am getting many issues. I’ll share my issues, but before that I want to make sure if your plugin is suitable for the latest cesium version. Please write back to me as soon as possible. I am trying to create terrain from dem data using geoserver for cesium js.  
Thank you

---

<div class="post-metadata">

**Author:** ![abdou](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/abdou/32/2012_2.png) [@abdou](https://community.cesium.com/u/abdou)\
**Post date:** [July 6, 2022, 6:57pm UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/55 "2022-07-06T18:57:40Z")

</div>

Hello, I just update the repository to be compliant with cesium 1.95

---

<div class="post-metadata">

**Author:** ![basant1431](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/basant1431/32/3476_2.png) [@basant1431](https://community.cesium.com/u/basant1431)\
**Post date:** [July 7, 2022, 5:18am UTC](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958/56 "2022-07-07T05:18:22Z")

</div>

@abdou ,Thank you for the update

[Previous page](https://community.cesium.com/t/geoserver-and-cesium-for-terrain-rendering/958.md?page=2)
