fort_teler

getting empty geometry

Discussion created by fort_teler on May 20, 2014
I have following code

SOEHelper soeHelper = new SOEHelper();

IRouteLocator routeLocator = soeHelper.GetRouteLocator(featureClass, idFieldNameValue, soeHelper.getMeasurementUnit(measureUnit));

if(routeLocator == null)
{
serverLog.addMessage(2, 500,"Route Locator is null" );
}
else
{
serverLog.addMessage(2, 500,"Route Locator" );
}


IRouteLocation routeLocation = new RouteMeasurePointLocation();
routeLocation.setRouteID(routeID);
routeLocation.setMeasureUnit(routeLocator.getMeasureUnit());
routeLocation.setLateralOffset(offset);

IRouteMeasurePointLocation routeMeasurePointLocation = (IRouteMeasurePointLocation)routeLocation;
routeMeasurePointLocation.setMeasure(measure);


serverLog.addMessage(2, 500, "index " + routeLocator.getRouteFeatureClass().getFields().getFieldCount() );


IGeometry[] geometry = new Point[1];

int[] locatingError = null; 

routeLocator.locate(routeLocation,geometry , locatingError);

if(geometry !=null)
{
serverLog.addMessage(2, 500,"geometry length" + geometry.length );
}
else
{
serverLog.addMessage(2, 500,"geometry IS NULL" );
}
if(locatingError != null)
{
String str = "";
for(int errorCode : locatingError)
{
str += errorCode + ",";

}
serverLog.addMessage(2, 500,str );
}
else
{
serverLog.addMessage(2, 500,"locating error IS NULL" );

}


but i am getting empty geometry and error code

the log output is


Route Locator
index 11
geometry IS NULL
locating error IS NULL

Any idea what might be be wrong here?



when i am passing int[] locatingError = new int[1];

now it is giving me the error code but when i do this to geometry

IGeometry[] geometry = new Point[1];

it is returuning null in geometry[0] ??

Outcomes