Hi folks. I have small home server and many srtm data in tiff format. How i can generate tiles which will be supported by CesiumTerrainProvider ? I read this topic:
http://cesium.agi.com/forum.html?place=msg%2Fcesium-dev%2F74a5XriE-eM%2Fjns0RsaWetYJ
May be already exists tools for generation tiles CesiumTerrainProvider format ?
Hi,
I generated the current tile set using a simple tool I wrote. The tool loads the source terrain data using GDAL (http://www.gdal.org/) and then interpolates heights and writes each tile. Unfortunately, I can’t release the tool, but if you choose to follow a similar path, the format of the Cesium terrain tiles is documented on the wiki (https://github.com/AnalyticalGraphicsInc/cesium/wiki/Cesium-Terrain-Server). Please be aware that the format can and will change as time goes on, though if I hear of anyone generating their own data in this format I will make sure to maintain backward compatibility in Cesium.
Kevin
Thanks for reply.
May be You can help me with algorithm?
I modify gdal2tiles to generate GTiff in Int16 data type.
Now its generate 256x256 tiles. Them i need scale their to 65x65 ? or already gdal2tiles must generate 65x65 tiles ?
Thanks
PS. Sorry for my english
I modify gdal2tiles.py. Now this script generate terrain tiles in cesium format. If somebody needs generate this tile format write me.
Thanks for help.
PS. Cool project. Im very happy what find it =)
Awesome, glad to hear you got it working. I wouldn’t mind taking a look at your modified script, if you don’t mind sharing it.
Hi again. Script for generation terrain tiles for Cesium. Its beta, and in this time have many problems. But its worked.
Whats not realized:
1. Whater mask
2. Aprox height on tile borders
3. Split two and more SRTM files( example: srtm_15_08 and srtm_16_08 result at now looks as http://sergeserver.dyndns.org/images/cesium/heightfield3.png
Who knows russian may look this on my site: http://sergeserver.dyndns.org/index.php/programming/python/2-generator-landshafta-dlya-cesium
Script will be update on this site, changes will be posted in this topic.
Download script: http://sergeserver.dyndns.org/index.php/downloads/category/1-scripts?download=2:generator-landshafta-dlya-cesium
Cool, thanks for sharing the script with us!
the script link is unavailable now. Could you send me(pim.researcher#gmail.com) the script or post it online.
Thanks a lot
Shawn
Attached.
gdal2srtmtiles.tar.gz (23.7 KB)
http://sergeserver.dyndns.org/index.php/downloads/category/1-scripts?download=1:gdal2tilessrtm
In near feature will be done new version of this file.
Could you provide an example of the command line?
Thanks,
Shawn
Hi all again. I write new version of script. Download from http://sergeserver.dyndns.org/index.php/downloads/category/1-scripts?download=2:gdal2srtmtiles-with-join-option
Sorry for english, its translate by google )
Original in my native language(russian) and screens may be read on http://sergeserver.dyndns.org/index.php/programming/python/4-generator-landshafta-dlya-cesium-versiya-ii
Whats new:
1. Posted tiles overlap the edges to fit the specification Cesium Terrain Server.
2. Added flag to glue tiles (- join)
3. Laid basic support for water mask
On the second point in more detail. I work with treated SRTM data taken from the server GisLab, this data is based on CGIAR, the only difference is that the mosaic is 5x5 degrees, and the value of NODATA c 255 is replaced by -32678.
So, the flag - join means that the script will first check for the existence of the generated files, and if there are, they will simply supplemented. It used the same script gdal2tiles just overwrite the existing or missing tiles. By the way, this flag can be used to generate raster tiles.
Example, consider two files DEM - srtm_45_04(http://gis-lab.info/data/srtm-tif/srtm_45_04.zip) and srtm_45_05(http://gis-lab.info/data/srtm-tif/srtm_45_05.zip). This two adjacent tile vertically.
For first tile we do gdal2srtmtiles.py --cesium -p geodetic srtm_45_04.tif terrain -z 0-9
We have screen - http://sergeserver.dyndns.org/images/cesium/srtm_45_04.png
For second gdal2srtmtiles.py --cesium -p geodetic srtm_45_05.tif terrain -z 0-9 --join
We have screen - http://sergeserver.dyndns.org/images/cesium/srtm_45_05.png
If you look at what was successful bonding.
With regard to the third point. Now I test your script to process the water mask. For water mask I use lannye SRTM Water Body Data Files (SWBD) that are online HB http://dds.cr.usgs.gov/srtm/version2_1/SWBD/. The algorithm works as follows script as an input parameter the tile DEM (georeferenced), then calculates what the script tiles 1x1 degrees to download http://dds.cr.usgs.gov/srtm/version2_1/SWBD/. The script unpacks the downloaded zip file, rastrizuet them GTiff (input, these tiles have a 1x1 degree shape format), then there is cross-linking of these tiles in a tile 5x5 degrees. When we have the original tile SRTM and ready to grow aquatic mask I do the following I to the basic raster SRTM add another layer (Band) from raster SWBD and generating tiles Cesium Terrain Server when setting a flag - water-mask layer that I will consider the aqueous mask. Has turned out to generate the tile surface with a water mask only for the ground level of tiles, for thumbnail not yet obtained. By the way, SWBD is not only the seas and oceans, but also rivers and lakes.
http://sergeserver.dyndns.org/images/cesium/stm_45_04-sea.png
http://sergeserver.dyndns.org/images/cesium/sertm_45_04-lake.png
Hi,
I am going to use ASTER data. refer to, http://gdem.ersdac.jspacesystems.or.jp/search.jsp . Resolution is 30 meters. Is that data compatible to your script?
DEM output format for this data is, GeoTIFF, signed 16 bits, 1m/DN, Referenced to the WSG84/EGM96 geoid, -9999 for void pixels, 0 for sea water body.
Thanks,
Shawn
I donwload you test tif files and follow your command line. terrain file is created but terrain shapes were not rendered.
try open script and replace NODATA value from -32768 to you value(-9999). May be ist help you. And how many bands in you raster ?
I’ve tried your tiff http://gis-lab.info/data/srtm-tif/srtm_45_04.zip, and your command line, ./gdal2srtmtiles.py --cesium -p geodetic srtm_45_04.tif terrain -z 0-9. The output terrain files seem not correct. I zipped my output as attachment . Would you check it? BTW, which distro and version of python-gdal are your use.
Thanks,
Shawn
terrain.tar.gz (1.62 MB)
I got what my problem is. How did you generate 0/0/0.terrain file? By your script, 0/0/0.terrain will not be created. If this file missing, whole global won't be rendered. When I use cesium team generated 0/0/0.terrain, there would be other issue. cesium team generated 0/0/0.terrain determines it have succeed terrain file in level 1, but I don't copy cesium team generated level 1 terrain file. Error pop up. Did your meet this issue before? What's the full steps to reach your screenshot show terrain?
Thanks,
Shawn
I forgot to say, in my example srt_45_04 and srtm_45_05 placed in right from 0 degrees by longitude, and terrain in 0 level in left of 0 degrees by longitude not been generated. By specification in terrain place flags which tiles exists on server, in this time i fill this flags as exists. Try do second, generate terrain from tile srtm_45_04(this tile placed in right from 0 degrees by longitude) and second generate terrain from tile srtm_13_06( this tile placed in north america(Los angeles)(left from 0 degrees by longitude)
gdal2srtmtiles.py --cesium -z 0-9 -p geodetic srtm_45_04.tif terrain
gdal2srtmtiles.py --cesium -z 0-9 -p geodetic srtm_13_06.tif terrain --join
And globe will be rendered full
GDAL 1.8.1, released 2011/07/09
Python 2.7.2
Terrain generated by me from this tiles : http://sergeserver.dyndns.org/phocadownload/terrain.tar.gz
And tile <-> name in globe for google-earth - http://sergeserver.dyndns.org/phocadownload/srtm41.kmz
Thanks a lot. Your script worked.
And another tiny issue. I don't find "-32768" in script. I cannot replace it with my value, -9999. How to do this modification?
Thanks,
Shawn