<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error returned from IWkb::ExportToWkb() method in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-returned-from-iwkb-exporttowkb-method/m-p/36890#M954</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In order to simplify a geometry, you must use ITopologicalOperator2 and set IsKnownSimple to False.&amp;nbsp; After that, calling Simplify will simplify the geometry.&amp;nbsp; If you call Simplify without first setting IsKnownSimple to False, it will exit without doing anything if IsSimple returns true.&amp;nbsp; IsSimple pretty much returns True all of the time, which is the reason IsKnownSimple was added to the object model.&amp;nbsp; I don't know that it will solve your problem, but give it a try.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Jul 2012 12:56:11 GMT</pubDate>
    <dc:creator>NeilClemmons</dc:creator>
    <dc:date>2012-07-24T12:56:11Z</dc:date>
    <item>
      <title>Error returned from IWkb::ExportToWkb() method</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-returned-from-iwkb-exporttowkb-method/m-p/36889#M953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using the IWkb interface to read data from a geometry.&amp;nbsp; When reading from a file or personal geodatabase, I get the following result:&amp;nbsp; HR=-2147220968 (E_GEOMETRY_NOTSIMPLE).&amp;nbsp; When I call ITopologicalOperator::get_IsSimple(), it returns true.&amp;nbsp; Does anyone know how a geometry can be both simple and non-simple? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code I am using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;esriGeometry::ITopologicalOperatorPtr topoOp = pGeo; // pGeo initialized earlier&amp;nbsp;&amp;nbsp; if (topoOp != NULL) { &amp;nbsp;&amp;nbsp;&amp;nbsp; VARIANT_BOOL isSimple = VARIANT_TRUE; &amp;nbsp;&amp;nbsp;&amp;nbsp; hr = topoOp-&amp;gt;get_IsSimple(&amp;amp;isSimple);&amp;nbsp; // returns 'true' for the geometry in question&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (VARIANT_FALSE == isSimple) &amp;nbsp;&amp;nbsp;&amp;nbsp; { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Simplifies the geometry in place &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hr = topoOp-&amp;gt;Simplify(); &amp;nbsp;&amp;nbsp;&amp;nbsp; } }&amp;nbsp;&amp;nbsp; esriGeometry::IWkbPtr ipWkb = pGeo;&amp;nbsp;&amp;nbsp; long reqSize = 0;&amp;nbsp; if (FAILED(hr = ipWkb-&amp;gt;get_WkbSize(&amp;amp;reqSize))) { &amp;nbsp;&amp;nbsp;&amp;nbsp; return false; }&amp;nbsp; esriGeometry::esriGeometryType aoGeoType; hr = pGeo-&amp;gt;get_GeometryType(&amp;amp;aoGeoType); unsigned char* pInOutWorkingBuffer = new unsigned char[reqSize];&amp;nbsp; if (FAILED(hr = ipWkb-&amp;gt;ExportToWkb(&amp;amp;reqSize, pInOutWorkingBuffer))) { &amp;nbsp;&amp;nbsp;&amp;nbsp; // Fails here with hr=-2147220968 &amp;nbsp;&amp;nbsp;&amp;nbsp; return false; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One other note: the geometry that fails is the first one in the feature class.&amp;nbsp; The WKB size is 59629.&amp;nbsp; Is there a limitation on the size of a WKB buffer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using ArcGIS 10.1, ArcObjects C++, Visual Studio 2008.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Bob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 18:55:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-returned-from-iwkb-exporttowkb-method/m-p/36889#M953</guid>
      <dc:creator>BobCave</dc:creator>
      <dc:date>2012-07-23T18:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: Error returned from IWkb::ExportToWkb() method</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-returned-from-iwkb-exporttowkb-method/m-p/36890#M954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In order to simplify a geometry, you must use ITopologicalOperator2 and set IsKnownSimple to False.&amp;nbsp; After that, calling Simplify will simplify the geometry.&amp;nbsp; If you call Simplify without first setting IsKnownSimple to False, it will exit without doing anything if IsSimple returns true.&amp;nbsp; IsSimple pretty much returns True all of the time, which is the reason IsKnownSimple was added to the object model.&amp;nbsp; I don't know that it will solve your problem, but give it a try.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2012 12:56:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-returned-from-iwkb-exporttowkb-method/m-p/36890#M954</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2012-07-24T12:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error returned from IWkb::ExportToWkb() method</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-returned-from-iwkb-exporttowkb-method/m-p/36891#M955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Neil,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&amp;nbsp; That solved the problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another question:&amp;nbsp; Is there a good way to determine whether or not the geometry needs to be simplified?&amp;nbsp; The documentation led me to believe that ITopologicalOperator::get_IsSimple() would do that for me, but apparently not.&amp;nbsp; If I first set IsKnownSimple to false, should IsSimple then tell me whether or not the geometry is simple?&amp;nbsp; I tried that, and at first it seemed to be working, but there were still cases where IsSimple returned true, but IWkb::ExportToWkb failed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Bob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2012 13:33:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-returned-from-iwkb-exporttowkb-method/m-p/36891#M955</guid>
      <dc:creator>BobCave</dc:creator>
      <dc:date>2012-07-24T13:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error returned from IWkb::ExportToWkb() method</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-returned-from-iwkb-exporttowkb-method/m-p/36892#M956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If I remember right, features taken from a feature class are assumed to be simple whether or not they actually are.&amp;nbsp; I don't think there's any way to tell for all geometry types.&amp;nbsp; If you're working with polygons then I believe you can call IToplogicalOperator3.IsSimpleEx.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2012 16:19:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-returned-from-iwkb-exporttowkb-method/m-p/36892#M956</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2012-07-24T16:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: Error returned from IWkb::ExportToWkb() method</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-returned-from-iwkb-exporttowkb-method/m-p/36893#M957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OK.&amp;nbsp; Thanks for the information.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2012 16:27:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-returned-from-iwkb-exporttowkb-method/m-p/36893#M957</guid>
      <dc:creator>BobCave</dc:creator>
      <dc:date>2012-07-24T16:27:42Z</dc:date>
    </item>
  </channel>
</rss>

