Exercise 3c: Using source attributes to separate data
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:
- Add a ValueMapper transformer and map specific attribute values in the COVER field to AutoCAD block definitions stored in the AutoCAD template (.dwg) file.
- Expose the AutoCAD properties for the block name, block rotation, and the block reference (insert) entity.
- Specify the AutoCAD template file that is included with the tutorial data.
- Add a second data destination for a GML dataset and set the Fanout By Attribute parameter for each unique value in the COVER field.
Create a toolbox and a spatial ETL tool
The Data Interoperability extension must be enabled.
- Start ArcMap.
- Click the Catalog Window button on the Standard toolbar.
-
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.
- Right-click the birds_eggs folder and click New > Toolbox .
- Right-click the toolbox, click Rename, then type nests.
- Right-click the nests toolbox and click New > Spatial ETL Tool.Create Translation Workspace Wizard opens.
Create the translation workspace
Choosing the FME reader
- Click the Format button.
The FME Reader Gallery dialog box opens.
- Type gdb in the Search text box.
- Click the row listing the ESRI Geodatabase (Filed-based) format and click OK.
The FME Reader Gallery dialog box closes.
- Click Next.
Specifying the data source
- Click the Locate Source Data browse button.
The Select Geodatabase dialog box opens.
- Navigate to the C:\arcgis\ArcTutor\Data Interoperability\birds_eggs\ folder.
- Click the nests.gdb folder and click Open.
The Select Geodatabase dialog box closes.
- Click Next.
Specifying the reader parameters
Accept the default parameters for the geodatabase.
- Click Next.
Choosing the FME writer
- Click the Format browse button.
The FME Writer Gallery dialog box opens.
- Type dwg in the Search text box.
- Click the row listing ESRI Geodatabase (File-based) and click OK.
The FME Writer Gallery dialog box closes.
- Click Next.
Specifying the writer parameters
Accept the default parameters for the AutoCAD DWG format.
- Click Next.
Creating the workspace
- Click Finish.
The wizard processes the information and starts Workbench.
- 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.
- In the Transformers window, type valuem in the search text box and press ENTER.
-
Double-click ValueMapper.
A ValueMapper transformer is added to the canvas.
- Right-click the ValueMapper transformer and click Insert Before from the shortcut menu.Workbench Wizard starts.
- Click Next.
The transformer is connected to the source and destination datasets.
- Click the Properties button on the ValueMapper transformer window.
The Edit ValueMapper Parameters dialog box opens.
- Click the Source Attribute arrow and choose the Cover attribute.
- 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.
- Click Import.
Workbench Wizard starts.
- Confirm the path is set to C:\arcgis\ArcTutor\Data Interoperability\birds_eggs\nests.gdb.
- Click Next.
- Click the feature type NEST and click Next.
- Click the key attribute COVER and click Next.
- Click the value attribute COVER and click Next.
- Click Finish.
- 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.
- Double-click each value in the right-hand column and replace it with the corresponding AutoCAD block name listed in the following table.
-
Click OK.
The Edit ValueMapper Parameters dialog box closes.
COVER attribute value | block_name attribute value |
---|---|
rock | KRYSS |
willow | BARRTR |
conifer | STOMPKT |
bare | LOVTR |
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.
- Click the Properties button on the destination feature type NESTS.
The Feature Type Properties dialog box opens.
- Click the Format Attributes tab.
- Check the boxes for autocad_block_name, autocad_entity, and autocad_rotation.
-
Click OK.
The Feature Type Properties dialog box closes.
Connect input for the exposed format attributes
- Expand the attributes list for the ValueMapper transformer and the NESTS destination feature.Pan to the bottom of the lists and make the following connections:
- Connect the ROTATION attribute to the autocad_rotation format attribute.
The rotation values are passed from the source data.
- Connect the block_name attribute to the autocad_block_name format attribute.
The block_name values are generated by the ValueMapper lookup table.
- Double-click the autocad_entity input (red) arrow.
New Constant appears as input.
- 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.
- 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.
- Click the browse (...) button.
The Select Template File dialog box opens.
- Navigate to the C:\arcgis\ArcTutor\Data Interoperability\birds_eggs folder, click template.dwg, then click Open.
- Click OK.
- Save your work and exit Workbench.
Save and rename the tool
- Click File > Save to save the tool.
- Click File > Exit to exit Workbench.
- Right-click the new spatial ETL tool in the Catalog window, click Rename, then type Nests to AutoCAD.
Open and run the tool
- In the Catalog window, expand the Nests toolbox .
-
Double-click the Nests to AutoCAD tool.
The Nests to AutoCAD dialog box opens.
- 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
- In the Catalog window, expand the nests DWG dataset and drag the point feature class into ArcMap to confirm your results.
Copy and rename the tool
- In the Catalog window, right-click the Nests to AutoCAD tool and click Copy on the shortcut menu.
- Right-click the Nests toolbox and click Paste on the shortcut menu.
- Right-click the Nests to AutoCAD (2) tool, click Rename on the shortcut menu, then type Nests to AutoCAD and GML.
- 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.
- On the main menu, click Writers > Add Writer.
The Add Writer dialog box opens.
- Click the Format browse button and choose Geography Markup Language (GML) from FME Writer Gallery.
- Click the Dataset browse button.
The Select File dialog box opens.
- Navigate to the C:\arcgis\ArcTutor\Data Interoperability\birds_eggs\ folder, type nests in the File name text box, then click Save.
- Click OK.
Workbench prompts you to create a new feature type.
- Click No.
- Right-click the AutoCAD output feature type NESTS and click Duplicate from the shortcut menu.
- Connect the ValueMapper OUTPUT to the INPUT of the new destination feature type.
- Click the Properties button on the destination feature type NESTS.
The Feature Type Properties dialog box opens.
- In the Feature Type Name text box, type NESTS_gml.
- 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.
- Click the Dataset arrow and choose nests [GML].
-
Click OK.
The Feature Type Properties dialog box closes.
Save and run the tool
- Click File > Save to save the tool.
- Click File > Exit to exit Workbench.
- In the Catalog window, expand the Nests toolbox .
-
Double-click the Nests to AutoCAD tool.
The Nests to AutoCAD dialog box opens.
- 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
- In the Catalog window, drag the nests GML dataset into ArcMap to verify your results.
This completes the exercise.