In an Python Toolbox I have a parameter that gets the location of a geodatabase input.gdb
which has several layers of input data.
contextual_data_param = arcpy.Parameter(
name="context",
displayName="source for contextual data files",
datatype="GPFile",
direction="Input",
parameterType="Optional"
)
From that parameter I would like to access feature layers in the .gdb individually.
Appending layer names using os.path.join()
hasn't worked because the parameter returns a geoprocessing value
rather than a string/path.
Is GPfile
the right datatype to be using?
How can I open a feature layer in a geodatabase using the separate names of the feature layer and the geodatabase?
DEWorkspace
class (the contents of which can be accessed viaarcpy.ListFeatureClasses()
andListTables
andListDatasets
). See the documentation. I useos.path.join
exclusively, so I know it works (if you extract the path with.valueAsText
-- note that the value isunicode
in Python 2.7),