[gdal-dev] VRT raster for reading formatted files?

Even Rouault even.rouault at spatialys.com
Sat Jun 25 17:00:25 PDT 2016


Le dimanche 26 juin 2016 01:00:52, Mike Toews a écrit :
> Hi all,
> 
> I've been using the VRTRawRasterBand feature of the VRT format to read
> unformatted (so-called "BINARY") 2D grid data, which has been very
> successful to adapt to obscure formats.
> 
> However, I would like to know if there is a similar feature of the VRT
> format to read formatted values (so-called "ASCII") from a
> SourceFilename.

No.

One workaround I can think of would be to use a /vsisparse/ file to do that. 
See http://gdal.org/cpl__vsi_8h.html#ab79aed725b28eb22471a8b6733405843

You would create a AAIGRID header for the first region, and point to your .bas 
for the data part.

But at that point you could probably just create a AAIGRID file by copy&pasting 
from your .bas...

> 
> There are already a few GDAL drivers that do this already,
> specifically AAIGrid / GRASSASCIIGrid and GSAG. Possibly others. But
> it would be great to see if there is a generic approach with VRT.
> 
> An example of a SourceFilename is at:
> https://github.com/mwtoews/MODFLOW-2005/blob/release/test-run/etsdrt.bas
> 
> With this example there are two formatted 2D arrays (integer and
> float), which of course start on different line numbers (4 and 17).
> Other parts of this file have a specific format, and are out of scope.
> Similar to VRTRawRasterBand, all of other metadata, including grid
> size, are provided elsewhere.
> 
> Cheers,
> -Mike
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list