I developed one tool in arcgis using python code, in the process i used Describe(feature class) function to know the coordinate system of input feature class. I got success while compiling code, But i couldn't get how to set parameters for this function in tool(arcgis 10.0) designing.
I tried parameters as follow
Display name:input feature class
Data type : coordinate system.
Type : optional
Direction : input.
My problem is while i'm selecting input feature class, i didn't get coordinate system of that feature class.
Please Suggest..
Answer
Well you could use code validation to populate the parameter with the coordinate system of the feature class, using something like the following:
def updateParameters(self):
fc = self.params[0].value #Change 0 to refer to parameter number of feature class
if fc: #Check if value was specified
#Change 1 to refer to parameter number of coordinate system
self.params[1].value = arcpy.Describe(fc).SpatialReference.name
return
Or the easiest way would be to just perform all of this in your actual code, and not worry about populating another parameter.
No comments:
Post a Comment