Search Results for

    Show / Hide Table of Contents

    Class WKTReader

    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 .

    As of version 2.0, NTS can read WKT syntax which specifies coordinate dimension Z, M or ZM as modifiers(e.g.POINT Z) or in the name of the geometry type(e.g.LINESTRINGZM). If the coordinate dimension is specified it will be set in the created geometry. If the coordinate dimension is not specified, the default behaviour is to create XYZ geometry(this is backwards compatible with older JTS versions). This can be altered to create XY geometry by setting IsOldNtsCoordinateSyntaxAllowed to false.

    A reader can be set to ensure the input is structurally valid by setting FixStructure to true. This ensures that geometry can be constructed without errors due to missing coordinates. The created geometry may still be topologically invalid.

    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 NTS 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. WKTReader reads also non-standard LINEARRING tags.
    Inheritance
    object
    WKTReader
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: NetTopologySuite.IO
    Assembly: NetTopologySuite.dll
    Syntax
    public class WKTReader

    Constructors

    | Edit this page View Source

    WKTReader()

    Creates a WKTReader that creates objects using a basic GeometryFactory.

    Declaration
    public WKTReader()
    | Edit this page View Source

    WKTReader(GeometryFactory)

    Creates a WKTReader that creates objects using the given GeometryFactory.

    Declaration
    [Obsolete("Use a constructor with a configured NtsGeometryServices instance.")]
    public WKTReader(GeometryFactory factory)
    Parameters
    Type Name Description
    GeometryFactory factory

    The factory used to create Geometrys.

    | Edit this page View Source

    WKTReader(NtsGeometryServices)

    Creates a WKTReader that creates objects using a basic GeometryFactory.

    Declaration
    public WKTReader(NtsGeometryServices ntsGeometryServices)
    Parameters
    Type Name Description
    NtsGeometryServices ntsGeometryServices

    Properties

    | Edit this page View Source

    DefaultSRID

    Gets or sets the default SRID

    Declaration
    [Obsolete("Supply an appropriate NtsGeometryServices instance to the constructor instead.  The ability to set this value after an instance is created may be removed in a future release.")]
    public int DefaultSRID { get; set; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    Factory

    Gets or sets the factory to create geometries

    Declaration
    [Obsolete("Supply an appropriate NtsGeometryServices instance to the constructor instead.  The ability to set this value after an instance is created may be removed in a future release.")]
    public GeometryFactory Factory { get; set; }
    Property Value
    Type Description
    GeometryFactory
    | Edit this page View Source

    FixStructure

    Gets or sets a flag indicating that the structure of input geometry should be fixed so that the geometry can be constructed without error.
    This involves adding coordinates if the input coordinate sequence is shorter than required.

    Declaration
    public bool FixStructure { get; set; }
    Property Value
    Type Description
    bool
    See Also
    MinimumValidSize
    | Edit this page View Source

    IsOldNtsCoordinateSyntaxAllowed

    Gets or sets a value indicating whether or not coordinates may have 3 ordinate values even though no Z or M ordinate indicator is present. The default value is true.

    Declaration
    public bool IsOldNtsCoordinateSyntaxAllowed { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    IsOldNtsMultiPointSyntaxAllowed

    Gets or sets a value indicating whether or not point coordinates in a MultiPoint geometry must not be enclosed in paren. The default value is true.

    Declaration
    public bool IsOldNtsMultiPointSyntaxAllowed { get; set; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    IsStrict

    Gets or sets a value indicating if the reader should attempt to repair malformed input.

    Declaration
    public bool IsStrict { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    Malformed in this case means the ring has too few points (4), or is not closed.

    Methods

    | Edit this page View Source

    Read(Stream)

    Converts a Well-known Text representation to a Geometry.

    Declaration
    public Geometry Read(Stream stream)
    Parameters
    Type Name Description
    Stream stream

    one or more Geometry Tagged Text strings (see the OpenGIS Simple Features Specification) separated by whitespace.

    Returns
    Type Description
    Geometry

    A Geometry specified by wellKnownText

    | Edit this page View Source

    Read(TextReader)

    Converts a Well-known Text representation to a Geometry.

    Declaration
    public Geometry Read(TextReader reader)
    Parameters
    Type Name Description
    TextReader reader

    A Reader which will return a "Geometry Tagged Text" string (see the OpenGIS Simple Features Specification).

    Returns
    Type Description
    Geometry

    A Geometry read from reader.

    | Edit this page View Source

    Read(string)

    Converts a Well-known Text representation to a Geometry.

    Declaration
    public Geometry Read(string wellKnownText)
    Parameters
    Type Name Description
    string wellKnownText

    one or more Geometry Tagged Text strings (see the OpenGIS Simple Features Specification) separated by whitespace.

    Returns
    Type Description
    Geometry

    A Geometry specified by wellKnownText

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX