mygp = load(version=9.3) # load geoprocessor mygp.OverWriteOutput = True desc = mygp.describe("c:\temp\VillageSurvey.mdb\Land") mygp.AddMessage(str(desc.Extent)) #that is ok fcs = mygp.FeatureClass # dont work ! same case for FIDSet property for a layer
hi all,
I verified that I work under ArcGIS 9.3.1.
My code dont work,I dont understand why ! I become crazy. Someone could help me ?
Very simple code:mygp = load(version=9.3) # load geoprocessor mygp.OverWriteOutput = True desc = mygp.describe("c:\temp\VillageSurvey.mdb\Land") mygp.AddMessage(str(desc.Extent)) #that is ok fcs = mygp.FeatureClass # dont work ! same case for FIDSet property for a layer
Msg is <type 'exceptions.AttributeError'>: Object: Tool or environment <FeatureClass> not found
thanks for any help !
I believe you made an error in the line that reads:
fcs = mygp.FeatureClass # dont work ! same case for FIDSet property for a layer
it seems that it should read:
fcs = desc.FeatureClass # change from gp object to describe object
import arcgisscripting #Process: Create the gp object mygp = arcgisscripting.create(9.3) mygp.OverWriteOutput = True desc = mygp.describe("c:\\temp\\VillageSurvey.mdb\\Land") # added slashes to read as file name mygp.AddMessage(str(desc.Extent)) #that is ok fcs = desc.featuretype # works !
You cannot read FeatureClass as a property of the describe, it is just a heading for a property group in the gp programming model, but you can read any of the properties for the FeatureClass that are listed under the FeatureClass property group in the gp programming model. For example you can read FeatureType. I tested the code below and it works (with one of my featureclasses in the place of yours). I do not know why the FIDSet property did not work. Perhaps it did not work because the object you described was just a featureclass and not a layer. I think you would have to use the mygp.CreateLayer_Management tool (or whatever it is that creates a layer from a feature class) and describe the layer to get that property.import arcgisscripting #Process: Create the gp object mygp = arcgisscripting.create(9.3) mygp.OverWriteOutput = True desc = mygp.describe("c:\\temp\\VillageSurvey.mdb\\Land") # added slashes to read as file name mygp.AddMessage(str(desc.Extent)) #that is ok fcs = desc.featuretype # works !
Thank you for your time.
Layer is a properties of FeatureClass. I dont understand why FIDSet dont work.
Be sure that Land is a a layer (parcel land from geodatabase)
1- Try desc.Layer.FIDSet --> dont work
2- Try mygp.MakeFeatureLayer_management(desc.CatalogPath,"out").FIDSet ---> dont work also
The question is how instantiate an object FeatureClass to access Layer properties.
Thanks a lot.