Skip to main content
I have a road network with left side and right side reporting area attributes. I'm trying to figure out how to determine how to assign the left/right side when a line falls on a boundary between two reporting areas. There is no danger of overlapping areas as they are spatially discrete objects. I've tried several methods, but each seems to have drawbacks. Any suggestions?
Hi,

 

 

The LeftRightSpatialCalculator might help you.

 

 

Supposing that you have collected lines which fall on a boundary between two areas already and the lines have unique ID attribute,

 

(1) Add a LeftRightSpatialCalculator to the workspace; send the lines to the Base port; send the areas to the Candiate port.

 

The candidate areas having this list attribute will be output from the transformer.

 

  _relative_position{}.base_id (specified ID attribute value of the Base line)

 

  _relative_position{}.position (LEFT or RIGHT against the Base line, or UNDEFINED)

 

If the areas are touching or intersecting the lines, the transformer doesn't determine their positions. In such a case, consider to shrink the areas beforehand with a Bufferer.

 

(2) Add a ListExploder to explode the "_relative_position{}".

 

(3) Separate the exploded areas into LEFT and RIGHT according to the "position" attribute value.

 

(4) Add a NeighborFinder; send the lines to the Base port; send the LEFT areas to the Candidate port. Here, attributes of the closest LEFT area will be added to each line.

 

(5) Add another NeighborFinder to add attributes of the closest RIGHT area to each line as well. To avoid conflict between attribute names of left and right, rename at least one-side attributes, beforehand.

 

 

Example:

 

 

 

Takashi
Hi

 

 

depending on your data and use case, an alternative strategy might be to use a LineJoiner with a Group By on the road name, then check which area the total road overlaps the most.

 

 

David

Reply