Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

in a class extension, I'm trying to do search features inside a point feature class(part of a geometric network on an sql server sde database) and I get a -2147215922 (FDO_E_SE_INVALID_NUM_PARTS) error.

The geometry I'm using to create my search filter is actually a Polygon created with the ISegmentCollection.SetCircle function. Basically, I'm trying to find some features inside a circle defined by a point and a radius

void CTools::FillArrayWithFeatures(IFeatureClassPtr ipFeatureClass, 
              IPointPtr ipPoint, double fRadius, CAtlArray<IFeature*>* pArrFeature)
{
    //create the geometry
    IGeometryPtr ipGeometry;
    IPolygonPtr ipPolygon(CLSID_Polygon);
    ISegmentCollectionPtr ipSegmentCollection(ipPolygon);
    HRESULT hr = ipSegmentCollection->SetCircle(ipPoint, fRadius);
    ipGeometry = ipSegmentCollection;
    ISpatialReferencePtr ipSpatialRef;
    ipPoint->get_SpatialReference(&ipSpatialRef);
    ipGeometry->putref_SpatialReference(ipSpatialRef);

    //Create the spatial filter
    ISpatialFilterPtr ipSpatialFilter(CLSID_SpatialFilter);
    ipSpatialFilter->putref_Geometry(ipGeometry); 
    BSTR strName;
    ipFeatureClass->get_ShapeFieldName(&strName);
    ipSpatialFilter->put_GeometryField(strName);
    ipSpatialFilter->put_SpatialRel(esriSpatialRelIntersects);

     // Execute the search 
    IFeatureCursorPtr ipFeatureCursor;
    HRESULT hr = ipFeatureClass->Search(ipSpatialFilter, VARIANT_FALSE, &ipFeatureCursor);

    //Fill the array with the results
    if(ipFeatureCursor)
    {
        IFeature* pFoundFeature;
        hr = ipFeatureCursor->NextFeature(&pFoundFeature);
        while(pFoundFeature)
        {
            pArrFeature->Add(pFoundFeature);
            ipFeatureCursor->NextFeature(&pFoundFeature);
        }
    }
}

Am I doing something wrong? The same code works on a personnal geodatabase, but not on an sde sql server

Thanks

share|improve this question
    
If this is still an issue would you be able to edit your Question to update it with the ArcGIS for Desktop version you are currently using, and any other information that might help elicit an Answer. –  PolyGeo Oct 8 '13 at 8:25
    
My problem is not version-specific. I happens on different ArcGIS for Desktop versions. –  Goldorak84 Oct 8 '13 at 13:12
1  
Is your database able to accept 'curve' geometry types? SDE is very rigid about bad geometries and may be rejecting the curves resulting in 0 parts i.e. an empty feature and then rejecting that too. –  Michael Miles-Stimson Oct 9 '13 at 1:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.