[FWTools] gvalg.py and rasterized shapes

Frank Warmerdam warmerdam at pobox.com
Fri Feb 24 10:24:34 EST 2006


Sujoy Chaudhuri wrote:
> Hi
> 
> I'm using gvalg.rasterize shapes but cannot seem to access the output 
> raster with the burned in shapes. The module returns 1, so I know its 
> working - am i missing something obvious?

Sujoy,

What exactly do you mean by 'access'?  Is it that the view of the file
isn't being updated?  Is it that you read the file and the rasterization
dos not seemed to have happened?

The rasterization will update the GDAL raster cache, and some of the
changes may be written to disk by the time the algorithm is complete.
But it will *not* automatically invalidate the GvRaster cache, so views
will tend to keep showing the old imagery unless you zoom and pan alot.

Try calling the GvRaster.flush_cache() method:

class GvRaster:
     def flush_cache(self,x_off=0,y_off=0,width=0,height=0):
         """Flush data cache.

         This will cause the data caches of GDAL, and this GvRaster to be
         cleared out.  If this is being done to trigger reload, and redisplay
         of modified data on disk, then a changed signal should be emitted on
         the GvRaster instead.  This will trigger a flush automatically, and
         also invalidate displays, forcing them to be rerendered.

         x_off -- x origin of area to be flushed.
         y_off -- y origin of area to be flushed.
         width -- width of area to be flushed (zero for whole image).
         height -- height of area to be flushed (zero for whole image).
         """

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 FWTools mailing list