I'm working with a GeoTIFF from http://www.fao.org/geonetwork/srv/en/main.home?uuid=ba4526fd-cdbf-4028-a1bd-5a559c4bff38
The original has data values from 0-11:
$ gdalinfo -hist ./data/FAO/glc_shv10_DOM.Tif
Driver: GTiff/GeoTIFF
Size is 43200, 21600
Metadata:
TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
TIFFTAG_SOFTWARE=Arc/Info
TIFFTAG_XRESOLUTION=119.999
TIFFTAG_YRESOLUTION=119.999
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0,21600.0)
Upper Right (43200.0, 0.0)
Lower Right (43200.0,21600.0)
Center (21600.0,10800.0)
Band 1 Block=43200x3 Type=Byte, ColorInterp=Gray
256 buckets from -0.5 to 255.5:
181470400 977689 29454097 33129685 71015243 18337497 3857498 122159 20544229
28053726 11242330 534915447 0 0 0 ... (more zeros)
I tried to reorganize it with a 256x256 block size for subsequent steps in my processing pipeline, using:
gdalwarp -ot Byte -co COMPRESS=DEFLATE -co TILED=YES -s_srs "EPSG:4326" -t_srs "EPSG:4326" -to SRC_METHOD=NO_GEOTRANSFORM glc_shv10_DOM.Tif new_file.tif
I had used "-to SRC_METHOD=NO_GEOTRANSFORM" because the original file lacks information about its coordinate system but looks like EPSG:4326.
The new file has very different pixel values: 0, 19, 26, 30, 34, 37, 39, 41, 43, 45, 47, 48.
Driver: GTiff/GeoTIFF
Size is 43200, 21600
Coordinate System is:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
USAGE[
SCOPE["unknown"],
AREA["World"],
BBOX[-90,-180,90,180]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (0.000000000000000,21600.000000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Metadata:
AREA_OR_POINT=Area
TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
TIFFTAG_SOFTWARE=Arc/Info
TIFFTAG_XRESOLUTION=119.999
TIFFTAG_YRESOLUTION=119.999
Image Structure Metadata:
COMPRESSION=DEFLATE
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 0.000, 21600.000) ( 0d 0' 0.01"E,Invalid angle)
Lower Left ( 0.0000000, 0.0000000) ( 0d 0' 0.01"E, 0d 0' 0.01"N)
Upper Right ( 43200.000, 21600.000) (Invalid angle,Invalid angle)
Lower Right ( 43200.000, 0.000) (Invalid angle, 0d 0' 0.01"N)
Center ( 21600.000, 10800.000) (Invalid angle,Invalid angle)
Band 1 Block=256x256 Type=Byte, ColorInterp=Gray
256 buckets from -0.5 to 255.5:
181470400 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 977689 0 0 0 0 0 0
29454097 0 0 0 33129685 0 0 0 71015243 0 0 18337497 0 3857498 0
122159 0 20544229 0 28053726 0 11242330 534915447 0 0 (more zeros)
I don't understand why the pixel values changed. Other questions where data values changed involve a scale_factor in the metadata, but my file does not have a scale_factor.
I also need to figure out what I'm missing about adding a coordinate system, the Corner Coordinates are still pixels but now being interpreted as degrees.
gdalinfo
output withOrigin = (-180.000000000000000,90.000000001440014)
andPixel Size = (0.008333333333400,-0.008333333333400)
. You appear to have stripped the georeferencing out of the tif somehow. Have you done any processing beforehand? What version of GDAL and how did you install?