SpatialFilter SpatialRelDescription Bug?

722
4
04-10-2014 06:03 AM
DeniseDemone
New Contributor II
I'm upgrading some 9.3.1 ArcObjects applications to 10.2.1 and I'm getting some weird results. I have code that does "interior intersects" using a spatial filter and is returning features that obviously do not have intersecting interiors.

pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelRelation;
pSpatialFilter.SpatialRelDescription = "T********";

The code is being used to select lines that intersect polygons. I've attached a screen shot of the result, it looks like maybe it's using the envelope of the features, not the features themselves?

It worked perfectly in 9.3.1.

[ATTACH=CONFIG]33010[/ATTACH]

Has anyone else come across this?
0 Kudos
4 Replies
NeilClemmons
Regular Contributor III
Are you setting the output spatial reference on your spatial filter?  If not, you'll get unexpected results if the spatial reference of your query geometry is different than the spatial reference of the features you are querying against.  Also, isn't the spatial relationship you're looking for the same as "crosses"?  If so, I would just set the spatial relationship property to esriSpatialRelCrosses and not use a custom filter.


esriSpatialRelCrosses

Returns a feature if the intersection of the interiors of the two shapes is not empty and has a lower dimension than the maximum dimension of the two shapes. Two lines that share an endpoint in common do not cross. Valid for Line/Line, Line/Area, Multi-point/Area, and Multi-point/Line shape type combinations.
0 Kudos
DeniseDemone
New Contributor II
The spatial reference of both geometries is the same, they are both in the same feature dataset in Oracle (SDE Binary storage option).


I've found a different series of spatial relationships that let me achieve the same goal, I guess my point was:

Why does this work differently in 10.2.1 than it did in 9.3.1?
0 Kudos
FélixLaberge
New Contributor
The bug is similar at the NIM092869 (http://support.esri.com/en/bugs/nimbus/TklNMDkyODY5) and it's new with ArcGIS 10... I use this workaround to solve it after our migration from 9.3.1...

        ...
        Dim itfSelctSet As ISelectionSet
        Dim itfResltSet As ISelectionSet = Nothing
        ' Create First spatialFilter
        itfSpatlFiltr = New SpatialFilter
        itfSpatlFiltr.Geometry = _itfPolgnExtra
        itfSpatlFiltr.SearchOrder = esriSearchOrder.esriSearchOrderAttribute
        itfSpatlFiltr.SpatialRel = esriSpatialRelEnum.esriSpatialRelRelation
        itfSpatlFiltr.SpatialRelDescription = strDescrReltn ' (ex. "T**F**FF*")
        ' First Selection
        itfSelctSet = Me.itfFeatrClassR.Select(itfSpatlFiltr, _
                                               esriSelectionType.esriSelectionTypeHybrid, _
                                               esriSelectionOption.esriSelectionOptionNormal, _
                                               itfDatst.Workspace)
        ' Workaround bug NIM092869...
        '*****************************************
        If itfSpatlFiltr.SpatialRelDescription.StartsWith("T") Then
            Dim itfSelctSetBug As ISelectionSet = Nothing
            ' SpatialFilter to substract
            itfSpatlFiltr.SpatialRelDescription = "F********"
            ' Second bug selection to substract
            itfSelctSetBug = itfSelctSet.Select(itfSpatlFiltr, _
                                                esriSelectionType.esriSelectionTypeSnapshot, _
                                                esriSelectionOption.esriSelectionOptionNormal, _
                                                itfDatst.Workspace)
            ' Substract bug selection from the first selection
            itfSelctSet.Combine(itfSelctSetBug, _
                                esriSetOperation.esriSetDifference, _
                                itfResltSet)
            itfSelctSet = itfResltSet
        End If
        ...
0 Kudos
DeniseDemone
New Contributor II

Just an update on this. ESRI did confirm is was a bug and it is fixed in 10.2.2.

0 Kudos