<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi Even,<br><br>I double checked and I noticed that this is not true:<br><br>> > The RAT is transferred to the geotiff file in both instances.<br><br>I pass -a_nodata and got no RAT as you can see on the
following log. <br><br>Without -a_nodata the file gtiff_i8u_c_i.tif.aux.xml is create with the full RAT.<br><br>$ gdal_translate -of gtiff i8u_c_i.img gtiff_i8u_c_i.tif -a_nodata 0<br>Input file size is 233, 250<br>0...10...20...30...40...50...60...70...80...90...100 - done.<br><br>$ gdalinfo gtiff_i8u_c_i.tif -noct<br>Driver: GTiff/GeoTIFF<br>Files: gtiff_i8u_c_i.tif<br>Size is 233, 250<br>Coordinate System is `'<br>Image Structure Metadata:<br> INTERLEAVE=BAND<br>Corner Coordinates:<br>Upper Left ( 0.0, 0.0)<br>Lower Left ( 0.0, 250.0)<br>Upper Right ( 233.0, 0.0)<br>Lower Right ( 233.0, 250.0)<br>Center ( 116.5, 125.0)<br>Band 1 Block=233x35 Type=Byte, ColorInterp=Palette<br> Description = Band_1<br> Min=0.000 Max=255.000<br> Minimum=0.000, Maximum=255.000, Mean=118.537, StdDev=102.769<br> NoData Value=0<br> Metadata:<br> LAYER_TYPE=thematic<br> STATISTICS_HISTOBINVALUES=12603|1|0|0|45|1|0|0|0|0|656|177|0|0|5026|1062|0|0<br>|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<br>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<br>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<br>|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<br>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<br>|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<br>|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<br>5|106|0|0|16|16517|<br> STATISTICS_HISTOMAX=255<br> STATISTICS_HISTOMIN=0<br> STATISTICS_HISTONUMBINS=256<br> STATISTICS_MAXIMUM=255<br> STATISTICS_MEAN=118.53732188841<br> STATISTICS_MEDIAN=85<br> STATISTICS_MINIMUM=0<br> STATISTICS_MODE=255<br> STATISTICS_SKIPFACTORX=1<br> STATISTICS_SKIPFACTORY=1<br> STATISTICS_STDDEV=102.76909129768<br> Color Table (RGB with 256 entries)<br><br>But for output HFA that is still true. I can pass
-a_nodata or not and the RAT is always copied to the output. <br><br>Try that:<br><br>$ gdal_translate -of hfa i8u_c_i.img hfa_i8u_c_i.img -a_nodata 0<br>$ gdal_translate -of hfa i8u_c_i.img hfa_i8u_c_i.img<br><br>Is that the same that you are getting over there?<br><br>Regards,<br><br>Ivan<br><br><br><div>> From: even.rouault@mines-paris.org<br>> To: gdal-dev@lists.osgeo.org<br>> Subject: Re: [gdal-dev] Passing RAT between drivers, including VRT<br>> Date: Thu, 15 Aug 2013 19:28:51 +0200<br>> CC: lucena_ivan@hotmail.com; robert@coup.net.nz<br>> <br>> Le jeudi 15 août 2013 18:53:46, Ivan Lucena a écrit :<br>> > Hi folks,<br>> > <br>> > I might be wrong, but it looks like the VRT driver is not supporting RAT at<br>> > this moment (TRUNK).<br>> > <br>> > Is that correct?<br>> <br>> Hi Ivan,<br>> <br>> yes, correct. See http://trac.osgeo.org/gdal/ticket/4903 where there's a patch <br>> pending for this support.<br>> <br>> > <br>> > A simple way to test it is by "gdal_translating" that file "i8u_c_i.img"<br>> > from autotest to VRT:<br>> > <br>> > $ gdal_translate -of vrt i8u_c_i.img vrt_i8u_c_i.vrt<br>> > $ gdalinfo vrt_i8u_c_i.vrt -noct<br>> > <br>> > The RAT is not there.<br>> > <br>> > That wouldn't be a big problem by itself, the real problem is that<br>> > gdal_translate uses an internal VRT to support several options. And I am<br>> > trying to fix that ticket: http://trac.osgeo.org/gdal/ticket/5200 and I<br>> > noticed that when I use *-a_nodata* the GetDefaultRAT() it returns null.<br>> > <br>> > Drivers that implement *file based* GDALPamDataset doesn't seems to have<br>> > that problem because they don't need to call GetDefaultRAT(). Examples:<br>> > <br>> > $ gdal_translate -of gtiif i8u_c_i.img gtiff_i8u_c_i.tif -a_nodata 0<br>> > $ gdal_translate -of gtiif i8u_c_i.img gtiff_i8u_c_i.tif<br>> > <br>> > The RAT is transferred to the geotiff file in both instances.<br>> <br>> That's surprising !, and even not what I observe in my test. The RAT is <br>> transfered in the simple gdal_translate case (since the IMG dataset is <br>> directly passed as the source dataset so GetDefaultRAT() != NULL), but not in <br>> the -a_nodata 0 case since the source dataset is a VRT one, without RAT <br>> support.<br>> <br>> > <br>> > Is that something we would like to get fix in VRT?<br>> <br>> Likely, the patches in http://trac.osgeo.org/gdal/ticket/4903 would need to be <br>> rebased on trunk since RFC 40 has been implemented.<br>> <br>> > <br>> > Best regards,<br>> > <br>> > Ivan<br>> <br>> -- <br>> Geospatial professional services<br>> http://even.rouault.free.fr/services.html<br></div> </div></body>
</html>