[gdal-dev] Modify virtual file attributes

Frank Warmerdam warmerdam at pobox.com
Wed May 19 09:50:55 EDT 2010


Luca Fasano wrote:
> Hi list,
> I'm encountering some problems using Python Gdal API to modify *virtual*
> file attributes.
> 
> In fact if I change the "Description" and "CategoryNames" attributes of
> a virtual band with the Python API, the Python object is updated
> correctly, but *not* the virtual file that mantains old values.
> In addition if I try to change the "DataType" attribute of virtual band
> the Python object (and obviously the virtual file) is *not* updated.
> Are these considerable as bugs?

Luca,

I reviewed the VRTRasterBand class and found that it was not marking the
VRT as needing a write to disk for some items that change including
the unit type, offset, scale and category names.  I have fixed this in
trunk:

   http://trac.osgeo.org/gdal/changeset/19741

I see there is also no overriding of SetDescription() on the band, so
the code does not know to flush it.  This is slightly more involved to
fix, but could be done.

Note that the DataType of a band cannot be changed in GDAL, and while
it is exposed as an attribute in Python, you should treat it as readonly.

If you would like the set methods for unittype, offset and scale exposed
in Python please file a ticket.  Likewise, if you file a ticket I can
migrate the flushing fixes in 19741 back into 1.7 stable.

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



More information about the gdal-dev mailing list