Raster Format Conversion Using gdal translate: Difference between revisions
Content deleted Content added
Ellis Symons (talk | contribs) No edit summary |
Ellis Symons (talk | contribs) No edit summary |
||
Line 16:
<Br>
'''Using DEFLATE Compression on Output GeoTIFF'''
:* ''<tt>-co</tt>'': (Creation Option) - output format specific option. Flag must be used for each creation option used - '''<u>[https://gdal.org/drivers/raster/gtiff.html More Details]</u>'''
:** ''<tt>COMPRESS=<method></tt>: "NONE", "DEFLATE", "LZW", and "PACKBITS" are currently supported by TUFLOW
<pre>gdal_translate.exe -of GTiff -co COMPRESS=DEFLATE DEM_M01_5m.asc DEM_M01_5m.tif</pre>
'''Specifying the Compression Level for the DEFLATE Compression Method'''<br>
:* ''<tt>-co</tt>'': (Creation Option) - output format specific option. Flag must be used for each creation option used - '''<u>[https://gdal.org/drivers/raster/gtiff.html More Details]</u>'''
:** ''<tt>ZLEVEL=[1-9]</tt>
<pre>gdal_translate.exe -of GTiff -co COMPRESS=DEFLATE -co ZLEVEL=9 DEM_M01_5m.asc DEM_M01_5m.tif</pre>
'''Adding a Horizontal Predictor to the Compression'''<br>
:* ''<tt>-co</tt>'': (Creation Option) - output format specific option. Flag must be used for each creation option used - '''<u>[https://gdal.org/drivers/raster/gtiff.html More Details]</u>'''
:** ''<tt>PREDICTOR=[1/2/3]</tt>'': 1 (No Predictor) and 2 (Horizontal Predictor) currently supported by TUFLOW
<pre>gdal_translate.exe -of GTiff -co COMPRESS=DEFLATE -co ZLEVEL=9 -co PREDICTOR=2 DEM_M01_5m.asc DEM_M01_5m.tif</pre>
==Assigning a Projection==
<br>
'''ASC to GeoTIFF'''<Br>
:* ''<t>-a_srs <srs_def></tt>'': Override the projection of the output file (no transformations performed). Srs_def can be an EPSG or WKT CRS definition.
<pre>gdal_translate.exe -of GTiff -a_srs "EPSG:32760" DEM_M01_5m.asc DEM_M01_5m.tif</pre>
==Converting to/from GPKG==
<br>
'''Convert to a new GPKG Database Where Layer Name is Different Than Database Name'''<Br>
:* ''<tt>-co</tt>'': (Creation Option) - output format specific option. Flag must be used for each creation option used - '''<u>[https://gdal.org/drivers/raster/gpkg.html More Details]</u>'''
:** ''<tt>RASTER_TABLE=<name></tt>'': The name of the output layer within database
<pre>gdal_translate.exe -of GPKG -co RASTER_TABLE=DEM_M01_5m DEM_M01_5m.asc DEM_database.gpkg</pre>
'''Convert to an existing GPKG Database Where Layer Name is Different Than Database Name'''<Br>
:* ''<tt>-co</tt>'': (Creation Option) - output format specific option. Flag must be used for each creation option used - '''<u>[https://gdal.org/drivers/raster/gpkg.html More Details]</u>'''
:** ''<tt>APPEND_SUBDATASET=[YES/NO]</tt>'': If "YES" the existing GPKG will not be priorly destroyed.
<pre>gdal_translate.exe -of GPKG -co RASTER_TABLE=DEM_M01_5m -co APPEND_SUBDATASET=YES DEM_M01_5m.asc DEM_database.gpkg</pre>
'''GPKG to GeoTIFF Where the Layer Name is Different Than the Database Name'''<Br>
:* ''<tt>-oo</tt>'': (Opening Option) - input format specific option. Flag must be used for each opening option used - '''<u>[https://gdal.org/drivers/raster/gpkg.html More Details]</u>'''
:** ''<tt>TABLE=<name></tt>'': Name of the layer within GPKG to be converted.
<pre>gdal_translate.exe -of GTiff -oo TABLE=DEM_M01_5m DEM_database.gpkg DEM_M01_5m.tif</pre>
| |||