Package org.geotools.grid
Class Envelopes
Object
Envelopes
A helper class to create bounding envelopes with width and height that are simple multiples of a given resolution.
// Example of use: creating an envlope with 'neat' lat-lon bounds
// that encompasses a set of features
SimpleFeatureSource featureSource = ...
ReferencedEnvelope featureBounds = featureSource.getBounds();
ReferencedEnvelope latLonEnv = featureBounds.transform(DefaultGeographicCRS.WGS84, true);
// 1 degree grid resoluation
final double gridSize = 1.0;
ReferencedEnvelope gridBounds = Envelopes.expandToInclude(latLonEnv, gridSize);
- Since:
- 2.7
- Author:
- mbedward
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ReferencedEnvelope
expandToInclude
(ReferencedEnvelope srcEnv, double resolution) Include the provided envelope, expanding as necessary and rounding the bounding coordinates such that they are multiples of the specified resolution.
-
Constructor Details
-
Envelopes
public Envelopes()
-
-
Method Details
-
expandToInclude
Include the provided envelope, expanding as necessary and rounding the bounding coordinates such that they are multiples of the specified resolution. For example, ifresolution
is 100 then the min and max bounding coordinates of this envelope will set to mutliples of 100 by rounding down the min values and rounding up the max values if required.// Example, create a new envelope that cntains an input envlope and // whose boundind coordinates are multiples of 100 // ReferencedEnvelope inputEnv = ... ReferencedEnvelope roundedEnv = new ReferencedEnvelope(); roundedEnv.expandToInclude(inputEnv, 100);
- Parameters:
srcEnv
- the envelope to includeresolution
- resolution (in world distance units) of the resulting boundary coordinates- Returns:
- a new envelope with 'rounded' bounding coordinates
-