Question

Get bandname image and rename bandname from Tiff file


Badge +5

Hi,

I have a .tif file that I convert from .nc format to .tif. I opend in ArcGis, I saw them multiples band.When I open it in FME, I don't display band name.

I want to extract some bands and rename bands it.

Could you please share me how the way to make it?

Thank you


16 replies

Userlevel 2
Badge +17

Hi @hoa_le, you can see band names with the Feature Information window in FME Data Inspector.

  • The RasterBandPropertyExtractor can be used to extract the band names as a list attribute (_band{}.band_name).
  • The RasterBandNameSetter can be used to set name(s) to a specific band or all bands. Note that you have to select the band with the RasterBandSelecterto beforehand if you set name to a specific single band with the RasterBandNameSetter.
Badge +5

Hi @takashi,

I tried it with model builder as the below. But the output inspector don't select Band0, it selects all band the same input raster.bands.png

 

Userlevel 2
Badge +17

Hi @takashi,

I tried it with model builder as the below. But the output inspector don't select Band0, it selects all band the same input raster.bands.png

 

Your workflow just extracts the original properties including band names, specifies the first band, and sets the original name (_band{0}.band_name) to the first band. Naturally, the band name would not be changed.

 

If you need to rename the first band, for example, set your desired name (a string value or an attribute storing the new name) to the Band Name parameter in the RasterBandNameSetter transformer.

 

If you want to keep only some bands, consider using the RasterBandRemover or the RasterBandKeeper.
Badge +5

Hi @takashi,

I tried it with model builder as the below. But the output inspector don't select Band0, it selects all band the same input raster.bands.png

 

Hi takashi,

 

Actually, I want to rename band based on excel list. Could you tell me how to make it?

 

 

Userlevel 2
Badge +17
Hi takashi,

 

Actually, I want to rename band based on excel list. Could you tell me how to make it?

 

 

Just read new band name from the Excel table and set it to the raster with the RasterBandNameSetter. The concrete solution depends on the actual data conditions (schema of the Excel table, structure of the raster dataset) and the requirement (your desired mapping rules between new name and band).

 

 

Badge +5
Just read new band name from the Excel table and set it to the raster with the RasterBandNameSetter. The concrete solution depends on the actual data conditions (schema of the Excel table, structure of the raster dataset) and the requirement (your desired mapping rules between new name and band).

 

 

Yes. I don't know how to join excel with bands image.

 

My excel file have structure:

 

rename-bands-image.fmw

 

 

Userlevel 2
Badge +17
Just read new band name from the Excel table and set it to the raster with the RasterBandNameSetter. The concrete solution depends on the actual data conditions (schema of the Excel table, structure of the raster dataset) and the requirement (your desired mapping rules between new name and band).

 

 

Are the values of "Raw" ("Band 756", "Band 757", ...) the original band names in the source raster?

 

Or, does "Band N" indicate the Nth band in the source raster?

 

How many bands does the source raster dataset have?
Badge +5
Are the values of "Raw" ("Band 756", "Band 757", ...) the original band names in the source raster?

 

Or, does "Band N" indicate the Nth band in the source raster?

 

How many bands does the source raster dataset have?
The raster source have 822 bands from band 0 to Band 821.

 

bands.png

 

 

Userlevel 2
Badge +17
Hi takashi,

 

Actually, I want to rename band based on excel list. Could you tell me how to make it?

 

 

If the the "Band N" in the "Raw" column indicates the Nth band (N is 0-based band index), this workflow might help you.

 

 

 

Badge +5
If the the "Band N" in the "Raw" column indicates the Nth band (N is 0-based band index), this workflow might help you.

 

 

 

Hi @takashi,

 

I tried with my model in the below. But it doesnot rename band name.

 

I tried make export tif one by one band name. I attatched my model fwmt:

 

rename-bands-image.fmwt

 

Userlevel 2
Badge +17
If the the "Band N" in the "Raw" column indicates the Nth band (N is 0-based band index), this workflow might help you.

 

 

 

Your workspace definitely renames the bands, but the TIFF writer doesn't seem to save the band names. I don't know why (Perhaps TIFF format doesn't support band names?)

 

Try using GeoTIFF writer instead.

 

 

Badge +5
Your workspace definitely renames the bands, but the TIFF writer doesn't seem to save the band names. I don't know why (Perhaps TIFF format doesn't support band names?)

 

Try using GeoTIFF writer instead.

 

 

Yes. I make an export bands to one band .Tif format (Raster file name).

 

So which I need get attribute value?exp-raster.pngexp-raster.png

 

 

Userlevel 2
Badge +17
Your workspace definitely renames the bands, but the TIFF writer doesn't seem to save the band names. I don't know why (Perhaps TIFF format doesn't support band names?)

 

Try using GeoTIFF writer instead.

 

 

I'm afraid that we are going on a wrong track...

 

Do you perhaps need to separate the multi-band raster into individual single-band rasters for each band and separately write them into files with the new names specified by the Excel table?

 

If so, the solution I suggested would be useless...

 

Userlevel 2
Badge +17

Hi @hoa_le, If the requirement was to separate the source multi-band raster into multiple single-band rasters for each band and write them into files with the names given by the Excel table ("New name" column), this workflow could work for you. Note: It's not a matter on "renaming band".

 

Userlevel 2
Badge +17

Hi @hoa_le, If the requirement was to separate the source multi-band raster into multiple single-band rasters for each band and write them into files with the names given by the Excel table ("New name" column), this workflow could work for you. Note: It's not a matter on "renaming band".

 

This is it: rasterbandseparator.fmwt (FME 2018.1.0.0)

 

 

Badge +5

Hi @hoa_le, If the requirement was to separate the source multi-band raster into multiple single-band rasters for each band and write them into files with the names given by the Excel table ("New name" column), this workflow could work for you. Note: It's not a matter on "renaming band".

 

Thank you so much, @takashi. I'm sorry because I describe not clear.

 

I done it

Reply