Hi,
How close do two object have to be in order for a SpatialFilter Intersect considers them to be intersecting? I'm doing some testing at a very small scale and getting some 'not expected' results.
In the screenshot below, I am running the following code to find the intersecting Watermain ID to place onto the Watermain Break point. So basically I pass the point of the selected Watermain Break and the Watermain Layer to this procedure (GetIntersectingFeature), and then update the Watermain Break:
public string GetIntersectingFeature(MapPoint point, FeatureLayer intersectLayer, string fieldName)
{
try
{
SpatialQueryFilter spatialFilter = new SpatialQueryFilter();
spatialFilter.FilterGeometry = point;
spatialFilter.SpatialRelationship = SpatialRelationship.Intersects;
spatialFilter.SubFields = fieldName;
string fieldValue = null;
RowCursor featureCursor = intersectLayer.Search(spatialFilter);
Feature feature;
while (featureCursor.MoveNext())
{
using (feature = (Feature)featureCursor.Current)
{
int fieldPosition = feature.FindField(fieldName);
if (feature[fieldPosition] != null)
fieldValue = feature[fieldPosition].ToString();
else
fieldValue = null;
}
}
return fieldValue;
}
catch (Exception ex)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("An error occured while finding the intersecting feature." + "\n" + "\n" + ex.ToString(), "GetIntersecingFeature", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
return null;
}
}
From the screenshot below, all of the selected points have a value returned. I really only should be getting a value returned for the Watermain Breaks that are exactly intersecting the Watermain. Is there a setting I am missing in either ArcGIS Pro, or in my code to tighten up the tolerance of what is considered 'intersecting'??
Thanks,