geo-data / cesium-terrain-builder

A C++ library and associated command line tools designed to create terrain tiles for use in the Cesium JavaScript library
Other
713 stars 341 forks source link

Misplaced and overscaled terrain after conversion #72

Open deseser opened 6 years ago

deseser commented 6 years ago

I have a problem with creating .terrain tiles from self made .tif for small area. Result after terrainExaggeration : 20.0 looks like that:

image

where square on the bottom is my area of interest. Everything works ok with other .tif files (for example one from here), but results from those from Agisoft always look like that. Same .tif works ok through Cesium Ion terrain provider. What do I do wrong ?

Qgis info about my raster

Size is 9344, 9673

Coordinate System is:

GEOGCS["WGS 84",

DATUM["WGS_1984",

SPHEROID["WGS 84",6378137,298.257223563,

AUTHORITY["EPSG","7030"]],

AUTHORITY["EPSG","6326"]],

PRIMEM["Greenwich",0],

UNIT["degree",0.0174532925199433],

AUTHORITY["EPSG","4326"]]

Origin = (20.039544991068233,53.642099784825270)

Pixel Size = (0.000000938585000,-0.000000557772000)

Metadata:

AREA_OR_POINT=Area

Image Structure Metadata:

COMPRESSION=LZW

INTERLEAVE=BAND

Corner Coordinates:

Upper Left ( 20.0395450, 53.6420998) ( 20d 2'22.36"E, 53d38'31.56"N)

Lower Left ( 20.0395450, 53.6367045) ( 20d 2'22.36"E, 53d38'12.14"N)

Upper Right ( 20.0483151, 53.6420998) ( 20d 2'53.93"E, 53d38'31.56"N)

Lower Right ( 20.0483151, 53.6367045) ( 20d 2'53.93"E, 53d38'12.14"N)

Center ( 20.0439301, 53.6394021) ( 20d 2'38.15"E, 53d38'21.85"N)

Band 1 Block=256x256 Type=Float32, ColorInterp=Gray

NoData Value=0

Overviews: 4672x4837, 2336x2419, 1168x1210, 584x605, 292x303, 146x152

Unit Type: metre

84ace commented 6 years ago

I have this problem too

84ace commented 6 years ago

I've done some digging and i have found the commit where the issue started, https://github.com/geo-data/cesium-terrain-builder/commit/29e0ba8dfd626eab485a9addf150fc4ce3135cf3

Any version before that seems to generate small area TIFFs without issue. I have tried building ctb with GDAL 2.1.1, 2.2.0 and 2.3.0.

From 29e0ba8dfd626eab485a9addf150fc4ce3135cf3 onwards, ctb has a compile error:

/root/cesium-terrain-builder-29e0ba8dfd626eab485a9addf150fc4ce3135cf3/src/GDALTiler.cpp: In function ‘void getOverviewDataset(GDALDatasetH, GDALTransformerFunc, void)’: /root/cesium-terrain-builder-29e0ba8dfd626eab485a9addf150fc4ce3135cf3/src/GDALTiler.cpp:243:87: error: too many arguments to function ‘GDALDataset GDALCreateOverviewDataset(GDALDataset, int, int)’ poSrcOvrDS = GDALCreateOverviewDataset( poSrcDS, iOvr, FALSE, FALSE ); ^ In file included from /root/cesium-terrain-builder-29e0ba8dfd626eab485a9addf150fc4ce3135cf3/src/GDALTiler.cpp:26:0: /usr/local/include/gdal_priv.h:1579:14: note: declared here GDALDataset GDALCreateOverviewDataset(GDALDataset poDS, int nOvrLevel, ^ src/CMakeFiles/ctb.dir/build.make:86: recipe for target 'src/CMakeFiles/ctb.dir/GDALTiler.cpp.o' failed make[2]: [src/CMakeFiles/ctb.dir/GDALTiler.cpp.o] Error 1 CMakeFiles/Makefile2:85: recipe for target 'src/CMakeFiles/ctb.dir/all' failed make[1]: [src/CMakeFiles/ctb.dir/all] Error 2 Makefile:127: recipe for target 'all' failed make: *** [all] Error 2

To get it to compile you must change GDALTiler.cpp:243 and remove the extra FALSE. This error is fixed with another commit at some later point.

I have an example tiff here that will reproduce the issue https://anonfile.com/Z8n9maidb5/small_tiff (23MB)

Any help is appreciated!

EDIT: Added a picture of the problem image