Select Data by Area Masks

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.0

Introduction

Extracting data using area masks in FME requires the use of both a raster and a vector dataset and the Clipper transformer. In this tutorial, you will be selecting raster data inside of polygon features; however, this tutorial can easily be modified to select vector features within a search envelope.

 

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 will use a municipal land boundary as a search envelope; however, you can also use multiple polygon features.

Sources
The first source dataset is a digital elevation model of the City of Vancouver and the surrounding area. 
DEMSource.png

The second source dataset is an Esri Shapefile of the City of Vancouver boundary. 
BoundarySource.png

1. Create a New Workspace
Open FME Workbench and create a blank workspace. 
NewWorkspace.png
 
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, select Esri Shapefile as the Format, then for Dataset browse to the VancouverLandBoundary.shp dataset which is available for download from the Files section on this article. Then click OK to finish adding the reader.
Shapefile.png
 
3. Add a Canadian Digital Elevation Data Reader
Next, add a  Canadian Digital Elevation Data (CDED) reader to the canvas, and browse to the DEM-Full.dem dataset. 
DEM.png
 
4. Inspect Coordinate Systems 
Since we will be clipping 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 popup menu, then click on View Source Data to view the data in Visual Preview. 
ViewSource.png
 
In Visual Preview, open the Feature Information Window, and select a feature to view the Coordinate System. Repeat this step for the CDED reader feature type. 
CoordSystem.png

The datasets are in different coordinate systems, so we need to change one so that they are the same.
 
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. 
QuickAdd.png
Repro.png
 
Double-click on the Reprojector to open the parameters. In the parameters, set the Destination Coordinate System to UTM83-10, then click OK. 
ReproParam.png
 
 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 (Clippee FME 2021 or older) input port to the Reprojector. We can accept the default parameters for this example. 
ClipperConnect.png
 
7. Run Workspace
Connect an Inspector transformer to the Inside output port on the Clipper. 
Inspector.png
 
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar. 
Run.png
 
After running the workspace, only the DEM that was inside of the VancouverLandBoundary will remain.  
VP.png

 

Data Attribution

Data used in this tutorial originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.