Question

How to get the raster value out of the RasterCellCoercer

  • 1 March 2022
  • 1 reply
  • 10 views

I want to use the RasterCellCoercer to polygonise a raster. I am using it in favour of the RasterToPolygonCoercer, since this one is running out of memory constantly when dissolving. So I would like to write the raster cells as polygons to a PosgresDB and then ST_UNION them.

However, on the RasterCellCoercer I am unable to retrieve the band values. There is only one band. The _band{}_value field is always empty. When I use the RasterToPolygonCoercer I get the expected values.

Could someone give me a hint on how to solve this issue? Thank you in advance!


1 reply

Userlevel 6
Badge +32

Not sure I understand what your issue is. I think you only need to expose "_band{0}.value" using the AttributeExposer to get the value you want as an attribute?

 

But loading all pixels as polygons to a database and do union there feels like a lot of I/O.

I would try to process the raster in smaller chunks, using a tiler and a workspacerunner, reading only smaller parts of the raster using the clip to envelope option. You probably have to do another run to dissolve the results on the edge of the tiles but this is probably still faster than loading all polygons to a database.

 

As an alternative, in the past I used PoTrace to convert raster to vector (png to dxf in my case), because I had the same issue you have. I used the PotraceCaller custom transformer from the FME hub as a starting point.

Reply