-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DDS/BIL plugin script for sub-meter elevation #9
Comments
Hello can I have a sample of your data? I'll work with it and make an update of the plug in. |
Hello, and thanks for your support. |
Hello, I worked with your sample. My stages:
terrainProvider = new Cesium.GeoserverTerrainProvider({
url : 'http://localhost:8090/geoserver/ows',
layerName: 'elevation:evaluation',
maxLevel: 20,
service: "WMS",
formatArray: {
format: "image/bil",
postProcessArray: function(bufferIn, size, highest, lowest, offset) {
var resultat;
var viewerIn = new DataView(bufferIn);
var littleEndianBuffer = new ArrayBuffer(size.height * size.width * 4);
var viewerOut = new DataView(littleEndianBuffer);
if (littleEndianBuffer.byteLength === bufferIn.byteLength) {
var temp, goodCell = 0,
somme = 0;
for (var i = 0; i < littleEndianBuffer.byteLength; i += 4) {
temp = viewerIn.getFloat32(i, false) - offset;
if (temp > lowest && temp < highest) {
// needed for big Endian
viewerOut.setFloat32(i, temp, true);
//for little Endian, there is no need to switch byte so the code should be viewerOut.setFloat32(i, temp, false);
somme += temp;
goodCell++;
} else {
var val = (goodCell == 0 ? 1 : somme / goodCell);
// needed for big Endian
viewerOut.setFloat32(i, val, true);
//for little Endian, there is no need to switch byte so the code should be viewerOut.setFloat32(i, val, false);
}
}
resultat = new Float32Array(littleEndianBuffer);
}
return resultat;
}
}
});
//place camera to the correct position
var target = Cesium.Cartesian3.fromDegrees(6.68093, 46.55159, 1000);
var offset = new Cesium.HeadingPitchRange(0, -Math.PI/2, 300);
viewer.camera.lookAt(target, offset);
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY); The results are in the attached images. Comments: Initially I was worried that the warping of the data creates some artefact but by using bing imagery, it seems correct. The artefacts seems to be the pick of trees!! |
well a workaround should be to merge the elevation data in order to have a bigger area. The artefacts comes from a rupture in elevation data: the area from sample have an elevation of 800m and the rest of the world is at 0 m... |
That make sense. When I have only a small sample area, how do I merge with other terrain data to provide a bigger elevation area? Ty |
you should see gdalbuildvrt to make a virtual file. After you can use the vrt file as a tif with gdal_retile |
Just two final questions: I'm just wondering how you draped the elevation over the globe. Based on the sample screenshot above (especially the first one) , the rest of the globe is flat (outside the sample area) and is floating nicely into that area. It doesn't look like that you extended the area of the elevation data?. I see also that you can successfully include the Bing layer and the custom image layer together. Thanks again for your great support and of course the time your spending. |
Hello, |
Hi, My second question was, that you included successfully the Bing layer and the custom image layer together, which looks nice. I can only see my custom layer when I try to include both. (see following screenshot, no Bing imagery visible ) Thank you for your time. |
Hello, |
All my scripts are above. I didn't change the nodata value of your sample. |
Thanks kaktus. I got it. Since I try different methods to integrate elevation data into Cesium, I saw that you also forked the gdal2cesium python script from giohappy. Did you get it to work in a windows system? |
for now I didn't work on it |
Thanks for all of your support. |
Hello kaktus40,
I was wondering how you can alter your script to use sub-meter elevation ranges.
I assume, your using the int 16 bit value range. It's working great with data of elevation ranges in meters using the dds/bil plugin and your GeoserverTerrainProvider plugin.
Now, I'm trying to include data of sub-meter elevation ranges (e.g. 0.3m).
I created floating 32 bit tiles and altered your script to set and get float32 values of your dds/bil plugin script. Also, I set the byte order in GeoServer to "Big Endian" which causes the error(see picture).
Do you have any ideas?
Thank you!
The text was updated successfully, but these errors were encountered: