Opened 22 years ago

Last modified 22 years ago

#221 closed defect (fixed)

gdal_translate to VRT with windowing bug

Reported by: warmerdam Owned by: warmerdam
Priority: high Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

Hi Frank,

When I do:

gdal_translate -of VRT -srcwin 0 0 7 8 test.tif junkvrt

It gives:

<VRTDataset rasterXSize="7" rasterYSize="8">
<VRTRasterBand dataType="Int32" band="1">
<ColorInterp>Gray</ColorInterp>
<SimpleSource>
<SourceFilename></SourceFilename>
<SourceBand>1</SourceBand>
<SrcRect xOff="0" yOff="0" xSize="7" ySize="8"/>
<DstRect xOff="0" yOff="0" xSize="7" ySize="8"/>
</SimpleSource>
</VRTRasterBand>
</VRTDataset>

The SourceFilename is missing.  I think it has something to do with
poSrcBand->GetDescription()'s return output being length 0 (line 515 or
so), but I'm not sure where this description should be set- in
gdal_translate, or at some lower level.

Gillian

Change History (2)

comment:1 by warmerdam, 22 years ago

gwalter@atlsci.com wrote:
> Hi Frank,
> 
> When I do:
> 
> gdal_translate -of VRT -srcwin 0 0 7 8 test.tif junkvrt
> 
> It gives:
> 
> <VRTDataset rasterXSize="7" rasterYSize="8">
>   <VRTRasterBand dataType="Int32" band="1">
>     <ColorInterp>Gray</ColorInterp>
>     <SimpleSource>
>       <SourceFilename></SourceFilename>
>       <SourceBand>1</SourceBand>
>       <SrcRect xOff="0" yOff="0" xSize="7" ySize="8"/>
>       <DstRect xOff="0" yOff="0" xSize="7" ySize="8"/>
>     </SimpleSource>
>   </VRTRasterBand>
> </VRTDataset>
> 
> The SourceFilename is missing.  I think it has something to do with
> poSrcBand->GetDescription()'s return output being length 0 (line 515 or
> so), but I'm not sure where this description should be set- in
> gdal_translate, or at some lower level.
> 
> Gillian

Gillian,

Cool bug.  I can see why this is happening.  gdal_translate is now clever 
enough to create an internal virtual file representing the window onto
the original dataset but then gdal_tarnslate creates yet a new output
virtual file which is copied from the intermediate virtual file which has
no name.  

I have submitted this problem into bugzilla and will try to address it but
I am not promising when.  The work around is to gdal_translate to a real
file when doing subwindowing (or other GDAL transformations like scaling). 

  http://bugzilla.remotesensing.org/show_bug.cgi?id=221

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent


comment:2 by warmerdam, 22 years ago

Problem fixed in VRTDriver::CopyCreate().  It will now recognise if the
input is already a virtual dataset, and if so, just save the VRT description
directly instead of adding another level of indirection.


Note: See TracTickets for help on using tickets.