The Data Flow transforms are a category that performs looping functions.

A loop function is a sequence of instructions that repeats until a specific condition is met. Loops are used in programming to solve problems by iterating through a set of steps.

In Giraffe Flows, Data Flow (looping) Transforms iterate over Lists of objects, performing a set of instructions for each item in the list.

Data Flow Nodes

Data flow nodes all have the same basic set-up

  1. Input - always a list
  2. Loop/Iteration functions
    1. Value - The value of an individual the list item, pre-function
    2. Index - The index of the list item currently being actioned
    3. Result - The resulting item, post-function
  3. Output(s) - always one or more lists

image.png

Setting Up Functions

In a typical single object flow, the object flows in, a node performs a function, and the output is passed out.

image.png

In a multi-object list, you need to perform the function on every part of the list.

If we were to pass a list into the apply usage node, we would not get the result we expect, because usages cannot be applied to lists, only features.

The Subdivide node turns the original feature into a feature collection - a list.

The Subdivide node turns the original feature into a feature collection - a list.

To apply the usage to every feature in the list, use the map node. This iterates through the list, and completes the function for each list item.

image.png

Here, the list passes into the Map node.

The “value” is each list item.

Each list item has the Usage applied

Then, the result is passed back into the Map node

Finally, the node re-compiles the list to include the resulting geometries.

image.png

Using the Index in the Function

The index denotes the location of an item in Lists. In Data Flow nodes, the index is a query-able output in the iteration step.

In this example, the index is used to set a random seed in the random color node.

A data flow node using the index as an input

A data flow node using the index as an input

The resulting geometry

The resulting geometry

Without the random seed, the same random color is assigned to every list item:

No seed

No seed

The resulting geometry

The resulting geometry

Use the index to iterate through specific items in the list or add additional information: