Now I'm tring to rasterize a shapefile with a utility "gdal_rasterize" and want to generate a new gtiff file,but when I open the rasterized gtiff file,it prompts "Windows Photo Viewer can't open this picture because the file appears to be damaged,corrupted,or is too large.
……………………………………………………………………………..
……………………………………………………………………………..
Command Line:
gdal_rasterize -burn 255 -burn 0 -burn 0 -ts 800 800 -l Countries02 "D:\Map Data\Countries02.shp" "D:\Result\Countries02.tif"
Map Data:
https://skydrive.live.com/redir?resid=7EF4FFBCD523D8E0!431&authkey=!AKiLt1a0bpOGi7w
The output gdalinfo returns is as follow:
Driver: GTiff/GeoTIFF
Files: d:\Result\World.tif
Size is 800, 800
Coordinate System is `'
Origin = (-180.000000000000000,83.623596191406250)
Pixel Size = (0.450000000000000,-0.217029495239258)
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left (-180.0000000, 83.6235962)
Lower Left (-180.0000000, -90.0000000)
Upper Right ( 180.0000000, 83.6235962)
Lower Right ( 180.0000000, -90.0000000)
Center ( 0.0000000, -3.1882019)
Band 1 Block=800×1 Type=Float64, ColorInterp=Gray
Minimum=0.000, Maximum=255.000, Mean=87.551, StdDev=121.080
Metadata:
STATISTICS_MAXIMUM=255
STATISTICS_MEAN=87.5514609375
STATISTICS_MINIMUM=0
STATISTICS_STDDEV=121.07999102565
Band 2 Block=800×1 Type=Float64, ColorInterp=Undefined
Minimum=0.000, Maximum=0.000, Mean=0.000, StdDev=0.000
Metadata:
STATISTICS_MAXIMUM=0
STATISTICS_MEAN=0
STATISTICS_MINIMUM=0
STATISTICS_STDDEV=0
Band 3 Block=800×1 Type=Float64, ColorInterp=Undefined
Minimum=0.000, Maximum=0.000, Mean=0.000, StdDev=0.000
Metadata:
STATISTICS_MAXIMUM=0
STATISTICS_MEAN=0
STATISTICS_MINIMUM=0
STATISTICS_STDDEV=0
Best Answer
Three suggestions:
Try outputting to another format. Maybe Jpeg or PNG. These will likely work better with Windows Photo Viewer.
Download IrfanView. This will display your tiff quite well.
If neither work - could you run 'gdalinfo -stats Countries02.tif' and post the output.
Edit:
The output is float64. This is likely the issue. Try 'gdal_translate -ot Byte -scale Countries02.tif Countires02_scaled.tif'
I'm not sure why rasterize is creating 64-bit output, but not much reads 64-bit. Also, -scale should not be necessary, but is precautionary.