any ideas on the process?
Raster Test for nodata
I am tiling a raster dataset of elevation. if one of the tiles only has nodata values i want to remove that tile from the process
Hi
You can use the RasterBandMinMaxExtractor and test if the resulting list values only contain nodata (e.g. using the ListRangeExtractor):
_band{}.min
_band{}.max
David
For reference, here is also a small Python snippet that will check the _band{} list to see if a raster only contains one value (e.g. all white or black) , it should be relatively easy to adapt to other criteria:
max_values = [int(x) for x in feature.getAttribute('_band{}.max')]
min_values = [int(x) for x in feature.getAttribute('_band{}.min')]
values = zip(max_values, min_values)
contents = sum([x[0]-x[1] for x in values])
if contents == 0:
# No content, all min and max cell values are identical on every band
feature.setAttribute('_raster_contents', 'EMPTY')
else:
feature.setAttribute('_raster_contents', 'OK')
You probably shouldn't be using it as-is on your rasters unless you know for a fact that single-color tiles are invalid.
David
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.