Class JtsWKTReaderShapeParser

  • All Implemented Interfaces:
    ShapeIO, ShapeReader

    public class JtsWKTReaderShapeParser
    extends JtsWKTReader
    This is an extension of JtsWKTReader that processes the entire string with JTS's WKTReader. Some differences:
    • No support for ENVELOPE and BUFFER
    • MULTI* shapes use JTS's GeometryCollection subclasses, not ShapeCollection
    • 'Z' coordinates are saved into the geometry
    • Method Detail

      • parseIfSupported

        public Shape parseIfSupported​(String wktString)
                               throws ParseException
        Description copied from class: WKTReader
        Parses the wktString, returning the defined Shape. If it can't because the shape name is unknown or an empty or blank string was passed, then it returns null. If the WKT starts with a supported shape but contains an inner unsupported shape then it will result in a ParseException.
        Overrides:
        parseIfSupported in class WKTReader
        Parameters:
        wktString - non-null, can be empty or have surrounding whitespace
        Returns:
        Shape, null if unknown / unsupported shape.
        Throws:
        ParseException - Thrown if there is an error in the Shape definition
      • parseIfSupported

        protected Shape parseIfSupported​(String str,
                                         com.vividsolutions.jts.io.WKTReader reader)
                                  throws ParseException
        Reads WKT from the str via JTS's WKTReader.
        Parameters:
        str -
        reader -
        new WKTReader(ctx.getGeometryFactory()))
        Returns:
        Non-Null
        Throws:
        ParseException
      • checkCoordinates

        protected void checkCoordinates​(com.vividsolutions.jts.geom.Geometry geom)