Filter in Python toolbox does not do the job

1278
3
Jump to solution
10-03-2014 02:58 AM
TomGeo
by
Occasional Contributor III

Hi,

as the header says, I do have a problem in getting only the datasets I want. In the following my parameter definition is shown, where from I would expect to get only feature classes of type point to be shown.

p_envWorkS = arcpy.Parameter(

    displayName = 'Workspace',

    name = 'in_ws',

    datatype = 'DEWorkspace',

    parameterType = 'Required',

    direction = 'Input',

    category = '1. Input Settings')

p_envPoints = arcpy.Parameter(

    displayName = 'Input FeatureClass',

    name = 'in_fc',

    datatype = 'DEFeatureClass',

    parameterType = 'Required',

    direction = 'Input',

    category = '1. Input Settings')

p_envPoints.parameterDependencies = [p_envWorkS.name]

p_envPoints.filter.list = ['POINT']

However, the following screenshot shows all kind of content. Even feature datasets are listed... hence the name 'roads' shows twice.

param.png

Does some of you know where I am going wrong or what I am missing the get the correct feature type shown?

Best regards,

Thomas

- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
0 Kudos
1 Solution

Accepted Solutions
DuncanHornby
MVP Notable Contributor

I have responded to this question on GIS Stack exchange.

View solution in original post

0 Kudos
3 Replies
JasonScheirer
Occasional Contributor III

Use GPFeatureLayer as your datatype instead.

0 Kudos
TomGeo
by
Occasional Contributor III

Hi Jason,

there is no difference in the resulting list if I replace DEFeatureClass in line 12 by GPFeatureLayer.

Reading the definition below it looks to me as if GPFeatureLayer is in my case actually a detour to the datasets requested.

What escapes me at this point as well is why GPFeatureLayer should work, respectively why does it work anyway.

According to the Resource Center

DEFeatureClass = A collection of spatial data with the same shape type: point, multipoint, polyline, and polygon.

GPFeatureLayer = A reference to a feature class, including symbology and rendering properties.

finally,

a DEFeatureDataset = A collection of feature classes that share a common geographic area and the same spatial reference system.

By my understanding, GPFeatureClass would be  the way to go, FeatureDatasets should not appear, and the filter list set should only populate the list of FeatureClasses with datasets of type point.

Any other suggestions for the problem at hand?

I tried to create a minimal example and wrapped it in the attached file. It contains a minimalistic FGDB and the toolbox.

Cheers, Thomas

- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
0 Kudos
DuncanHornby
MVP Notable Contributor

I have responded to this question on GIS Stack exchange.

0 Kudos