1

Using FME i want to reproject an ECW image to EPSG:3857 from EPSG:28354.

I intend to sit this image(and many more) over a large mosiac.

Using CSMapReprojector this re-projects with a boarder. I've read other discussions about how to clip and set the nodata value but none seem to work.

Can anyone please suggest the right method for this

Example below is something i've tried (also with the RasterNoDataSetter but to no success). I think it has something

I think i'm failing due to the varying RGB values in the black collar area as below enter image description here enter image description here enter image description here

0
0

So, let's run through what happens here. Apologies if this is too basic in places, but I like to be thorough.

Consider the boundary of the raster object. It is a rectangle. It has to be. When FME reprojects that raster, what was a rectangular boundary can now be slightly distorted by the reprojection. Because a raster dataset must be rectangular, FME fills in the gaps between the new boundary shape and the smallest rectangular area that fits around it.

This is the black border you are seeing. It can't be clipped or removed, because it would leave a non-rectangular shape. The color is black because the default is 0 (so 0,0,0). I'm not sure how you're getting 0,1,1, but I suspect it's the InterpretationCoercer that you are using, which can rescale values.

Anyway. If you are both reprojecting and mosaicking inside FME, then the simplest solution is to create the mosaic first, then reproject. Then you won't get the black borders in the output.

Another solution is to mosaic the rasters in a set order so that the one with the black border is mosaicked underneath one with the actual data.

But what I think is the most common solution is to make the black borders transparent. One way is to use Nodata. Nodata isn't a separate value, it is simply a marker that this specific raster value signifies "no data" (basically a raster null).

So if you add a RasterBandNodataSetter transformer before the CsmapReprojector, then you can set this Nodata value, and that will be used as the "border". For example, if I set Nodata to 200, then this border will become 200,200,200 (instead of 0,0,0).

Whatever tool you use to mosaic the raster together should recognize that 200,200,200 is Nodata, and render that transparent. So no black (or other coloured) borders.

The problem there is what happens if some data is actually 200,200,200 (or 0,0,0) in the dataset? Then it will be rendered invisible in your mosaic. That's not good.

To solve that I would tweak the data so that you have a free value to use for nodata. Use a RasterCellValueReplacer transformer to replace values equal to 0 to 1. So 0,0,0 becomes 1,1,1. Now you can use 0,0,0 as nodata without interfering with other cell values.

So the workspace would be:

  • RasterCellValueReplacer (to replace 0 with 1)
  • RasterBandNodataSetter (to set 0 as Nodata)
  • CsmapReprojector (to reproject the data)

enter image description here

Because the border is now nodata, it should be transparent in any operations and viewers, and your mosaic should not show it as a border.

Incidentally, if your format doesn't support nodata, then you would need instead to make the actual values invisible. For that you would do the same as above, but add an alpha band (RasterBandAdder) and make the border cells have 0 for alpha (RasterExpressionEvaluator where the expression tests A[0]=0 and A1=0 and A[2]=0 and if so sets A[3] to 0 too). But I doubt this would be necessary.

1
  • Thanks for simplifying it, much of this is new to me and there are so many variables(so many ways to skin a cat!). I wasn't sure about the 'default is 0' for this border after reprojection. I've quickly tested your recommended workflow and can see that the cell values still vary. I guess ecw does not support nodata judging by the Quick Facts? It does have the desired outcome when using the RasterBandAdder to add the alpha8 band before reprojecting and looks to happen automatically without the need of any other transformers. This basically doubles my file size at the other end though. – Kieranm Sep 6 '19 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.