Select to view content in your preferred language

getting empty geometry

573
0
05-20-2014 08:46 PM
HaiderAli
Deactivated User
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] ??
0 Kudos
0 Replies