Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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=800x1 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=800x1 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=800x1 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

share|improve this question
    
Can you tell us what you mean by 'cannot open tif file'? –  Devdatta Tengshe Dec 21 '12 at 5:32
add comment

1 Answer 1

up vote 2 down vote accepted

Three suggestions:

  1. Try outputting to another format. Maybe Jpeg or PNG. These will likely work better with Windows Photo Viewer.

  2. Download IrfanView. This will display your tiff quite well.

  3. 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.

share|improve this answer
    
Great Thanks! First,I'v used the JPEG and PNG to have a test,it says "not support",so i replace it with BMP and it works. but I wish to get a GTIFF file,so I use the IrfanView to open the GTIFF file generated just now and it prompts "D:\Result\World.tif:Decode error!Invalid or unsupported TIF file" –  Ever For Dec 21 '12 at 3:04
    
What does gdalinfo return? –  Jay Laura Dec 21 '12 at 3:08
    
I'v pasted it on the content of the question –  Ever For Dec 21 '12 at 3:16
    
@EverFor Update in my answer. –  Jay Laura Dec 21 '12 at 3:22
    
Thanks!as you say,the issue is the default parameter float64,I change the -ot parameter to byte and it works properly.gdal_rasterize -burn 255 -burn 0 -burn 0 -ts 800 800 -ot BYTE -l Countries02 "D:\Map Data\Countries02.shp" "D:\Result\Countries02.tif" –  Ever For Dec 21 '12 at 3:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.