/** * @module org/locationtech/jts/io/WKTReader */ import GeometryFactory from '../geom/GeometryFactory' import WKTParser from './WKTParser' /** * Converts a geometry in Well-Known Text format to a {@link Geometry}. *

* WKTReader supports extracting Geometry objects * from either {@link Reader}s or {@link String}s. This allows it to function * as a parser to read Geometry objects from text blocks embedded * in other data formats (e.g. XML). */ export default class WKTReader { /** * 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. * @param {GeometryFactory} geometryFactory */ constructor(geometryFactory) { this.parser = new WKTParser(geometryFactory || new GeometryFactory()) } /** * Reads a Well-Known Text representation of a {@link Geometry} * * @param {string} * wkt a string (see the OpenGIS Simple Features * Specification). * @return {Geometry} a Geometry read from * string. * @memberof module:org/locationtech/jts/io/WKTReader# */ read(wkt) { return this.parser.read(wkt) } }