Skip to main content

I have multiple rasters, which I want to merge. These are scanned maps, in different pieces, georeferenced afterwards. Files are jpg, together with jgw (for georeferencing)

I "simply" want to merge them into one file (again, jpg with jgw), so that I have one map, one jpg.

Rastermosaicker and rasterbandcombiner are not ideal, as the maps have completely different height, width and rotation.

Printscreen of the overlapping maps, after georeferencing in FME data inspector.

It looks quiet easy, but I can't solve it :(

Result after using the rastermosaicker in FME data inspector.

Thanks for giving me some hints here!

With kind regards,

Ine De Cubber

You'll need to turn the black pixels into transparent ones. A RasterExpressionEvaluator can do that (provided you have the image with RGBA bands). Inspect the pixel value of a black pixel (let's assume it's 0) and then set the expression for the alpha channel to if(A[2]== 0, 0, 255)

 

 

Like this:

(in my case the black pixels were 16,16,16 in RGB)

After that merging them with the RasterMosaicker should work.

However, there's a few things to keep in mind:

  1. This will affect all black pixels...
  2. JPG being a lossy compression algorithm there might be a lot of artifacts, depending on how they were saved.

Hope this helps.


thanks for the hint. although the answer was a little bit trickier, I found a solution, thanks to you!

first of all, as het jpg's were geo-referenced, they were rotated. Making the black part transparent, was not possible in the beginning (as the gaps were not black, as you can see in the first image I posted).

the solution:

1) adding a rasterband for the alphaband (which was not in the jpg),

2)rastermosaicker for each jpg separately. (this is resulting in black rectangles around the rotated jpg)

3)setting the black value as "no data", with the rasterbandnodatasetter (what you did with the rasterexpressionevaluator)

4) rastermosaicker again, with the two (transparent - no data) jpgs.

5) rasterselector and rasterbandremover to remove the alphaband.

and at last (or in the beginning: preprocessing of the jpgs, by deleting the white borders in an image editor like gimp, and replacing it by black ones. this will result in no-data afterwards, in the workbench). this step will make the jpgs fit nice.

finally: I will look further if I can save in a better format

and the workbench:

last step:

5) rasterselector and rasterbandremover to remove the alphaband. (as jpg cannot save the alphaband)


I think you definitely want to have a look at the FME 2017 Release Candidate, the new version of the RasterMosaicker has added functionality for just this, based on this idea: https://knowledge.safe.com/idea/18837/add-minmaxmean-and-blend-as-merge-options-to-raste.html


I think you definitely want to have a look at the FME 2017 Release Candidate, the new version of the RasterMosaicker has added functionality for just this, based on this idea: https://knowledge.safe.com/idea/18837/add-minmaxmean-and-blend-as-merge-options-to-raste.html

as soon as the official FME 2017 is released, I will. I cannot install beta's at work ;)

 

thanks for the hint

 

 


Reply