Brendan, > > Using the Python bindings, I am having trouble getting a memory raster to > respect SetNoDataValue. It works with a GeoTiff(if I close and then reopen > it for reading), I presume because everything gets written when the raster > is closed. My code: > > conc_band = t_ds.GetRasterBand(1) > conc_band.SetNoDataValue(-32768)
SetNoDataValue() only sets a parameter to indicate which value should be considered as nodata, but doesn't change the pixel values themselves. Try adding conc_band.Fill(-32768) > thick_band = t_ds.GetRasterBand(2) > thick_band.SetNoDataValue(-32768) Idem, add thick_band.Fill(-32768) > gdal.RasterizeLayer(t_ds, [1], layer, options=['ATTRIBUTE=CONC']) > gdal.RasterizeLayer(t_ds, [2], layer, options=['ATTRIBUTE=THICK']) > #t_ds.FlushCache() > conc = conc_band.ReadAsArray() > thick = thick_band.ReadAsArray() > > When I ReadAsArray, I get a 0 instead of -32768. I tried FlushCache > (commented out above) but it did not help. How do I force the raster in > memory to update before I reaqd it? > Even -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
