Select to view content in your preferred language

Spatial Joins for Lines & Polygons

50
3
yesterday
SaraJL
by
Frequent Contributor

Hello everyone!

I'm brainstorming a scenario and the best way to address it - I'm working with a professor that has a line file that needs a spatial join with a polygon layer. Easy enough, however, we're running into an issue (that I was expecting to happen) - many of the lines are overlapping with the polygon boundaries so I'm trying to reconcile that.

For example, I ran the intersect to see where the spots are where the line overlaps with the polygon boundary. A point represents every part of the line that zig zags over the polygon boundary. The polygon boundary is highlighted in pink and the line is purple:

SaraJL_0-1760033752920.png

If it was a typical situation, I would split the lines at the points, and then it would give me a little more accurate count if I ran the spatial join and where it is located with the polygon. But I know in this case, the overlapping lines are a bit of a sticking point.

Any recommendations? I need to create some type of join between the lines and polygons, but there isn't a common field in either dataset. There are also many lines over one polygon, and one line can stretch multiple polygons. Ideally, I need some kind of table where it's one polygon (census tract in this case) with an entry for each line. Or just some why to create a tie between the layers when they only share a spatial relationship and no shared attributes.

To be honest - I'm not sure if there is much I can do about it, there is probably going to be some type of margin of error, but just exploring possibilities.

Also, something that does not involved writing a script please!

Thank you!

0 Kudos
3 Replies
DavidSolari
MVP Regular Contributor

If you run an Intersect between the lines and the polygons it outputs multipart features, one for every combo of line and polygon intersection. If you select the longest line for each group of line IDs you can use the polygon ID for that feature as your answer. Summary Statistics + Join Field should get you there.

If "what polygon has the most overlap" doesn't answer your question you'll have to provide more details on what you're trying to get out of the analysis.

0 Kudos
RPGIS
by MVP Regular Contributor
MVP Regular Contributor

Hi @SaraJL,

Another option you can try is:

  1. Dissolve the line features by a common field value to create a single line/multi-part feature.
  2. Create a point feature using the centroid of the line.
  3. Spatial join the point feature to the polygon.
  4. Join the spatial joined point back the line feature using the IDs of the line feature.

This would be my recommendation but there are other ways to tackle this problem.

0 Kudos
RhettZufelt
MVP Notable Contributor

I've had similar need, but in my case, most of my lines crossed the polygon instead of following it.

I used the Feature To Line tool with my line layer and the polygon layer as inputs with Preserve Attributes selected.

This creates a fc with all the lines, both polygon outlines and the input line fc data, split at the intersections, with attributes from each.

I then select all features in the output that have a null value for the copied over ID field from the lines.  This way, I'm selecting only the polygon boundaries (as they don't have that particular ID field) and then I delete them.  Then I delete the un-needed polygon attributes that were carried over to the lines.

This leaves me with an attributed copy of my line input data that is split at each of the polygon boundaries that I can use for my spatial join(s).  Have not run into it myself, but the Feature To Line tool has 'some' flagging/handling of coincident lines/boundaries as well.

Different scenario, but thought I'd put it up here as don't think that is what that tool was originally intended for.

R_

0 Kudos