[gdal-dev] Reading raw bin raster. Need help with .vrt please.

Koko Alberti kokoalberti at fastmail.com
Thu Aug 9 01:43:17 PDT 2018


Hi Nicolas,

You can add georeferencing information in separate <SRS> and <GeoTransform> nodes underneath the <VRTDataset>, that should work in one step.

For the data type of the <VRTRasterBand> you can use Byte or UInt16 for a 2 byte unsigned integer, or any of the other GDAL data types. Also, if you know the file size and the number of rows/columns but not datatype you can also work backwards to find the number of bytes used for a single pixel.

ImageOffset is usually 0, ByteOrder usually 'LSB'. PixelOffset 1 for Byte and 2 for Uint16, LineOffset is usually the number of columns multiplied by the PixelOffset.

See also https://www.gdal.org/gdal_vrttut.html for more info.


On Wed, Aug 8, 2018, at 10:18 PM, Nicolas Cadieux wrote:
> Hi,
> 
> I need help setting up the .vrt file to read a raw bin file. This is 
> what I figured out about the files:
> 
> 3601 row x 3601 columns, big endian byte order, 2-byte unsigned 
> integer.  Some files are 2-byte signed integer or byte.  They have the 
> following Extent. -72.0001388888888840,-1.0001388888888889 : 
> -70.9998611111111018,0.0001388888888889.  Perhaps Georeferencing should 
> be done in another step or can it be done in the .vrt?
> 
> I figure the file would look like this but I need help with the big 
> endian, 2-byte unsigned int and ByteOrder.
> 
> <VRTDataset rasterXSize="3601" rasterYSize="3601">
>      <VRTRasterBand dataType="Byte" band="1" subClass="VRTRawRasterBand">
>          <SourceFilename 
> relativetoVRT="1">s01w072_slope.bin</SourceFilename>
>          <ImageOffset>????</ImageOffset>
>          <PixelOffset>????</PixelOffset>
>          <LineOffset>?????</LineOffset>
>          <ByteOrder>????</ByteOrder>
>      </VRTRasterBand>
> </VRTDataset>
> 
> Thanks in advance.
> 
> Nicolas Cadieux
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list