Closed masonr closed 5 years ago
Hello, first you don't need to merge files to use gdal_retile. It's more interesting to use gdalvrt to generate a virtual file that you use as parameter of gdal_retile. Tests with gdalvrt and come back with your result.
Tried using gdalvrt and ended up with the same result (screenshot below). I'm wondering if it's the MGRS -> Lat/Lon coordinate system conversion that's causing this. Or how'd I would even go about diagnosing/fixing it if that turned out to be the case. Edit: I don't think this is the case since the raw DTED files are in WGS_84 coordinate system.
Here's the exact commands I used:
gdal_translate {file_1}.DT2 {file_1}.tif
gdal_translate {file_2}.DT2 {file_2}.tif
java -jar GeotiffTranslate.jar -i {path/to/tifs} -o {path/to/out}
gdalbuildvrt dted.vrt {path/to/out/file_1}.tif {path/to/out/file_2}.tif
gdal-retile.py -v -r cubic -levels 4 -ps 512 512 -co "TILED=YES" -targetDir {tiled-dir} dted.vrt
Then I add store in geoserver using the "ImagePyramid" tool and point to the directory containing all the tiled images. Keep all the defaults. Publish layer. Add as terrain provider in Cesium.
don't translate your dted data!
gdalbuildvrt dted.vrt {file_1}.DT2 {file_2}.DT2
gdal-retile.py -v -r cubic -levels 4 -ps 512 512 -co "TILED=YES" -targetDir {tiled-dir} dted.vrt
gdal-retile.py -v -r cubic -levels 4 -ps 512 512 -co "TILED=YES" -targetDir {tiled-dir} dted.vrt
Sorry about that. Just redid it using the method you described. Using the 'grayToColor' geoserver style. Here's the result -
Lots of jagged peaks and gaps in the terrain.
did you use bil/dds plugin?
Negative. Tried using it but my geoserver instance wouldn't start up when the java libraries were added. I'll give that another shot now and report back.
Interestingly enough, it looks identical as the first method I tried (in the OP) -
This is using just the gdalbuildvrt and gdal_retile commands.
These are my BIL settings for the terrain layer I'm using -
well, did you test with other elevation datas like srtm? What is the precision of your data?
Welp... I figured out the problem. I wasn't grabbing all of the terrain tiles that I needed for the area that I'm looking at, so the gaps and anomalies were a result of missing terrain data for that area. I'm not really sure why it's not all the same elevation for areas with missing data, so that's why I never thought that this would be the problem in the first place.
I was assuming that a file named for example, "W100/N20.DT2" contained the data for W100°-101°, N20°-21°. In reality, this file contains data for W99°-100°, N20°-21°. Complete facepalm moment for me as I wasted many hours trying to debug this and the issue would have been easily spotted had I inspected the files from the start (via gdalinfo).
Everything is working great, now that I have the right data! I really appreciate all of your help @kaktus40 and am truly sorry for wasting your time dealing with my mistake. Your tool has proved extremely valuable for our offline usage. Thanks and sorry again!
No problem. Goob luck
I am using CesiumJs version 1.89 with @kaktus40 GeoserverTerrainProvider and my code as given below:
Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3MjA5Zjk0ZC0yM2U0LTQ2NTgtOGQyNi1lNDRlNDU4YmJmYTIiLCJpZCI6NzYwMDksImlhdCI6MTY0NTc4NjYwOH0.****"; var terrainProvider = new Cesium.GeoserverTerrainProvider({ service: "WMS", url: "http://mydomain****/geoserver/JAMMU_KASHMIR/wms", layerName: "JAMMU_KASHMIR:DEM", // xml: xmlGetCapabilities, // proxy: proxy, heightMapWidth: 64, heightMapHeight: 64, offset: 0, highest: 12000, lowest: -500, styleName: "grayToColor", hasStyledImage: true, waterMask: true, maxLevel: 11, formatImage: { format: "image/png", extension: "png" }, 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 2); var viewerOut = new DataView(littleEndianBuffer); if (littleEndianBuffer.byteLength === bufferIn.byteLength) { // time to switch bytes!! var temp, goodCell = 0, somme = 0; for (var i = 0; i < littleEndianBuffer.byteLength; i += 2) { temp = viewerIn.getInt16(i, false) - offset; if (temp > lowest && temp < highest) { viewerOut.setInt16(i, temp, true); somme += temp; goodCell++; } else { var val = (goodCell == 0 ? 1 : somme / goodCell); viewerOut.setInt16(i, val, true); } } resultat = new Int16Array(littleEndianBuffer); } return resultat; } } }); var viewer = new Cesium.Viewer("cesiumContainer"); var scene = viewer.scene;
var globe = new Cesium.Globe(Cesium.Ellipsoid.WGS84);
//viewer.scene.globe = globe;
var ellipsoid = viewer.scene.globe.ellipsoid;
viewer.terrainProvider = terrainProvider;
after that scene globe being hide. viewer.terrainProvider = terrainProvider;
viewer.scene.globe.terrainProvider = terrainProvider; nothing is working for me... @kaktus40 or anyone ..... please help. thanks in advance
Hello, could you show u=your console log?
there is no errors in console log
[Violation] Added non-passive event listener to a scroll-blocking
could you send your capabilities document from geoserver?
Geoserver WMS_Capabilities :
This XML file does not appear to have any style information associated with it. The document tree is shown below.
I'm running into an issue where it appears that at tile boundaries, the terrain doesn't quite match up. This leads to gaps, pits, and artifacts being introduced into the converted product. The current area that I'm looking at uses two DTED files that I merge together (after converting to TIF).
I've tested a couple sources of DTED/SRTF (Level 1 & Level 2) DT1/DT2 files and also TanDEM-X GeoTIFFs. All sources I tested have this same issue at the same locations on the earth, so I think this rules out an issue with the source of the data itself. Below are my general steps to using the DTED data within Cesium via GeoServer:
When viewing the area that the terrain includes within Cesium, I observe the gaps and artifacts shown in the screenshots below. Most of the area is perfectly fine and doesn't have these issues, but about 25% of the Western side of the area does. Any advice or things to try would be appreciated.