<!--Exercise Section-->
<!--NB: In GitBook world we don't give a number to exercises-->

<table style="border-spacing: 0px;border-collapse: collapse;font-family:serif">
<tr>
<td style="vertical-align:middle;background-color:darkorange;border: 2px solid darkorange">
<i class="fa fa-cogs fa-lg fa-pull-left fa-fw" style="color:white;padding-right: 12px;vertical-align:text-top"></i>
<span style="color:white;font-size:x-large;font-weight: bold">Exercise</span>
</td>
<td style="border: 2px solid darkorange;background-color:darkorange;color:white">
<span style="color:white;font-size:x-large;font-weight: bold">Grounds Maintenance Project - Labelling Features</span>
</td>
</tr>

<tr>
<td style="border: 1px solid darkorange; font-weight: bold">Data</td>
<td style="border: 1px solid darkorange">City Parks (MapInfo TAB)</td>
</tr>

<tr>
<td style="border: 1px solid darkorange; font-weight: bold">Overall Goal</td>
<td style="border: 1px solid darkorange">Calculate the size and average size of each park in the city, to use in Grounds Maintenance estimates for grass cutting, hedge trimming, etc.</td>
</tr>

<tr>
<td style="border: 1px solid darkorange; font-weight: bold">Demonstrates</td>
<td style="border: 1px solid darkorange">Content transformation with parallel transformers</td>
</tr>

<tr>
<td style="border: 1px solid darkorange; font-weight: bold">Start Workspace</td>
<td style="border: 1px solid darkorange">C:\FMEData2016\Workspaces\DesktopBasic\Transformation-Ex4-Begin.fmw</td>
</tr>

<tr>
<td style="border: 1px solid darkorange; font-weight: bold">End Workspace</td>
<td style="border: 1px solid darkorange">C:\FMEData2016\Workspaces\DesktopBasic\Transformation-Ex4-Complete.fmw</td>
</tr>

</table>


Let's continue your work on the grounds maintenance project.

In this part of the project we’ll create a label for each park and write it to a new output layer. This is best done using a parallel stream of data.


<br>**1) Start Workbench**
<br>Start Workbench (if necessary) and open the workspace from Exercise 2c. Alternatively you can open C:\FMEData2016\Workspaces\DesktopBasic\Transformation-Ex4-Begin.fmw

The previous exercise measured park areas with the AreaCalculator. Now we are asked to add this information as labels to the output dataset.

This can be achieved using the LabelPointReplacer transformer.


<br>**2) Create New Writer Feature Type**
<br>Right-click the Writer feature type and choose the option Duplicate. This creates a new feature type (layer) in the output dataset.

![](./Images/Img2.62.Ex4.DuplicateFeatureType.png)


Now clean up this feature type's schema. Open the Feature Type properties dialog. Rename the new type to ParkLabels. In the User Attributes tab delete all of the existing user attributes.


<br>**3) Place a LabelPointReplacer Transformer**
<br>Click onto a blank area of canvas. Type "LabelPointReplacer" to add a transformer of this type.

Connect it to the Complete port of the StatisticsCalculator by dragging a second connection from there to the new transformer.

![](./Images/Img2.63.Ex4.LabelPointReplacerCanvas.png)

Make a new connection from the LabelPointReplacer to the new feature type.


<br>**4) Check Transformer Parameters**
<br>Open the parameters dialog for the LabelPointReplacer transformer.

Click the browse button to the right of the label field to open an advanced text editor. We want the label to include the park name and area, with a notation for the units too.

So, firstly double click ParkName in the list of attributes to the left:

![](./Images/Img2.64.Ex4.LabelEditDialog.png)

Now press the Enter/Return key to insert a new line.

Next double-click the ParkArea attribute to add that.

Finally type " sq metres" after the ParkArea attribute (including a <space\> character before the "sq" part):

![](./Images/Img2.65.Ex4.LabelEditDialog.png)

Click OK to close this dialog.

Now click in the Label Height field and type 25 (that’s 25 working units, which in this case is metres).

The “Always Rotate Label” parameter can be left to its default value.

![](./Images/Img2.66.Ex4.LabelPointReplacerParameters.png)

---

<!--Tip Section--> 

<table style="border-spacing: 0px">
<tr>
<td style="vertical-align:middle;background-color:darkorange;border: 2px solid darkorange">
<i class="fa fa-info-circle fa-lg fa-pull-left fa-fw" style="color:white;padding-right: 12px;vertical-align:text-top"></i>
<span style="color:white;font-size:x-large;font-weight: bold;font-family:serif">TIP</span>
</td>
</tr>

<tr>
<td style="border: 1px solid darkorange">
<span style="font-family:serif; font-style:italic; font-size:larger">
Many parameter fields (like Label Height) can be set either as a constant value (by typing it in) or set to an attribute by using “Set to Attribute Value.
<br><br>If in doubt, a tooltip is often provided to point the way.
</span>
</td>
</tr>
</table>

---

<br>**5) Run the Translation**
<br>Run the translation and inspect the output.

Notice that the output is in two layers in two files. Use the FME Data Inspector to open both output files in the same view.

![](./Images/Img2.67.Ex4.LabelsInDIView.png)


<br>**6) Save the Workspace**
<br>Save the workspace – it will be completed in further examples.

![](./Images/Img2.68.Ex4.WorkspaceWithLabelPointReplacer.png)

---

<!--Advanced Exercise Section-->

<table style="border-spacing: 0px">
<tr>
<td style="vertical-align:middle;background-color:darkorange;border: 2px solid darkorange">
<i class="fa fa-cogs fa-lg fa-pull-left fa-fw" style="color:white;padding-right: 12px;vertical-align:text-top"></i>
<span style="color:white;font-size:x-large;font-weight: bold;font-family:serif">Advanced Exercise</span>
</td>
</tr>

<tr>
<td style="border: 1px solid darkorange">
<span style="font-family:serif; font-style:italic; font-size:larger">
Now you know how to create a new feature type (layer) in the output, how to test data, and how to use parallel streams, why not try this task:
<br><br>Identify which parks are smaller than average and which parks are larger than average, and write them out to different feature types.
</span>
</td>
</tr>
</table>

---

<!--Exercise Congratulations Section--> 

<table style="border-spacing: 0px">
<tr>
<td style="vertical-align:middle;background-color:darkorange;border: 2px solid darkorange">
<i class="fa fa-thumbs-o-up fa-lg fa-pull-left fa-fw" style="color:white;padding-right: 12px;vertical-align:text-top"></i>
<span style="color:white;font-size:x-large;font-weight: bold;font-family:serif">CONGRATULATIONS</span>
</td>
</tr>

<tr>
<td style="border: 1px solid darkorange">
<span style="font-family:serif; font-style:italic; font-size:larger">
By completing this exercise you have learned how to:
<br><br><li>Create a new Writer feature type
<br><li>Use multiple streams of transformers in a single workspace
<br><li>Use FME's built-in string editor dialog
</span>
</td>
</tr>
</table>