org.gvsig.fmap.geom.operation.fromwkt
Class WKTParser

java.lang.Object
  extended by org.gvsig.fmap.geom.operation.fromwkt.WKTParser

public class WKTParser
extends Object

Converts a Well-Known Text string to a 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.

Version:
1.5

Constructor Summary
WKTParser()
          Creates a WKTReader that creates objects using a basic GeometryFactory.
 
Method Summary
 Geometry read(Reader reader)
          Converts a Well-known Text representation to a Geometry.
 Geometry read(String wellKnownText)
          Converts a Well-known Text representation to a Geometry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WKTParser

public WKTParser()
Creates a WKTReader that creates objects using a basic GeometryFactory.

Method Detail

read

public Geometry read(String wellKnownText)
              throws com.vividsolutions.jts.io.ParseException
Converts a Well-known Text representation to a Geometry.

Parameters:
wellKnownText - one or more strings (see the OpenGIS Simple Features Specification) separated by whitespace
Returns:
a Geometry specified by wellKnownText
Throws:
com.vividsolutions.jts.io.ParseException - if a parsing problem occurs

read

public Geometry read(Reader reader)
              throws com.vividsolutions.jts.io.ParseException
Converts a Well-known Text representation to a Geometry.

Parameters:
reader - a Reader which will return a string (see the OpenGIS Simple Features Specification)
Returns:
a Geometry read from reader
Throws:
com.vividsolutions.jts.io.ParseException - if a parsing problem occurs


Copyright © 2004-2012 gvSIG. All Rights Reserved.