public final class Envelopes extends Static
transform(…)methods in this class take in account the curvature of the transformed shape. For example the shape of a geographic envelope (figure below on the left side) is not rectangular in a conic projection (figure below on the right side). In order to get the envelope represented by the red rectangle, projecting the four corners of the geographic envelope is not sufficient since we would miss the southerner part.
|Envelope before map projection||Shape of the projected envelope|
MathTransformimplementations involved in the operation (directly or indirectly) support derivative, for more accurate calculation of curve extremum. This is the case of most Apache SIS implementations.
transform(…) methods in this class expect an arbitrary
Envelope with one
of the following arguments:
The recommended method is the one expecting a
since it contains sufficient information for handling the cases of envelopes that encompass a pole.
The method expecting a
CoordinateReferenceSystem object is merely a convenience method that
infers the coordinate operation itself, but at the cost of performance if the same operation needs
to be applied on many envelopes.
|Modifier and Type||Method and Description|
Returns the bounding box of a geometry defined in Well Known Text (WKT) format.
Formats the given envelope as a
Formats the given envelope as a
Transforms an envelope using the given coordinate operation.
Transforms the given envelope to the specified CRS.
Transforms an envelope using the given math transform.
public static Envelope transform(Envelope envelope, CoordinateReferenceSystem targetCRS) throws TransformException
MathTransforminstance once and invoke one of the others
envelope- The envelope to transform (may be
targetCRS- The target CRS (may be
envelopeif no change was required.
TransformException- If a transformation was required and failed.
public static GeneralEnvelope transform(MathTransform transform, Envelope envelope) throws TransformException
MathTransformdoes not carry sufficient information. For a more robust envelope transformation, use
transform- The transform to use.
envelope- Envelope to transform, or
null. This envelope will not be modified.
TransformException- if a transform failed.
public static GeneralEnvelope transform(CoordinateOperation operation, Envelope envelope) throws TransformException
This method can handle the case where the envelope contains the North or South pole, or when it cross the ±180° longitude.
nullbefore to call this method.
public static Envelope fromWKT(CharSequence wkt) throws FactoryException
LINESTRINGhave the same dimension. However this method ensures that the parenthesis are balanced, in order to catch some malformed WKT.
BOX(-180 -90, 180 90)(not really a geometry, but understood by many softwares)
MULTIPOLYGON(((1 1, 5 1, 1 5, 1 1),(2 2, 3 2, 3 3, 2 2)))
GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(3 8,7 10))
GeneralEnvelope.GeneralEnvelope(CharSequence)for more information about the parsing rules.
BOXelement. The output is like below, where n is the number of dimensions (omitted if equals to 2):
BOXelement is not part of the standard Well Known Text (WKT) format. However it is understood by many softwares, for example GDAL and PostGIS.
public static String toPolygonWKT(Envelope envelope) throws IllegalArgumentException
POLYGONelement in the Well Known Text (WKT) format.
POLYGONcan be used as an alternative to
BOXwhen the element needs to be considered as a standard WKT geometry.
The string returned by this method can be parsed by the
Copyright © 2010–2016 The Apache Software Foundation. All rights reserved.