Question

How to create a table of attributes from a geotiff and generate statistics?

  • 10 March 2018
  • 4 replies
  • 43 views

Badge

Is there a way to create a table of attributes from a geotiff? I would like to create a table of pixel values where each pixel has an associated elevation. Elevations can be negative or positive and are from LIDAR. The table can be a .txt file. Zonal Spatial statistics with ESRI can create a table of attributes but the geotiff cannot have float values. The elevations for my geotiff range from about -10.00001 to 24.00001 so these valuse will not work with spatial analyst. I would also like to create statistics for specific elevation classes. any advice welcome

thanks


4 replies

Userlevel 5
Badge +25

The RasterCellCoercer will create polygons of your raster pixels and will allow you to specify row and column attributes. Then a ListBuilder grouped by row, a ListConcatenator to turn the list elements (the pixel values on that row) into a single attribute and write out to a CSV, that should do the trick.

Userlevel 2
Badge +17

Hi @bradmason2015, probably I finally found what Zonal Spatial Statistics is. I suppose you need to create a workflow which performs the same calculation as this functionality.

How Zonal Statistics works

If you have two rasters - ZoneRas and ValRas as shown in the above page, I think this workflow performs the Zonal Statistics. Assuming that the two input rasters have the same resolution.

  1. Send the ZoneRas to a RasterToPolygonCoercer (Label Attribute: _label)
  2. Send the ValRas to a RasterCellCoercer (Output Cell Geometry: Points, Extract Band Values As: Attributes)
  3. Add a Clipper to the workspace, send the polygons output from the RasterToPolygonCoercer to the Clipper port, send the points output from the RasterCellCoercer to the Clipee port, and check Merge Attributes checkbox.
  4. Send the points output from the Inside port of the Clipper to a StatisticsCalculator (Group By: _label, Attributes to Analyze: _band{0}.value).
  5. If necessary, connect a NumericRasterizer to the Complete port of the StatisticsCalculator to create a new raster based on your desired statistics value.

Badge

The RasterCellCoercer will create polygons of your raster pixels and will allow you to specify row and column attributes. Then a ListBuilder grouped by row, a ListConcatenator to turn the list elements (the pixel values on that row) into a single attribute and write out to a CSV, that should do the trick.

The translation is failing at the rastercellcoercer. Output cell geometry = polygons, extract band values as z values, preserve attributes = Yes, column attribute = 0 and row attribute =0, do those parameters make sense? All I need is a list of all of the elevations in the tiff? thanks

 

 

 

Badge

Hi @bradmason2015, probably I finally found what Zonal Spatial Statistics is. I suppose you need to create a workflow which performs the same calculation as this functionality.

How Zonal Statistics works

If you have two rasters - ZoneRas and ValRas as shown in the above page, I think this workflow performs the Zonal Statistics. Assuming that the two input rasters have the same resolution.

  1. Send the ZoneRas to a RasterToPolygonCoercer (Label Attribute: _label)
  2. Send the ValRas to a RasterCellCoercer (Output Cell Geometry: Points, Extract Band Values As: Attributes)
  3. Add a Clipper to the workspace, send the polygons output from the RasterToPolygonCoercer to the Clipper port, send the points output from the RasterCellCoercer to the Clipee port, and check Merge Attributes checkbox.
  4. Send the points output from the Inside port of the Clipper to a StatisticsCalculator (Group By: _label, Attributes to Analyze: _band{0}.value).
  5. If necessary, connect a NumericRasterizer to the Complete port of the StatisticsCalculator to create a new raster based on your desired statistics value.

Creating zones is a secondary problem for me. My main problem here is that my ZoneRas and ValRas are the same raster. I created a geotiff by subtracting one tiff from another to get elevation change in each pixel. I would like to export clipped areas of interest from the tiff using the z values in a text file or alternatively convert to a point shapefile. The goal would be to clip out areas of interest in the tiff or shapefile, export the attributes to a txt file and then analyze the elevations using a stats program. I tried converting tiff to .txt with fme but that doesn't work. I also tried converting the tiff to .txt using qgis but the resulting .xyz file is not readable. I would like to use the original raw data which is two point clouds instead of the tiffs like Hans has recommended but I am stumped there too. Point cloud xyz format is close to what I need as an end product for statistical analysis. any advice or further direction welcomed. thanks

 

 

Reply