Skip to main content
Solved

How to detect polygon that majority of line falls within?

  • September 11, 2018
  • 2 replies
  • 137 views

nicholas
Contributor
Forum|alt.badge.img+14

Hello all,

I have two layers, one of roads (lines) and one of electorates (polygons). The roads intersect the electorates and one road can intersect more than one electorate.

For each road feature, I want to add the name of the electorate that the majority of the road falls within.

I am using a SpatialFilter to populate the roads with the names of electorates but I don't know how the transformer chooses which electorate to populate the road feature with. Is it just the first electorate that happens to intersect?

Best answer by virtualcitymatt

You could look at the LineOnAreaOverlarlayer. That will cut the roads so you can calculate their lengths. From there you can figure out which rods go with which polygon and merge the polygon name back on to the original road.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+47
  • Celebrity
  • 2000 replies
  • Best Answer
  • September 11, 2018

You could look at the LineOnAreaOverlarlayer. That will cut the roads so you can calculate their lengths. From there you can figure out which rods go with which polygon and merge the polygon name back on to the original road.


nicholas
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 116 replies
  • September 13, 2018

I did use the LineOnAreaOverlayer, and then followed this with;

- Sorter by length (descending)

- DuplicateFilter keeping the longest only