try {
Geometry unioned = GeometryEngine.union(geomsToUnion, spatialRef);
// we have to infer the type of the differenced geometry because we don't know
// if it's going to end up as a single or multi-part geometry
OGCType inferredType = GeometryUtils.getInferredOGCType(unioned);
return GeometryUtils.geometryToEsriShapeBytesWritable(unioned, firstWKID, inferredType);
} catch (Exception e){
LogUtils.Log_ExceptionThrown(LOG, "GeometryEngine.union", e);
return null;