I am curious if I can, without having to write a python or an ArcObjects script, create a spatial join that will result in a polygon feature class containing the attributes of the LONGEST intersecting join polylines. The input polylines I have roughly correspond to the polygons to which I want to transfer the attributes. I've determined that it is almost always the longest intersecting polyline whose attribute I need to transfer into the polygon.

Currently, using the figure below as an example, the spatial join hits 3 polylines (join_count = 3 for this particular polygon) but instead of joining on the longest intersecting polyline it seems to choose the first one it encounters. (which is also contrary to what the tool's description says about the JOIN_ONE_TO_ONE operation which is suppose to aggregate the join features into the output feature. The description speaks of SUM merge rule in its example which I do not see in this particular tool as an option)

I am using INTERSECT because there is no suitable spatial relationship I can think of in this "polyline to polygon" situation. I understand what is going on but don't know whether a workaround exists. I just wish there would be another set sub-parameters allow me to control what happens when more than one join features exists; in this case selecting the longest polyline by default.

I am using ArcGIS 10.2.1 Standard. enter image description here

2 Answers 2


Intersect is indeed the way to go. After intersecting your lines and polygons, you end up with a line feature class wth the attribute table of the polygons, the attribute table of the lines and the length of your new lines.

You can then use "summary statistics" based on to original line ID's in order to fin the maximum length.

Then you join by attribute this new table with the intersect result (based on line ID) and you can select by attribute the length that are equal to the maximum length per ID.

The selection gives you the ID's of the polygons with the largest overlap, which you can now use for joining the polygon attributes to the original lines.

Here is a second work around, looks nicer but not completely robust :

1) create lots of points on your lines (e.g. densify then feature to points).

2) spatial join the points and the polygons

3) use spatial join with the mode values (see field mapping for details)

Why not robust :The longest is not necessarily the most vertices (could be solved and very unlikely), their can be two modes and several lines could combine to yield

  • "summary statistics" will provide the Max length but not the corresponding ID of that polyline.
    – klewis
    Commented Mar 10, 2014 at 20:43
  • In my method, the ID is the case field, so you will keep its value together with the max length.
    – radouxju
    Commented Mar 10, 2014 at 20:51

I think I managed to do the same by first use Identify to split the lines at the polygon's edges. The second step was a Spatial Join (target_feature: polygons, Join feature: lines, one to many), make sure to include the length of the splitted lines. Then create a summarize table of the target_fid, including the max of the line_length. The last step is to select the feature where the geometry length matches the maximum.

Your Answer

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

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