GeoServer and Cesium for Terrain Rendering

5,236 views
Skip to first unread message

dext...@gmail.com

unread,
Jan 28, 2014, 5:57:59 AM1/28/14
to cesiu...@googlegroups.com
Hello!

I'm trying to build a terrain visualization stack on my local machine using Cesius and GeoServer (using other proprietary servers is not an option). Unfortunately, I didn't have much luck.

1 - Why was WebMapServiceTerrainProvider removed from the master branch? In an older discussion here in cesium-dev there was a patch to make it work on latest Cesium. Is there any other problem with it?

2 - What's the point of using BIL format on GeoServer instead of plain PNG or other format? I seem to understand it has something to do with terrain data resolution, but I'm not quite sure.

I'm sorry for the naive questions, but I would like to understand :)

Alessio

bobac...@gmail.com

unread,
Jan 28, 2014, 6:50:48 AM1/28/14
to cesiu...@googlegroups.com, dext...@gmail.com
Hello I'm implementing a solution a terrain provider which uses Geoserver.
This solution works with bil,gif,png ang jpeg formats. The bil format is an array directly directly machine readable. The others formats need a little transformation (picture to array).
I'm using SRTM 250 meters in my tests.
Best regards

dext...@gmail.com

unread,
Jan 28, 2014, 7:18:27 AM1/28/14
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com
Thank you very much for your reply. I just found your repository and compiled Cesium with GeoServerProvider support.

I know this is a bit OT, but can you point me to a guide or something to understand how to import SRTM data to GeoServer?

Also would you please post a snippet on how to use your provider in Cesium?

Thank you very much!

bobac...@gmail.com

unread,
Jan 28, 2014, 2:16:07 PM1/28/14
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com
Hello,
1- you can download SRTM data at http://srtm.csi.cgiar.org/
2- you need to install GDAL tools and python to work with SRTM http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
3- you need to install geoserver image pyramid plugin
4- a guide is available at http://docs.geoserver.org/latest/en/user/tutorials/imagepyramid/imagepyramid.html

I didn't make a documentation to my implementation of geoserver terrain provider. I'll write it soon. I saw that you find my github.
Once you defined a layer of SRTM in geoserver, you could use this snippet:

var terrainProvider = new Cesium.GeoserverTerrainProvider({
url : "http://localhost:8080/geoserver/elevation/wms",
layerName: "SRTM250",
maxLevel:4,
heightmapWidth:65
});
centralBody.terrainProvider = terrainProvider;

dext...@gmail.com

unread,
Jan 29, 2014, 4:11:21 AM1/29/14
to cesiu...@googlegroups.com, bobac...@gmail.com
Thank you for your reply and support. Unfortunately, even though I've succeeded in visualizing something, the resulting rendering is not correct. I think I'm missing something here. That's what I did so far:

1. Installed both the DDS/BIL and tyhe Image Pyramid plugin
2. Downloaded GDAL and SRTM250
3. Used this command (taken from your previous post):
gdal_retile.py -v -r lanczos -levels 6 -ps 2048 2048 -co "TILED=YES" -co "COMPRESS=DEFLATE" -co "ZLEVEL=4" -ot Int16 -targetDir pyramid srtm250.tif
4. Added a new layer in GeoServer
5. USed the code you provided

Unfortunately I get glitchy visualization (see this picture: http://postimg.org/image/bj7c5mrcv/ ) and many errors in the JS Console (see the picture).

I think the visualization is wrong also because I see lakes textures over montains geometries..!

bobac...@gmail.com

unread,
Jan 29, 2014, 4:02:17 PM1/29/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com
I have sames glitches:
- Mount Everest in sandCastle with cesium provider: http://postimg.org/image/e33fiqlg5/
- Same spot with geoserver terrain provider, 250 m SRTM and maxlevel=4: http://postimg.org/image/j9ekts07p/ (maybe sampling of terrain change geometry of terrain??)
- Same spot with geoserver terrain provider, 250 m SRTM and maxlevel=5: http://postimg.org/image/b56gp1dsl/
- Same spot with geoserver terrain provider, 250 m SRTM and maxlevel=7: http://postimg.org/image/jpzsg7nyt/
- Same spot with geoserver terrain provider, 90 m SRTM and maxlevel=8: http://postimg.org/image/em8is0cut/

I suppose that quality of tiles influence sampling of terrains and so for the maxlevel that you can define in geoserver terrain provider (it's experimental).

Also I regenerate my tiles with lower dimension (1024X1024) from ASCII SRTM 250m. This operation takes lots of time on my laptop (10hours and the first level is not coompleted). After I generate tiles from SRTM 90m.
I'll give you my conclusion or my update on my github repository.

dext...@gmail.com

unread,
Jan 30, 2014, 3:28:23 AM1/30/14
to cesiu...@googlegroups.com, bobac...@gmail.com
I'm not quite sure it's a matter of data resolution: I've slightly modified the old WebMapServiceTerrainProvider and made it work with the current cesium build (b-24). It's not perfect, but doesn't seem to show the same glitch. Can you confirm?

The working WebMapServiceTerrainProvider is available here: https://dl.dropboxusercontent.com/u/10671464/WebMapServiceTerrainProvider.js

bobac...@gmail.com

unread,
Jan 30, 2014, 7:05:48 AM1/30/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com
I should try with snippets of code where it change Endianness of array. I can't evaluate while my computer works on generation of tiles...
But by the way, your geoserver can product data in application/bil16?

dext...@gmail.com

unread,
Jan 30, 2014, 7:12:28 AM1/30/14
to cesiu...@googlegroups.com, bobac...@gmail.com
Yes, seems like a reasonable place to look for a bug to me. Yes, my server can generate application/bil16 using this plugin (http://docs.geoserver.org/stable/en/user/community/dds/index.html)

bobac...@gmail.com

unread,
Jan 30, 2014, 7:34:04 AM1/30/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com
But you can also try in my implementation before me.In Source / Scene /WmsParserHelper.js at line 322 you've got a static array in which is defined how to manage data array format from web map service protocole. This array is not complete but you can define a new type on same model to give to constructor of geoserverTerrainprovider:
var terrainProvider = new Cesium.GeoserverTerrainProvider({
url : "http://localhost:8080/geoserver/elevation/wms",
layerName: "SRTM250",
maxLevel:4,
heightmapWidth:65,
formatArray: {
format : "application/bil16",
postProcessArray : function(bufferIn) {
// bil is 16 bits big endian cell
var viewerIn = new DataView(bufferIn);
var littleEndianBuffer = new ArrayBuffer(bufferIn.byteLength);
var viewerOut = new DataView(littleEndianBuffer);
//time to switch bytes!!
for (var i = 0; i < bufferIn.byteLength; i += 2) {
viewerOut.setInt16(i, viewerIn.getInt16(i, false), true);
}

return new Uint16Array(viewerOut.buffer);
},
terrainDataStructure : {
heightScale : 1.0,
heightOffset : 0.0,
elementsPerHeight : 1,
stride : 1,
elementMultiplier : 256.0,
isBigEndian : false
}
}
});
Moreover, you'll need to change:
-line 30 from this.getMetaDatafromURL(description.url, description.proxy);
to
this.getMetaDatafromURL(description.url, description.proxy,description);
- line 32 from this.getMetaDatafromXML(description.xml);
to
this.getMetaDatafromXML(description.xml,description);
- line 36 from WmsParserHelper.prototype.getMetaDatafromURL = function(urlofServer, proxy) {
to
WmsParserHelper.prototype.getMetaDatafromURL = function(urlofServer, proxy,description) {
- line 47 from that.getMetaDatafromXML(xml);
to
that.getMetaDatafromXML(xml,description);

Sorry for these requests but I can't manage to test now. I will have more time during week end.

bobac...@gmail.com

unread,
Jan 30, 2014, 7:35:44 AM1/30/14
to cesiu...@googlegroups.com, dext...@gmail.com
Le mardi 28 janvier 2014 11:57:59 UTC+1, dext...@gmail.com a écrit :
Can you send pictures with your modifications?

dext...@gmail.com

unread,
Jan 30, 2014, 8:40:30 AM1/30/14
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com
Does not seem to work any better: Italy is flat except on the coast (see http://postimg.org/image/vw1y4jg27/ )

bobac...@gmail.com

unread,
Feb 1, 2014, 4:39:11 PM2/1/14
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com
Hello,
I study problems with my implementation thanks to your snippet. I found that array of data doesn't have the expected size. In this case, the array must not be used (problem comes from geoserver).
for example, if the size of tile is 64 pixels X 64 pixels, the size of the array should be 64*64*2=8192 bits. BUT sometimes the returned array from server is 4 times greater.
So changes were made to cope this inconsistency. Nevertheless, with this segregation of arrays, the terrain cannot have all his tiles defined and the result is so so...

I'll clean and send my code tomorrow. Thanks for your help, I'll try to found an other solution.

dext...@gmail.com

unread,
Feb 2, 2014, 4:21:01 AM2/2/14
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com
Thank you for your support and for figuring this out. I'd be willing to test the new code whenever you are ready.

Just out of curiosity: how are you planning to handle "nodata" values coming from GeoServer? (i.e. points for which a measurement is not available, for example the sea)

bobac...@gmail.com

unread,
Feb 2, 2014, 8:53:12 AM2/2/14
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com
Hello,
I pushed an update on my git. My next problem is to force a promise from when.js to be synchronous. With this, instead of transfering a false array where each cell have an altitude of 0 meter, I will indicate to Cesium that the request must be remade. In this way, the altitude of each cell of the map will be consistent, even if camera moves.
So if any one know how to wait until a promise is fulfilled (make it synchronous), I'm interested

The array providen by geoserver follow bil format where each 2 bytes match a (short) int which is "equal" to the high of the cell (more or less). Each pixel have a color on 16 bits so I presume that there is no "nodata". Maybe nodata is translate by a cell of 0 meter?

dext...@gmail.com

unread,
Feb 3, 2014, 5:14:57 AM2/3/14
to cesiu...@googlegroups.com, bobac...@gmail.com
That's odd, but for some particular reason, no geometry is generated on my machine with your latest version. It looks like heightBuffer contains only null data, even though bil tiles are correct.

As for the nodata, my GeoTiff file has a NODATA Value of "2147483647" (which is 2^31 - 1). By serving the tiles through the BIL plugin, since this value does not fit into a 16 bit location, NODATAs are representing using the 32768 value (2^15).

Which results in water areas literarly in orbit (see http://postimg.org/image/8ddu369vn/ ). I'm trying to figure out how to fix this. Has anybody any idea?

My plan is to build some sort of "water mask" out of the array data, in order to take advantage of Cesium cool water effects.

bobac...@gmail.com

unread,
Feb 3, 2014, 6:53:12 AM2/3/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com
Hello, what you wrote is very interessing because in my implementation if a cell is higher than 20000 m, I said that the bil was wrong (see cesium / Source / Scene / WmsParserHelper.js line 303). Also, what is the best pratice? The cell should be at 0 or ...?

dext...@gmail.com

unread,
Feb 3, 2014, 7:21:49 AM2/3/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com
That's very interesting: that's probably why I'm not seeing anything on screen. What I'm doing is processing the array I receive from GeoServer and setting every location which has a nodata value (in my case 32767) to 0. I'm setting up a water mask as well, and it seems to work very well with my dataset (see http://postimg.org/image/kir6d2tvz/ ).

Unfortunately, I'm not sure what I'm doing could be considered a best practice. I'm not sure setting the "no data" locations to 0 is the right thing to do, as there could be legit places with the 0 value. So I'm not quite sure that's right nor where to look to be sure. Maybe someone else from the CesiumJS community might know a little bit more about this stuff.

Patrick Cozzi

unread,
Feb 3, 2014, 9:44:08 AM2/3/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com
Hi folks - when you are satisfied with your implementation, we're happy to list it as a Cesium plugin for the benefit of the community.  Just open a pull request to cesium-plugins-list to add it to the list.

Thanks,
Patrick

bobac...@gmail.com

unread,
Feb 3, 2014, 4:37:23 PM2/3/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com
Hello, with a better resolution of SRTM map, (90m instead of 250m) I have good result and relief is maintained against camera movement!!
So soon I'll follow Patrick Cozzi advice and I'll pull a new Cesium plugin for geoserver.

bobac...@gmail.com

unread,
Feb 4, 2014, 2:46:41 PM2/4/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com
Hello in my repository I try to manage no data value by changing altitude with previous cell altitude. What do you think?

bobac...@gmail.com

unread,
Feb 13, 2014, 3:49:15 PM2/13/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com
Hello, I don't know if you use my plugin but I finally improve it to decrease some identified glitches of bil/DDS plug in (sometimes datas provided by bil/DDS plugin aren't consistent).

alessio.p...@gmail.com

unread,
Feb 14, 2014, 11:35:23 AM2/14/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com
Unfortunately I'm still unable to get the geometry back using your plugin. It seems to always fail on line 536:

if (littleEndianBuffer.byteLength === bufferIn.byteLength)

alessio.p...@gmail.com

unread,
Feb 14, 2014, 11:37:20 AM2/14/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com
Also, maybe you should use

throw new Cesium.DeveloperError('no good size');

at line 366

bobac...@gmail.com

unread,
Feb 15, 2014, 3:25:07 AM2/15/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com, alessio.p...@gmail.com
Hello,
the core problem is in bil/DDS plugin that doesn't always send good datas. In these cases array size is different than expected size. Also
"if (littleEndianBuffer.byteLength === bufferIn.byteLength)" is a mandatory to filter good datas returned by bil/DDS plugin. ( problem seems to be known http://forum.worldwindcentral.com/showthread.php?18819-DDS-Plugin-for-geoserver/page4 ).
Hence, for me, it's not a developerError but just indication to throw when data size mismatches. In the when.js framework (https://github.com/cujojs/when) used in Cesium, a throw command can be catched by otherwise whatever the object type thrown.

In my plugin, I defined a Styled Layer Description (SLD see http://docs.geoserver.org/stable/en/user/webadmin/data/styles.html) in geoserver to convert a 16 bit grayscale color map into a more classical 8 bit red/green/blue scale map which is useable by internet navigator and so by Cesium. For that, you need to insert mySLD.xml (https://github.com/kaktus40/Cesium-GeoserverTerrainProvider/blob/master/mySLD.xml) into geoserver and to remember the name of inserted style, for the exemple it's "grayToColor".
After that, you could use geoserverTerrain provider like this:
var terrainProvider = new Cesium.GeoserverTerrainProvider({
url : "http://localhost:8080/geoserver/elevation/wms",
layerName: "SRTM90",
heightmapWidth:64,
styleName:"grayToColor"// name of inserted SLD
});

After that, the plugin will use BIL format in priority and when the datas provided by geoserver in BIL format is wrong, the geoserverTerrainProvider will require a map with the style defined in parameter styleName to make a terrain.

For information I made some captures of an area where BIL/DDS plugin seems to have problems with SRTM 90 meters (lat= 29.39355398979329°; long=85.60289665359001°):
- capture with your WebMapServiceTerrainProvider: http://postimg.org/image/h65mjb47p/
- capture with GeoserverTerrainProvider without SLD: http://postimg.org/image/hueh292xh/
- capture with GeoserverTerrainProvider and with SLD: http://postimg.org/image/6grxr1set/

al...@formationmedia.net

unread,
Jun 2, 2014, 2:45:22 AM6/2/14
to cesiu...@googlegroups.com, bobac...@gmail.com, dext...@gmail.com, alessio.p...@gmail.com
Hi,

I'm trying to add a geotiff DEM to the Cesium globe using GeoserverTerrainProvider. The terrain data looks fine in Cesium, but I am having problems with the new terrain being displayed incorrectly at a much lower elevation than the rest of the globe. See here: http://s7.postimg.org/ahyakuhij/geoserver_qld3.jpg

I have tiled the data using GDAL and imported it into geoserver using ImagePyramid and with BIL plugin installed, and the SLD stylesheet mapping -32768 to #000000 and 15000 to #00BA98. The code I'm using is below. I have tried the example specified on the plugin page, however I cannot get the data to show at all without the postProcessArray function below:

var terrainProvider = new Cesium.GeoserverTerrainProvider({

url : "http://localhost:8081/geoserver/cubeglobe/wms",
layerName: "pyramid",
heightmapWidth:65,
styleName:"grayToColor",
formatImage: "image/png",
tagAltitudeProperty:"GRAY_INDEX",
waterMask: false,


formatArray: {
format : "application/bil16",
postProcessArray : function(bufferIn)
{
// bil is 16 bits big endian cell
var viewerIn = new DataView(bufferIn);
var littleEndianBuffer = new ArrayBuffer(bufferIn.byteLength);

if (littleEndianBuffer.byteLength === bufferIn.byteLength)
{


var viewerOut = new DataView(littleEndianBuffer);
//time to switch bytes!!
for (var i = 0; i < bufferIn.byteLength; i += 2)
{

viewerOut.setUInt16(i, viewerIn.getUInt16(i, false), true);
}

return new UInt16Array(viewerOut.buffer);
}

return undefined;
}
}
});

I have been modifying the plugin source around lines 427 to 442 and have gotten various results, and I have tried to determine if the SLD values need to be changed for my data (elevation range is -5625m to 2848m), but I am still not understanding things correctly. I am now resorting to trial and error with no success.

Changing line 427 to:
var valeur = (dataPixels[i + 1] << 8 | dataPixels[2] - 32768);
I get this image.. http://s7.postimg.org/m8c828aaz/geoserver_qld1.jpg
Which looks correct elevation outside the land surface (bathymetry) but still incorrect inside the land surface.

Does anyone have any idea what I am doing wrong here?

Some advice would be greatly appreciated thanks!

Allan


farouk abdou

unread,
Jun 2, 2014, 12:55:16 PM6/2/14
to al...@formationmedia.net, cesiu...@googlegroups.com, dext...@gmail.com, alessio.p...@gmail.com
Hello,
thank to you I corrected a little issue in line 427: dataPixels[2] should be dataPixels[i+2].
When I wrote GeoserverTerrainProvider, I presume that elevation range is -500m to 12000m (see the default formatArray line 577).
To sum up the plug in behavior, for each tile, it requests a data array from geoserver (format=bil) and parse this array. Sometimes, the size of bill array is inconsistent, also the plug in request from geoserver the image of the tile styled with SLD. The images requested should be blue (range of color between #000000 for -32768 and  #00BA98 for 15000 in Red Green Blue format).

The elevation range of your data seems to be -5625m to 2848m. I suggest to get the update of GeoserverTerrainProvider, change line 577 in compliance with the elevation range of your data and combine the use of GeoserverTerrainProvider and ground-push plugin ( https://github.com/NICTA/cesium-groundpush-plugin )

al...@formationmedia.net

unread,
Jun 3, 2014, 1:46:06 AM6/3/14
to cesiu...@googlegroups.com, al...@formationmedia.net, dext...@gmail.com, alessio.p...@gmail.com, bobac...@gmail.com
Thanks for your reply Farouk.. and thanks for your work developing this plugin, it will be a great feature for my needs if I can get it working with my data.

I have updated the plugin with the fixed line 427, and modified line 577 to account for my data range, but I still cannot see any improvement.

As you suggested, the use of the groundpush plugin has allowed me to push the DEM up (32768m) to the correct height but it is now difficult matching the groundpush bounds and the DEM bounds, which results in either a 32768m ditch or wall around the data. I have exaggerated this in the image here for demonstration: http://s30.postimg.org/t63lmqe1d/geoserver_groundpush.png

Without groundpush, the DEM data is showing correctly, except it is 32768 below the surface.. again when I modify line 427 to:
var valeur = (dataPixels[i + 1] << 8 | dataPixels[i+2] + 32768);
I get the result in this image (with heightScale=5):
http://s14.postimg.org/lg2sz75m9/geoserver_bathymetry.png
Where the bathymetry is correct, but the land surface is still at -32768. Is there a change I can make that will align both land and bathymetry? I presume the waterMask is the key (I have set waterMask:false). I am searching for a way to increase only the land elevation values by 32768 - do you have any advice to do this?


I am also getting a large number of WebGL errors (which may be related to the inconsistent BIL array sizes)

WebGL: INVALID_OPERATION: texImage2D: ArrayBufferView not big enough for request with UNPACK_ALIGNMENT > 1

Your help is really appreciated, thanks again!

Allan

bobac...@gmail.com

unread,
Jun 3, 2014, 1:25:01 PM6/3/14
to cesiu...@googlegroups.com, al...@formationmedia.net, dext...@gmail.com, alessio.p...@gmail.com, bobac...@gmail.com
I guess that "the earth surface under ocean" has no-data elevation or an elevation of 0 meter...
You can check this via geoserver layer preview. In this page you choose openlayer as a common format. With a double click in the map, geoserver return the data which was double clicked (elevation in meter or grey tone or color).
Message has been deleted

bobactor

unread,
Jun 4, 2014, 7:00:54 AM6/4/14
to al...@formationmedia.net, cesiu...@googlegroups.com, dext...@gmail.com, alessio.p...@gmail.com
I guess that "the earth surface under ocean" has no-data elevation or
an elevation of 0 meter...
You can check this via geoserver layer preview. In this page you choose
openlayer as a common format. With a double click in the map, geoserver
return the data which was double clicked (elevation in meter or grey
tone or color).


al...@formationmedia.net

unread,
Jun 12, 2014, 1:27:01 AM6/12/14
to cesiu...@googlegroups.com, al...@formationmedia.net, dext...@gmail.com, alessio.p...@gmail.com, bobac...@gmail.com

Unfortunately I still cannot get my data to show correctly.

I have confirmed the preview in Geoserver and my bathymetry data looks as expected. See image here, showing almost the entire dataset:
http://s27.postimg.org/w1b80rx03/bathymetry_preview.png

The value of 140.0 displayed is from a point towards the bottom-left corner of the data (which is the land surface of Queensland, lighter green). The top-right side of the image is the bathymetry under the water (all negative values).

As mentioned previously, the terrain surface relief looks correct, except my data is showing far beneath the rest of the global terrain. I have tried various modifications to the source with mixed results, all incorrect. I can get the bathymetry surface only to display at the correct position by changing line 427, as in my previous post, but the land remains underneath the rest of the terrain.

It would be great if you could help me understand the format of the dataPixels array. Or if there is a way I can isolate just the land values only?

thanks again

Allan

Alexander Wood

unread,
Jun 16, 2014, 10:23:22 AM6/16/14
to cesiu...@googlegroups.com

Hi Allan,

You may want to give STK World Terrain Server a try.  The STK World Terrain Server can convert any raw height data readable by GDAL into the open format quantized-mesh, that can be easily rendered in Cesium via the CesiumTerrainProvider.  The STK World Terrain Server is a commercial product and there may be a licensing options available that fits your needs.  I can put you in touch with someone at Analytical Graphics if you'd like to find out more.

Alex

--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

bobactor

unread,
Jun 16, 2014, 2:13:05 PM6/16/14
to cesiu...@googlegroups.com, al...@formationmedia.net
Hello,
I follow the Alexander's recommendation. You should try with quantized-mesh. I suspect that Cesium globe uses a limitation of terrain when it's below a certain depth (maybe 0 meter?). When I use any Terrain provider, during construction, I can't go below this limitation with camera...
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/ML7oBEUepuI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.

ccye...@gmail.com

unread,
Jan 7, 2015, 3:54:49 AM1/7/15
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com
2014년 1월 29일 수요일 오전 3시 16분 7초 UTC+8, bobactor 님의 말:
> Le mardi 28 janvier 2014 13:18:27 UTC+1, dext...@gmail.com a écrit :
> > Il giorno martedì 28 gennaio 2014 12:50:48 UTC+1, bobac...@gmail.com ha scritto:
> >
> > > Le mardi 28 janvier 2014 11:57:59 UTC+1, dext...@gmail.com a écrit :
> >
> > >
> >
> > > > Hello!
> >
> > >
> >
> > > >
> >
> > >
> >
> > > > I'm trying to build a terrain visualization stack on my local machine using Cesius and GeoServer (using other proprietary servers is not an option). Unfortunately, I didn't have much luck.
> >
> > >
> >
> > > >
> >
> > >
> >
> > > > 1 - Why was WebMapServiceTerrainProvider removed from the master branch? In an older discussion here in cesium-dev there was a patch to make it work on latest Cesium. Is there any other problem with it?
> >
> > >
> >
> > > >
> >
> > >
> >
> > > > 2 - What's the point of using BIL format on GeoServer instead of plain PNG or other format? I seem to understand it has something to do with terrain data resolution, but I'm not quite sure.
> >
> > >
> >
> > > >
> >
> > >
> >
> > > > I'm sorry for the naive questions, but I would like to understand :)
> >
> > >
> >
> > > >
> >
> > >
> >
> > > > Alessio
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > >
> >
> > > Le mardi 28 janvier 2014 11:57:59 UTC+1, dext...@gmail.com a écrit :
> >
> > >
> >
> > > > Hello!
> >
> > >
> >
> > > >
> >
> > >
> >
> > > > I'm trying to build a terrain visualization stack on my local machine using Cesius and GeoServer (using other proprietary servers is not an option). Unfortunately, I didn't have much luck.
> >
> > >
> >
> > > >
> >
> > >
> >
> > > > 1 - Why was WebMapServiceTerrainProvider removed from the master branch? In an older discussion here in cesium-dev there was a patch to make it work on latest Cesium. Is there any other problem with it?
> >
> > >
> >
> > > >
> >
> > >
> >
> > > > 2 - What's the point of using BIL format on GeoServer instead of plain PNG or other format? I seem to understand it has something to do with terrain data resolution, but I'm not quite sure.
> >
> > >
> >
> > > >
> >
> > >
> >
> > > > I'm sorry for the naive questions, but I would like to understand :)
> >
> > >
> >
> > > >
> >
> > >
> >
> > > > Alessio
> >
> > >
> >
> > >
> >
> > >
> >
> > > Hello I'm implementing a solution a terrain provider which uses Geoserver.
> >
> > >
> >
> > > This solution works with bil,gif,png ang jpeg formats. The bil format is an array directly directly machine readable. The others formats need a little transformation (picture to array).
> >
> > >
> >
> > > I'm using SRTM 250 meters in my tests.
> >
> > >
> >
> > > Best regards
> >
> >
> >
> > Thank you very much for your reply. I just found your repository and compiled Cesium with GeoServerProvider support.
> >
> >
> >
> > I know this is a bit OT, but can you point me to a guide or something to understand how to import SRTM data to GeoServer?
> >
> >
> >
> > Also would you please post a snippet on how to use your provider in Cesium?
> >
> >
> >
> > Thank you very much!
>
> Hello,
> 1- you can download SRTM data at http://srtm.csi.cgiar.org/
> 2- you need to install GDAL tools and python to work with SRTM http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
> 3- you need to install geoserver image pyramid plugin
> 4- a guide is available at http://docs.geoserver.org/latest/en/user/tutorials/imagepyramid/imagepyramid.html
>
> I didn't make a documentation to my implementation of geoserver terrain provider. I'll write it soon. I saw that you find my github.
> Once you defined a layer of SRTM in geoserver, you could use this snippet:
>
> var terrainProvider = new Cesium.GeoserverTerrainProvider({
> url : "http://localhost:8080/geoserver/elevation/wms",
> layerName: "SRTM250",
> maxLevel:4,
> heightmapWidth:65
> });
> centralBody.terrainProvider = terrainProvider;



Hello,

I did an image pyramid from SRTM website and import the data into the geoserver successfully.

and use the following js code to use the elevation to show in Cesium but didn't work , Could you kindly instruct me what's wrong ?

Thanks very much....

below is my test.html with javascript code:


<!DOCTYPE html>
<html lang="en">
<head>
<!-- Use correct character set. -->
<meta charset="utf-8">
<!-- Tell IE to use the latest, best version (or Chrome Frame if pre-IE11). -->
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Hello World!</title>
<script src="../Build/Cesium/Cesium.js"></script>
<script src="../Build/Cesium-GeoserverTerrainProvider-master/GeoserverTerrainProvider.js" type="text/javascript"></script>
<style>
@import url(../Build/Cesium/Widgets/widgets.css);
html, body, #cesiumContainer {
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
}
</style>
</head>
<body>
<div id="cesiumContainer"></div>
<script>
var canvas = new Cesium.Viewer('cesiumContainer');
var scene = new Cesium.Scene(canvas);
var primitives = scene.primitives;
var globe = new Cesium.Globe(Cesium.Ellipsoid.WGS84);
scene.globe=globe;

var terrainProvider = new Cesium.GeoserverTerrainProvider({
url : "http://localhost:8090/geoserver/elevation/wms?",
layerName: "SRTM90",
styleName:"grayToColor",
waterMask:true
});
globe.terrainProvider = terrainProvider;

var hand = new Cesium.ScreenSpaceEventHandler(canvas);
// return altitude with double click in console.log!!
hand.setInputAction(
function (movement) {
if(movement.position != null) {
var carDtesian = scene.camera.pickEllipsoid(movement.position, ellipsoid);
if (cartesian) {
var cartographic = ellipsoid.cartesianToCartographic(cartesian);
cartographic.height=globe.getHeight(cartographic);
console.log("lat= "+(cartographic.latitude*180/Math.PI)+"°; long="+(cartographic.longitude*180/Math.PI)+"°; altitude="+cartographic.height+" meters")
}
}
}, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
</script>
</body>
</html>

bobac...@gmail.com

unread,
Jan 7, 2015, 8:33:08 AM1/7/15
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com, ccye...@gmail.com
Hello could you check that your internet navigator receive the data. Maybe you have a CORS issue? (see http://enable-cors.org/ )

ccye...@gmail.com

unread,
Jan 7, 2015, 10:12:40 PM1/7/15
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com, ccye...@gmail.com

> Hello could you check that your internet navigator receive the data. Maybe you have a CORS issue? (see http://enable-cors.org/ )


Yes, I think so, too. here is the JavaScript console shows:

Uncaught TypeError: undefined is not a function
HelloWorld2.html:1 XMLHttpRequest cannot load http://localhost:8090/geoserver/elevation/wms?SERVICE=WMS&REQUEST=GetCapabilities&tiled=true. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.

Is that what you said? If so, please kindly instruct how to solve the CORS issue.


Thanks for your instruction sincerely....


bobac...@gmail.com

unread,
Jan 8, 2015, 1:04:03 AM1/8/15
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com, ccye...@gmail.com
Hello,
in http://enable-cors.org/ you have the instructions to remove the CORS issue. First,geoserver is deployed on Tomcat? glassFish? Jboss...?? Do you use an httpd server like Apache, Nginx...?
Through these questions, you see I can't help you without more informations on your configuration and http://enable-cors.org/ is easy to apprehend.

ccye...@gmail.com

unread,
Jan 8, 2015, 3:21:23 AM1/8/15
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com, ccye...@gmail.com
bobac...@gmail.com於 2015年1月8日星期四UTC+8下午2時04分03秒寫道:
ok, thanks very much I'll study that web page to get the answer.

actually, I use Node.js to run the httpd server

"D:\Cesium1.5>node server.js
Cesium development server running locally. Connect to http://localhost:8080/ "


the geoserver is 2.5 and run using Java ...
Everything is simple....

ccye...@gmail.com

unread,
Jan 8, 2015, 4:37:16 AM1/8/15
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com, ccye...@gmail.com
ccye...@gmail.com於 2015年1月8日星期四UTC+8下午4時21分23秒寫道:
Sorry , I read that web CORS page, but it's too difficult to me,

as to I just want to test the efficiency of Cesium, so please kindly instruct me how to do to solve the CORS issue.

the web server is run under Node.js and the geoserver is 2.5 running under JAVA.
my OS is windows 7, the Javascript code that load the elevation data is described below. I just edited it from the HelloWorld.html bundled with Cesium 1.5.

Hope you could give some instruction about the next step. Thanks very much.....



---

bobac...@gmail.com

unread,
Jan 8, 2015, 5:17:37 AM1/8/15
to cesiu...@googlegroups.com, dext...@gmail.com, bobac...@gmail.com, ccye...@gmail.com
How do you install geoserver?

ccye...@gmail.com

unread,
Jan 8, 2015, 5:31:21 AM1/8/15
to cesiu...@googlegroups.com
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....

bobac...@gmail.com

unread,
Jan 8, 2015, 9:37:21 AM1/8/15
to cesiu...@googlegroups.com, ccye...@gmail.com
Sorry I can't help you, I don't know how to manage CORS issue with geoserver in standalone application.

ccye...@gmail.com

unread,
Jan 9, 2015, 2:00:06 AM1/9/15
to cesiu...@googlegroups.com, ccye...@gmail.com, bobac...@gmail.com
bobac...@gmail.com於 2015年1月8日星期四 UTC+8下午10時37分21秒寫道:
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..^^


ccye...@gmail.com

unread,
Jan 9, 2015, 3:50:46 AM1/9/15
to cesiu...@googlegroups.com, ccye...@gmail.com, bobac...@gmail.com
ccye...@gmail.com於 2015年1月9日星期五 UTC+8下午3時00分06秒寫道:
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 )


bobac...@gmail.com

unread,
Jan 9, 2015, 9:19:42 AM1/9/15
to cesiu...@googlegroups.com, ccye...@gmail.com
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)

jai singla

unread,
Jul 26, 2016, 7:37:14 AM7/26/16
to cesium-dev, ccye...@gmail.com
Hello farouk,

Trying to add terrain using geoserver using

Cesium.GeoserverTerrainProvider says it is not a function.

Please help.


regards
Jai

farouk abdou

unread,
Jul 26, 2016, 2:00:30 PM7/26/16
to cesium-dev, ccye...@gmail.com
Sorry,
could you explain what you did?

jai singla

unread,
Jul 27, 2016, 12:39:37 AM7/27/16
to cesium-dev, ccye...@gmail.com

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.

bobactor

unread,
Jul 27, 2016, 12:43:37 AM7/27/16
to cesiu...@googlegroups.com

Could you send your code please?

--

ronak.a...@gmail.com

unread,
Dec 28, 2016, 5:14:29 AM12/28/16
to cesium-dev
<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>
<style>
@import url(./Cesium-1.26/Build/Cesium/Widgets/widgets.css);
html, body, #cesiumContainer {
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
}
</style>
<body>
<canvas id="cesiumContainer"></canvas>
<script>
var canvas = document.getElementById('cesiumContainer');
var scene = new Cesium.Scene(canvas);
var primitives = scene.primitives;
var globe = new Cesium.Globe(Cesium.Ellipsoid.WGS84);
scene.globe=globe;s

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


</body>
</html>

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

farouk abdou

unread,
Dec 29, 2016, 6:09:58 AM12/29/16
to cesium-dev, ronak.a...@gmail.com
Hello and sorry, I can't reproduce your issue.
For information you should use http://localhost:8080/geoserver/ows instead of http://localhost:8080/geoserver/wcs/wms

Scott Haynes

unread,
Jun 12, 2018, 8:05:51 PM6/12/18
to cesium-dev
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

farouk abdou

unread,
Jun 13, 2018, 12:18:18 PM6/13/18
to cesium-dev
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.
Reply all
Reply to author
Forward
0 new messages