How to use C# to copy features of sde featureclass to a local featureclass based on spatial intersection?

585
6
Jump to solution
11-30-2021 01:52 AM
Chapin
by
New Contributor III

Hello,everyone.

i used to tried to use the gp tool for copying features. I know the efficiency of the gp tool is optimal.But it doesn't seem to support queryfilter.

And I have implemented a method to copy the sde features to local gdb's same featureclass, and the queryfilter based on the spatial intersection. But the efficiency of this copy is rather slow, can anyone provide a better idea or implementation method?

Chapin_0-1638265824220.png

 

 

0 Kudos
3 Solutions

Accepted Solutions
GintautasKmieliauskas
Regular Contributor II

Hi,

You need to select features using spatial filter first and then use geoprocessing. Most of  geoprocessing tools checks automatically for layer selection.

SpatialQueryFilter filter = new SpatialQueryFilter();
// define filter patameters
layer.Select(filter);

// Call geoprocessing using layer as input parameter

 

View solution in original post

0 Kudos
Chapin
by
New Contributor III

sir,thank you for your reply.
This approach works. I've tried it before. The gp tool can use layers as input parameters. This method is efficient.
But I can't let the user know what feaclass table I've manipulated in the background. So should I do it that way, first load the sde featureclass as a layer on the map, then finish the selection, then copy it with the gp tool, and finally remove the relevant layer?

View solution in original post

0 Kudos
GintautasKmieliauskas
Regular Contributor II

Hi,

There is better way. You can use Feature Class To Feature Class  geoprocessing tool. You can set SQL expression for it. But expression you need to form by yourself, From spatial query read each row OBJECTID and form expression like this: OBJECTID in (.....)

View solution in original post

0 Kudos
6 Replies
GintautasKmieliauskas
Regular Contributor II

Hi,

You need to select features using spatial filter first and then use geoprocessing. Most of  geoprocessing tools checks automatically for layer selection.

SpatialQueryFilter filter = new SpatialQueryFilter();
// define filter patameters
layer.Select(filter);

// Call geoprocessing using layer as input parameter

 

0 Kudos
Chapin
by
New Contributor III

sir,thank you for your reply.
This approach works. I've tried it before. The gp tool can use layers as input parameters. This method is efficient.
But I can't let the user know what feaclass table I've manipulated in the background. So should I do it that way, first load the sde featureclass as a layer on the map, then finish the selection, then copy it with the gp tool, and finally remove the relevant layer?

0 Kudos
GintautasKmieliauskas
Regular Contributor II

Hi,

There is better way. You can use Feature Class To Feature Class  geoprocessing tool. You can set SQL expression for it. But expression you need to form by yourself, From spatial query read each row OBJECTID and form expression like this: OBJECTID in (.....)

0 Kudos
Chapin
by
New Contributor III

Wow, a new tool, another treasure found.
sir,you are really a genius, thank you for your selflessness.

I also asked a question before about exporting cad leaders.This issue was left behind.Can I ask you for advice?The following one.

https://community.esri.com/t5/arcgis-pro-questions/how-can-i-export-annotation-layers-to-cad-with-th...

0 Kudos
GintautasKmieliauskas
Regular Contributor II
Sorry. I am not an expert in annotations and CAD


0 Kudos
Chapin
by
New Contributor III

It doesn't matter
I will also try to try more.Thank you

0 Kudos