そのため、空間フィルターを使用してフィーチャレイヤーで空間選択を実行するコードがいくつかあります。これは、通常のフィーチャクラス レイヤーでは正常に機能しますが、SDE フィーチャクラスで実行すると失敗します。問題が何であるかについて誰かが光を当てることができるかどうか疑問に思っていますか? 私が得ているエラーは HRESULT 0x80041515 で、どこからでも情報を見つけることができるエラー コードを提供します。私の関数は、ポリラインとレイヤー文字列を取り、ラインの中心点に基づいてレイヤー内のポリゴンを選択します。コードのサンプルを次に示します。
' Creates centerpoint of line envelope
Dim pCenterPoint As IPoint = New Point
pCenterPoint.SpatialReference = pPolyline.SpatialReference
pCenterPoint.PutCoords((pPolyline.Envelope.XMin + pPolyline.Envelope.XMax) / 2, (pPolyline.Envelope.YMin + pPolyline.Envelope.YMax) / 2)
' Expands envelope
Dim eCenterEnvelope As IEnvelope
eCenterEnvelope = pCenterPoint.Envelope
eCenterEnvelope.Expand(pMxDoc.SearchTolerance, pMxDoc.SearchTolerance, False)
' Get layer of interest
Dim pLayer As IFeatureLayer = FindLayerByName(strSelect, layerType.FeatureLayer, False, False)
pLayer.Selectable = True
' Create spatial filter
Dim spatialFilter As ISpatialFilter = New SpatialFilterClass()
spatialFilter.Geometry = eCenterEnvelope
spatialFilter.GeometryField = pLayer.Name
spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
Dim queryFilter As IQueryFilter = New QueryFilterClass()
queryFilter = CType(spatialFilter, IQueryFilter)
' Select features
Dim pFeatureSelection As IFeatureSelection = pLayer
pFeatureSelection.Clear() 'clear any current selections in the layer first
pFeatureSelection.SelectFeatures(queryFilter, esriSelectionResultEnum.esriSelectionResultAdd, True)
If pFeatureSelection.SelectionSet.Count = 0 Then
Return False
Else
Return True
End If
pFeatureSelection.SelectFeatures() を呼び出すとコードが失敗しますが、これはフィーチャレイヤーが SDE フィーチャクラスに属している場合のみです。何か案は?
ありがとう、
ルーク