public class WKTParser
extends java.lang.Object
Geometry.
The WKTReader allows
extracting Geometry objects from either input streams or
internal strings. This allows it to function as a parser to read Geometry
objects from text blocks embedded in other data formats (e.g. XML).
The Well-known Text format is defined in the OpenGIS Simple Features Specification for SQL .
Note: There is an inconsistency in the SFS. The WKT grammar states
that MultiPoints are represented by MULTIPOINT ( ( x y), (x y) )
, but the examples show MultiPoints as MULTIPOINT ( x y, x y )
. Other implementations follow the latter syntax, so JTS will adopt it as
well.
A WKTReader is parameterized by a GeometryFactory
, to allow it to create Geometry objects of the appropriate
implementation. In particular, the GeometryFactory will
determine the PrecisionModel and SRID that is
used.
The WKTReader will convert the input numbers to the precise
internal representation.
Reads non-standard "LINEARRING" tags.
| Constructor and Description |
|---|
WKTParser()
Creates a WKTReader that creates objects using a basic GeometryFactory.
|
| Modifier and Type | Method and Description |
|---|---|
Geometry |
read(java.io.Reader reader)
Converts a Well-known Text representation to a
Geometry. |
Geometry |
read(java.lang.String wellKnownText)
Converts a Well-known Text representation to a
Geometry. |
public WKTParser()
public Geometry read(java.lang.String wellKnownText) throws ParseException
Geometry.wellKnownText - one or more Geometry specified by wellKnownTextParseException - if a parsing problem occurspublic Geometry read(java.io.Reader reader) throws ParseException
Geometry.reader - a Reader which will return a Geometry read from readerParseException - if a parsing problem occurs