FME Version
Files
-
- 3 MB
- Download
Adding Data
Two rasters can be combined in a way when one raster supplies a certain layer of information - for example, one raster might contain only a road network (surface and labels), and another raster works as a background.
Classifying only road related cells from the raster map requires quite a complex condition - it should consider major routes (yellow), regular roads (white), and labels on both kinds of roads (labels have different colors). If if the cell satisfies the condition, we can take it from the road raster, otherwise we use the background raster:
if((B[0]==B[1] && B[0]==B[2]) || (abs(B[0]-B[1])<=5 && (B[0]-B[2]>6 && B[0]<100) || (B[0]-B[2]>20 && B[0]>100)), B[0], A[0]);
if((B[0]==B[1] && B[0]==B[2]) || (abs(B[0]-B[1])<=5 && (B[0]-B[2]>6 && B[0]<100) || (B[0]-B[2]>20 && B[0]>100)), B[1], A[1]);
if((B[0]==B[1] && B[0]==B[2]) || (abs(B[0]-B[1])<=5 && (B[0]-B[2]>6 && B[0]<100) || (B[0]-B[2]>20 && B[0]>100)), B[2], A[2]) <br>
This is how the result looks:
Roads + Background
Combined
You may note that the condition stays the same for all three bands and only index of the band is changing in the last portion of the statement. We can redesign our workspace in a way that would require only one condition, but it requires many more transformers.
Semitransparency
When we combine two rasters it's quite easy to achieve semitransparency of one of the rasters - we simply add a small portion of the raster we want to see as semitransparent to the existing value of the background:
if(B[0]==0,A[0],A[0]+B[0]/5);if(B[1]==0,A[1],A[1]+B[1]/2);
if(B[2]==0,A[2],A[2]+B[2]/5)
As result of this calculation, one fifth of the park pixel values are added to the values of the original pixels of the aerial image that are covered by the park areas. This gives us a semitransparent look:
Parks + Background
Combined
Comments
0 comments
Please sign in to leave a comment.