AnsweredAssumed Answered

Select By Location in Script Errors

Question asked by wtgeographer on May 30, 2014
Latest reply on May 30, 2014 by Wayne_Whitley
I have no idea why I can run this tool from tool dialogue but not from the following script?

Error Message: Failed to execute. Parameters are not valid. ERROR 000368: Invalid input data.
Failed to execute (SelectLayerByLocation).


import arcpy import os from arcpy import env env.overwriteOutput = 1 ''' lines = arcpy.GetParameterAsText(0) results = arcpy.GetParameterAsText(1) '''  lines = 'G:/Xcel/Route Tool/Southwest/Scratch.gdb/lines_clip' results = 'G:/Xcel/Route Tool/Southwest/Results.gdb'  line_string = '"' + "'" + lines + "'" + " #" + '"'  env.workspace = results  def main():      points = results + '\\pts'     # Process: Find all stream crossings (points)     #arcpy.Intersect_analysis(lines,'G:\Xcel\Route Tool\Southwest\Results.gdb\pts',"ONLY_FID","#","POINT")      in_features = "'" + lines + "'" + " #"      arcpy.Intersect_analysis(in_features,\     out_feature_class="G:/Xcel/Route Tool/Southwest/Scratch.gdb/lines_clip_Intersect",\     join_attributes="ONLY_FID",cluster_tolerance="#",output_type="POINT")      # Adds x and y field to points     pts_geometry = arcpy.AddXY_management("G:/Xcel/Route Tool/Southwest/Scratch.gdb/lines_clip_Intersect")      # Dissolves duplicate points     arcpy.Dissolve_management(pts_geometry,"pts_dissolve","POINT_X;POINT_Y","#","SINGLE_PART","DISSOLVE_LINES")      # Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script     # The following inputs are layers or table views: "pts_dissolve", "LCP_A"     arcpy.SelectLayerByLocation_management("pts_dissolve","INTERSECT","LCP_A","400 Feet","ADD_TO_SELECTION")

Outcomes