Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saved rasterisation .tif is seen as invalid by gdalinfo #337

Closed
felixcremer opened this issue Nov 21, 2022 · 2 comments
Closed

Saved rasterisation .tif is seen as invalid by gdalinfo #337

felixcremer opened this issue Nov 21, 2022 · 2 comments

Comments

@felixcremer
Copy link
Contributor

felixcremer commented Nov 21, 2022

When I save the result of a rasterisation into a .tif file I can't open this file in QGIS for comparison and gdalinfo reports th error below.
I would have expected, that I could open the file with QGIS to compare against the rasterisation of gdal_rasterize.The julia code which I ran is below and I attached an example file with which I run into this problem.
When I write the Raster which I got from opening the .tif file the resulting .tif file seems to be valid.

This is the gdalerror:

$ gdalinfo rastersaved_freqrastif.tif 
ERROR 6: rastersaved_freqrastif.tif: Unsupported TIFF configuration: BitsPerSample(=64) and SampleType(=2)
gdalinfo failed - unable to open 'rastersaved_freqrastif.tif'.

using Rasters, Shapefile
julia> shp = Shapefile.Table("palsar_3paths_v4_save00_poly_paleovarzea_frequently_buffer_90.shp")
julia> freqras = Raster("gdal_rasterized_frequently.tif")
julia> rasnc = rasterize(shp, to=freqras[:,:,1], fill=1, name=Symbol("freqbin_rasterized_rasters_from_nc"))
julia> write("rastersaved_freqrastif.tif", rasnc)

failed_rasterisation_save.zip

@rafaqz
Copy link
Owner

rafaqz commented Nov 22, 2022

This works fine on my system, and Rasters.jl is reading and writing it with GDAL too.

So I would guess the problem is your system gdal is older than your julia GDAL_jll, and doesn't yet read Int64. It's only recently that that was possible with GDAL. You can use fill=UInt8(1) for a smaller file that works everywhere.

@felixcremer
Copy link
Contributor Author

Thanks, using the UInt8 filling works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants