<?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 join points closest to line segments returns incorrect count in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/spatial-join-points-closest-to-line-segments/m-p/203589#M6967</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, but if you want to know the count of observer points for each line, you should spatial join for point feature not line.&lt;/P&gt;&lt;P&gt;Right click on points layer in TOC &amp;gt; Join and Relates &amp;gt; Join.. &amp;gt; select Join data from another layer based on spatial location. Then select line layer . then second choice for closest line.&lt;/P&gt;&lt;P&gt;Finally&amp;nbsp;, after you get the output from last step,&amp;nbsp;Summarize the OBJECTID field&amp;nbsp;that related to line feature . and you will get the count table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jan 2017 12:59:33 GMT</pubDate>
    <dc:creator>AbdullahAnter</dc:creator>
    <dc:date>2017-01-20T12:59:33Z</dc:date>
    <item>
      <title>spatial join points closest to line segments returns incorrect count</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/spatial-join-points-closest-to-line-segments/m-p/203587#M6965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a point file with observation data, and a line file with segmented transect lines. I'm trying to come up with a count of observations on each line segment. The attached map shows that some line segments have more than one observation, while others have no observations (lines_points_map.JPG). Using the Spatial Join Tool from the Analysis/Overlay Toolbox, I specified the line layer&amp;nbsp;as my target input, observation point layer as the join input and choose a "one to one" join operation with a match option of "closest". Because the default count field kept returning a value of 1 for every record, I added a Value field to my observation point layer and assigned a value of 1 to each record in the observation layer. I tried running the Spatial Join tool again,&amp;nbsp;this time using the field map to add a new field called ObsCount and specified a merge rule to sum the Value field from the observation layer (spatialjoindialogue.JPG). So each line segment should have a count of all observations in the ObsCount field. Or so I thought. Each record had a value of 1 (spatialjoinoutput.JPG). &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I use the joins &amp;amp; relate option available by right clicking on my line segment layer in the table of contents (toc_join.JPG) and select the "Join data from another layer based on spatial location" option, specifying&amp;nbsp;my observation layer as the join layer and selecting "closest" as the join option (toc_joindialogue.JPG), my output file gives me the expected results in the Count field (toc_joinoutput.JPG).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to add the spatial join into a larger geoprocessing flow, so ideally I'd like to be able to achieve this using a python &lt;SPAN&gt;script&lt;/SPAN&gt;. Since I can't get the proper results using the Spatial Join analysis tool manually, I don't think using arcpy.SpatialJoin_analysis in a script would work. &amp;nbsp;I haven't been able to find python code for the spatial join achieved through the table of contents joins &amp;amp; relates menu. I'm a python novice, so I'm sure there's a way to do it....I'm just kind of stumped right now. If anyone has any suggestions, I would really love to hear them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2017 19:40:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/spatial-join-points-closest-to-line-segments/m-p/203587#M6965</guid>
      <dc:creator>WendyWright</dc:creator>
      <dc:date>2017-01-19T19:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: spatial join points closest to line segments returns incorrect count</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/spatial-join-points-closest-to-line-segments/m-p/203588#M6966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The spatial join tool's help states:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"When the &lt;SPAN&gt;Match Option&lt;/SPAN&gt; is set to &lt;SPAN&gt;CLOSEST&lt;/SPAN&gt; or &lt;SPAN&gt;CLOSEST_GEODESIC&lt;/SPAN&gt;, it is possible that two or more join features are at the same distance from the target feature. When this situation occurs, one of the join features is randomly selected as the matching feature (the join feature's FID does not influence this random selection). If you want to find the 2&lt;SUP style="font-size: small;"&gt;nd&lt;/SUP&gt;, 3&lt;SUP style="font-size: small;"&gt;rd&lt;/SUP&gt;, or &lt;EM&gt;N&lt;/EM&gt;&lt;SUP&gt;&lt;EM style="font-size: small;"&gt;th&lt;/EM&gt;&lt;/SUP&gt; closest feature, use the &lt;SPAN&gt;&lt;A href="https://community.esri.com/"&gt;&lt;SPAN style="color: #0066cc; text-decoration: underline;"&gt;Generate Near Table&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt; tool."&amp;nbsp; Effectively it is ignoring your subsequent points for using the sum merge rule.&amp;nbsp; I have no answer for why this is different when doing this manually in the TOC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why not use Intersect for your map option&amp;nbsp;if your points are on the line, it should allow you to get all the points along your line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2017 20:12:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/spatial-join-points-closest-to-line-segments/m-p/203588#M6966</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2017-01-19T20:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: spatial join points closest to line segments returns incorrect count</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/spatial-join-points-closest-to-line-segments/m-p/203589#M6967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, but if you want to know the count of observer points for each line, you should spatial join for point feature not line.&lt;/P&gt;&lt;P&gt;Right click on points layer in TOC &amp;gt; Join and Relates &amp;gt; Join.. &amp;gt; select Join data from another layer based on spatial location. Then select line layer . then second choice for closest line.&lt;/P&gt;&lt;P&gt;Finally&amp;nbsp;, after you get the output from last step,&amp;nbsp;Summarize the OBJECTID field&amp;nbsp;that related to line feature . and you will get the count table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2017 12:59:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/spatial-join-points-closest-to-line-segments/m-p/203589#M6967</guid>
      <dc:creator>AbdullahAnter</dc:creator>
      <dc:date>2017-01-20T12:59:33Z</dc:date>
    </item>
  </channel>
</rss>

