public class Envelopes extends Object
// 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);
|Constructor and Description|
|Modifier and Type||Method and Description|
Include the provided envelope, expanding as necessary and rounding the bounding coordinates such that they are multiples of the specified resolution.
public static ReferencedEnvelope expandToInclude(ReferencedEnvelope srcEnv, double resolution)
resolutionis 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);
srcEnv- the envelope to include
resolution- resolution (in world distance units) of the resulting boundary coordinates
Copyright © 1996–2023 Geotools. All rights reserved.