Пример #1
0
  /**
   * Generate squares inside given bounds
   *
   * @param bounds
   * @param size
   * @return
   * @throws IOException
   */
  private SimpleFeatureIterator squares(ReferencedEnvelope bounds, double size) throws IOException {

    // Limit squares to bounding box
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
    Filter filter = ff.bbox(ff.property(GEOM), bounds);

    // Align bound to square size and expand by 150%
    bounds = align(bounds, size, 1.5);

    // Create grid for given bounds
    SimpleFeatureSource grid = Grids.createSquareGrid(bounds, size);

    // Finished
    return grid.getFeatures(filter).features();
  }