SQL settings for WhereClause

408
1
Jump to solution
03-03-2022 03:58 AM
DavidMrázek
Occasional Contributor II

Good day,
I'm trying to figure out how to write an SQL query for SpatialQueryFilter in WhereClause, so that when browsing individual elements, it excludes the currently read element from the selection.

 private async Task DeletePolygonInPolygon(FeatureLayer polygonLayer)
        {
            var spatialQuery = new SpatialQueryFilter()
                    {  SpatialRelationship = SpatialRelationship.Contains };
                spatialQuery.WhereClause = "";//Somehow write down to keep it current because it would match
            polygonLayer.Select(spatialQuery);
            object[] listOfPara = { polygonLayer };
            await StartATask("management.DeleteFeatures", listOfPara);

        }

 

Thank you

David

0 Kudos
1 Solution

Accepted Solutions
KimGarbade
Occasional Contributor III

I'm not near a computer to test anything, but from what I can see your going to want to add a for loop to the body of your function. For each feature in the featurelayer you pass into the function return the ObjectID (or other unique id). Then you can use that to exclude the current feature from the WhereClause. 

View solution in original post

1 Reply
KimGarbade
Occasional Contributor III

I'm not near a computer to test anything, but from what I can see your going to want to add a for loop to the body of your function. For each feature in the featurelayer you pass into the function return the ObjectID (or other unique id). Then you can use that to exclude the current feature from the WhereClause.