AnsweredAssumed Answered

createGeometryFromWkbVariant giving Null Pointer exception

Question asked by imranrajjad on Jan 20, 2016
Latest reply on Jan 21, 2016 by imranrajjad

I have been trying to use the  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



        at com.esri.arcgis.interop.Dispatch.vtblInvoke(Unknown Source)

        at com.esri.arcgis.geometry.IGeometryFactoryProxy.createGeometryFromWkbV

ariant(Unknown Source)


my java code


IGeometry[] geomArr = new IGeometry[1];

geomArr[0]=new com.esri.arcgis.geometry.Polygon(); //populate with an empty polygon

byte[] wkb = ... //populate bytes array

int[] intArr = new int[1];

intArr[0]=wkb.length; //size of bytes


IGeometryFactory3Proxy geometryFactory = new IGeometryFactory3Proxy();

  geometryFactory.createGeometryFromWkb(intArr, wkb, geomArr); //tried this

  geometryFactory.createGeometryFromWkbVariant(wkb, geomArr, intArr); //also tried this



any idea what am I doing wrong.