Exercise 3c: Using source attributes to separate data

Komplexität: Erweitert Erforderliche Daten: ArcGIS Tutorial Data Setup Datenpfad: C:\arcgis\ArcTutor\Data Interoperability\ Ziel: Learn how to use source attribute values in FME Workbench to separate data and generate new features.

This exercise introduces two methods for separating 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

Voraussetzung:

The Data Interoperability extension must be enabled.

Schritte:
  1. Start ArcMap.
  2. Click the Catalog Window button Fenster "Katalog" 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 under the Folders Connection heading.

    Catalog window

  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.
    Create Translation Workspace Wizard opens.

    Wizard welcome

Create the translation workspace

Choosing the FME reader

Schritte:
  1. Click the Format button.

    The FME Reader Gallery dialog box opens.

    FME Reader Gallery

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

    The FME Reader Gallery dialog box closes.

  4. Click Next.

Specifying the data source

Schritte:
  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.

Specifying the reader parameters

Accept the default parameters for the geodatabase.

Schritte:
  1. Click Next.

Choosing the FME writer

Schritte:
  1. Click the Format browse button.

    The FME Writer Gallery dialog box opens.

    FME Writer Gallery

  2. Type dwg in the Search text box.
  3. Click the row listing ESRI Geodatabase (File-based) and click OK.

    The FME Writer Gallery dialog box closes.

  4. Click Next.

Specifying the writer parameters

Accept the default parameters for the AutoCAD DWG format.

Schritte:
  1. Click Next.

Creating the workspace

Schritte:
  1. Click Finish.

    The wizard processes the information and starts Workbench.

    Default mapping

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

Add a ValueMapper transformer

The ValueMapper transformer acts as a lookup table for input values and stores the output values in a user-defined attribute.

Map the unique values in the COVER feature attribute field to specific AutoCAD block names stored in the block_name attribute field.

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

    A ValueMapper transformer is added to the canvas.

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

    The transformer is connected to the source and destination datasets.

    Value Mapper

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

    The Edit ValueMapper Parameters dialog box opens.

    ValueMapper parameters

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

Importing unique values

You can type the source input values manually or use the import wizard. You can use the import wizard even when the destination values are unavailable. In this case, select the same source attributes for both sides of the equation to generate a basic 1:1 mapping, then edit the destination values to match the corresponding AutoCAD block names stored in the template (.dwg) file.

Schritte:
  1. Click Import.

    Workbench Wizard starts.

    Workbench Wizard

  2. Confirm the path is set to C:\arcgis\ArcTutor\Data Interoperability\birds_eggs\nests.gdb.
  3. Click Next.
  4. Click the feature type NEST and click Next.
  5. Click the key attribute COVER and click Next.
  6. Click the value attribute COVER and click Next.
  7. Click Finish.
  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 providing a default AutoCAD block name.

  9. Double-click each value in the right-hand column and replace it with the corresponding AutoCAD block name listed in the following table.
  10. COVER attribute value

    block_name attribute value

    rockKRYSS
    willowBARRTR
    coniferSTOMPKT
    bareLOVTR
  11. Click OK.

    The Edit ValueMapper Parameters dialog box closes.

Expose the AutoCAD block properties

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

Schritte:
  1. Click the Properties button on the destination 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

Schritte:
  1. Expand the attributes list for the ValueMapper transformer and the NESTS destination feature.

    ValueMapper connections
    Pan to the bottom of the lists and make the following connections:

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

    The rotation values are passed from the source data.

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

    The block_name values are generated by the ValueMapper lookup table.

  4. Double-click the autocad_entity input (red) arrow.

    New Constant appears as input.

  5. Double-click New Constant and type autocad_insert.

    The autocad_insert constant instructs FME Writer to insert a block reference for each output entity. In addition to the graphic elements defined in the AutoCAD template (.dwg) file, the user attributes specified for the destination dataset are written as block attributes to each block reference.

Specify the AutoCAD template file

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

Schritte:
  1. In the Navigator window, expand the destination format Parameters, right-click Template File, then click Edit Parameter from the shortcut menu.

    The Edit Parameter dialog box opens.

    Template File Parameter

  2. Click the browse (...) button.

    The Select Template File dialog box opens.

  3. Navigate to the C:\arcgis\ArcTutor\Data Interoperability\birds_eggs folder, click template.dwg, then click Open.
  4. Click OK.
  5. Save your work and exit Workbench.

Save and rename the tool

Schritte:
  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

Schritte:
  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 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

Schritte:
  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

Schritte:
  1. In the Catalog window, right-click the Nests to AutoCAD tool and click Copy on the shortcut menu.
  2. Right-click the Nests toolbox and click Paste on the shortcut menu.
  3. Right-click the Nests to AutoCAD (2) tool, click Rename on the shortcut menu, 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 writer and connect a second destination dataset for GML to the ValueMapper transformer OUTPUT.

Schritte:
  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 Geography Markup Language (GML) from FME Writer Gallery.
  3. Click the Dataset browse button.

    The Select File dialog box opens.

  4. Navigate to the C:\arcgis\ArcTutor\Data Interoperability\birds_eggs\ folder, type nests in the File name text box, then click Save.
  5. Click OK.

    Workbench prompts you to create a new feature type.

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

    Destination Features for GML

  10. Click the Properties button on the destination feature type NESTS.

    The Feature Type Properties dialog box opens.

    NESTS general parameters

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

    The Fanout setting generates a new output feature type on the fly for each unique value in the COVER attribute field.

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

    The Feature Type Properties dialog box closes.

Save and run the tool

Schritte:
  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 tool.

    The Nests to AutoCAD 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

Schritte:
  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.

Verwandte Themen


7/10/2012