Skip to main content

Does anyone know of a way to calculate cell values based on their location or distance from the origin? I've been trying to use the Raster Expression Evaluator but can't find a transformer that will expose the cell's x,y values as attributes. Or am I on the wrong track?

 

 

Takashi kindly suggested the raster cell coercer but I wonder if I can't avoid the conversion to vector and then back to raster.

 

 

Thanks.

MvW

Another potential solution is to use the Raster Numeric Creator to create a surface that I can then add to my original raster. But again, I'd need to calculate the cell values based on their x and y values.
Hi MvW,

 

 

The RasterPropertiesExtractor can be used to get these attributes: _num_rows, _num_columns _min_x, min_y, max_x, max_y _spacing_x, _spacing_y etc.   You can calculate x, y of every cell based on those values. 1) Remove geometry (GeometryRemover). Not essential, but it will prevent consuming huge memory when copying in the next step. 2) Create copies (Cloner). Number of Copies: @Value(_num_rows)*@Value(_num_columns) (i.e. number of cells) Copy Number Attribute: _copynum 3) Create row / column index (AttributeCreator). _row_index = @Evaluate(@Value(_copynum)/@Value(_num_columns)) _col_index = @Evaluate(@Value(_copynum)%@Value(_num_columns)) 4) Calculate x, y of each cell (AttributeCreator). _x = @Evaluate(@Value(_min_x)+@Value(_spacing_x)*@Value(_col_index)) _y = @Evaluate(@Value(_min_y)+@Value(_spacing_y)*@Value(_row_index))   After calculating cell values based on _x and _y, transform them to a raster. 3DPointReplacer (_x, _y, value) --> NumericRasterizer. It might be necessary to move point to center of cell before rasterizing. And, the nodata value set in the NumericRasterizer has to be same as the original raster.   Finally, the RasterCellValuCalculator can combine it to the original raster.   ... this way doesn't avoid using vector geometries (3D points).

 

Takashi

Thank you very, very much Takashi. I am still working my way through your reply but will let you know when I am successful. Best regards,

MvW


Reply