Skip to main content
Solved

Using vector to mask raster (VectorOnRasterOverlayer)


wolters
Contributor
Forum|alt.badge.img+6

I have a large binary raster (1 band, values either 0 or 1) that I want to mask with a polygon shapefile (which contains 1 attribute column, id, with values 0). I was thinking of using Vector on Raster Overlayer for this. However the output file is the original raster, without changes. Am I using the VectorOnRasterOverlayer correctly?

Best answer by takashi

Hi @wolters, no, the VectorOnRasterOverlayer would not transfer any attribute value from the vector feature to the raster. It just draws the shape of the vector geometry onto RGB raster using its color value (fme_color).

I think the Clipper could help you.Send the polygon to the Clipper port, send the raster to the clipee port of a Clipper. Then check the resulting raster output from the Outside port of the Clipper transformer.It might be necessary to set Yes to the Preserve Clippee Extents parameter if the polygon was relatively large.
View original
Did this help you find an answer to your question?

3 replies

takashi
Contributor
Forum|alt.badge.img+23
  • Contributor
  • Best Answer
  • March 8, 2018

Hi @wolters, no, the VectorOnRasterOverlayer would not transfer any attribute value from the vector feature to the raster. It just draws the shape of the vector geometry onto RGB raster using its color value (fme_color).

I think the Clipper could help you.Send the polygon to the Clipper port, send the raster to the clipee port of a Clipper. Then check the resulting raster output from the Outside port of the Clipper transformer.It might be necessary to set Yes to the Preserve Clippee Extents parameter if the polygon was relatively large.

helmoet
Forum|alt.badge.img+8
  • March 9, 2018

Hi @Wolters, I think it should be possible using the VectorOnRasterOverlayer, like the example that is herewith. You have to be sure however that a Z-value is present on the numeric type of raster that you are using. I suggest you use a 3D polygon with either Z=0 or Z=1. You can force your polygons 3D with the 3DForcer. However, I'm still not sure how FME handles a binary type numeric raster anyway. The example I used is a UInt8 interpretation. Please let me know if it worked for you.cuta-holeinanumericraster.fmw


wolters
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • March 9, 2018
takashi wrote:

Hi @wolters, no, the VectorOnRasterOverlayer would not transfer any attribute value from the vector feature to the raster. It just draws the shape of the vector geometry onto RGB raster using its color value (fme_color).

I think the Clipper could help you.Send the polygon to the Clipper port, send the raster to the clipee port of a Clipper. Then check the resulting raster output from the Outside port of the Clipper transformer.It might be necessary to set Yes to the Preserve Clippee Extents parameter if the polygon was relatively large.

 

I did it in a roundabout way by converting all raster values to 0 and then using the clipper on the raster, and use a combination of rasternodataremover and rastercellvaluereplacer to get the result I wanted.

 


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