private Geometry unionUsingEnvelopeIntersection(Geometry g0,Geometry g1,Envelope common){
  List disjointPolys=new ArrayList();
  Geometry g0Int=extractByEnvelope(common,g0,disjointPolys);
  Geometry g1Int=extractByEnvelope(common,g1,disjointPolys);
  Geometry union=unionActual(g0Int,g1Int);
  disjointPolys.add(union);
  Geometry overallUnion=GeometryCombiner.combine(disjointPolys);
  return overallUnion;
}

private Geometry unionUsingEnvelopeIntersection ( Geometry g0 , Geometry g1 , Envelope common ) { List disjointPolys = new ArrayList ( ) ; Geometry g0Int = extractByEnvelope ( common , g0 , disjointPolys ) ; Geometry g1Int = extractByEnvelope ( common , g1 , disjointPolys ) ; Geometry union = unionActual ( g0Int , g1Int ) ; disjointPolys . add ( union ) ; Geometry overallUnion = GeometryCombiner . combine ( disjointPolys ) ; return overallUnion ; }
unions two polygonal geometries , restricting computation to the envelope intersection where possible . the case of multipolygons is optimized to union only the polygons which lie in the intersection of the two geometry ' s envelopes . polygons outside this region can simply be combined with the union result , which is potentially much faster . this case is likely to occur often during cascaded union , and may also occur in real world data ( such as unioning data for parcels on different street blocks ) .
