The input to Spatial Union consists of the geometry objects to perform the union operation on. Optionally, you can also specify a field to group the records by. If you do, Spatial Union performs separate union operations on each group. If you do not specify a "group by" field the union operation will performed using all records in the input stream.

Specifying a group by field allows you to perform separate union operations for each group in the input. For example, say you have an input file that contains all the car dealerships and their customers in a city. For each car dealership, you want to create a geometry that represents the union of all the home addresses for the car dealership's customers. To accomplish this, you would specify the field containing customer's home location in the Input geometry field. In the Group by field you would specify the field that contains the dealer ID for each car dealership. The Spatial Union stage would perform a union operation on each group's geometries, which in this case would result in a union operation for all the points in each dealer ID group. So if the input looks like this:

DealerID Customer HomeLocation
1 Benny [GeometryObject]
1 Jennie [GeometryObject]
1 Eric [GeometryObject]
1 Ruby [GeometryObject]
2 Mark [GeometryObject]
2 James [GeometryObject]
3 Brian [GeometryObject]
3 Michelle [GeometryObject]
3 Stephen [GeometryObject]

In the Input geometry field you would specify HomeLocation, and in the Group by field you would specify DealerID.

The result of the Spatial Union operation would be three geometries: one containing the homes of Benny, Jennie, Eric, and Ruby; one containing the homes of Mark and James; and one containing the homes of Brian, Michelle, and Stephen.

Note: If input is not sorted by group by, one geometry produced per record.