# Data Transformation - Exercise 7

<table><thead><tr><th width="176">Exercise Details</th><th>Grounds Maintenance Project (Additional Output Dataset)</th></tr></thead><tbody><tr><td><strong>Locality</strong></td><td>Vancouver, Canada</td></tr><tr><td><strong>Data</strong></td><td>Parks (MapInfo TAB)</td></tr><tr><td><strong>Overall Goal</strong></td><td>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><strong>Demonstrates</strong></td><td>Multiple Writers</td></tr><tr><td><strong>Start Workspace</strong></td><td>C:\FMETraining\Workspaces\DataTransformation-Ex7-Begin.fmw</td></tr><tr><td><strong>End Workspace</strong></td><td>C:\FMETraining\Workspaces\DataTransformation-Ex7-Complete.fmw</td></tr></tbody></table>

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

The parks team have received a request from another department to receive a version of the parks maintenance data in geodatabase format, instead of MapInfo. Additionally, the output requires a Feature Type (a Feature Class in the Geodatabase) for the two different park types.

We will be able to adapt our existing workspace to include both the MapInfo and the Geodatabase outputs, so let’s do just that!

***

{% stepper %}
{% step %}

#### Open Workspace

Start FME Workbench (if necessary) and open the workspace from Exercise 6. Alternatively, you can open C:\FMETraining\Workspaces\DataTransformation-Ex7-Begin.fmw
{% endstep %}

{% step %}

#### Move Tester Transformer

Now that we have a need to process the dog parks data, we want to reconsider the position of the Tester transformer that is filtering out features that are dog parks.

Instead of isolating the dog park features *prior* to the area calculations, we want to now separate them *after* the area calculation, so we can provide the new output with the required information.

Disconnect your Tester transformer and reconnect it after the AttributeRenamer transformer. Reconnect the AttributeManager to the AreaCalculator transformer:

<figure><img src="https://4274781559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRckaXL2bzdwpcuSDj83u%2Fuploads%2Fgit-blob-0d11cca62eae2611bb981737f4ef5cac80bd6940%2F03_Ex7_01_Data_Transformation.jpg?alt=media" alt=""><figcaption></figcaption></figure>

Make sure that you move the connections for the existing MapInfo Feature Types (ParksMaintenanceData and ParkLabels) to the ‘Passed’ port of the now moved Tester, as these do not need the Dog Parks.
{% endstep %}

{% step %}

#### Add Geodatabase Writer

Now that we have prepared our workflow, we want to add a Geodatabase Writer.

Begin by clicking the “Add Writer” button on the toolbar:

<figure><img src="https://4274781559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRckaXL2bzdwpcuSDj83u%2Fuploads%2Fgit-blob-05a0eeefac78081ee28b6cade728549ca6004047%2F03_Ex7_02_Data_Transformation.jpg?alt=media" alt=""><figcaption></figcaption></figure>

Configure the writer using the following settings:

<table><thead><tr><th width="176">Parameter</th><th>Value</th></tr></thead><tbody><tr><td><strong>Writer Format</strong></td><td>Esri Geodatabase (File Geodb Open API)</td></tr><tr><td><strong>Writer Dataset</strong></td><td>C:\FMETraining\Output\ParksMaintenanceData.gdb</td></tr><tr><td><strong>Feature Class Definition</strong></td><td>Automatic…</td></tr></tbody></table>

Before selecting “OK” to create the writer, we want to modify the parameters.

Click on the “Parameters…” button to open up the Writer Parameters. Tick the “Overwrite Existing Geodatabase” tickbox:

<figure><img src="https://4274781559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRckaXL2bzdwpcuSDj83u%2Fuploads%2Fgit-blob-3b199bf57c2a9164c1371f51f7895138cf3a9026%2F03_Ex7_03_Data_Transformation.jpg?alt=media" alt=""><figcaption></figcaption></figure>

This will ensure that each time we run the workflow, the geodatabase is re-created with the results (instead of appending the new results to the previous results).

Click Ok to accept the settings and create the writer.

A new window will appear, prompting you to configure the feature type for this writer. Set the Feature Class name to be *StandardParks*, and set the geometry as *geodb\_polygon*, as shown below:

<figure><img src="https://4274781559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRckaXL2bzdwpcuSDj83u%2Fuploads%2Fgit-blob-f545dc78a66b815593ac9473f7aa386b34b1f72e%2F03_Ex7_04_Data_Transformation.jpg?alt=media" alt=""><figcaption></figcaption></figure>

Click “OK” to create your new Geodatabase Writer.
{% endstep %}

{% step %}

#### Create DogParks Feature Type

We need to create an additional feature type to include the dog park data in our new geodatabase. We could do the same thing as we did to create the ParkLabels feature type, but let’s look at a different approach.

On the Menubar, navigate to Writers > Add Feature Type…:

<figure><img src="https://4274781559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRckaXL2bzdwpcuSDj83u%2Fuploads%2Fgit-blob-5fb5cb3b62add8e94c79c6ef643fcc9c199fa286%2F03_Ex7_05_Data_Transformation.jpg?alt=media" alt=""><figcaption></figcaption></figure>

You will be prompted by the same Feature Type window that you saw when you created the Geodatabase Writer. Set the Feature Class name to be *DogParks*, and set the geometry as *geodb\_polygon*, as shown below:

<figure><img src="https://4274781559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRckaXL2bzdwpcuSDj83u%2Fuploads%2Fgit-blob-c2f05dfaebd060ffba4a106d29d2aa2c25369385%2F03_Ex7_06_Data_Transformation.jpg?alt=media" alt=""><figcaption></figcaption></figure>

Make sure that the Writer is set to your Geodatabase Writer *ParkMaintenanceData*, as this will add the Feature Type to that writer upon completion.

On the User Attributes tab, make sure the Attribute Definition is set to *Automatic*.

Click OK and your second Feature Type will be created and placed on the canvas.
{% endstep %}

{% step %}

#### Connect Feature Types

Now that we have created our Geodatabase Writer and Feature Types, it is time to connect them.

The *StandardParks* Feature Type can be connected to the “Passed” port of the Tester, as this is the output for parks that are NOT dog parks.

The *DogParks* Feature Type can be connected to the “Failed” port of the Tester, as this is the output for parks that ARE dog parks.

Once finished, your connections should look similar to the below:

<figure><img src="https://4274781559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRckaXL2bzdwpcuSDj83u%2Fuploads%2Fgit-blob-316c253c25c2885b9d314a682681467969bbbfac%2F03_Ex7_07_Data_Transformation.jpg?alt=media" alt=""><figcaption></figcaption></figure>

If you take a look at the User Attributes for either Feature Type, you will see that they have automatically been set with the features that are coming from the Tester. This is what the *Automatic* definition does for us, simply uses what is present. If preferred, you can set this to manual to make sure there are no unexpected changes.
{% endstep %}

{% step %}

#### Run the Workspace

Now that we have finished our new writer, it is time to run the workspace and confirm the output is correct.

Click the “Run Workspace” button on the toolbar and allow the workspace to run to completion. Once done, inspect the output dataset by selecting either Feature Type and selecting the “View Written Data” option to view the data of that Feature Type:

<figure><img src="https://4274781559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRckaXL2bzdwpcuSDj83u%2Fuploads%2Fgit-blob-666b6307e87e4668681724f19b6d42f46c857775%2F03_Ex7_08_Data_Transformation.jpg?alt=media" alt=""><figcaption></figcaption></figure>

Alternatively, you can open the dataset in the FME Data Inspector:

<figure><img src="https://4274781559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRckaXL2bzdwpcuSDj83u%2Fuploads%2Fgit-blob-bf544f254549606dba15af50dfd7c2eb4eff4f33%2F03_Ex7_09_Data_Transformation.jpg?alt=media" alt=""><figcaption></figcaption></figure>

You should see 73 features for the Standard Parks and 7 features for the Dog Parks.
{% endstep %}
{% endstepper %}

***

{% hint style="success" %}
By completing this exercise, you have learned how to:

* Create additional writers
* Configure the parameters for a writer
* Add additional Feature Types
  {% endhint %}
