Solved

Removing nodata from raster

  • 3 September 2015
  • 4 replies
  • 60 views

Hi.

 

 

I want to remove, or make transparent all areas where Band 0 and Band 1 are both 0. The rasterbandnodatasetter only looks at band 0 and sets those cells to nodata, which also removes information from the raster image. Is there a way to remove just the black areas (i.e. wher band 0 and 1 = 0)? I have tried to clip the image with a polygon but the black areas still remain. Is there a way to set the band values as attributes?

 

 

icon

Best answer by gio 3 September 2015, 14:27

View original

4 replies

Userlevel 2
Badge +17
Hi,

 

 

I think the RasterBandNodataSetter should work.

 

If it wouldn't work, one of the two bands could have been selected for any reason.

 

Consider using the RasterSelecter to select all bands before setting nodata.

 

Band and Palette List: ALL

 

 

Takashi
Badge +3
a raster is rectangular, you can't remove the area.

 

 

you say:

 

"where Band 0 and Band 1 are both 0. The rasterbandnodatasetter only looks at band 0 and sets those cells to nodata"

 

 

The help of the RasteBandNoDataSetter states:

 

 

"If different nodata values are desired on each band (for example, when setting nodata values on a color raster, where each of the red, green, and blue bands has a different value), then add multiple RasterBandNodataSetter transformers using either different band selections, or by using raster band splitting to separate the bands on which to set the nodata value."

 

 

so you separate or select bands 1 and  0 and test them etc.

 

 

But if all you need is to set the black area to nodata without compromising other colours with bands 1 and 0 = 0 you can of course use a clipper;

 

 

You need  an alpha channel. Then you can set nodata cells to transparency.

 

You can use the rasterintepretationcoercer for that using "create alphaband from no data"

 

Then  you can use a clipper. The clipped bit (wether inside or outside) will become transparent.

 

 

look at a forum question called "seaxture" (if i remember wel)

 

 
Badge
a raster is rectangular, you can't remove the area.

 

 

you say:

 

"where Band 0 and Band 1 are both 0. The rasterbandnodatasetter only looks at band 0 and sets those cells to nodata"

 

 

The help of the RasteBandNoDataSetter states:

 

 

"If different nodata values are desired on each band (for example, when setting nodata values on a color raster, where each of the red, green, and blue bands has a different value), then add multiple RasterBandNodataSetter transformers using either different band selections, or by using raster band splitting to separate the bands on which to set the nodata value."

 

 

so you separate or select bands 1 and  0 and test them etc.

 

 

But if all you need is to set the black area to nodata without compromising other colours with bands 1 and 0 = 0 you can of course use a clipper;

 

 

You need  an alpha channel. Then you can set nodata cells to transparency.

 

You can use the rasterintepretationcoercer for that using "create alphaband from no data"

 

Then  you can use a clipper. The clipped bit (wether inside or outside) will become transparent.

 

 

look at a forum question called "seaxture" (if i remember wel)

 

 
Trying to do the same thing in 2017.1 and can't seem to find the same options in the rasterinterpretationcoercer. Anyone know how to do this in 2017.1 or 2018.0?

 

 

Thanks!

 

 

Userlevel 2
Badge +17
a raster is rectangular, you can't remove the area.

 

 

you say:

 

"where Band 0 and Band 1 are both 0. The rasterbandnodatasetter only looks at band 0 and sets those cells to nodata"

 

 

The help of the RasteBandNoDataSetter states:

 

 

"If different nodata values are desired on each band (for example, when setting nodata values on a color raster, where each of the red, green, and blue bands has a different value), then add multiple RasterBandNodataSetter transformers using either different band selections, or by using raster band splitting to separate the bands on which to set the nodata value."

 

 

so you separate or select bands 1 and  0 and test them etc.

 

 

But if all you need is to set the black area to nodata without compromising other colours with bands 1 and 0 = 0 you can of course use a clipper;

 

 

You need  an alpha channel. Then you can set nodata cells to transparency.

 

You can use the rasterintepretationcoercer for that using "create alphaband from no data"

 

Then  you can use a clipper. The clipped bit (wether inside or outside) will become transparent.

 

 

look at a forum question called "seaxture" (if i remember wel)

 

 
The "Create alpha band from no data" is an option available when you do coerce RGB to RGBA. If your case isn't, find other Q&A; or consider posting a new question.

 

Reply