emilharold

Having trouble with selectbylocation

Discussion created by emilharold on Jan 17, 2014
Latest reply on Jan 18, 2014 by emilharold
I'm unzipping a file, adding the shapefile contained within it to my map, and then trying to select by intersection with another layer.

The script runs fine but nothing gets selected.

import arcpy, zipfile, os.path

from arcpy import env

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]

env.workspace = 'C:\Job\Frontline\Workspace'

TheZIP = arcpy.GetParameter(0)

TheP6 = arcpy.GetParameter(1)



zfile = zipfile.ZipFile(str(TheZIP))
zfile.extractall(r'C:\Job\Frontline\Workspace')

fc = arcpy.ListFeatureClasses ()
for f in fc:
    addLayer = arcpy.mapping.Layer(f)
    arcpy.mapping.AddLayer(df, addLayer)
    arcpy.MakeFeatureLayer_management(addLayer, "parcel_lyrr")
    arcpy.SelectLayerByLocation_management (addLayer, "INTERSECT", TheP6)


I've also tried for the final line:
arcpy.SelectLayerByLocation_management ("parcel_lyrr", "INTERSECT", TheP6)


But no luck.

Any help? Thanks!

Outcomes