Question

Overlapping raster mosaicking

  • 14 February 2013
  • 13 replies
  • 18 views

Userlevel 4
Badge +13
Hi,

 

 

I have a set of overlapping rasters that need to be combined, normally its not a problem, but these rasters overlap in such a way that no sorting can help.

 

 

I was wondering if someone knows of a easier solution, before diving into the rasterexpressionevaluator.

 

 

Cheers,

 

Itay 

13 replies

Userlevel 4
Badge +13
HI Itay -- how is the RasterMosiacer not workign for you?  Do you want to blend the values where there was overlap in a certain way?
Badge +2
Would go with Dale's advice and use blending if they overlapped quite majorly:

 

 

http://fmepedia.safe.com/articles/Samples_and_Demos/Alpha-Compositing-Blending-Two-Raster-Images
Userlevel 4
Badge +13
Hi Dale and Kathy,

 

 

Thanks for replaying. The option (Nodata Overwites Data) on the RasterMosaicker does not solve my issue.

 

 

Firstly the nodata value is returned as N/A when quering the rasters, setting the nodata to one value (255) does not solve the issue  since there are also values rangng from 245 to 255 in the nodata region.

 

 

I did manage to mosaic them correctly by changing the range of values into nodata, but also the data region is affected (undesired).

 

 

What I need is to create a mask where the nodata can be set.

 

I have had a look at this example which is not very clear on how to create such a mask.

 

 

Any help would be appreciated.

 

 

Userlevel 2
Badge +17
Hi Itay,   If your main issue is that nodata value can be in a certain range, how about replacing all possible nodata values with a particular value (e.g. 255) before identifying nodata?
Userlevel 4
Badge +13
Hi Takashi,

 

 

Repalcing a range of values (240 to 255) to 255 and setting 255 to nodata, does not help since the data region also gets affected, which is undesired.

 

 

Thats why creating a mask where the values convertion can take place might be a solution, however I am still not managing to create a mask for the region 'nodata' region in the overlap.

 

Itay
Userlevel 4
Badge +13
I have decided to re-mosaic the all area using the original tiles, instead of the smaller mosaics initially provided.

 

Hopefully my computer can take it, some twiking will probably help

 

 

Userlevel 4
Badge +25
Hi Itay,

 

I'm assuming then, that each raster has a border around it, with values set to 255, but you can't just set that to NODATA because 255 is also used in the data itself?

 

 

If so, perhaps try set NODATA to 255 and then use a RasterExtentsCoercer to extract the Data Extents. That would give you a boundary with which to clip the black border off the raster.

 

 

If there are NODATA values in the main data area I imagine (though I haven't tried this) that they would appear as donuts or holes in the boundary. Just drop the holes and it will ensure those cells are kept when clipped. You then just need to un-set the NODATA value.

 

 

I hope that I've interpreted your scenario correctly and that this helps.

 

 

Mark
Userlevel 4
Badge +13
Hi Mark,

 

 

Unfortunatly the border values are not only 255 and that is where mosaicking them goes wrong.

 

The majority of the border area contain 255 values, but closer to the data area a range of values (240-254) can be found, I imagine that it is due to the mosaicking and resampling of the original (smaller) mosaic's  I am using.

 

 

I will give the RasterExtentsCoercer a shot with nodata set to 255 and see if that can be used or needs to be corrected (generalized/drop holes).

 

Cheers,

 

Itay
Userlevel 4
Badge +13
Hello,

 

 

The following method to create the data extent works:

 

  • Resample rasters (speed up the process)
  • Replace cells values (RasterCellValueReplacer)
  • Set nodata (RasterBandNodataSetter)
  • RasterExtentsCoercer type = data extents
  • Clean up result (Deaggregator + DonutHoleExtractor > outershell port)
The rest is obvious, use the extents to clip the rasters (using parallel processing) , sort them, mosaic and set nodata. 

 

Thanks all for the tips and guidance.

 

Itay

 

 

Badge +5

In the past I have found the only way to set no data in low bit depth rasters is adjust one of the pixel values to free up one of the 255. For instance replace all '0' with 1 and then set your no data as 0. The difference between 0 and 1 is indistinguishable. If you set no data as 0 without adjusting the true '0' pixels first you will end up with transparent parts to the image in GIS software.

Userlevel 2
Badge +16

Itay, if you have polygons for the regions where the raster should contain data, you could use the Clipper to clip the raster before mosaicking.

What is the simplest way to create an overlapping mosiac using fme? I have two images which overlap and also have no data values appearing as black on the outside. I need to remove both so the image blends together. I wasnt sure if the alpha band would be the best way to go?

Userlevel 4
Badge +13

@diggs12 - I'd suggest checking out https://knowledge.safe.com/articles/1247/raster-mosaicking-scenario.html, and then the suggested related articles listed on the right. Definitely this is bread and butter FME, you just have to work through your no-data and alpha band situation.

Reply