Skip to main content
Hello,

 

 

This is a simple use of the spatial realtor but I can't figure out how to expose the related attributes. I have a set of overlapping polygons, differentiated by an attribute (Type 1- 5). I have a point file. For each point in the file I want to calculate 5 attributes (Type 1- 5), indicating whether or not that point fell within the polygon type.

 

 

I thought the spatial relator wiith a groupby "Type" would create a list for each point indicating if it were related to each of the 5 types, accessible through the "_relationship{indexValue}". With the indexvalue being the order of polygon types based on the order the grouby was processed. Can some explain how to properly use this transformer and access the results?

 

 

Thanks,

 

 

 

Desired final product:

 

Point, Type1, Type2, Type3, Type4, Type5

 

1      , YES  ,  NO    , YES  , YES  , NO

 

etc
Hi,

 

 

I think you are on the right track with the SpatialRelator, but you shouldn't set the "Group By" parameter in this case.

 

The "Group By" parameter can be used to make groups of input features including both Requestors and Suppliers by common attribute(s). However, in your case, the points and the polygons should not be grouped, because each point should be compared with every polygon regardless of the Type value.

 

 

If you send the points to the Requestor port and send the polygons to the Supplier port of the SpatialRelator, each output feature (point) will have "_relationships{}.Type" containing all "Type" values of polygons which have been related to the point.

 

That is, if 3 polygons (Type: 1, 3, 5) have been related to a point, the list of the point will have these elements.

 

_relationships{0}.Type = 1

 

_relationships{1}.Type = 3

 

_relationships{2}.Type = 5

 

 

You can then determine whether a Type value (1-5) is stored in the list "_relationships{}.Type", and create new attributes "Type1" - "Type5" storing the result.

 

There could be several ways to do that, one possible way is:

 

(1) Concatenate elements of the list with a ListConcatenator. The resulting "_concatenated" attribute will store "1,3,5" for the example above.

 

(2) Create the 5 new attributes "Type1" - "Type5" with an AttributeCreator. Use conditional value setting for each of them.

 

Type1 = If _concatenated CONTAINS 1 Then YES Else NO

 

Type2 = If _concatenated CONTAINS 2 Then YES Else NO

 

...

 

Type5 = If _concatenated CONTAINS 5 Then YES Else NO

 

 

Hope this helps.

 

 

Takashi
Takashi,

 

 

Thanks, this was just what I needed, and accessing the result of the SpatialRelator was much easier then how I thought it worked.

 

 

Thanks,

 

David

 

 

Reply