Composite Data Types in Python Toolbox

329
1
Jump to solution
04-13-2022 11:21 AM
Labels (1)
ccowin_odfw
Occasional Contributor

Hello,

Had a parameter that can be a feature class or a raster. If it is a raster I would like it to be vectorized. Is there a way to get that information from the parameter and then just do a simple if statement to send it to be vectorized or to move on if it already is?

habitat = arcpy.Parameter(
name='Habitat',
displayName='Habitat Raster',
datatype=['GPRasterLayer', 'GPFeatureLayer'],
direction='Input',
parameterType='Required')
0 Kudos
1 Solution

Accepted Solutions
ccowin_odfw
Occasional Contributor

Should have looked a little longer:

desc = arcpy.da.Describe(FC or Raster)

if desc['dataType'] == 'RasterDataset':
...
elif desc['dataType'] == 'FeatureClass':
...

View solution in original post

0 Kudos
1 Reply
ccowin_odfw
Occasional Contributor

Should have looked a little longer:

desc = arcpy.da.Describe(FC or Raster)

if desc['dataType'] == 'RasterDataset':
...
elif desc['dataType'] == 'FeatureClass':
...
0 Kudos