public class Grids extends Object
Oblongs
and Hexagons
utility classes.Constructor and Description 

Grids() 
Modifier and Type  Method and Description 

static SimpleFeatureSource 
createHexagonalGrid(ReferencedEnvelope bounds,
double sideLen)
Creates a vector grid of hexagonal elements.

static SimpleFeatureSource 
createHexagonalGrid(ReferencedEnvelope bounds,
double sideLen,
double vertexSpacing)
Creates a vector grid of hexagonal elements represented by 'densified' polygons.

static SimpleFeatureSource 
createHexagonalGrid(ReferencedEnvelope bounds,
double sideLen,
double vertexSpacing,
GridFeatureBuilder builder)
Creates a vector grid of hexagonal elements represented by 'densified' polygons.

static SimpleFeatureSource 
createSquareGrid(ReferencedEnvelope bounds,
double sideLen)
Creates a vector grid of square elements.

static SimpleFeatureSource 
createSquareGrid(ReferencedEnvelope bounds,
double sideLen,
double vertexSpacing)
Creates a vector grid of square elements represented by 'densified' polygons.

static SimpleFeatureSource 
createSquareGrid(ReferencedEnvelope bounds,
double sideLen,
double vertexSpacing,
GridFeatureBuilder builder)
Creates a vector grid of square elements represented by 'densified' polygons.

public static SimpleFeatureSource createSquareGrid(ReferencedEnvelope bounds, double sideLen)
null
coordinate reference system is permitted.
The grid's origin is the minimum X and Y point of the envelope. If the width and/or height of the bounding envelope is not a simple multiple of the requested side length, there will be some unfilled space.
Each square in the returned grid is represented by a SimpleFeature
. The feature
type has two properties:
bounds
 bounds of the gridsideLen
 the side length of grid elementsIllegalArgumentException
 if bounds is null or empty; or if sideLen is <=
0public static SimpleFeatureSource createSquareGrid(ReferencedEnvelope bounds, double sideLen, double vertexSpacing)
vertexSpacing
which specifies the maximum distance between adjacent vertices. Vertices are
added more or less uniformly.
The coordinate reference system is taken from the input bounds. A null
coordinate
reference system is permitted.
The grid's origin is the minimum X and Y point of the envelope. If the width and/or height of the bounding envelope is not a simple multiple of the requested side length, there will be some unfilled space.
Each square in the returned grid is represented by a SimpleFeature
. The feature
type has two properties:
bounds
 bounds of the gridsideLen
 the side length of grid elementsvertexSpacing
 maximum distance between adjacent vertices in a grid element; if <= 0
or >= sideLen / 2.0
it is ignored and the polygons will not be densifiedIllegalArgumentException
 if bounds is null or empty; or if sideLen is <=
0public static SimpleFeatureSource createSquareGrid(ReferencedEnvelope bounds, double sideLen, double vertexSpacing, GridFeatureBuilder builder)
vertexSpacing
which specifies the maximum distance between adjacent vertices. Vertices are
added more or less uniformly.
The coordinate reference system is taken from the GridFeatureBuilder
. A null
coordinate reference system is permitted but if both the builder and bounding envelope
have nonnull
reference systems set they must be the same.
The grid's origin is the minimum X and Y point of the envelope. If the width and/or height of the bounding envelope is not a simple multiple of the requested side length, there will be some unfilled space.
bounds
 bounds of the gridsideLen
 the side length of grid elementsvertexSpacing
 maximum distance between adjacent vertices in a grid element; if <= 0
or >= sideLen / 2.0
the polygons will not be densifiedbuilder
 the GridFeatureBuilder
used to control feature creation and the
setting of feature attribute valuesIllegalArgumentException
 if bounds is null or empty; or if sideLen is <=
0;
or if builder is null; or if the CoordinateReferenceSystems
set for the bounds
and the GridFeatureBuilder
are both nonnull but differentpublic static SimpleFeatureSource createHexagonalGrid(ReferencedEnvelope bounds, double sideLen)
The hexagons created by this method are orientated with a pair of edges parallel to the
top and bottom of the bounding envelope (org.geotools.grid.hexagon.Hexagon.Orientation#FLAT). The bounding rectangle of each hexagon
has width sideLen * 2.0
and height sideLen * sqrt(3.0)
.
The grid's origin is the minimum X and Y point of the envelope.
The feature type of grid features has two properties:
bounds
 bounds of the gridsideLen
 the lengthIllegalArgumentException
 if bounds is null or empty; or if sideLen is <=
0public static SimpleFeatureSource createHexagonalGrid(ReferencedEnvelope bounds, double sideLen, double vertexSpacing)
vertexSpacing
which specifies the maximum distance between adjacent vertices. Vertices are
added more or less uniformly.
Hexagon size is expressed as side length. To create hexagons of specified area you can use the static Hexagons.areaToSideLength(double) method to calculate the equivalent side length.
The hexagons created by this method are orientated with a pair of edges parallel to the
top and bottom of the bounding envelope (org.geotools.grid.hexagon.Hexagon.Orientation#FLAT). The bounding rectangle of each hexagon
has width sideLen * 2.0
and height sideLen * sqrt(3.0)
.
The grid's origin is the minimum X and Y point of the envelope.
The feature type of grid features has two properties:
bounds
 bounds of the gridsideLen
 the lengthvertexSpacing
 maximum distance between adjacent vertices in a grid element; if <= 0
or >= sideLen / 2.0
the polygons will not be densifiedIllegalArgumentException
 if bounds is null or empty; or if sideLen is <=
0public static SimpleFeatureSource createHexagonalGrid(ReferencedEnvelope bounds, double sideLen, double vertexSpacing, GridFeatureBuilder builder)
vertexSpacing
which specifies the maximum distance between adjacent vertices. Vertices are
added more or less uniformly.
Hexagon size is expressed as side length. To create hexagons of specified area you can use the static Hexagons.areaToSideLength(double) method to calculate the equivalent side length.
The hexagons created by this method are orientated with a pair of edges parallel to the
top and bottom of the bounding envelope (org.geotools.grid.hexagon.Hexagon.Orientation#FLAT). The bounding rectangle of each hexagon
has width sideLen * 2.0
and height sideLen * sqrt(3.0)
.
The grid's origin is the minimum X and Y point of the envelope.
The feature type of grid features has two properties:
bounds
 bounds of the gridsideLen
 the lengthvertexSpacing
 maximum distance between adjacent vertices in a grid element; if <= 0
or >= sideLen / 2.0
the polygons will not be densifiedbuilder
 the GridFeatureBuilder
used to control feature creation and the
setting of feature attribute valuesIllegalArgumentException
 if bounds is null or empty; or if sideLen is <=
0;
or if builder is null; or if the CoordinateReferenceSystems
set for the bounds
and the GridFeatureBuilder
are both nonnull but differentCopyright © 1996–2018 Geotools. All rights reserved.