Select to view content in your preferred language

How do I create a spatiafilter based on a spatial relationship?

691
4
Jump to solution
06-21-2022 12:53 PM
MarioLandry2
Occasional Contributor

Under ArcMap, I used to be able to create a spatialfilter based on a spatial relationship.  For example, if I wanted to find the polygons of a feature that were sharing a border I could do this:

' Create a spatial filter with a share border spatial relationship.
Dim spatialFilter As ISpatialFilter = New SpatialFilterClass()
spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelRelation
spatialFilter.SpatialRelDescription = "F***T****"
spatialFilter.WhereClause = "CAST(" & EgdPdA.NomChamp.PD_NUM & " AS VARCHAR(3)) || '-' || " & EgdPdA.NomChamp.PD_NBR_SFX & " = '" & pdNumPdNbrSfx & "' AND " & _
EgdPdA.NomChamp.FED_NUM & " = " & sFedNum

' Execute the query.
Dim selectionSet As ISelectionSet
selectionSet = pFwsp.OpenFeatureClass(sLayerName).Select(spatialFilter,esriSelectionType.esriSelectionTypeSnapshot, esriSelectionOption.esriSelectionOptionNormal, Nothing)

I have not been able to find an equivalent under ArcGIS Pro.  Do you know how it can be done?

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

There's a page in the docs that shows how to return the features that meet the relationship between two geometries using the GeometryEngine Relate method.

View solution in original post

0 Kudos
4 Replies
MarioLandry2
Occasional Contributor

I believe I'll be able to do what I want by using the geoprocessing "management.SelectLayerByLocation"

0 Kudos
Aashis
by Esri Contributor
Esri Contributor

Have you looked into SpatialQueryFilter? Here are a couple of code snippets using it

0 Kudos
KenBuja
MVP Esteemed Contributor

There's a page in the docs that shows how to return the features that meet the relationship between two geometries using the GeometryEngine Relate method.

0 Kudos
MarioLandry2
Occasional Contributor

Thanks a lot!

 

That's what I was looking for.

0 Kudos