Skip to main content

I have tried using VectorOnRasterOverlayer, Clipper, RasterBandNodataRemover and RasterClipOverlay...all being fed to an ECW Writer. And even though the results are all different, no method is giving me a clipped (i.e. no black or white boundary) ECW version of our orthophtoto:

 

To me my method appears to be logical, but I'm obviously missing something.

 Image2ECW_Workbench_Example-1

RasterInterpretationCoercer parameters:

 RasterInterpretationCoercer_Parameters

RasterClipOverlay parameters:

 RasterClip_Overlay_Parameters

Clip polygon parameters:

 Clip_Polygon_Parameters

ECW Writer parameters:

ECW_Writer_Parameters-1

 

ECW_Writer_Parameters-2

 

As mentioned, I'm pretty sure I'm doing something wrong (I'm also definitely not a power FME user), but what I'm trying to do shouldn't be that difficult either.

 

The original orthophoto looks like this:

 Original_Orthophoto

I made the background grey so it is obvious there is no white or black data surrounding the image.

 

The clip (or mask) polygon is just something I had used to clean up the original image, and it worked well for that:

 Clip-Mask_Polygon

The best ECW I have managed to create so far is this:

Best_attempt_at_ECW

 

 But how do I get rid of the black no-data area? Any suggestions? What would be the best way to do this using FME?

 

Thanks

I did a quick search and found this topic. It looks like nodata does not work for ECW, see the documentation. It also links to this topic, it seems you need to use an Alpha Band for transparency in ECW.

You can do this using the RasterBandAdder and RasterExpressionEvaluator.

The Alpha Band defines the transparency from 0 (transparent) to 255 (not transparent). So the cell values are 0.

RasterBandAdderParameters

 

Now set Red=Red, Green=Green, Blue=Blue and Alpha=0 when R,G,B = 0,0,0.

RasterExpressionEvaluatorParameters

 

if (A(0]==0&&A;1]==0&&A;2]==0,0,255)

If you have NoData values, I would use those instead.


I did a quick search and found this topic. It looks like nodata does not work for ECW, see the documentation. It also links to this topic, it seems you need to use an Alpha Band for transparency in ECW.

You can do this using the RasterBandAdder and RasterExpressionEvaluator.

The Alpha Band defines the transparency from 0 (transparent) to 255 (not transparent). So the cell values are 0.

RasterBandAdderParameters

 

Now set Red=Red, Green=Green, Blue=Blue and Alpha=0 when R,G,B = 0,0,0.

RasterExpressionEvaluatorParameters

 

if (A(0]==0&&A;1]==0&&A;2]==0,0,255)

If you have NoData values, I would use those instead.

Yep, this - you need to make sure that the alpha mask is correctly applied.

If you think that you are doing the right thing you can read the output back into FME and check the bands. I have seen cases where the ALPHA band has been mislabelled as a UINT8 band so FME doesn't interpret it properly.

My tip would be to add the ALPHA8 band before you apply the clip. Use the RasterBandAdder to add an alpha band with value 255, pass thought the clipper. The cells which get clipped should now have 0 for the ALPHA8 band.

 

 


I did a quick search and found this topic. It looks like nodata does not work for ECW, see the documentation. It also links to this topic, it seems you need to use an Alpha Band for transparency in ECW.

You can do this using the RasterBandAdder and RasterExpressionEvaluator.

The Alpha Band defines the transparency from 0 (transparent) to 255 (not transparent). So the cell values are 0.

RasterBandAdderParameters

 

Now set Red=Red, Green=Green, Blue=Blue and Alpha=0 when R,G,B = 0,0,0.

RasterExpressionEvaluatorParameters

 

if (A(0]==0&&A;1]==0&&A;2]==0,0,255)

If you have NoData values, I would use those instead.

Nielgerrits:

 

Thanks a million for not only your advice, but your examples too. My big struggle with FME is not so much the logic, bur rather knowing which transformer to use, and when. That and also learning what syntax to use when configuring those transformers.

 

So your examples were HUGELY effective for me...I wish SAFE would use more examples in the online help too. So I ran the process with just the transformers you suggested (and using your configuration examples) and it worked exactly as I was hoping it would work as per below:

 

Final_ECW_Output - After FME Community Support

Your examples saved me hours more work tweaking the configuration 🙂.

 

Thanks again.


Yep, this - you need to make sure that the alpha mask is correctly applied.

If you think that you are doing the right thing you can read the output back into FME and check the bands. I have seen cases where the ALPHA band has been mislabelled as a UINT8 band so FME doesn't interpret it properly.

My tip would be to add the ALPHA8 band before you apply the clip. Use the RasterBandAdder to add an alpha band with value 255, pass thought the clipper. The cells which get clipped should now have 0 for the ALPHA8 band.

 

 

virtualcitymatt:

 

Thank you. I think I was making this mistake a few times before too...not applying the correct alpha mask. I was trying to use Alpha8 (as per many online suggestions) but sometimes when I would tweak the transformer (or use a different one) that setting would change, and the result (30 minutes later) would be a mess. I was growing tired of creating a mess 30 minutes each time...it makes for a long day 🙂.


Nielgerrits:

 

Thanks a million for not only your advice, but your examples too. My big struggle with FME is not so much the logic, bur rather knowing which transformer to use, and when. That and also learning what syntax to use when configuring those transformers.

 

So your examples were HUGELY effective for me...I wish SAFE would use more examples in the online help too. So I ran the process with just the transformers you suggested (and using your configuration examples) and it worked exactly as I was hoping it would work as per below:

 

Final_ECW_Output - After FME Community Support

Your examples saved me hours more work tweaking the configuration 🙂.

 

Thanks again.

You're welcome 🙂 You posted a clear question, what often helps a ton. I also always struggle with getting new things to work so I also prefer having a clear example to start from and tweak it to my needs.


Reply