Effective BulkAttributeRenamer

This example is a part of an actual project I recently completed.
The source dataset contains fine mesh polygons covering a local government area; each polygon has land-use type code as an attribute named "lu_type", its value can be one of 12 different codes:
0100, 0200, 0500, 0600, 0700, 0901, 0902, 1000, 1100, 1400, 1500, 1600

The purpose is to clip the meshes by other polygons (representing some specific land lots), and create a table of every land-use sum area inside of each lot.
Columns of the destination table should be:
lot_id | A0100 | A0200 | A0500 | ... | A1600

Here, "Axxxx" means the sum area of a land-use type "xxxx" (0100, 0200, ...).

The workflow I created looks like this.

The point is the BulkAttributeRenamer parameter setting.
  Rename: Selected Attributes
  Selected Attributes: A
  Action: Add String Suffix
  String: @Value(lu_type)

In the AreaCalculator, I specified "A" to the Area Attribute name; then the value of "lu_type" (0100, 0200, and so on) is appended to "A" as suffix, in the BulkAttributeRenamer.
So, after exposing those attribute names (AttributeExposer), all land-use areas of a lot can be aggregated into a feature (Aggregator 2).


At first, I thought of using Python to rename the area attribute, but I just remembered this article. Community > Attribute renaming using attribute values
Wonderful BulkAttributeRenamer!

No comments:

Post a Comment