Exercise 3c: Using source attributes to separate data

Complexity: Advanced Data Requirement: ArcGIS Tutorial Data for Desktop Data Path: C:\arcgis\ArcTutor\Data Interoperability\ Goal: Learn how to use source attribute values in FME Workbench to separate data and generate new features.

This exercise introduces two methods for using attribute values to separate data based on attribute values. They can be used to create spatial ETL tools that categorize source data and generate sets of features with common values.

The first method separates the data within the workspace using the ValueMapper transformer as a lookup table and routes the data to specific AutoCAD block definitions. The second method separates the data at the time of writing using the Fanout By Attribute writer parameter for a GML dataset and generates unique feature types on the fly.

Using Workbench, you perform the following tasks:

Create a toolbox and a spatial ETL tool

Prerequisite:

The Data Interoperability extension must be enabled.

Steps:
  1. Start ArcMap.
  2. Click the Catalog Window button Catalog on the Standard toolbar.
  3. Type C:\arcgis\ArcTutor\Data Interoperability\birds_eggs\ in the Location text box and press ENTER.

    The location is added to the Catalog tree.

  4. Right-click the birds_eggs folder and click New > Toolbox Toolbox.
  5. Right-click the toolbox, click Rename, then type nests.
  6. Right-click the nests toolbox and click New > Spatial ETL Tool.
    Creating a new spatial ETL tool

    Create Translation Workspace Wizard opens.

Create the translation workspace

Choosing the FME reader

Steps:
  1. Click the Format browse button.

    Wizard welcome

    The FME Reader Gallery dialog box opens.

  2. Type gdb in the Search text box.
  3. Click the row listing the Esri Geodatabase (Filed-based) format and click OK.

    FME Reader Gallery

    The FME Reader Gallery dialog box closes.

  4. Click Next.

Specifying the data source

Steps:
  1. Click the Locate Source Data browse button.

    The Select Geodatabase dialog box opens.

    Locate Source Data

  2. Navigate to the C:\arcgis\ArcTutor\Data Interoperability\birds_eggs\ folder.
  3. Click the nests.gdb folder and click Open.

    The Select Geodatabase dialog box closes.

  4. Click Next to accept the default reader parameters for the geodatabase.

Choosing the FME writer

Steps:
  1. Click the Format browse button.
    Select destination format

    The FME Writer Gallery dialog box opens.

  2. Type dwg in the Search text box.
  3. Click the row listing Autodesk AutoCAD DWG/DXF and click OK.
    FME Writer Gallery

    The FME Writer Gallery dialog box closes.

  4. Click Next.
  5. Click Next to accept the default parameters for the AutoCAD DWG format..

Creating the workspace

Steps:
  1. Click Finish.

    The wizard processes the information and starts Workbench.

  2. Expand the reader feature type NESTS and the writer feature type NESTS. Observe that the source feature attributes are mapped directly to the destination AutoCAD dataset.

    Default mapping

Add an AttributeValueMapper transformer

The AttributeValueMapper transformer assigns attribute values based on other attributes and stores the looked-up value in a new attribute.

Map specific COVER attribute values to AutoCAD block names and store the lookup values in an attribute named block_name.

Steps:
  1. In the Transformers window, type valuem in the search text box and press ENTER.
  2. Double-click AttributeValueMapper.

    An AttributeValueMapper transformer is added to the canvas.

  3. Right-click the AttributeValueMapper transformer and click Insert Before from the context menu.
    Workbench Wizard starts.
    Insert before
  4. Click Next.

    The transformer is connected to the reader and writer feature types.

    ValueMapper

  5. Click the Properties button on the ValueMapper transformer window.

    The AttributeValueMapper Parameters dialog box opens.

  6. Click the Source Attribute arrow and choose the COVER attribute.
  7. In the New Attribute Name text box, type block_name.
    AttributeValueMapper settings

Importing unique values

You can type the source input values manually or use the import wizard. This section shows you how to use the import wizard. When the destination values are unavailable, as in this case, you can select the same attributes for both the Key and Value attributes and create a 1:1 mapping. You can then edit the destination values to match the corresponding AutoCAD block names stored in the template (.dwg) file.

Steps:
  1. Click Import.

    Workbench Wizard starts.

    Workbench Wizard

  2. Confirm that Dataset is set to the C:\arcgis\ArcTutor\Data Interoperability\birds_eggs\nests.gdb data source. You can click the Change button to view the settings, then click the Cancel button to close the dialog box.
  3. Click Next.
  4. On the Select Feature Types dialog box, click the feature type NEST and click Next.
  5. On the Key Attribute dialog box, click the COVER attribute and click Next.
  6. On the Value Attribute dialog box, click the value attribute COVER and click Next.
  7. On the Scanning Attribute Values dialog box, click Finish when it has completed scanning the data.

    Workbench displays the message: 5 lookup entries read. Click OK.

  8. In the Default Value text box, type LOVSK.

    During execution, the default value is used if the tool encounters an attribute value not listed in the ValueMapper lookup table. In this exercise, you are specifying an AutoCAD block name stored in the template drawing.

  9. Double-click each value in the right-hand column and replace it with an AutoCAD block name stored in the template drawing.
    AttributeValueMapper mappings
  10. You can cut and paste the values from the following table:

    COVER attribute

    AutoCAD block name

    rockKRYSS
    willowBARRTR
    coniferSTOMPKT
    bareLOVTR
  11. Click OK.

    The AttributeValueMapper Parameters dialog box closes.

Expose the AutoCAD block properties

Exposing specific AutoCAD block properties for the writer feature type enables you to control how the block references are inserted in the output AutoCAD (.dwg) file.

Steps:
  1. Click the Properties button on the writer feature type NESTS.

    The Feature Type Properties dialog box opens.

    Feature Type Properties

  2. Click the Format Attributes tab.
  3. Check the boxes for autocad_block_name, autocad_entity, and autocad_rotation.
  4. Click OK.

    The Feature Type Properties dialog box closes.

Connect input for the exposed format attributes

Steps:
  1. Expand the attributes list for the ValueMapper transformer and the NESTS writer feature type. Pan to the bottom of the lists and make the following connections:

    ValueMapper connections

  2. Connect the ROTATION attribute to the autocad_rotation format attribute.

    This passes the rotation values from the source data to the AutoCAD block.

  3. Connect the block_name attribute to the autocad_block_name format attribute.

    This passes the block_name values you mapped in the AttributeValueMapper lookup table to the DWG writer.

  4. Right-click the autocad_entity input (red) arrow, and click Attach Constant on the context menu.

    A new constant is connected as input.

  5. Double-click New Constant and type autocad_insert.

    Specifying the AutoCAD entity as autocad_insert inserts a block reference for each output feature. The geometry (or symbology) is defined by the block definitions stored in the AutoCAD template (.dwg) file you specify in the next section.

    NoteNote:

    All user attributes that are passed to the DWG writer feature type are inserted as block attributes with the block reference for each feature. This is the result of the DWG writer Attribute Output parameter set to Ignore. This in effect ignores any attribute definitions found within the block definitions in the template file and allows the spatial ETL tool to control which attributes are written to the drawing file.

Specify the AutoCAD template file

The AutoCAD template file contains the block definitions you specified in the ValueMapper lookup table.

Set the Template file path to point to the template.dwg file in the tutorial folder.

Steps:
  1. In the Navigator window, expand the [ACAD] writer feature type and expand the Parameters node.
  2. Right-click Template File, then click Edit Parameter from the context menu.

    The Edit Parameter dialog box opens.

  3. Click the browse (...) button and navigate to the folder C:\arcgis\ArcTutor\Data Interoperability\birds_eggs\template.dwg.
    Template file parameter
  4. On the Select Template File dialog box, click template.dwg and click Open.
  5. On the Edit Parameter dialog box, click OK.

Save and rename the tool

Save your work, exit Workbench, then rename the tool in the Catalog window.

Steps:
  1. Click File > Save to save the tool.
  2. Click File > Exit to exit Workbench.
  3. Right-click the new spatial ETL tool in the Catalog window, click Rename, then type Nests to AutoCAD.

Open and run the tool

Open the tool, set the destination file parameter, then run the tool.

Steps:
  1. In the Catalog window, expand the Nests toolbox Toolbox.
  2. Double-click the Nests to AutoCAD tool.

    The Nests to AutoCAD dialog box opens.

    Nests to AutoCAD

  3. Click the folder browse button and navigate to the folder C:\arcgis\ArcTutor\Data Interoperability\birds_eggs.
  4. In the Save As dialog box, type nests in the File name text box and click Save. The FME writer appends the necessary file extension to the output.
  5. Click OK to run the tool.

    The tool executes the conversion in the background. A progress bar at the bottom of your map displays the name of the tool. When the tool is finished, a pop-up notification appears in the system tray. You can examine the details of the conversion in the Results window.

Add the data to ArcMap

Steps:
  1. In the Catalog window, expand the nests DWG dataset and drag the point feature class into ArcMap to confirm your results.

    Nest to AutoCAD results

Copy and rename the tool

Copy the tool and use it as the basis for a second tool that generates both a drawing file and a GML dataset using the Fanout By Attribute parameter.

Steps:
  1. In the Catalog window, right-click the Nests to AutoCAD spatial ETL tool and click Copy on the context menu.
  2. Right-click the Nests toolbox and click Paste.
  3. Right-click the Nests to AutoCAD (2) tool, click Rename, then type Nests to AutoCAD and GML.
  4. Right-click the Nests to AutoCAD and GML tool and click Edit.

    Workbench starts.

Add a writer for GML

Add a second writer that creates GML datasets and connect it to the ValueMapper transformer output.

Steps:
  1. On the main menu, click Writers > Add Writer.

    The Add Writer dialog box opens.

    Add Writer

  2. Click the Format browse button and choose GML (Geography Markup Language) from FME Writer Gallery.
  3. Click the Dataset browse button and navigate to the folder C:\arcgis\ArcTutor\Data Interoperability\birds_eggs.
  4. On the Select File dialog box, type nests in the File name text box, and click Save. The FME writer appends the necessary file extension to the output.
  5. Navigate to the C:\arcgis\ArcTutor\Data Interoperability\birds_eggs\ folder, type nests in the File name text box, then click Save.
  6. Click OK.

    Workbench prompts you to create a new feature type.

  7. Click No.
  8. Instead of creating a feature type from scratch, copy the AutoCAD feature type and edit the settings.
  9. Right-click the AutoCAD output feature type NESTS and click Duplicate from the context menu.
  10. Connect the ValueMapper OUTPUT to the input of the new destination feature type.

    Destination features for GML

  11. Click the Properties button on the duplicate destination feature type NESTS. When you are finished editing the settings, the ToolTip displays information similar to the above graphic.

    The Feature Type Properties dialog box opens.

    NESTS general parameters

  12. In the Feature Type Name text box, type NESTS_gml.
  13. Check the Fanout By Attribute check box, click the arrow, then choose COVER.

    The Fanout setting splits output data based on the value of an attribute. The data is divided at run time rather than being generated within the workspace. This exercise uses it to generate output based on the value in the COVER attribute field.

  14. Click the Dataset arrow and choose nests [GML].
  15. Click OK.

    The Feature Type Properties dialog box closes.

Set the destination parameter for DWG datasets

A published parameter is any parameter (setting) that has been made available for the user to change when running the tool. Parameters appear as text boxes on the spatial ETL tool dialog box similar to most geoprocessing tools. In the Navigator window, they are denoted with a purple icon.

When you added the GML writer, you set this parameter with a default destination path and file name. This section sets this parameter for DWG datasets with a default path and file name.

Steps:
  1. In the Navigator window, expand the [ACAD] writer feature type and expand the Parameters node.
    Published parameter for DWG datasets
  2. Right-click Destination and click Edit Parameter from the context menu.

    The Edit Published Parameter dialog box opens.

  3. Click the browse (...) button and navigate to the folder C:\arcgis\ArcTutor\Data Interoperability\birds_eggs.
  4. In the File name text box, type nests and click Save.
  5. Click OK to close the Edit Published Parameter dialog box.

Save and run the tool

Steps:
  1. Click File > Save to save the tool.
  2. Click File > Exit to exit Workbench.
  3. In the Catalog window, expand the Nests toolbox Toolbox.
  4. Double-click the Nests to AutoCAD and GML tool.

    The Nests to AutoCAD and GML dialog box opens.

    Nests to AutoCAD and GML

  5. Click OK.

    The tool executes the conversion in the background. A progress bar at the bottom of your map displays the name of the tool. When the tool is finished, a pop-up notification appears in the system tray. You can examine the details of the conversion in the Results window.

Add the data to ArcMap

Steps:
  1. In the Catalog window, drag the nests GML dataset into ArcMap to verify your results.

    Nests to AutoCAD and GML results

This completes the exercise.

Related Topics

6/7/2012