[GRASS-user] Need help applying gdalwarp

Rich Shepard rshepard at appl-ecosys.com
Tue Sep 24 11:47:04 PDT 2019


I found Markus N's 'gdal tips and tricks' web page and tried applying it to
warp a DEM so north is up rather than tilted to the right.

The script:

-----
#!/usr/bin/bash

# set region to the map to be warped
g.region rast=45123h5_clatsop

# The file format is ENVI or Ehdr, not a GTiff so use r.gdal.out
r.out.gdal in=45123h5_clatsop out=45123h5_clatsop.tif for=GTiff --o

# raster map reprojection (warping)
gdalwarp -rb 45123h5_clatsop.tif test1.tif
-----

r.out.gdal appears to work but did not like the 'elev' color scale;

r.out.gdal in=45123h5_clatsop out=45123h5_clatsop.tif for=GTiff --o
Checking GDAL data type and nodata value...
  100%
Using GDAL data type <Float32>
Input raster map contains cells with NULL-value (no-data). The value -nan
will be used to represent no-data values in the input map. You can specify
a nodata value with the nodata option.
Exporting raster data to GTiff format...
ERROR 6: SetColorTable() only supported for Byte or UInt16 bands in TIFF format.
  100%
r.out.gdal complete. File <45123h5_clatsop.tif> created.

The gdalwarp test1.tif output looks the same as the input .tif. It's still
slightly skewed clockwise.

Since I've not before had a need to use gdalwarp I'm totally inexperienced
with the tool. How should the script be modified to produce a northup.tif
output that can be imported back to grass with r.in.gdal?

TIA,

Rich



More information about the grass-user mailing list