FME Version
Files
-
- 200 KB
- Download
Introduction
Although FME is capable of creating cartographic elements, such as labels, it is not intended to be used for cartographic purposes. In this tutorial, you will learn how to create labels for point features and how to create a center point in polygons which can then be converted to a label point.
Step-by-step Instructions
Exercise 1: Labeling Point Features
In this scenario, you are interested in creating labels for school point features.
Source
The source dataset is an Esri Shapefile containing points for school locations in the City of Vancouver.
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, select Esri Shapefile as the Format, then for Dataset, browse to the Schools.shp dataset, which is available for download from the Files section on this article.
3. Label Points
Click on the Schools reader feature type to select it. Then add a LabelPointReplacer transformer to the canvas by typing “LabelPointReplacer” to bring up the list of FME Transformers in the Quick Add Search. Select the LabelPointReplacer 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 LabelPointReplacer to open the parameters. In the parameters, set the Label to school_name, then set the Label Height to 50.
Note: Label height is measured in ground units (meters in this case) and may either be entered as a number or can be taken from the value of a feature attribute by selecting the attribute name from the drop-down list. If the label height is too tall, you can either adjust the label height accordingly in the LabelPointReplacer parameters or edit the annotation size in the output format.
4. Run Workspace
Add an Inspector to the canvas and connect it to the LabelPointReplacer LabelPoint output port.
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar.
After running the workspace, in Visual Preview, there will be labels next to each point feature.
Exercise 2: Labelling Polygon Features
In this scenario, you are interested in creating labels for neighborhood polygon features that can be exported.
Source
The source dataset is an Esri Geodatabase containing neighborhood polygons for the City of Vancouver.
1. Create a New Workspace
Open FME Workbench and create a blank workspace.
2. Add an Esri Geodatabase (Open API Geodb) Reader
Add an E Esri Geodatabase (Open API Geodb) 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 Geodatabase (Open API Geodb) as the Format, then for Dataset, browse to the Neighborhoods.gdb dataset, which is available for download from the Files section on this article.
3. Find Center Point
Before we can label the neighborhood polygon, we need to define a location to attach the label, in this case, the center point of the polygon. Click on the Neighborhoods reader feature type to select it. Then add a CenterPointExtractor transformer to the canvas by typing “CenterPointExtractor” to bring up the list of FME Transformers in the Quick Add Search. Select the LabelPointReplacer from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it. There are no parameters to set.
4. Label Points
With the center points defined, a label can be attached. Add a LabelPointReplacer to the canvas and connect it to the CenterPointReplacer. In the parameters, set the Label to NeighborhoodName, then set the Label Height to 200.
Note: Label height is measured in ground units (meters in this case) and may either be entered as a number or can be taken from the value of a feature attribute by selecting the attribute name from the drop-down list. If the label height is too tall, you can either adjust the label height accordingly in the LabelPointReplacer parameters or edit the annotation size in the output format.
5. Run Workspace
Add an Inspector to the canvas and connect it to the LabelPointReplacer LabelPoint output port.
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar.
After running the workspace, in Visual Preview, there will be labels next to each of the point features in the center of each neighborhood polygon.
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.
Comments
0 comments
Please sign in to leave a comment.