Modifier and Type | Method and Description |
---|---|
static Envelope |
fromWKT(CharSequence wkt)
Returns the bounding box of a geometry defined in Well Known Text (WKT) format.
|
static String |
toPolygonWKT(Envelope envelope)
Formats the given envelope as a
POLYGON element in the Well Known Text
(WKT) format. |
static String |
toString(Envelope envelope)
Formats the given envelope as a
BOX element. |
public static Envelope fromWKT(CharSequence wkt) throws FactoryException
LINESTRING
have the same dimension. However this method
ensures that the parenthesis are balanced, in order to catch some malformed WKT.
Example:
BOX(-180 -90, 180 90)
(not really a geometry, but understood by many softwares)POINT(6 10)
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.wkt
- The BOX
, POLYGON
or other kind of element to parse.FactoryException
- If the given WKT can not be parsed.toString(Envelope)
,
CRS#fromWKT(String)
,
org.apache.sis.io.wkt
public static String toString(Envelope envelope)
BOX
element. The output is like below,
where n is the number of dimensions
(omitted if equals to 2):
BOX
nD(
lower corner,
upper corner)
BOX
element is not part of the standard Well Known Text (WKT) format.
However it is understood by many softwares, for example GDAL and PostGIS.GeneralEnvelope
constructor.envelope
- The envelope to format.BOX
or BOX3D
(most typical dimensions) element.fromWKT(CharSequence)
,
org.apache.sis.io.wkt
public static String toPolygonWKT(Envelope envelope) throws IllegalArgumentException
POLYGON
element in the Well Known Text
(WKT) format. POLYGON
can be used as an alternative to BOX
when the element
needs to be considered as a standard WKT geometry.
The string returned by this method can be parsed by the GeneralEnvelope
constructor.
envelope
- The envelope to format.POLYGON
in WKT format.IllegalArgumentException
- if the given envelope can not be formatted.org.apache.sis.io.wkt
Copyright © 2010–2014 The Apache Software Foundation. All rights reserved.