Class Wkt


  • public class Wkt
    extends Object
    Creates encoders/decoders for WKT geometry representations.

    Note that the WktEncoder/WktDecoder instances returned by the factory methods are not thread-safe.

    Author:
    Karel Maesen, Geovise BVBA, 2011
    • Constructor Detail

      • Wkt

        public Wkt()
    • Method Detail

      • fromWkt

        public static <P extends PositionGeometry<P> fromWkt​(String wkt,
                                                               CoordinateReferenceSystem<P> crs)
        Decodes the specified WKT String to a Geometry.

        This method uses the default WKT dialect (Postgis v1.5 EWKT)

        Parameters:
        wkt - the WKT string to decode
        Returns:
        The decoded Geometry
      • toWkt

        public static String toWkt​(Geometry<?> geometry)
        Encodes a Geometry to a WKT representation.

        This method uses the default WKT dialect (Postgis v1.5 EWKT)

        Parameters:
        geometry - the Geometry to encode
        Returns:
        the WKT representation of the given geometry
      • newDecoder

        public static WktDecoder newDecoder​(Wkt.Dialect dialect)
        Creates a WktDecoder for the specified WKT Dialect.
        Parameters:
        dialect - the WKT dialect
        Returns:
        an WktDecoder that supports the specified dialect
      • newDecoder

        public static WktDecoder newDecoder()
        Creates a WktDecoder for the default dialect (Postgis 1.x EWKT).
        Returns:
        an WktDecoder that supports the default dialect
      • newEncoder

        public static WktEncoder newEncoder​(Wkt.Dialect dialect)
        Creates a WktEncoder for the specified WKT Dialect.
        Parameters:
        dialect - the WKT dialect
        Returns:
        an WktEncoder that supports the specified dialect
      • newEncoder

        public static WktEncoder newEncoder()
        Creates a WktEncoder for the default dialect (Postgis 1.x EWKT).
        Returns:
        an WktEncoder that supports the default dialect