Class EWKTParser
java.lang.Object
org.gvsig.fmap.geom.jts.operation.fromwkt.EWKTParser
Converts a geometry in EWKT to a JTS-Geometry.
EWKTReader supports
extracting Geometry objects from either Readers or
Strings. This allows it to function as a parser to read Geometry
objects from text blocks embedded in other data formats (e.g. XML). A
WKTReader is parameterized by a GeometryFactory,
to allow it to create Geometry objects of the appropriate
implementation. In particular, the GeometryFactory
determines the PrecisionModel and SRID that is
used. The
WKTReader converts all input numbers to the precise
internal representation.
Notes:
- The reader supports non-standard "LINEARRING" tags.
- The reader uses Double.parseDouble to perform the conversion of ASCII numbers to floating point. This means it supports the Java syntax for floating point literals (including scientific notation).
Syntax
The following syntax specification describes the version of Well-Known Text supported by JTS. (The specification uses a syntax language similar to that used in the C and Java language specifications.)
WKTGeometry: one of
WKTPoint WKTLineString WKTLinearRing WKTPolygon
WKTMultiPoint WKTMultiLineString WKTMultiPolygon
WKTGeometryCollection
WKTPoint: POINT ( Coordinate )
WKTLineString: LINESTRING CoordinateSequence
WKTLinearRing: LINEARRING CoordinateSequence
WKTPolygon: POLYGON CoordinateSequenceList
WKTMultiPoint: MULTIPOINT CoordinateSequence
WKTMultiLineString: MULTILINESTRING CoordinateSequenceList
WKTMultiPolygon:
MULTIPOLYGON ( CoordinateSequenceList { , CoordinateSequenceList } )
WKTGeometryCollection:
GEOMETRYCOLLECTION ( WKTGeometry { , WKTGeometry } )
CoordinateSequenceList:
( CoordinateSequence { , CoordinateSequence } )
CoordinateSequence:
( Coordinate { , Coordinate } )
Coordinate:
Number Number Numberopt
Number: A Java-style floating-point number
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a reader that creates objects using the defaultGeometryFactory.EWKTParser(com.vividsolutions.jts.geom.GeometryFactory geometryFactory) Creates a reader that creates objects using the givenGeometryFactory. -
Method Summary
-
Constructor Details
-
EWKTParser
public EWKTParser()Creates a reader that creates objects using the defaultGeometryFactory. -
EWKTParser
public EWKTParser(com.vividsolutions.jts.geom.GeometryFactory geometryFactory) Creates a reader that creates objects using the givenGeometryFactory.- Parameters:
geometryFactory- the factory used to createGeometrys.
-
-
Method Details
-
read
public org.gvsig.fmap.geom.Geometry read(String wellKnownText) throws com.vividsolutions.jts.io.ParseException Reads a Well-Known Text representation of aGeometryfrom aString.- Parameters:
wellKnownText- one or morestrings (see the OpenGIS Simple Features Specification) separated by whitespace - Returns:
- a
Geometryspecified bywellKnownText - Throws:
com.vividsolutions.jts.io.ParseException- if a parsing problem occurs
-
read
public org.gvsig.fmap.geom.Geometry read(Reader reader) throws com.vividsolutions.jts.io.ParseException Reads a Well-Known Text representation of aGeometryfrom aReader.- Parameters:
reader- a Reader which will return astring (see the OpenGIS Simple Features Specification) - Returns:
- a
Geometryread fromreader - Throws:
com.vividsolutions.jts.io.ParseException- if a parsing problem occurs
-