Files
-
- 4 MB
- Download
Introduction
Extracting data using area masks in FME requires both a raster and a vector dataset, as well as the Clipper transformer. In this tutorial, you will select raster data within polygon features; however, it can easily be modified to select vector features within a search envelope.
Data Sources
The first source dataset is a digital elevation model of the City of Vancouver and the surrounding area.
The second source dataset is an Esri Shapefile of the City of Vancouver boundary.
Step-by-step Instructions
In this scenario, you are interested in clipping the extent of an existing DEM to the boundary of your city based on a polygon feature. This exercise uses a municipal land boundary as the search envelope; however, you can also use multiple polygon features.
To follow along with this tutorial, please download the data from the article's Files section.
1. Create a New Workspace
Open FME Workbench and create a blank workspace.
2. Add an Esri Shapefile Reader
Add an Esri Shapefile reader to the canvas by clicking on the Reader button on the top menu bar or by going to Readers > Add Reader. In the Add Reader dialog, set the following:
- Format: Esri Shapefile
-
Dataset: LandBoundary.shp
- Click the ellipses to navigate to the file location on your computer
Click OK to finish adding the reader.
3. Add a Canadian Digital Elevation Data Reader
Next, add a second reader to the canvas and set the following:
- Format: Canadian Digital Elevation Data (CDED)
-
Dataset: DEM-full.dem
- Click the ellipses to navigate to the file location on your computer
Click OK to add the reader to the canvas.
4. Inspect Coordinate Systems
Since we will clip the DEM based on the boundary polygon, we need to ensure that both datasets are in the same coordinate system.
Click on the VancouverLandBoundary reader feature type to open the mini toolbar, then click on View Source Data to view the data in Visual Preview.
In Data Preview, open the Feature Information Window, and select a feature to view the Coordinate System. Repeat this step for the CDED reader feature type.
The datasets are in different coordinate systems, so we need to convert one of them to match the others.
5. Reproject Coordinates
We will reproject the DEM dataset. Click on the CDED reader feature type to select it. Then add a Reprojector to the canvas by typing “Reprojector” to bring up the list of FME Transformers in the Quick Add Search. Select the Reprojector from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it.
Double-click on the Reprojector to open the parameters. In the parameters, set the Destination Coordinate System to UTM83-10, then click OK.
6. Clip DEM
In FME, the Clipper performs a geometric clipping operation similar to a cookie cutter. With that in mind, we will clip the areas outside of the VancouverLandBoundary polygon because we are only interested in the DEM for the Vancouver area.
Add a Clipper to the canvas and connect the Clipper input port to the VancouverLandBoundary reader feature type, and then connect the Candidate input port to the Reprojector. We can accept the default parameters for this example.
7. Run Workspace
Connect an Inspector transformer to the Clipper's Inside output port.
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, only the DEM that was inside the VancouverLandBoundary will remain.
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.