MakeFeatureLayer throwing error 00840: The value is not a feature layer

المشرف العام

Administrator
طاقم الإدارة
first-time asker, but I've been lurking for a while. I've searched SE and ArcGIS support, but haven't figured out why this is acting so strange.

I'm working through tutorials from the book "GIS Tutorial for Python Scripting," by David W. Allen, and I have this code pretty much exactly the way the book wants it (I altered one variable name from LayerSStations to LayerStation because the double-S was giving me problems seeing it) and every time I run it it throws the error "00840: The value is not a feature layer."

Here's my code, up to the point it throws the error:

import arcpy #code to name and define the map document, data frames, list the layers in the data frames, #and some layout elements goes here. I can post it if you want, but for now I'm fairly #certain all of it works. #Get a list of all layers in the table of contents #Use a for loop to find layers Parcels and SamplingStations #assign them to new variables for easier reference myLayers = arcpy.mapping.ListLayers(myDF) for lyr in myLayers: if lyr.name == "Parcels": print "Parcels have been found." layerParcels = lyr elif lyr.name == "SamplingStations": print "Sampling Stations have been found." layerStation = lyr #create feature layer to hold only Operational sampling stations arcpy.MakeFeatureLayer_management(layerStation,"ActiveStations_lyr",'"Status=\'Operational\'') It's failing on that last command, the MakeFeatureLAyer_management line. Any idea what I'm doing wrong? I've been over and over the variable names looking for wrong things, I have done Rubber Duck debugging, and I can't nail down the problem.



أكثر...
 
أعلى