FME Version
Files
Introduction
A GeoTIFF is a TIFF (Tagged Image File Format) file that contains geographic information. GeoTIFF and TIFF files are good formats when dealing with raster information as they can handle both lossy and lossless compressed images. When working with GeoTIFFS, ensure that you have a .tfw World File associated with the GeoTIFF as this contains the spatial location information for the image.
In this scenario, we are going to take a GeoTIFF orthophoto of Queen Elizabeth Park in Vancouver, BC, and overlay it on top of a hillshade model that has been created with a GeoTIFF digital elevation model. The hillshade model will be created to have sharp edges to distinguish changes in elevation easily. If you are interested in a basic translation between GeoTIFF and ECW just complete steps one and twelve below.
Step-by-step Instructions
1. Add a GeoTIFF Reader to read in the orthophoto
In a blank workspace, add a GeoTIFF Reader to the canvas. Browse to the QueenElizabethPark.tiff dataset. Within the parameters, change Feature Type Name(s) to From File Name(s), so we can distinguish which feature type is which. This GeoTIFF has its coordinate system information embedded in its properties, so we don't need to set it in the reader. If the GeoTIFF had an associated .tfw World File containing coordinate system information it would take precedence over what was contained in the .tif file properties. This GeoTIFF contains an orthophoto of Queen Elizabeth Park which is the park at the highest elevation in Vancouver, BC.
In the parameters, set the Feature Type Name to From File Name
2. Add Alpha8 Band for transparency
To make the orthophoto transparent so we will be able to see the hillshade underneath, we need to create an Alpha band. In rasters, the alpha band acts like a transparency mask, changing the value of this band sets the transparency. For no transparency (100% opaque), set the alpha band to 255, for complete transparency (100% transparent), set the alpha band to 0. In this example, we will want our image to be about 25% transparent, so we will set the alpha band to 190.
To do this, connect a RasterBandAdder transformer to the QueenElizabethPark GeoTiff feature type. Within the parameters, set the Interpretation Type to Alpha8, and the Cell Value to 190.
Set the Alpha8 band to 190 for 25% transparency
3. Add the digital elevation model (DEM)
Add another GeoTIFF Reader to the workspace, this time browse to the QueenElizabethPark_DEM.tiff dataset. In the parameters, set the Feature Type Name(s) to From File Name(s).
Inspect the dataset. This GeoTIFF contains a digital elevation model of Queen Elizabeth Park, Vancouver. This is the exact same extent as the orthophoto, it just shows the elevation of the area, which at it’s highest point is 152 meters or 499 feet above sea level.
The DEM of Queen Elizabeth Park viewed in the Data Inspector
4. Change band interpretation from Real32 to RGBA32
The DEM only contains one band of data, REAL32, which is a numeric 32-bit band type. To be able to mosaic our rasters together later, we need to change the band type interpretation. To do this we will use the RasterInterpreationCoercer transformer. Add the RasterInterpretationCoercer to the workspace and connect it to the GeoTIFF Reader for the DEM. In the parameters, set the Destination Interpretation Type to RGBA32, this will change the band from one band to four bands, Red8, Green8, Blue8, and Alpha8. Just accept the rest of the default parameters.
Change the Destination Interpretation Type to RGBA32
Number of bands before and after the RasterInterpretationCoercer viewed in the Data Inspector
5. Create a hillshade of the DEM to create a 3D appearance
Using the DEM we can create what is called a hillshade of the area to highlight the elevation and give the image the appearance that it is in 3D, even though it is only 2D. Add a RasterHillshader transformer to the workspace and connect it to the Output port on the RasterInterpretationCoercer. The defaults are ok for this transformer. Add an Inspector transformer to the Output port and run the translation to view the hillshade.
Hillshade created with the RasterHillshader viewed in the Data Inspector
Bands created with the Hillshader transformer
6. Select unnecessary bands
As you can see in the screenshot above, the RasterHillshader changes the bands to alternating Grey8 and Alpha8 bands. We don’t need all these bands. Use the RasterSelector transformer to select bands 1, 2, 3 and 5 for removal, which will select all three Alpha8 bands and a Grey8 band (which is a duplicate band). The reason we are removing all of the Alpha8 bands is that they are out of order for our final output, we can add the Alpha8 band back in later. Connect the RasterSelector to the Output port on the RasterHillshader and in the parameters, click the ellipsis next to Band and Palette List. Then type in 1, 2, 3, and 5 each on a new line for Band, and then ALL next to each or Palette. These four bands are now selected.
Using the RasterSelector to select the unnecessary bands
7. Remove the selected unnecessary bands
To remove the bands we just selected, we need to use the RasterBandRemover. Add a RasterBandRemover to the canvas and connect it to the Output port on the RasterSelector. There are no parameters to set for the RasterBandRemover, it will just remove the bands selected with the RasterSelector.
8. Change interpretation from Grey8 to RGBA32
Our values are still set to Grey8 from the RasterHillshader, to change them back to RGBA32 to be able to mosaic them, we will use another RasterInterpretationCoercer. Connect the RasterInterpretationCoercer to the RasterBandAdder and set the Destination Interpretation Type to RGBA32 and accept the rest of the defaults. If you connect an Inspector, you can see that the hillshade has changed from greyscale to a yellow and blue image. This ok for this example, as it will highlight the contours below the orthophoto.
After the second RasterInterpretationCoercer the inspected output in the Data Inspector
9. Select all bands
None of the bands are selected because we removed the ones we selected. To select the rest of the bands we have remaining, add another RasterSelector. The defaults should be set to "ALL ALL" for Band and Palette List.
10. Resample the raster to make the hillshade the same resolution as the orthophoto
To ensure the resolution of the hillshade is the same as the orthophoto, we will use a RasterResampler. Add a RasterResampler to the workspace, and connect it to the second RasterSelector. In the parameters, set the Size Specification to RowsColumns. For Number of Columns (cells) set the value to 6135 and for Number of Rows (cells) set the value to 5886. These values can be found in the Feature Information pane when inspecting the original orthophoto.
Set the RasterResampler to 6135 and 5886
Where the 6135 and 5886 values come from in the Data Inspector
11. Mosaic both the rasters together to create one raster
Now to mosaic both of the rasters together, so they become one raster. Using the RasterMosaicker transformer, connect it to the RasterBandAdder coming from the QueenElizabethPark orthophoto and also connect it to the RasterResampler. In the parameters, set Overlapping Values to Minimum, and then Merge Palettes to No. Connect an Inspector transformer, and run the translation.
In the RasterMosaicker parameters, set the Overlapping Values to Minimum and Merge Palettes to No
12. Output to ECW
After confirming that the translation was successful using the Inspector transformer, you can now write out to ECW. Add an ER Mapper ECW Writer to the canvas, and change the Raster Attribute Definition to Automatic.
Output of the mosaicked (overlapped) ECW file viewed in the Data Inspector
Data Attribution
The data used here originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.
Comments
0 comments
Please sign in to leave a comment.