[gdal-dev] Combining raw .vrt with derived bands

Scott Staniewicz scott.stanie at gmail.com
Wed Mar 11 09:59:03 PDT 2020


Oh very cool, thanks!
So that appears to work for getting the Derived band (pasted below), but
I've got 2 followups

1. is there any way to access the nested VRT? So for this one .vrt, it
would have one band as Float32 (the derived phase), and one as CFloat32
(the original raw file). Or are the different datatypes not allowed as
different bands in one raster?
2. If I wanted to have two derived bands (say, a logamp derived band),
would I need to copy the CDATA section twice?

Thanks (apologies for the mis-reply the first time)


(This loaded correctly, but only has 1 band)

<VRTDataset rasterXSize="720" rasterYSize="720">
  <SRS>...</SRS>
  <GeoTransform>  ...</GeoTransform>
  <VRTRasterBand dataType="Float32" band="1"
subClass="VRTDerivedRasterBand">
    <SimpleSource>
      <SourceFilename><![CDATA[
        <VRTDataset rasterXSize="720" rasterYSize="720">
          <SRS>...</SRS>
          <GeoTransform>  ...</GeoTransform>
          <VRTRasterBand dataType="CFloat32" band="1"
subClass="VRTRawRasterBand">
            <SourceFilename relativeToVRT="1">20160327_20160420.int
</SourceFilename>
            <ImageOffset>8</ImageOffset>
            <PixelOffset>8</PixelOffset>
            <LineOffset>5760</LineOffset>
            <ByteOrder>LSB</ByteOrder>
          </VRTRasterBand>
        </VRTDataset>
      ]]></SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="720" RasterYSize="720"
DataType="CFloat32" BlockXSize="720" BlockYSize="1" />
    </SimpleSource>
    <PixelFunctionType>phase</PixelFunctionType>
    <SourceTransferType>CFloat32</SourceTransferType>
  </VRTRasterBand>
</VRTDataset>


On Wed, Mar 11, 2020 at 9:54 AM Even Rouault <even.rouault at spatialys.com>
wrote:

> On mercredi 11 mars 2020 09:49:49 CET Scott Staniewicz wrote:
> > Is it possible to have a VRTRawRasterBand and a VRTDerivedRasterBand,
> which
> > is derived from that Raw file, together as two bands in a single VRT
> file?
> >
> >
> > I've got a CFloat32 raster file with only one complex band in binary
> format
> > (called "20160327_20160420.int" in the example below), and I've figured
> out
> > how to make a VRT for it so I can load it with GDAL.
> >
> > "20160327_20160420.int.vrt":
> >
> > <VRTDataset rasterXSize="720" rasterYSize="720">
> >   <VRTRasterBand dataType="CFloat32" band="1"
> subClass="VRTRawRasterBand">
> >     <SourceFilename relativeToVRT="1">20160327_20160420.int
> </SourceFilename>
> > <ImageOffset>8</ImageOffset>
> >     <PixelOffset>8</PixelOffset>
> >     <LineOffset>5760</LineOffset>
> >     <ByteOrder>LSB</ByteOrder>
> >   </VRTRasterBand>
> >   <SRS>WGS84</SRS>
> >   <GeoTransform> ...</GeoTransform>
> > </VRTDataset>
> >
> > This works great. I've also figured out how to make a derived raster band
> > from this that shows the amplitude of the data, and also the phase
> (below):
> >
> > "20160327_20160420.int.phase.vrt":
> >
> > <VRTDataset rasterXSize="720" rasterYSize="720">
> >   <SRS>...</SRS>
> >   <GeoTransform>  ...</GeoTransform>
> >   <VRTRasterBand dataType="Float32" band="1"
> > subClass="VRTDerivedRasterBand">
> >     <Description>phase of 20160327_20160420.int.vrt </Description>
> >     <SimpleSource>
> >       <SourceFilename
> > relativeToVRT="1">20160327_20160420.int.vrt</SourceFilename>
> >       <SourceBand>1</SourceBand>
> >       <SourceProperties RasterXSize="720" RasterYSize="720"
> > DataType="CFloat32" BlockXSize="720" BlockYSize="1" />
> >     </SimpleSource>
> >     <PixelFunctionType>phase</PixelFunctionType>
> >     <SourceTransferType>CFloat32</SourceTransferType>
> >   </VRTRasterBand>
> > </VRTDataset>
> >
> > But I can't figure out how I would get both of these as two bands in one
> > VRT without causing an infinite recursion. Is that possible? Or do I need
> > to keep them separate?
>
> In the top level VRT, instead of having
>
> <SourceFilename
> relativeToVRT="1">20160327_20160420.int.vrt</SourceFilename>
>
> you can put the content of .int.vrt inline in a CDATA section
>
> <SourceFilename relativeToVRT="1"><![CDATA[put here content of
> 20160327_20160420.int.vrt]]></SourceFilename>
>
> See example from autotest suite:
> https://github.com/OSGeo/gdal/blob/master/autotest/gcore/data/vrtinvrt.vrt
>
> Even
>
> --
> Spatialys - Geospatial professional services
> http://www.spatialys.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200311/8330fd53/attachment-0001.html>


More information about the gdal-dev mailing list