Plan B. I think this procedure is relatively efficient.
1) Send the polygons to the Clipper port, the points to the Clippee port of a Clipper, so that "District" will be added to inside points of each polygon.
Group By: <not set>
Merge Attributes: Yes
Merge Attribute Prefix: <blank>
The PointOnAreaOverlayer or the SpatialFilter can also be used. But in my experiences, the Clipper seems to be more efficient than both of them, when transferring attributes of a polygon to inside points.
2) Connect a Tcl/PythonCaller to the Inside port of the Clipper.
-----
# Tcl Script Example
proc pivot {} {
set attributes {"Category" "Priority"}
foreach {attr} $attributes {
set newAttr [FME_GetAttribute $attr]
if {![string equal $newAttr {}]} {
FME_SetAttribute $newAttr {1}
}
}
}
-----
# Python Script Example
def pivot(feature):
attributes = ['Category', 'Priority']
for attr in attributes:
newAttr = feature.getAttribute(attr)
if newAttr:
feature.setAttribute(newAttr, 1)
-----
The script creates new attributes. Their names will be original attribute values (A, B, C, Red, Amber, Green); the value is 1.
3) Expose the new attribute names. Set the "Attributes To Expose" parameter of the Tcl/PythonCaller, or use the AttributeExposer.
4) Connect an Aggregator to calculate number of occurences of the new attributes for each district.
Group By: District
Mode: Attributes Only
Keep Input Attributes: No
Attributes to Sum: A, B, C, Red, Amber, Green
5) Merge the resulting features to the original polygons using "District" as the "Join On" parameter.