Skip to main content
Question

Is anyone able to convert a geotiff raster image with multiple bands into csv file reporting longitude, latitude, values and band number ?


Forum|alt.badge.img

Here attached you can find an example of the geotiff image I need to convert.

 

9 replies

danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • August 14, 2017

Hi @beatricemontele, would you like to extract the boundingbox from your raster files to report longitude, latitude, values ( RGB - min and Max ) and band values?

The attached is not here.

Thanks,

Danilo


courtney_m
Contributor
Forum|alt.badge.img+12
  • Contributor
  • August 14, 2017

You can use a GeoTiff reader, then a RasterBandSeparator to split up the bands. You can use an AttributeManager to rename the output. Then use a Point Cloud XYZ Writer - you can specify the x, y, and z, components and give them a new name (see the screenshot below). The writer will write to a CSV file.


courtney_m
Contributor
Forum|alt.badge.img+12
  • Contributor
  • August 14, 2017
courtney_m wrote:

You can use a GeoTiff reader, then a RasterBandSeparator to split up the bands. You can use an AttributeManager to rename the output. Then use a Point Cloud XYZ Writer - you can specify the x, y, and z, components and give them a new name (see the screenshot below). The writer will write to a CSV file.

This will give you a bunch of records - but if you just want one record per band, you should use the RasterBandSeperator, then use the BoundsExtractor to get the Max/Min x/y for each band. Use an AttributeManager to rename attributes and remove unwanted attributes, then use a CSV writer.

Forum|alt.badge.img

Hi everyone and many thanks for your answers.

I want to extract long, lat, number of the band and the value of each cell of the raster (not only max and min). I hope you can download the file at the following link.

https://www.dropbox.com/s/wctbwsel5mugmmt/Febbraio_2017.tif?dl=0

I tried the method suggested by courtney_m but I always get the following error message:

"Failed to obtain point cloud from feature. Only features with point cloud geometry are expected

A fatal error has occurred. Check the logfile above for details"


erik_jan
Contributor
Forum|alt.badge.img+18
  • Contributor
  • August 15, 2017

My first thought was the XYZ pointcloud writer too as @courtney_m mentioned.

But if it only takes point cloud features you need another approach:

Use the GeoTiff reader and the RasterBandSeparator.

Then create points from the raster using the RasterCellCoercer.

These points can be written to the CSV file using the CSV writer.

You might need an AttributeManager to set values to the right attribute names.


Forum|alt.badge.img

Thanks erik_jan. With your method and adding an the ElevationExtractor transformer I was able to extract band number and z_values for each cell. I still need latitude and longitude of the center of each cell. Here you can see FME flow and the output I got.


takashi
Influencer
  • August 15, 2017
beatricemontele wrote:

Thanks erik_jan. With your method and adding an the ElevationExtractor transformer I was able to extract band number and z_values for each cell. I still need latitude and longitude of the center of each cell. Here you can see FME flow and the output I got.

You can use the CoordinateExtractor to extract (x, y, z) from the point.

courtney_m
Contributor
Forum|alt.badge.img+12
  • Contributor
  • August 15, 2017
beatricemontele wrote:

Hi everyone and many thanks for your answers.

I want to extract long, lat, number of the band and the value of each cell of the raster (not only max and min). I hope you can download the file at the following link.

https://www.dropbox.com/s/wctbwsel5mugmmt/Febbraio_2017.tif?dl=0

I tried the method suggested by courtney_m but I always get the following error message:

"Failed to obtain point cloud from feature. Only features with point cloud geometry are expected

A fatal error has occurred. Check the logfile above for details"

Ah, sorry about that. It looks like @erik_jan was right on the money with the RasterCellCoercer, though! If you are using the RasterCellCoercer to output points, you will need to use the CoordinateExtractor to expose the x,y.

 


Forum|alt.badge.img
courtney_m wrote:
Ah, sorry about that. It looks like @erik_jan was right on the money with the RasterCellCoercer, though! If you are using the RasterCellCoercer to output points, you will need to use the CoordinateExtractor to expose the x,y.

 

Many Thanks. The CoordinateExtractor worked perfectly.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings