[Qgis-developer] RasterFileWriter creates 5 times bigger geotiff then gdal_translate

Radim Blazek radim.blazek at gmail.com
Fri Jul 11 02:14:13 PDT 2014


GDALGetRasterDataType() in QGIS GDAL provider is giving GDT_Float64.
It is also strange that gdalinfo gives Float32 because the data values
have about 17 digits, i.e. double, reducing them to Float32 means loss
of precision.

Your sample has 560073 bytes, saved as TIFF from QGIS it has 242320
which makes sense, 17 bytes for each value reduced to 8 bytes per
pixel.

I don't see any problem in QGIS, you might ask in GDAL list why
gdalinfo reports Float32.

Radim

On Tue, Jul 8, 2014 at 11:05 AM, G. Allegri <giohappy at gmail.com> wrote:
> Hi Radim,
> it seems so.
> If verified that both gdalinfo and qgis.bin are pointing to the same
> libgdal:
>
>>ldd /usr/bin/gdalinfo
> libgdal.so.1 => /usr/lib/libgdal.so.1
>
>>ldd /usr/bin/qgis.bin
> libgdal.so.1 => /usr/lib/libgdal.so.1
>
> Doing a debug sessione I've seen that Float64 is set by GDAL here:
> https://github.com/qgis/QGIS/blob/master/src/providers/gdal/qgsgdalprovider.cpp#L1076
>
> Here it is an excerpt of the original ASCII:
> https://dl.dropboxusercontent.com/u/13861666/FI_clipped.asc
>
> giovanni
>
>
> 2014-07-08 10:16 GMT+02:00 Radim Blazek <radim.blazek at gmail.com>:
>
>> On Sat, Jul 5, 2014 at 8:17 PM, G. Allegri <giohappy at gmail.com> wrote:
>> > Sorry for the buzz. It's not QGIS fault, it's GDAL itself which reads
>> > the
>> > ASCII Grid as Float64, but I wonder why contrarily gdalinfo and
>> > gdal_translate treats it as Float32...
>>
>> Float64 in QGIS layer properties metadata Data Type and gdalinfo
>> giving Float32 on the same file?
>>
>> Radim
>>
>> >
>> > 2014-07-05 18:56 GMT+02:00 G. Allegri <giohappy at gmail.com>:
>> >
>> >> I haven't spot tha exact point where this happens but QGIS exports
>> >> Float64, even if the origin was Float32.
>> >>
>> >> giovanni
>> >>
>> >>
>> >> 2014-07-05 16:54 GMT+02:00 G. Allegri <giohappy at gmail.com>:
>> >>
>> >>> Causally I hit the save as raster dialog, and I tried to export a
>> >>> raster
>> >>> to layer (coming from an ASCII Grid source) to Geotiff, with no
>> >>> creation
>> >>> options set.
>> >>> The result was a file 3 times bigger then the original ASCII, and 5
>> >>> times
>> >>> bigger then the Geotiff created by gdal_translate.
>> >>>
>> >>> gdalinfo on the files give same results (except statistics missing
>> >>> from
>> >>> the one created by RasterFileWriter).
>> >>> Does gdal_translate do some optimizations that RFW doesn't?
>> >>> I wasn't aware that two Geotiffs, apparently with the same properties,
>> >>> could be so different in size...
>> >>>
>> >>> giovanni
>> >>>
>> >>> --
>> >>> Giovanni Allegri
>> >>> http://about.me/giovanniallegri
>> >>> Twitter: https://twitter.com/_giohappy_
>> >>> blog: http://blog.spaziogis.it
>> >>> GEO+ geomatica in Italia http://bit.ly/GEOplus
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Giovanni Allegri
>> >> http://about.me/giovanniallegri
>> >> Twitter: https://twitter.com/_giohappy_
>> >> blog: http://blog.spaziogis.it
>> >> GEO+ geomatica in Italia http://bit.ly/GEOplus
>> >
>> >
>> >
>> >
>> > --
>> > Giovanni Allegri
>> > http://about.me/giovanniallegri
>> > Twitter: https://twitter.com/_giohappy_
>> > blog: http://blog.spaziogis.it
>> > GEO+ geomatica in Italia http://bit.ly/GEOplus
>
>
>
>
> --
> Giovanni Allegri
> http://about.me/giovanniallegri
> Twitter: https://twitter.com/_giohappy_
> blog: http://blog.spaziogis.it
> GEO+ geomatica in Italia http://bit.ly/GEOplus


More information about the Qgis-developer mailing list