Geometry[] createRectangles(Envelope env,int nRect,double rectSize){
  int nSide=1 + (int)Math.sqrt((double)nRect);
  double dx=env.getWidth() / nSide;
  double dy=env.getHeight() / nSide;
  List rectList=new ArrayList();
  for (int i=0; i < nSide; i++) {
    for (int j=0; j < nSide; j++) {
      double baseX=env.getMinX() + i * dx;
      double baseY=env.getMinY() + j * dy;
      Envelope envRect=new Envelope(baseX,baseX + dx,baseY,baseY + dy);
      Geometry rect=fact.toGeometry(envRect);
      rectList.add(rect);
    }
  }
  return GeometryFactory.toGeometryArray(rectList);
}

Geometry [ ] createRectangles ( Envelope env , int nRect , double rectSize ) { int nSide = 1 + ( int ) Math . sqrt ( ( double ) nRect ) ; double dx = env . getWidth ( ) / nSide ; double dy = env . getHeight ( ) / nSide ; List rectList = new ArrayList ( ) ; for ( int i = 0 ; i < nSide ; i ++ ) { for ( int j = 0 ; j < nSide ; j ++ ) { double baseX = env . getMinX ( ) + i * dx ; double baseY = env . getMinY ( ) + j * dy ; Envelope envRect = new Envelope ( baseX , baseX + dx , baseY , baseY + dy ) ; Geometry rect = fact . toGeometry ( envRect ) ; rectList . add ( rect ) ; } } return GeometryFactory . toGeometryArray ( rectList ) ; }
creates a set of rectangular polygons which cover the given envelope . the rectangles at least nrect rectangles are created .
