Solved

Merge attributes filling empty cell

  • 26 November 2019
  • 2 replies
  • 11 views

Badge +14
  • Contributor
  • 120 replies

This is a follow up to a question I asked yesterday, https://knowledge.safe.com/questions/103101/intersector-behaving-really-strange.html

Source B is a road network and source A is overlaying lines with aditional info on the roads. I would like to transfer the attributes, and some non overlaping features from A to B. Some of the features in B already have these attributes so there is a empty cell causing trouble when I try a spatial join like the LineOnline. If B gets read first no attribute will be transfered from A and a empty cell will be output.

I have then moved on to trying to do this with Lists, but have run out of ideas.

The LineOnline transformer above is set to gather lists for the attributes I need. In some places there are multiple overlays which makes it tricky to merge the data. See illustration below.

 

NN

 

OO

 

MM

 

1

 

X

 

 

 

2

 

 

Y

 

 

3

 

 

 

Z

 

 

How do I merge the attributes in the table above?

Also some of the features have conflicting data, but that is a later headache.

icon

Best answer by hollyatsafe 26 November 2019, 17:55

View original

2 replies

Badge +2

Hi @aron,

If you are merging based on the spatial relationship I would use the SpatialRelator. You can set Source B as the Requestor and Source A as the supplier, then the Spatial Predicates to Test= 'Requestor Intersects Supplier'.

In the Attribute Accumulation of this transformer there is an additional parameter, Conflict Resolution. You can set this to 'Use Supplier' and this way the Empty values on Source B will be overwritten with the correct values from Source A.

Badge +3

Might need a screenshot out of Data Inspector for one of the Output features that is causing difficulty @aron? I'm not sure how you would end up with an output matrix like that for a single attribute comparison of one set of feature vs another. You might get multiple List items, but each List Item will retain the original Attribute Names and values

If the problem is similar to the previous post, then it sounded like you have attribute B.RoadAttribute you want to merge onto A.RoadAttribute, for the line segment components of A and B that overlay each other.

IF you don't want to split the Geometry of the features of B and want to leave them intact (but in your original post using Intersector this was similarly splitting the original feature lines in B), then hollyatsafe's answer can be used for SpatialRelator, although for roads you would use a Spatial Predicate of 'Requestor Overlaps Supply' instead of intersects, however a List again would be needed on the output if there were multiple lines with different values from A overlapping a single feature from B, and you needed to process and resolve these.

Sample workflow as below for where there is only one available value from A. There is another Port there in the TestFilter for where there are multiple overlapping segments from A (apologies mixed up the names for A and B in the late stage of the workflow, I should have called it AttributeValueFromA), to use whatever logic is needed to resolve those like giving priority to one value or another y using a ListSorter or ListExploder+Sorter etc.

 

The final step from ListSearcher simply finds the first AttributeValueFromA that has a non-Empty value (A Regular Expression = ".") and puts this value in a new Attribute which can be compared to the original Attribute in B, and the value in B can then be overwritten with a further AttributeCreator step.

 

Reply