Using Aggregator to Create a Segment Points Field

Aggregator converts flat data to hierarchical data. It takes input data from a single source, creates a schema (a structured hierarchy of data) by grouping the data based on fields you specify, and then constructs the groups in the schema.

Here the input for Aggregator is a set of longitude and latitudes that define one or more lines. The schema that is created is a Segment Points list that describes the coordinate fields. This can also be used to create a Line Segments list if your coordinates represent polygons (closed line segments). The output SegmentPoints is then used as the input to a Create Line Geometry operation using Spatial Calculator.

To create the Segment Points field:

  1. In Enterprise Designer, create a new dataflow and add a Read From File stage. Double-click to display the Options dialog. In the File Properties tab, specify the input file containing the location information; for example:
    LINEID Longitude Latitude
    1 -74.023226 40.638864
    1 -74.015887 40.633294
    1 -74.026896 40.616027
    1 -74.035702 40.606277
    2 -73.823238 40.714004
    2 -73.816633 40.702877
    2 -73.810762 40.693696
    2 -73.806358 40.685627
    2 -73.800854 40.671713
  2. In the Fields tab, click the Detect Type button, if necessary, to automatically determine the fields.

  3. Add an Aggregator stage to the canvas. Connect the Read from File stage to the Aggregator. To keep track of what this aggregator does, rename it to Prepare Segment Points.
  4. Double-click the Prepare Segment Points aggregator to open the Options dialog.

  5. To tell the Aggregator how the data is to be organized, highlight Group By and click the Add button. Check the box for the LINEID field. Click OK.

  6. To create a new data type for the output, highlight the Output lists field and click the Add button. In the Field Options dialog box choose the New data type and provide the type name as ListFieldType. In the Name field type Coords. Click Add, then Close.

  7. To add the child fields for output, highlight the Coords field and click the Add button. From the Input field drop-down list, choose Latitude, then click Add. Repeat for the Longitude field and click Add, then Close.

  8. To use the Prepare Segment Points in a dataflow, add a Spatial Calculator stage (renamed to Create Line). Double-click the stage to open the Spatial Calculator Options dialog. Select Create Line Geometry, then select the coordinate system and click OK.
  9. Add a Write to Null stage to complete the dataflow. To test the dataflow, add an Inspection Point and run Inspect Current Flow.