In general, the SpatialRelator or SpatialFilter can be used to merge attributes of a feature to other features based on spatial relations. If you can assume that the "surrounding" polygon [a] contains the target polygon [b], try using the SpatialFilter.
- Send [a] to the Filter port, send [b] to the Candidate port.
- Set "Contains" to the "Tests to Perform" parameter.
- Set "Yes" (default) to the "Merge Attributes" parameter.
Note: If [b] feature has the same name attribute as [a] feature, attributes of [a] will not be merged to [b]. In such a case, remove or rename the attributes of [b] feature beforehand.
In this case you probably want the Touch as Tests to perform if you are using the SpatialFilter.
You can also use the NeighborFinder to perform this test and merge the attributes from touching polygons (set maximum distance to 0).You want the empty polygons as Base and the polygons containing a postal code as Candidate.
I would probably go with the NeighborFinder as per erik_jan and built the list of close candidates. That way you can check if all the surrounding polygons contain the same postal code, or if there are different postal codes, then you can you some other logic to decide which one to use (eg. largest adjacent area, most number of adjacent).
With or without buffering the boundary of the zero value polygon (in case it don't touch) you can just use a spatialrelator. (intersect, as the sort of relation is not relevant )
The use a listconcatenator on the related_candidates list.
Then listduplicateremover to remove the duplicate postcode's (in case it is surrended by different zones).
If listelement counter is 0 , u can listindex{0} the _concatenated list.
Else it is surrounded by multiple postcode zones.
@gio, I also think the spatialrelator is the best suitable for this occasion. When I run it it gives only the count of the suitable neighbors. Is it possible to make it save the postal code of the neighbor? I read the webpage a few times already and tried every option but don't get it to work.
Never mind, figured it out;) thanks for your help guys