[GRASS-dev] [GRASS GIS] #906: r.out.gdal (VRT) broken output

#906: r.out.gdal (VRT) broken output
-----------------------+------------------------------
  Reporter: epifanio | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 6.4.6
Component: Raster | Version: svn-develbranch6
Resolution: | Keywords: r.out.gdal, VRT
       CPU: x86-64 | Platform: MacOSX
-----------------------+------------------------------
Changes (by neteler):

* milestone: 6.5.0 => 6.4.6

Old description:

tring to generate a VRT file using r.out.gdal i get a broken file (not
loadable in ossim and qgis)
using gdal_translate i get a different results.

using r.out.gdal

r.out.gdal input=geology at PERMANENT format=VRT type=Byte
output=name.vrt

r.out.gdal input=geology at PERMANENT format=VRT type=Byte
output=name.vrt
Exporting to GDAL data type: Byte
Checking GDAl data type and nodata value
Input raster map contains cells with NULL-value (no-data). The value 255
will be used to represent no-data values in the input map. You can
specify a nodata value with the nodata option.
Exporting to GDAL raster
ERROR 1: Writing through VRTSourcedRasterBand is not
supported.
Unable to write GDAL raster file
Unable to export raster map <geology at PERMANENT>
r.out.gdal complete.
(Thu Feb 4 00:53:22 2010) Command finished (0 sec)

i get this output :

#############################################

<VRTDataset rasterXSize="1899" rasterYSize="1398">
  <SRS>PROJCS[&quot;UTM Zone 13, Northern
Hemisphere&quot;,GEOGCS[&quot;clark66&quot;,DATUM[&quot;North_American_Datum_1927&quot;,SPHEROID[&quot;Clarke_1866&quot;,6378206.4,294.9786982]],PRIMEM[&quot;Greenwich&quot;,0],UNIT[&quot;degree&quot;,0.0174532925199433]],PROJECTION[&quot;Transverse_Mercator&quot;],PARAMETER[&quot;latitude_of_origin&quot;,0],PARAMETER[&quot;central_meridian&quot;,-105],PARAMETER[&quot;scale_factor&quot;,0.9996],PARAMETER[&quot;false_easting&quot;,500000],PARAMETER[&quot;false_northing&quot;,0],UNIT[&quot;meter&quot;,1]]</SRS>
  <GeoTransform> 5.9001000000000000e+05, 1.0000000000000000e+01,
0.0000000000000000e+00, 4.9280000000000000e+06, 0.0000000000000000e+00,
-1.0000000000000000e+01</GeoTransform>
  <VRTRasterBand dataType="Byte" band="1">
    <NoDataValue>2.55000000000000E+02</NoDataValue>
    <ColorInterp>Palette</ColorInterp>
    <ColorTable>
      <Entry c1="197" c2="129" c3="125" c4="255"/>
      <Entry c1="107" c2="250" c3="75" c4="255"/>
      <Entry c1="226" c2="83" c3="250" c4="255"/>
      <Entry c1="246" c2="222" c3="188" c4="255"/>
      <Entry c1="123" c2="225" c3="27" c4="255"/>
      <Entry c1="134" c2="190" c3="1" c4="255"/>
      <Entry c1="48" c2="86" c3="221" c4="255"/>
      <Entry c1="113" c2="70" c3="15" c4="255"/>
      <Entry c1="102" c2="134" c3="101" c4="255"/>
      <Entry c1="89" c2="135" c3="169" c4="255"/>
    </ColorTable>
  </VRTRasterBand>
</VRTDataset>

#############################################

this output is different from the gdal output :

gdal_translate -of VRT
/Users/sasha/Downloads/spearfish60/PERMANENT/cellhd/geology
/Users/sasha/Desktop/geology.vrt

#############################################

<VRTDataset rasterXSize="190" rasterYSize="140">
  <SRS>PROJCS[&quot;UTM Zone 13, Northern
Hemisphere&quot;,GEOGCS[&quot;clark66&quot;,DATUM[&quot;North_American_Datum_1927&quot;,SPHEROID[&quot;Clarke_1866&quot;,6378206.4,294.9786982]],PRIMEM[&quot;Greenwich&quot;,0],UNIT[&quot;degree&quot;,0.0174532925199433]],PROJECTION[&quot;Transverse_Mercator&quot;],PARAMETER[&quot;latitude_of_origin&quot;,0],PARAMETER[&quot;central_meridian&quot;,-105],PARAMETER[&quot;scale_factor&quot;,0.9996],PARAMETER[&quot;false_easting&quot;,500000],PARAMETER[&quot;false_northing&quot;,0],UNIT[&quot;meter&quot;,1]]</SRS>
  <GeoTransform> 5.9000000000000000e+05, 1.0000000000000000e+02,
0.0000000000000000e+00, 4.9280000000000000e+06, 0.0000000000000000e+00,
-1.0000000000000000e+02</GeoTransform>
  <Metadata/>
  <VRTRasterBand dataType="Byte" band="1">
    <Metadata>
      <MDI key="COLOR_TABLE_RULES_COUNT">0</MDI>
    </Metadata>
    <NoDataValue>0.00000000000000E+00</NoDataValue>
    <ColorInterp>Palette</ColorInterp>
    <ColorTable>
      <Entry c1="197" c2="129" c3="125" c4="255"/>
      <Entry c1="107" c2="250" c3="75" c4="255"/>
      <Entry c1="226" c2="83" c3="250" c4="255"/>
      <Entry c1="246" c2="222" c3="188" c4="255"/>
      <Entry c1="123" c2="225" c3="27" c4="255"/>
      <Entry c1="134" c2="190" c3="1" c4="255"/>
      <Entry c1="48" c2="86" c3="221" c4="255"/>
      <Entry c1="113" c2="70" c3="15" c4="255"/>
      <Entry c1="102" c2="134" c3="101" c4="255"/>
      <Entry c1="89" c2="135" c3="169" c4="255"/>
    </ColorTable>
    <SimpleSource>
      <SourceFilename
relativeToVRT="0">/Users/sasha/Downloads/spearfish60/PERMANENT/cellhd/geology</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="190" RasterYSize="140"
DataType="Byte" BlockXSize="190" BlockYSize="1"/>
      <SrcRect xOff="0" yOff="0" xSize="190" ySize="140"/>
      <DstRect xOff="0" yOff="0" xSize="190" ySize="140"/>
    </SimpleSource>
  </VRTRasterBand>
</VRTDataset>

#############################################

the grass output doesn't include :

    <SimpleSource>
...
    </SimpleSource>

it is missed and tring to load the output in ossim or qgis it is not
displayed.

from a chat on gdal seems the problem is related to the "create_copy()"
usage .. but i'm not able to debug it.

thanks!

Massimo.

New description:

tring to generate a VRT file using r.out.gdal i get a broken file (not
loadable in ossim and qgis)
using gdal_translate i get a different results.

using r.out.gdal

{{{

r.out.gdal input=geology@PERMANENT format=VRT type=Byte output=name.vrt

r.out.gdal input=geology@PERMANENT format=VRT type=Byte output=name.vrt
Exporting to GDAL data type: Byte
Checking GDAl data type and nodata value
Input raster map contains cells with NULL-value (no-data). The value 255
will be used to represent no-data values in the input map. You can specify
a nodata value with the nodata option.
Exporting to GDAL raster
ERROR 1: Writing through VRTSourcedRasterBand is not
supported.
Unable to write GDAL raster file
Unable to export raster map <geology at PERMANENT>
r.out.gdal complete.
(Thu Feb 4 00:53:22 2010) Command finished (0 sec)
}}}

i get this output :

{{{

#############################################

<VRTDataset rasterXSize="1899" rasterYSize="1398">
   <SRS>PROJCS[&quot;UTM Zone 13, Northern
Hemisphere&quot;,GEOGCS[&quot;clark66&quot;,DATUM[&quot;North_American_Datum_1927&quot;,SPHEROID[&quot;Clarke_1866&quot;,6378206.4,294.9786982]],PRIMEM[&quot;Greenwich&quot;,0],UNIT[&quot;degree&quot;,0.0174532925199433]],PROJECTION[&quot;Transverse_Mercator&quot;],PARAMETER[&quot;latitude_of_origin&quot;,0],PARAMETER[&quot;central_meridian&quot;,-105],PARAMETER[&quot;scale_factor&quot;,0.9996],PARAMETER[&quot;false_easting&quot;,500000],PARAMETER[&quot;false_northing&quot;,0],UNIT[&quot;meter&quot;,1]]</SRS>
   <GeoTransform> 5.9001000000000000e+05, 1.0000000000000000e+01,
0.0000000000000000e+00, 4.9280000000000000e+06, 0.0000000000000000e+00,
-1.0000000000000000e+01</GeoTransform>
   <VRTRasterBand dataType="Byte" band="1">
     <NoDataValue>2.55000000000000E+02</NoDataValue>
     <ColorInterp>Palette</ColorInterp>
     <ColorTable>
       <Entry c1="197" c2="129" c3="125" c4="255"/>
       <Entry c1="107" c2="250" c3="75" c4="255"/>
       <Entry c1="226" c2="83" c3="250" c4="255"/>
       <Entry c1="246" c2="222" c3="188" c4="255"/>
       <Entry c1="123" c2="225" c3="27" c4="255"/>
       <Entry c1="134" c2="190" c3="1" c4="255"/>
       <Entry c1="48" c2="86" c3="221" c4="255"/>
       <Entry c1="113" c2="70" c3="15" c4="255"/>
       <Entry c1="102" c2="134" c3="101" c4="255"/>
       <Entry c1="89" c2="135" c3="169" c4="255"/>
     </ColorTable>
   </VRTRasterBand>
</VRTDataset>

#############################################

this output is different from the gdal output :

gdal_translate -of VRT
/Users/sasha/Downloads/spearfish60/PERMANENT/cellhd/geology
/Users/sasha/Desktop/geology.vrt

#############################################

<VRTDataset rasterXSize="190" rasterYSize="140">
   <SRS>PROJCS[&quot;UTM Zone 13, Northern
Hemisphere&quot;,GEOGCS[&quot;clark66&quot;,DATUM[&quot;North_American_Datum_1927&quot;,SPHEROID[&quot;Clarke_1866&quot;,6378206.4,294.9786982]],PRIMEM[&quot;Greenwich&quot;,0],UNIT[&quot;degree&quot;,0.0174532925199433]],PROJECTION[&quot;Transverse_Mercator&quot;],PARAMETER[&quot;latitude_of_origin&quot;,0],PARAMETER[&quot;central_meridian&quot;,-105],PARAMETER[&quot;scale_factor&quot;,0.9996],PARAMETER[&quot;false_easting&quot;,500000],PARAMETER[&quot;false_northing&quot;,0],UNIT[&quot;meter&quot;,1]]</SRS>
   <GeoTransform> 5.9000000000000000e+05, 1.0000000000000000e+02,
0.0000000000000000e+00, 4.9280000000000000e+06, 0.0000000000000000e+00,
-1.0000000000000000e+02</GeoTransform>
   <Metadata/>
   <VRTRasterBand dataType="Byte" band="1">
     <Metadata>
       <MDI key="COLOR_TABLE_RULES_COUNT">0</MDI>
     </Metadata>
     <NoDataValue>0.00000000000000E+00</NoDataValue>
     <ColorInterp>Palette</ColorInterp>
     <ColorTable>
       <Entry c1="197" c2="129" c3="125" c4="255"/>
       <Entry c1="107" c2="250" c3="75" c4="255"/>
       <Entry c1="226" c2="83" c3="250" c4="255"/>
       <Entry c1="246" c2="222" c3="188" c4="255"/>
       <Entry c1="123" c2="225" c3="27" c4="255"/>
       <Entry c1="134" c2="190" c3="1" c4="255"/>
       <Entry c1="48" c2="86" c3="221" c4="255"/>
       <Entry c1="113" c2="70" c3="15" c4="255"/>
       <Entry c1="102" c2="134" c3="101" c4="255"/>
       <Entry c1="89" c2="135" c3="169" c4="255"/>
     </ColorTable>
     <SimpleSource>
       <SourceFilename
relativeToVRT="0">/Users/sasha/Downloads/spearfish60/PERMANENT/cellhd/geology</SourceFilename>
       <SourceBand>1</SourceBand>
       <SourceProperties RasterXSize="190" RasterYSize="140"
DataType="Byte" BlockXSize="190" BlockYSize="1"/>
       <SrcRect xOff="0" yOff="0" xSize="190" ySize="140"/>
       <DstRect xOff="0" yOff="0" xSize="190" ySize="140"/>
     </SimpleSource>
   </VRTRasterBand>
</VRTDataset>

#############################################
}}}

the grass output doesn't include :

{{{
     <SimpleSource>
...
     </SimpleSource>
}}}

it is missed and tring to load the output in ossim or qgis it is not
displayed.

from a chat on gdal seems the problem is related to the "create_copy()"
usage .. but i'm not able to debug it.

thanks!

Massimo.

--

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/906#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>