Problem with the geoprocessing CopyFeatures when I want to copy only selected elements from a layer

481
3
Jump to solution
08-12-2022 10:25 AM
MarioLandry2
New Contributor III

I'm currently doing  the following operation in an app in C#:

1- Do a geoprocessing SelectLayerByAttribute on a layer x

2- Do a geoprocessing CopyFeatures of that layer x and the output ends up in an FGDB

I did expect that the result would contain only the selected items in the layer x, but that's not the case.  The whole content of the layer x is copied.  The CopyFeatures does not seem to take into account that some elements are selected even though the documentation says so.

Just to be sure, I did a MakeFeatureLayer with the same query and then I did the CopyFeatures and it worked.  So the problem does not come from the query itself.

Anybody seen that problem?

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

I use Select . It covers both: SelectLayerByAttribute and CopyFeatures.

View solution in original post

0 Kudos
3 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

I use Select . It covers both: SelectLayerByAttribute and CopyFeatures.

0 Kudos
MarioLandry2
New Contributor III

Thanks, it will work with that solution.

I also have a SelectLayerByLocation followed by a CopyFeatures that does not take into account the result of the selection.  So I guess that there is still a problem with that one.

0 Kudos
GKmieliauskas
Esri Regular Contributor

There is no reason to use SelectLayerByAttribute or SelectLayerByLocation from geoprocessing. You can select layer features directly using FeatureLayer method Select .

0 Kudos