GDAL makes it very easy to create COG files by specifying the -of COG option. This makes it very efficient to access this data and even analyze it - without downloading large files. A Cloud-optimized GeoTIFF is behaving just like a regular GeoTIFF imagery, but instead of downloading the entire image locally, you can access portions of imagery hosted on a cloud server streamed to clients like QGIS. Check this article GeoTIFF compression and optimization with GDAL to learn more about various options and compression algorithms.ġ.1.5 Writing Cloud-Optimized GeoTIFF (COG)Ī new format called Cloud-Optimized GeoTIFF (COG) is making access to such a vast amount of imagery easier to access and analyze. The resulting file now comes out much smaller at 39MB. Mac/Linux gdal_translate -of GTiff merged.vrt merged.tif \ co COMPRESS=DEFLATE -co TILED=YES -co PREDICTOR=2 #Thought train mac os windowsWindows gdal_translate -of GTiff merged.vrt merged.tif ^ Windows shell uses ^ as the line-continuation, while Mac/Linux shells use \ as the line continuation. Note: You can split long commands into multiple lines using the line-continuation character. The TILED option will compress the data in blocks rather than line-by-line. For elevation data, this is definitely the case. The PREDICTOR option helps compress data better when the neighboring values are correlated. We can further reduce the file size by specifying additional options. After applying the DEFLATE compression, the file size was reduced to 73MB. gdal_translate -of GTiff merged.vrt merged.tif -co COMPRESS=DEFLATE We can try the DEFLATE algorithm on our dataset. The most popular loss-less compression algorithms are DEFLATE, LZW and PACKBITS. GDAL supports many compression algorithms out-of-the-box and can be specified with GDAL commands using the -co option. #Thought train mac os fullA smart approach is to use a lossless compression algorithm to reduce the size of the raster while maintaining full fidelity of the original data. For large rasters, this can consume a lot of disk space. The default output GeoTIFF file is uncompressed - meaning each pixel’s value is stored on the disk without any further processing. It is recommended to use a file list instead of wildcards with GDAL commands on Windows to avoid unexpected results. However, some versions of GDAL on Windows do not expand the * wildcard correctly and the command results in an error. Note: We could have done this operation in a single step using the command gdalbuildvrt merged.vrt *.hgt. gdalbuildvrt -input_file_list filelist.txt merged.vrt We can now use the gdalbuildvrt program to create a virtual raster from the source files in the filelist.txt. Once the command finishes, verify that the filelist.txt has the names of the source tiles. Here the /b option runs the command in the Bare mode which excludes all info except file names.įor Mac/Linux systems, the same can be achieved using the ls command. We can use the dir command on Command prompt to list the files matching the pattern *.hgt and redirect the output to a file. vrt file is just a text file, so it doesn’t consume any disk space but allows us to run any GDAL command as if it was a raster file.įirst we need to create a text file containing all the files we want to merge. vrt extension that is a pointer to multiple source files. GDAL provides a useful format called Virtual Raster that allows us to create a Virtual file with. We will now merge the 4 neighboring SRTM tiles into 1 raster so we can work with them together.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |