-
|
Is there any documentation or examples specifically about updating files? I could not find it so far. E.g. I want to convert a GeoTIFF into COG, adding Overviews, setting Compression etc. Is this possible without temporarilly copying the file as we do in translate? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
For the case of converting GeoTIFF into COG it is required to re-write the file. This is also true in general for enabling compression on an uncompressed file (for formats that support compression), or for changing the type of compression used (e.g., with GeoTIFF format which supports several compression methods). The file must be re-written in order to do that. In the case of COG, there is also more involved, e.g., "Optimized layout of TIFF sections to minimize the number of GET requests needed by a reader doing random read access." This requires rewriting the file so we need Besides that, there are several things we can update in-place on files that support rw+. For existing documentation, a good starting point is the vignette "Raster API Tutorial" at: The other relevant documentation and examples are those for class To open a raster dataset with update access: ds <- new(GDALRaster, filename, read_only = FALSE)where In the documentation for We can build or delete overviews with We can set or delete a raster nodata value (per band). This does not change any pixel values, it only affects the value of the nodata marker that is defined on the dataset (for formats that support an intrinsic nodata value). We can set the unit type, scale, offset and color interpretation values per band. We can get statistics which will generally then be "set back" on the raster if the format supports caching statistics. We can also set metadata items. See the GDAL Raster Data Model for a description of metadata: We can get/set color tables and raster attribute tables. These will then be available in other software such as QGIS. GDAL Raster Attribute Tables are well-supported in We can write pixel data with Also note that when calling methods on a Error: could not find valid methodSo just check the documentation and verify the required parameters are correct if that occurs. After updating a raster dataset has been completed, it is important to call Let me know if there are examples relating to update, or gaps in the documentation, that you think would be helpful to add. |
Beta Was this translation helpful? Give feedback.
For the case of converting GeoTIFF into COG it is required to re-write the file. This is also true in general for enabling compression on an uncompressed file (for formats that support compression), or for changing the type of compression used (e.g., with GeoTIFF format which supports several compression methods). The file must be re-written in order to do that. In the case of COG, there is also more involved, e.g., "Optimized layout of TIFF sections to minimize the number of GET requests needed by a reader doing random read access." This requires rewriting the file so we need
translate()including thec("-of", "COG")command-line arguments passed incl_arg.Besides that, there are severa…