Tell me more ×
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

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

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.