Files
-
- 4 MB
- Download
Introduction
In this tutorial, you will learn how to modify raster cell sizes using the FME RasterResampler transformer. The RasterResampler resamples an input raster using user-specified parameters (raster dimensions, cell size, or percentage of size) and an interpolation method (Nearest Neighbor, Bilinear, Bicubic, Average 4, or Average 16) to merge cells.
Data Source
The source dataset is a digital elevation model of mountains in British Columbia with a resolution of 1201 x 1201 px.
Step-by-step Instructions
In this scenario, you want to change the spatial resolution of your raster dataset and set rules for aggregating or interpolating values across the new pixel sizes. This will allow you to change the cell size without changing the extent of the raster dataset. The objective of this exercise is to downsample the raster to reduce file size and improve performance when displaying it.
The files used in this tutorial are available in the article's Files section.
1. Create a New Workspace
Open FME Workbench and create a blank workspace.
2. Add a Reader
Add a reader to the canvas by clicking on the Reader button on the top menu bar, and set the following:
- Format: Canadian Digital Elevation Data (CDED)
-
Dataset: <path>\DEM-Full.dem
- Click on the ellipses to navigate to the file location on your computer
Then click OK to finish adding the reader.
3. Resample Raster
Add a RasterResampler transformer to the canvas by typing “RasterResampler” to bring up the list of FME Transformers in the Quick Add Search. Select the RasterResampler from the list of Transformers by double-clicking or using the arrow keys and Enter to add it.
Double-click on the RasterResampler to open the parameters. In the parameters, set the following
- Raster Specification: Percentage
- Percentage: 50
- Interpolation Type: Average 4
Click OK.
Average 4 and Average 16 are useful interpolation methods for numeric rasters like DEMs and produce higher-quality images than Bilinear and Nearest Neighbor. For more information, see the RasterResampler documentation.
Note: Another common practice is to create raster pyramids to improve performance. To find out more about using the RasterPyramider in FME, see the Raster Pyramiding Example article.
4. Add an Esri ASCII Grid Writer
Add a writer to the canvas, the same way a reader is added. Set the following parameters:
- Format: Esri ASCII Grid
-
Dataset: <path>\Output
- Click on the ellipses to navigate to the location on your computer
Click OK. The Feature Type window will open next.
In the Feature Type dialog, set:
- DEM File Name: ResampledRaster
-
DEM File:
- TAB File Generation: Yes
Click OK.
TAB files store control points, a coordinate system, and user attributes. To learn more about TAB files, see the Raster documentation.
5. Run the Workspace
Connect the ResampledRaster writer feature type to the Resampled output port on the RasterResampler.
Run the workspace by clicking the Run button on the top toolbar, or by selecting Run > Run Workspace from the top menu bar.
After running the workspace, click on the ResampledRaster writer feature type to open the mini toolbar, then click on View Written Data to view the data in Visual Preview.
In Data Preview (formerly Visual Preview), click on data to select it, then open the Feature Information Window. In the Feature Information Window, notice that the Resolution has been decreased by 50% from 1201x1201 to 601x601.
Data Attribution
The data used in this tutorial originates from open data made available by the Government of Canada. It contains information licensed under the Open Government Licence - Canada.