<?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 createGeometryFromWkbVariant giving Null Pointer exception in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/creategeometryfromwkbvariant-giving-null-pointer/m-p/435885#M11798</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been trying to use the&amp;nbsp; IGeometryFactoryProxy.createGeometryFromWkbVariant to convert OGC WKB into an IGeometry object. I have had no luck with this at all. Was unable to find any Java example on this. The Wkb bytes are valid since I am able to convert them into geometry using another third party API esri-geometry-core. The doucumentation suggests that I should pass in the byte[], a single element array of IGeometry (I have no idea if this array should be empty or populated with empty geometry but I assigned an empty geometry anyways), lastly a single element int[1] which holds the size of WKB at [0]. as suggested by the documentation. I get Null Pointer exception with the following stack&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;java.lang.NullPointerException&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at com.esri.arcgis.interop.Dispatch.vtblInvoke(Unknown Source)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at com.esri.arcgis.geometry.IGeometryFactoryProxy.createGeometryFromWkbV&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;ariant(Unknown Source)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my java code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IGeometry[] geomArr = new IGeometry[1];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;geomArr[0]=new com.esri.arcgis.geometry.Polygon(); //populate with an empty polygon&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;byte[] wkb = ...&lt;SPAN style="color: #7ed529;"&gt; //populate bytes array&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;int[] intArr = new int[1];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;intArr[0]=wkb.length;&lt;SPAN style="color: #7ed529;"&gt; //size of bytes&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; IGeometryFactory3Proxy geometryFactory = new IGeometryFactory3Proxy();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; geometryFactory.createGeometryFromWkb(intArr, wkb, geomArr);&lt;SPAN style="color: #7ed529;"&gt; //tried this&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; geometryFactory.createGeometryFromWkbVariant(wkb, geomArr, intArr); &lt;SPAN style="color: #7ed529;"&gt;//also tried this&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; geomArr[0].toString();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any idea what am I doing wrong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jan 2016 06:54:19 GMT</pubDate>
    <dc:creator>ImranRajjad</dc:creator>
    <dc:date>2016-01-21T06:54:19Z</dc:date>
    <item>
      <title>createGeometryFromWkbVariant giving Null Pointer exception</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creategeometryfromwkbvariant-giving-null-pointer/m-p/435885#M11798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been trying to use the&amp;nbsp; IGeometryFactoryProxy.createGeometryFromWkbVariant to convert OGC WKB into an IGeometry object. I have had no luck with this at all. Was unable to find any Java example on this. The Wkb bytes are valid since I am able to convert them into geometry using another third party API esri-geometry-core. The doucumentation suggests that I should pass in the byte[], a single element array of IGeometry (I have no idea if this array should be empty or populated with empty geometry but I assigned an empty geometry anyways), lastly a single element int[1] which holds the size of WKB at [0]. as suggested by the documentation. I get Null Pointer exception with the following stack&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;java.lang.NullPointerException&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at com.esri.arcgis.interop.Dispatch.vtblInvoke(Unknown Source)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at com.esri.arcgis.geometry.IGeometryFactoryProxy.createGeometryFromWkbV&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;ariant(Unknown Source)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my java code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IGeometry[] geomArr = new IGeometry[1];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;geomArr[0]=new com.esri.arcgis.geometry.Polygon(); //populate with an empty polygon&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;byte[] wkb = ...&lt;SPAN style="color: #7ed529;"&gt; //populate bytes array&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;int[] intArr = new int[1];&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;intArr[0]=wkb.length;&lt;SPAN style="color: #7ed529;"&gt; //size of bytes&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; IGeometryFactory3Proxy geometryFactory = new IGeometryFactory3Proxy();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; geometryFactory.createGeometryFromWkb(intArr, wkb, geomArr);&lt;SPAN style="color: #7ed529;"&gt; //tried this&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; geometryFactory.createGeometryFromWkbVariant(wkb, geomArr, intArr); &lt;SPAN style="color: #7ed529;"&gt;//also tried this&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; geomArr[0].toString();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any idea what am I doing wrong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 06:54:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creategeometryfromwkbvariant-giving-null-pointer/m-p/435885#M11798</guid>
      <dc:creator>ImranRajjad</dc:creator>
      <dc:date>2016-01-21T06:54:19Z</dc:date>
    </item>
    <item>
      <title>Re: createGeometryFromWkbVariant giving Null Pointer exception</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creategeometryfromwkbvariant-giving-null-pointer/m-p/435886#M11799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok I have solved it, thanks and no thanks to terrible arcobjects java code samples folks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead of using &lt;SPAN style="font-weight: bold; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;IGeometryFactory3Proxy &lt;/SPAN&gt;use &lt;STRONG&gt;GeometryEnvironment &lt;/STRONG&gt;and use&lt;STRONG&gt; &lt;/STRONG&gt;&lt;SPAN style="text-decoration: underline;"&gt;&lt;EM style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;createGeometryFromWkbVariant(wkb, geomArr, intArr)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps somebody&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2016 08:06:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creategeometryfromwkbvariant-giving-null-pointer/m-p/435886#M11799</guid>
      <dc:creator>ImranRajjad</dc:creator>
      <dc:date>2016-01-21T08:06:19Z</dc:date>
    </item>
  </channel>
</rss>

