HOW TO
Instructions provided describe how to use ArcObjects to leverage st_geometry operators.
There are many advantages to using st_geometry operators. The example provided demonstrates how to define a feature cursor and query filter that will execute the spatial relational operator on the database server utilizing the functionality of the specified spatial relational operator.
Note:
The st_geometry operator arguments must be fully qualified, because there is no ability to set a table alias when defining the tables involved in the query.
Code:
Dim pCursor As ICursor
Dim pFeatureWorkspace As IFeatureWorkspace
Dim pRow As IRow
Dim pCnt As Integer
Dim pQueryDef As IQueryDef
Set pFeatureWorkspace = pWorkspace
Set pQueryDef = pFeatureWorkspace.CreateQueryDef
pQueryDef.Tables = "tb.states, tb.lakes"
pQueryDef.SubFields = "lakes.name"
pQueryDef.WhereClause = "states.name = 'Oregon' AND sde.st_contains(states.shape, lakes.shape) = 1"
Set pCursor = pQueryDef.Evaluate
Set pRow = pCursor.NextRow
pCnt = 0
While Not pRow Is Nothing
pCnt = pCnt + 1
Set pRow = pCursor.NextRow
Wend
Get help from ArcGIS experts
Download the Esri Support App