[gdal-dev] Passing RAT between drivers, including VRT

Ivan Lucena lucena_ivan at hotmail.com
Thu Aug 15 11:04:51 PDT 2013


Hi Even,

I double checked and I noticed that this is not true:

> > The RAT is transferred to the geotiff file in both instances.

I pass -a_nodata and got no RAT as you can see on the 
following log. 

Without -a_nodata the file gtiff_i8u_c_i.tif.aux.xml is create with the full RAT.

$ gdal_translate -of gtiff i8u_c_i.img gtiff_i8u_c_i.tif -a_nodata 0
Input file size is 233, 250
0...10...20...30...40...50...60...70...80...90...100 - done.

$ gdalinfo gtiff_i8u_c_i.tif -noct
Driver: GTiff/GeoTIFF
Files: gtiff_i8u_c_i.tif
Size is 233, 250
Coordinate System is `'
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  250.0)
Upper Right (  233.0,    0.0)
Lower Right (  233.0,  250.0)
Center      (  116.5,  125.0)
Band 1 Block=233x35 Type=Byte, ColorInterp=Palette
  Description = Band_1
  Min=0.000 Max=255.000
  Minimum=0.000, Maximum=255.000, Mean=118.537, StdDev=102.769
  NoData Value=0
  Metadata:
    LAYER_TYPE=thematic
    STATISTICS_HISTOBINVALUES=12603|1|0|0|45|1|0|0|0|0|656|177|0|0|5026|1062|0|0
|2|0|0|0|0|0|0|0|0|0|0|0|0|0|75|1|0|0|207|158|0|0|8|34|0|0|0|0|538|57|0|10|214|2
0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|1|31|0|0|9|625|67|0|0|118|738|117|3004|1499|49
1|187|1272|513|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|16|3|0|0|283|123|5|1931|835
|357|332|944|451|80|40|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|12|5|0|0|535|10
29|118|0|33|246|342|0|0|10|8|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|169|439|0
|0|6|990|329|0|0|120|295|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|164
|42|0|0|570|966|0|0|18|152|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|4
5|106|0|0|16|16517|
    STATISTICS_HISTOMAX=255
    STATISTICS_HISTOMIN=0
    STATISTICS_HISTONUMBINS=256
    STATISTICS_MAXIMUM=255
    STATISTICS_MEAN=118.53732188841
    STATISTICS_MEDIAN=85
    STATISTICS_MINIMUM=0
    STATISTICS_MODE=255
    STATISTICS_SKIPFACTORX=1
    STATISTICS_SKIPFACTORY=1
    STATISTICS_STDDEV=102.76909129768
  Color Table (RGB with 256 entries)

But for output HFA that is still true. I can pass
 -a_nodata or not and the RAT is always copied to the output. 

Try that:

$ gdal_translate -of hfa i8u_c_i.img hfa_i8u_c_i.img -a_nodata 0
$ gdal_translate -of hfa i8u_c_i.img hfa_i8u_c_i.img

Is that the same that you are getting over there?

Regards,

Ivan


> From: even.rouault at mines-paris.org
> To: gdal-dev at lists.osgeo.org
> Subject: Re: [gdal-dev] Passing RAT between drivers, including VRT
> Date: Thu, 15 Aug 2013 19:28:51 +0200
> CC: lucena_ivan at hotmail.com; robert at coup.net.nz
> 
> Le jeudi 15 août 2013 18:53:46, Ivan Lucena a écrit :
> > Hi folks,
> > 
> > I might be wrong, but it looks like the VRT driver is not supporting RAT at
> > this moment (TRUNK).
> > 
> > Is that correct?
> 
> Hi Ivan,
> 
> yes, correct. See http://trac.osgeo.org/gdal/ticket/4903 where there's a patch 
> pending for this support.
> 
> > 
> > A simple way to test it is by "gdal_translating" that file "i8u_c_i.img"
> > from autotest to VRT:
> > 
> > $ gdal_translate -of vrt i8u_c_i.img vrt_i8u_c_i.vrt
> > $ gdalinfo vrt_i8u_c_i.vrt -noct
> > 
> > The RAT is not there.
> > 
> > That wouldn't be a big problem by itself, the real problem is that
> > gdal_translate uses an internal VRT to support several options. And I am
> > trying to fix that ticket: http://trac.osgeo.org/gdal/ticket/5200 and I
> > noticed that when I use *-a_nodata* the GetDefaultRAT() it returns null.
> > 
> > Drivers that implement *file based* GDALPamDataset doesn't seems to have
> > that problem because they don't need to call GetDefaultRAT(). Examples:
> > 
> > $ gdal_translate -of gtiif i8u_c_i.img gtiff_i8u_c_i.tif -a_nodata 0
> > $ gdal_translate -of gtiif i8u_c_i.img gtiff_i8u_c_i.tif
> > 
> > The RAT is transferred to the geotiff file in both instances.
> 
> That's surprising !, and even not what I observe in my test. The RAT is 
> transfered in the simple gdal_translate case (since the IMG dataset is 
> directly passed as the source dataset so GetDefaultRAT() != NULL), but not in 
> the -a_nodata 0 case since the source dataset is a VRT one, without RAT 
> support.
> 
> > 
> > Is that something we would like to get fix in VRT?
> 
> Likely, the patches in http://trac.osgeo.org/gdal/ticket/4903 would need to be 
> rebased on trunk since RFC 40 has been implemented.
> 
> > 
> > Best regards,
> > 
> > Ivan
> 
> -- 
> Geospatial professional services
> http://even.rouault.free.fr/services.html
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130815/832bd9c7/attachment.html>


More information about the gdal-dev mailing list