<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Spatial Joins for Lines &amp;amp; Polygons in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657700#M99528</link>
    <description>&lt;P&gt;Did you try the Feature to Line tool?&lt;/P&gt;&lt;P&gt;Don't have your data to test, but my testing splits all the lines exactly at the polygon boundary so that the one to many spatial join has a single match for each line segment.&amp;nbsp; It also retains all the attributes as well.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
    <pubDate>Tue, 14 Oct 2025 14:45:36 GMT</pubDate>
    <dc:creator>RhettZufelt</dc:creator>
    <dc:date>2025-10-14T14:45:36Z</dc:date>
    <item>
      <title>Spatial Joins for Lines &amp; Polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1656779#M99454</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SaraJL_0-1760033752920.png" style="width: 752px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141699i6907C4896A9812DE/image-dimensions/752x504?v=v2" width="752" height="504" role="button" title="SaraJL_0-1760033752920.png" alt="SaraJL_0-1760033752920.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Also, something that does not involved writing a script please!&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2025 18:24:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1656779#M99454</guid>
      <dc:creator>SaraJL</dc:creator>
      <dc:date>2025-10-09T18:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Joins for Lines &amp; Polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1656807#M99455</link>
      <description>&lt;P&gt;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. &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/summary-statistics.htm" target="_self"&gt;Summary Statistics&lt;/A&gt; + &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/join-field.htm" target="_self"&gt;Join Field&lt;/A&gt; should get you there.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2025 19:10:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1656807#M99455</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2025-10-09T19:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Joins for Lines &amp; Polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1656841#M99458</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/279955"&gt;@SaraJL&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Another option you can try is:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Dissolve the line features by a common field value to create a single line/multi-part feature.&lt;/LI&gt;&lt;LI&gt;Create a point feature using the centroid of the line.&lt;/LI&gt;&lt;LI&gt;Spatial join the point feature to the polygon.&lt;/LI&gt;&lt;LI&gt;Join the spatial joined point back the line feature using the IDs of the line feature.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This would be my recommendation but there are other ways to tackle this problem.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2025 19:27:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1656841#M99458</guid>
      <dc:creator>RPGIS</dc:creator>
      <dc:date>2025-10-09T19:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Joins for Lines &amp; Polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1656862#M99461</link>
      <description>&lt;P&gt;I've had similar need, but in my case, most of my lines crossed the polygon instead of following it.&lt;/P&gt;&lt;P&gt;I used the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/feature-to-line.htm#:~:text=For-,coincident,-lines%20or%20polygon%20boundaries%20within" target="_self"&gt;Feature To Line tool&lt;/A&gt; with my line layer and the polygon layer as inputs with Preserve Attributes selected.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;I then select all features in the output that have a null value for the copied over ID field from the lines.&amp;nbsp; This way, I'm selecting only the polygon boundaries (as they don't have that particular ID field) and then I delete them.&amp;nbsp; Then I delete the un-needed polygon attributes that were carried over to the lines.&lt;/P&gt;&lt;P&gt;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).&amp;nbsp; Have not run into it myself, but the Feature To Line tool has 'some' flagging/handling of coincident lines/boundaries as well.&lt;/P&gt;&lt;P&gt;Different scenario, but thought I'd put it up here as don't think that is what that tool was originally intended for.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Thu, 09 Oct 2025 20:08:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1656862#M99461</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2025-10-09T20:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Joins for Lines &amp; Polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657183#M99485</link>
      <description>&lt;P&gt;Setting aside the specific geoprocesses required, what is the goal?&lt;BR /&gt;&lt;BR /&gt;If a line is 'approximately' coincident with a polygon boundary...&lt;/P&gt;&lt;P&gt;1. Should the line be counted as 'in' both polygons?&lt;BR /&gt;2. Should the line be given to 'one' of 'two' polygons?&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;2a. How might you prioritize this association (a polygon attribute, line attribute, etc)?&lt;BR /&gt;3. Should the line-on-bounds be ignored altogether?&lt;/P&gt;&lt;P&gt;I imagine the chosen geoprocessing steps would vary in any case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Oct 2025 19:12:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657183#M99485</guid>
      <dc:creator>D_Atkins</dc:creator>
      <dc:date>2025-10-10T19:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Joins for Lines &amp; Polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657681#M99526</link>
      <description>&lt;P&gt;For Step 1 - would that remove the other attributes from the table and only preserve the one field that we would use to dissolve the line features?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 13:58:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657681#M99526</guid>
      <dc:creator>SaraJL</dc:creator>
      <dc:date>2025-10-14T13:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Joins for Lines &amp; Polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657685#M99527</link>
      <description>&lt;P&gt;The general scenario is that the census tract information needs to be transferred to the lines.&lt;/P&gt;&lt;P&gt;There aren't any shared attributes between the census tract polygons and the lines - the only relationship they share is that they are located in the same county.&lt;/P&gt;&lt;P&gt;If this helps - we don't have a set census tract dataset - so I've been experimenting with the US census tracts on ArcGIS Living Atlas AND 2025 census tract information from the US Census Bureau website. I get similar results using either dataset, so I'm fairly positive that the census tract layer doesn't matter.&lt;/P&gt;&lt;P&gt;I've tried some experiments with spatial joins - my latest experiment:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Using the Intersect tool to add points to the lines where they intersect with the polygons&lt;/LI&gt;&lt;LI&gt;Using the Split at Point tool to try and split the lines&lt;/LI&gt;&lt;LI&gt;Run the Spatial Join &amp;gt; one to many&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;That's getting me a little closer, but I'm now running into an issue where the Split at Point tool is not really splitting the lines correclty. For example:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The bottom highlighted line was split correctly between the polygons&lt;/LI&gt;&lt;LI&gt;For some reason, the top highlighted line was not split - the top highlighted line DOES have a point. So I'm not sure why the tool didn't register it as a line that needed to be split&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SaraJL_0-1760450737200.png" style="width: 771px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141935i3AC432E8047F342F/image-dimensions/771x351?v=v2" width="771" height="351" role="button" title="SaraJL_0-1760450737200.png" alt="SaraJL_0-1760450737200.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 14:09:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657685#M99527</guid>
      <dc:creator>SaraJL</dc:creator>
      <dc:date>2025-10-14T14:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Joins for Lines &amp; Polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657700#M99528</link>
      <description>&lt;P&gt;Did you try the Feature to Line tool?&lt;/P&gt;&lt;P&gt;Don't have your data to test, but my testing splits all the lines exactly at the polygon boundary so that the one to many spatial join has a single match for each line segment.&amp;nbsp; It also retains all the attributes as well.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 14:45:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657700#M99528</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2025-10-14T14:45:36Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Joins for Lines &amp; Polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657701#M99529</link>
      <description>&lt;P&gt;So the real problem is: the tract boundaries are intentionally drawn along the road (or the road built on the bounds).&amp;nbsp; Splitting the lines as they criss-cross the boundaries is taking advantage of&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;spurious precision&lt;/STRONG&gt;&amp;nbsp;&lt;/EM&gt;in the geometry, and not resolving the methodological questions:&lt;/P&gt;&lt;P&gt;If a road is&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;supposed to be approximately on the bounds&lt;/EM&gt;&lt;/STRONG&gt;, do you want that road to inherit attributes from the 'left' polygon, the 'right' polygon, or from both polygons?&amp;nbsp; &amp;nbsp;Should the result be a summary of both 'coincident' polygons?&lt;BR /&gt;&lt;BR /&gt;This question really needs resolved&amp;nbsp;&lt;EM&gt;before&amp;nbsp;&lt;/EM&gt;tackling the geoprocessing -- otherwise, as your images show, determining which 'polygon' the 'road' belongs to is about the same as a random roll of data precision and map projection.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;As for the geoprocessing steps and tools:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/intersect.htm" target="_blank"&gt;Intersect (Analysis)—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;should be all that's needed to split lines by polygons.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Then,&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/spatial-join.htm" target="_blank"&gt;Spatial Join (Analysis)—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;to update each line segment with the&amp;nbsp;&lt;EM&gt;polygon id&lt;/EM&gt;&amp;nbsp;below.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If you're having trouble with these tools (or their results), I would consider a thorough review of your spatial references.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 14:46:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657701#M99529</guid>
      <dc:creator>D_Atkins</dc:creator>
      <dc:date>2025-10-14T14:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Joins for Lines &amp; Polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657705#M99530</link>
      <description>&lt;P&gt;The main issue is that I'm troubleshooting this for a client, so I'm kind of the go-between! So I can't really answer all of your questions. Just doing with the client is saying they need to do and testing out different ideas &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Personally, if this was my research project, I would reach back out to the data host and see if they could give additional information. Which I've done in other scenarios, and some people will do (depending on the department). I would also only really recommend using a spatial join for points.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The client needs census tract IDs associated with the lines, but this is most likely a "many to many" relationship, which the spatial join doesn't do. But yes! All of your points that you have raised, I am aware of. Unfortunately,&amp;nbsp;I can't make assumptions for them, only present a variety of scenarios and they can pick which one they are the most comfortable with.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 15:01:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657705#M99530</guid>
      <dc:creator>SaraJL</dc:creator>
      <dc:date>2025-10-14T15:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Joins for Lines &amp; Polygons</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657729#M99531</link>
      <description>&lt;P&gt;There's nothing wrong with spatial joins between lines and polygons, other than some additional decision making.&lt;BR /&gt;&lt;BR /&gt;We perform similar analyses routinely (think of Residential Waste Service Routes overlaid on a street network); so I had the work ready to go -- the best way to share is a minimum-working-example by script, copy-and-paste, turnkey ready for a Notebook:&lt;BR /&gt;&lt;BR /&gt;The first 40 lines are simply preprocessing: I take census block groups and secondary roads from the Living Atlas; rather than process the entire dataset, I make view-layers, apply a selection, then copy the selected features to a local workspace.&amp;nbsp; You can replace all of this by referencing your own features in lines 46/47.&lt;BR /&gt;&lt;BR /&gt;Lines 46 to 60 'do the work' with just two tools: (Intersect, then, Spatial Join).&amp;nbsp; I've attached some screenshots to follow, which illustrate the issue with your client's request: the highway follows the polygon boundaries, gets split almost at random, then gets attributes joined from 'one' polygon when really it roughly belongs to both.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

poly = "https://services2.arcgis.com/FiaPA4ga0iQKduv3/arcgis/rest/services/USA_Block_Groups_v1/FeatureServer/0"
line = "https://services2.arcgis.com/FiaPA4ga0iQKduv3/arcgis/rest/services/Transportation_v1/FeatureServer/3"


### PREPROCCING FOR LIVING ATLAS (!

  ## make a layer from census blocks:
poly_layer = arcpy.management.MakeFeatureLayer(poly, "Atlas Census Blocks LayerView")

  ## select from that layer:
poly_selection = arcpy.management.SelectLayerByAttribute(
    in_layer_or_view = poly_layer, 
    selection_type   = "NEW_SELECTION",
    where_clause     = "COUNTY = '173' And STATE = '37'"
)

  ## copy selection to memory:

  # select returns a 'updated layer' as var[0], and 'count' as var[1]
print("Selected:", poly_selection[1], "counties")

  # use the selected layer to select all roads in the same area:
line_layer = arcpy.management.MakeFeatureLayer(line, "Atlas Roads LayerView")

  ## select from that layer:
line_selection = arcpy.management.SelectLayerByLocation(
    in_layer         = line_layer, 
    overlap_type     = "INTERSECT",
    select_features  = line_layer,
    selection_type   = "NEW_SELECTION"
)

print("Selected:", line_selection[2], "roads")

arcpy.management.CopyFeatures(poly_selection[0], "memory/my_poly")
arcpy.management.CopyFeatures(line_selection[0], "memory/my_lines")

### FINISHED PREPROCESSING: TWO LAYERS WITH SELECTIONS FOR INPUT...


### SPLIT LINES BY POLYGONS:

## References to lines and polygons:
my_lines = "memory/my_lines"
my_poly  = "memory/my_poly"


  ## split line_layer by poly_layer, create new 'lines_split' featureclass.
split_lines = arcpy.analysis.Intersect([my_lines, my_poly], "memory/lines_split")

  ## join the polygon attributes to the lines;
join_attr = arcpy.analysis.SpatialJoin(
    target_features = split_lines, 
    join_features   = poly_layer,
    out_feature_class = "memory/lines_split_wPolyAttr",
    join_operation = "JOIN_ONE_TO_ONE",
    join_type      = "KEEP_ALL",
    match_option   = "INTERSECT",
    search_radius  = "0 Feet"
)
    
print("Completed")    
      &lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Symbolized results and full table of contents:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="intersect_join_sample.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141942i0561E993A4A58183/image-size/large?v=v2&amp;amp;px=999" role="button" title="intersect_join_sample.png" alt="intersect_join_sample.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The tools appear to do what you're asking for.&amp;nbsp; The results are less than ideal, of course.&lt;BR /&gt;&lt;BR /&gt;I would perhaps suggest buffering road lines and using these road-buffer polygons for further analysis; this is more reflective of the real world of roads (which generally include 50-100 feet of right-of-way, and would settle many of the questions raised ... at the expense of geoprocessing complexity).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Oct 2025 16:14:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/spatial-joins-for-lines-amp-polygons/m-p/1657729#M99531</guid>
      <dc:creator>D_Atkins</dc:creator>
      <dc:date>2025-10-14T16:14:19Z</dc:date>
    </item>
  </channel>
</rss>

