<?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: How to run geoprocessing off a script output in the same script? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-run-geoprocessing-off-a-script-output-in/m-p/1550807#M89365</link>
    <description>&lt;P&gt;Are you trying to select the newly generated XY features? Or use them to select something else? You would put the output feature class from step one as in_layer or select_features, respectively. Either way, make sure you can get the select by location working by itself first, then try stringing them together. That way you know you're only working on one problem at a time.&lt;/P&gt;&lt;P&gt;Here's some sample code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#set variables
inTable = r"C:\Path\to\table.csv"
tableToPoint = r"in_memory\tablePoints" #if you don't need to keep it. Otherwise, save to file system
featuresToSelect = "C:\Sample.gdb\myFeatures"

#create points
arcpy.management.XYTableToPoint(inTable, tableToPoint, "x","y") #ideally you would know the coordinate system, defaults to WGS84

#select features touching xy points new selection
arcpy.management.SelectLayerByLocation(featuresToSelect, 'INTERSECT',tableToPoint)

#select features within 15 map units of xy points, new selection
arcpy.management.SelectLayerByLocation(featuresToSelect, 'INTERSECT',tableToPoint,15, 'NEW_SELECTION')

#select features more than 15 map units of xy points, new selection - note the "INVERT"
arcpy.management.SelectLayerByLocation(featuresToSelect, 'INTERSECT',tableToPoint,15, 'NEW_SELECTION', 'INVERT')

#select only features within 30 map units of xy points from an existing selection
arcpy.management.SelectLayerByLocation(featuresToSelect, 'INTERSECT',tableToPoint,30, 'SUBSET_SELECTION'))

#clean up
arcpy.management.Delete(tableToPoint)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just a note on the in_memory workspace. It's basically a file geodatabase that lives in the RAM. Great for smaller outputs that you don't need to keep, but use with caution. If you put a large dataset in there, it could use up too much memory and gum up the works until you close Pro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Oct 2024 11:59:08 GMT</pubDate>
    <dc:creator>JCGuarneri</dc:creator>
    <dc:date>2024-10-22T11:59:08Z</dc:date>
    <item>
      <title>How to run geoprocessing off a script output in the same script?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-run-geoprocessing-off-a-script-output-in/m-p/1550805#M89364</link>
      <description>&lt;P&gt;I get errors every time I try running multiple geoprocessing tools off outputs created from the same script.&lt;/P&gt;&lt;P&gt;For instance:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;arcpy.management.XYTableToPoint(in_table, out_feature_class, x_field, y_field, {z_field}, {coordinate_system})

and then

arcpy.management.SelectLayerByLocation(in_layer, {overlap_type}, {select_features}, {search_distance}, {selection_type}, {invert_spatial_relationship})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The XY Table to point will work but then I'll get an error on the Select layer by location. I know I'm missing something simple.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 11:25:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-run-geoprocessing-off-a-script-output-in/m-p/1550805#M89364</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2024-10-22T11:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to run geoprocessing off a script output in the same script?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-run-geoprocessing-off-a-script-output-in/m-p/1550807#M89365</link>
      <description>&lt;P&gt;Are you trying to select the newly generated XY features? Or use them to select something else? You would put the output feature class from step one as in_layer or select_features, respectively. Either way, make sure you can get the select by location working by itself first, then try stringing them together. That way you know you're only working on one problem at a time.&lt;/P&gt;&lt;P&gt;Here's some sample code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#set variables
inTable = r"C:\Path\to\table.csv"
tableToPoint = r"in_memory\tablePoints" #if you don't need to keep it. Otherwise, save to file system
featuresToSelect = "C:\Sample.gdb\myFeatures"

#create points
arcpy.management.XYTableToPoint(inTable, tableToPoint, "x","y") #ideally you would know the coordinate system, defaults to WGS84

#select features touching xy points new selection
arcpy.management.SelectLayerByLocation(featuresToSelect, 'INTERSECT',tableToPoint)

#select features within 15 map units of xy points, new selection
arcpy.management.SelectLayerByLocation(featuresToSelect, 'INTERSECT',tableToPoint,15, 'NEW_SELECTION')

#select features more than 15 map units of xy points, new selection - note the "INVERT"
arcpy.management.SelectLayerByLocation(featuresToSelect, 'INTERSECT',tableToPoint,15, 'NEW_SELECTION', 'INVERT')

#select only features within 30 map units of xy points from an existing selection
arcpy.management.SelectLayerByLocation(featuresToSelect, 'INTERSECT',tableToPoint,30, 'SUBSET_SELECTION'))

#clean up
arcpy.management.Delete(tableToPoint)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just a note on the in_memory workspace. It's basically a file geodatabase that lives in the RAM. Great for smaller outputs that you don't need to keep, but use with caution. If you put a large dataset in there, it could use up too much memory and gum up the works until you close Pro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 11:59:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-run-geoprocessing-off-a-script-output-in/m-p/1550807#M89365</guid>
      <dc:creator>JCGuarneri</dc:creator>
      <dc:date>2024-10-22T11:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to run geoprocessing off a script output in the same script?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-run-geoprocessing-off-a-script-output-in/m-p/1550818#M89366</link>
      <description>&lt;P&gt;I get an error and I think the issue is the (x,y table to point) doesn't gets pushed to the Contents so then it's not there for it to do the select layer by location.&lt;/P&gt;&lt;P&gt;I dont' know how to force the (x, y table to point) to get pushed before the other process starts.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 12:02:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-run-geoprocessing-off-a-script-output-in/m-p/1550818#M89366</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2024-10-22T12:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to run geoprocessing off a script output in the same script?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-run-geoprocessing-off-a-script-output-in/m-p/1550895#M89371</link>
      <description>&lt;P&gt;Could you share the exact error your getting? Also, the&amp;nbsp;&lt;EM&gt;exact&amp;nbsp;&lt;/EM&gt;code you're using. Just copy and paste both here for us to see.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2024 14:31:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-run-geoprocessing-off-a-script-output-in/m-p/1550895#M89371</guid>
      <dc:creator>JCGuarneri</dc:creator>
      <dc:date>2024-10-22T14:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to run geoprocessing off a script output in the same script?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-run-geoprocessing-off-a-script-output-in/m-p/1551155#M89402</link>
      <description>&lt;P&gt;You haven't defined "in_layer". Try&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/make-feature-layer.htm" target="_self"&gt;Make Feature Layer (Data Management)&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.management.XYTableToPoint(in_table, out_feature_class, x_field, y_field, {z_field}, {coordinate_system})

in_layer = arcpy.management.MakeFeatureLayer(out_feature_class, "Layer Name")[0]

arcpy.management.SelectLayerByLocation(in_layer, {overlap_type}, {select_features}, {search_distance}, {selection_type}, {invert_spatial_relationship})&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Of course fill in {parameters} in curly braces in the above example.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 05:30:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-run-geoprocessing-off-a-script-output-in/m-p/1551155#M89402</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2024-10-23T05:30:15Z</dc:date>
    </item>
  </channel>
</rss>

