I am new to ArcPy and was trying to get a new layer from two shapefiles. The new layer would only have the data if the two layers intersect and one of the attributes ("VEGETATION") = "NV".
import arcpy
import numpy
#Locations
arcpy.env.workspace = "c:\Users\C\Desktop\GIS\Geodatabases"
LClocation = "c:\Users\C\Desktop\GIS\Geodatabases\ex_LandCover.shp"
RBveglocation = "c:\Users\C\Desktop\GIS\Geodatabases\ex_RedBluffVegetation.shp"
a_RBVeg = arcpy.MakeFeatureLayer_management(RBveglocation, "VEGETATION")
a_LC = arcpy.MakeFeatureLayer_management(LClocation, "LU_CODE")
updateveg = arcpy.SelectLayerByLocation_management(a_RBVeg,'INTERSECT', a_LC, 0, 'NEW_SELECTION')
query = '"VEGETETATION" = "NV"'
updatevegQ = arcpy.SelectLayerByAttribute_management(a_RBVeg, "SUBSET_SELECTION", query)
arcpy.CopyFeatures_management(updatevegQ,'updateveg4')