I am attempting what I thought was a straightforward operation in ArcMap. I have a polygon layer where some polygons overlap. I also have a polyline layer. I would like to spatially join the polygon layer with the polyline layer using a "WITHIN" relationship.

The objective is to make sure every polyline which is either fully or partially within a polygon layer takes on the attribute from the (partially containing polygon). This is what the spatial join dialog looks like:

enter image description here

What I do see, however, is that many polylines do not obtain a containing polygon attribute and get a 0 instead. This occurs mostly in polygon border crossings and when a significant portion of the segment lies outside the polygon.

enter image description here

Which is very confusing because it implies that "WITHIN" and "COMPLETELY WITHIN" have the same behavior? I thought that "WITHIN" implied that even target features partially within the join features get matched...

What am I doing wrong here? Is there another way?

  • It is "partly within". Intersect does not guarantee what I need... what if the line is fully within, yet does not intersect the polygon? I still want that to match...
    – user32882
    May 1, 2019 at 8:20
  • 1
    A line crossing a polygon border is not within, look at this. Try intersect instead. If line is fully inside polygon they still intersect
    – BERA
    May 1, 2019 at 8:21
  • Should go to accepted answer.
    – TomazicM
    May 1, 2019 at 9:13

1 Answer 1


A line crossing a polygon border is not within. Use intersect instead:

The features in the join features will be matched if they intersect a target feature

Look at a description of the spatial queries here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.