AnsweredAssumed Answered

Error returned from IWkb::ExportToWkb() method

Question asked by rlcave on Jul 23, 2012
Latest reply on Jul 24, 2012 by rlcave
Hello,

I am using the IWkb interface to read data from a geometry.  When reading from a file or personal geodatabase, I get the following result:  HR=-2147220968 (E_GEOMETRY_NOTSIMPLE).  When I call ITopologicalOperator::get_IsSimple(), it returns true.  Does anyone know how a geometry can be both simple and non-simple?

Here is the code I am using:

esriGeometry::ITopologicalOperatorPtr topoOp = pGeo; // pGeo initialized earlier   if (topoOp != NULL) {     VARIANT_BOOL isSimple = VARIANT_TRUE;     hr = topoOp->get_IsSimple(&isSimple);  // returns 'true' for the geometry in question       if (VARIANT_FALSE == isSimple)     {         // Simplifies the geometry in place         hr = topoOp->Simplify();     } }   esriGeometry::IWkbPtr ipWkb = pGeo;   long reqSize = 0;  if (FAILED(hr = ipWkb->get_WkbSize(&reqSize))) {     return false; }  esriGeometry::esriGeometryType aoGeoType; hr = pGeo->get_GeometryType(&aoGeoType); unsigned char* pInOutWorkingBuffer = new unsigned char[reqSize];  if (FAILED(hr = ipWkb->ExportToWkb(&reqSize, pInOutWorkingBuffer))) {     // Fails here with hr=-2147220968     return false; }


One other note: the geometry that fails is the first one in the feature class.  The WKB size is 59629.  Is there a limitation on the size of a WKB buffer?

I am using ArcGIS 10.1, ArcObjects C++, Visual Studio 2008.

Thanks,

Bob

Outcomes