bbulla

Geodatabase vs SDE geometry error

Discussion created by bbulla on Oct 27, 2010
Latest reply on Oct 28, 2010 by bbulla
Hi,

I'm creating a tool that I am testing with a Geodatabase.  Ultimately the tool has to work on SDE data.  I am having an issue where my tool works in the Geodatabase, but not in SDE and I can't seem to figure it out.  Here is what I am doing:

I am selecting features from a FeatureClass using a SpatialFilter.  I take a point and a FeatureClass, pass it to a subroutine and return a cursor of selected features.  Here is my code:

//This will select a feature based on location and return an updateable FeatureCursor
        public IFeatureCursor SelectByLocation(IFeatureLayer2 intersectLayer, IPoint intersectPoint)
        {
            try
            {
                IFeatureClass featureClass = intersectLayer.FeatureClass;
                IGeometry queryGeometry = intersectPoint;

                ITopologicalOperator topoOp = (ITopologicalOperator)queryGeometry;

                ISpatialFilter spatialFilter = new SpatialFilterClass();   //create a new spatial filter
                //spatialFilter.Geometry = queryGeometry;
                spatialFilter.Geometry = topoOp.Buffer(0.000512000000477);
                spatialFilter.GeometryField = featureClass.ShapeFieldName;
                spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;

                IFeatureCursor spatialCursor = featureClass.Update(spatialFilter, false);  //This is where it won't work in SDE, but does work in a Geodatabase

                return spatialCursor;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                m_editor.StopOperation("Update Fittings");                
                return null;
            }
        }


The error I am getting is attached.  The FeatureClass that I am running the SpatialFilter on is a polyline featureClass in both SDE and the Geodatabase, but I am only getting this error when using SDE.

Any ideas as to why this is happening??

Attachments

Outcomes