Skip to content
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

blocky terrain question #38

Closed
mortac8 opened this issue Jun 12, 2020 · 12 comments
Closed

blocky terrain question #38

mortac8 opened this issue Jun 12, 2020 · 12 comments

Comments

@mortac8
Copy link

mortac8 commented Jun 12, 2020

Attached is a comparison of cgiar srtm 90m from http://srtm.csi.cgiar.org/download with Cesium World Terrain. Is there a way to reduce the blockiness of the terrain? Or is this just a result of using only 90m terrain resolution?

I configured my GeoserverTerrainProvider.js to use the 'mySLD.xml option' with WMTS. Thanks for your time! @kaktus40

image

@kaktus40
Copy link
Owner

Hello

from what I see, it seems you don't use a good configuration of the bil/dds plugin. Did you try different configurations? What is your process to generate your tiff files?

@mortac8
Copy link
Author

mortac8 commented Jun 12, 2020

I am not using the bil/dds plugin. I just loaded 90m terrain files from http://srtm.csi.cgiar.org/download into an ImageMosaic in GeoServer then I simply configured my layer to use the mySLD.xml style from this project's github.

What is the best way? Is it the bil/dds plugin or maybe the GeotiffTranslate script?

var terrainProvider = new Cesium.GeoserverTerrainProvider({
	service : "WMTS",
	url : "http://localhost:8080/geoserver/gwc/service/wmts",
    layerName: "cite:srtm90",
    styleName: "mySLD",
    waterMask: true
});

@kaktus40
Copy link
Owner

You should check the README.md. There is a comparison for each type and some hints for processing your data.

@mortac8
Copy link
Author

mortac8 commented Jun 12, 2020

Ok I got it to work for WMS in GeoServer 2.17 and Cesium 1.70.1 by doing the following:

Thank you!

What is the way to get the best performance? Use service:"WMS" providing a gwc wms endpoint?

var terrainProvider = new Cesium.GeoserverTerrainProvider({
	service: "WMS",
	url : "http://localhost:8080/geoserver/cite/wms",
	layerName: "srtm90",
	heightMapWidth: 64,
	heightMapHeight: 64,
	offset: 0,
	highest: 12000,
	lowest: -500,
	styleName: "mySLD",
	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;
		}
	}
});

@kaktus40
Copy link
Owner

kaktus40 commented Jun 12, 2020 via email

@mortac8
Copy link
Author

mortac8 commented Jun 12, 2020

Does GeoServer/GeoWebCache WMTS support .bil?
Whenever I try to use WMTS I get either blocky or spiky terrain using GeoserverTerrainProvider.js as it's just using .png or .jpeg and doesn't seem to go through the more accurate .bil pipeline.

@kaktus40
Copy link
Owner

kaktus40 commented Jun 13, 2020 via email

@mortac8
Copy link
Author

mortac8 commented Jun 14, 2020

I ran the GeotiffTranslate on the srtm4.1 dataset (90m). It looks decent but the .bil solution seems to have more accurate terrain especially when viewing near street level. By this I mean, visually the .bil solution looks better. Has this been your experience?

@kaktus40
Copy link
Owner

kaktus40 commented Jun 14, 2020 via email

@mortac8
Copy link
Author

mortac8 commented Jun 14, 2020

Do you believe the best solution could be this?

gdalbuildvrt mosaic.vrt c:\srtm90\*.tif

gdal_retile -ps 2048 2048 -overlap 0 -levels 6 -s_srs EPSG:4326 -r cubicspline -ot Int16 -co TILED=YES -co COMPRESS=DEFLATE -targetDir srtm90pyramid mosaic.vrt

The deploy srtm90pyramid as an ImagePyramid in GeoServer and use image/bil method?

@kaktus40
Copy link
Owner

kaktus40 commented Jun 14, 2020 via email

@mortac8
Copy link
Author

mortac8 commented Jun 15, 2020

I'm good with closing this Issue. Thanks for your advice!

@mortac8 mortac8 closed this as completed Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants