Processing data in a list requires something called a “loop.” A looping function is like telling the computer, “keep doing this over and over until I say stop.”
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.
Loop Example
Say you have a bunch of bananas.
The bunch can be considered a list. It is multiple individuals being treated as a group together.
Let's say you wanted to paint the bananas blue.
You could drop some paint on top and hope for the best, but you probably wouldn't actually end up with all blue bananas. You could also separate the bananas into individuals and paint each one, but then you wouldn't have a bunch anymore and it would be hard to carry.
So, instead, you full dip the banana bunch in paint and make sure every single one gets blue all the way around.
This isn't a perfect analogy, but hopefully you get the point.
Processing data as a list is more efficient (it's easier for the computer to use a list of values for a single key, rather than multiple key/value pairs).
Data Flow Nodes
In Giraffe Flows, Data Flow (looping) Nodes iterate over Lists of objects, performing a set of instructions for each item in the list.
Data flow nodes all have the same basic set-up:
1. Input - always a list
2. Loop/Iteration functions
V. Value - The value of an individual the list item, pre-function
I. Index - The index of the list item currently being actioned
R. Result - The resulting item, post-function
3. Output(s) - always one or more lists
Setting Up Functions
In a typical single object flow, the object flows in, a node performs a function, and the output is passed out.
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.
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.
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.
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. | The resulting geometry |
Without the random seed, the same random color is assigned to every list item:











