Class WKTWriter
Outputs the textual representation of a Geometry. The WKTWriter outputs coordinates rounded to the precision model. No more than the maximum number of necessary decimal places will be output. The Well-known Text format is defined in the OpenGIS Simple Features Specification for SQL. A non-standard "LINEARRING" tag is used for LinearRings. The WKT spec does not define a special tag for LinearRings. The standard tag to use is "LINESTRING".
Inherited Members
Namespace: NetTopologySuite.IO
Assembly: NetTopologySuite.dll
Syntax
public class WKTWriter
Constructors
| Improve this Doc View SourceWKTWriter()
Creates an instance of this class which is writing at most 2 dimensions.
Declaration
public WKTWriter()
WKTWriter(Int32)
Creates an instance of this class which is writing at most outputDimension
dimensions.
Declaration
public WKTWriter(int outputDimension)
Parameters
Type | Name | Description |
---|---|---|
Int32 | outputDimension |
Properties
| Improve this Doc View SourceFormatted
Gets/sets whether the output will be formatted
Declaration
public bool Formatted { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
MaxCoordinatesPerLine
Gets/sets the maximum number of coordinates per line written in formatted output.
Declaration
public int MaxCoordinatesPerLine { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
If the provided coordinate number is < 0, coordinates will be written all on one line.
OutputOrdinates
Gets or sets the Ordinates to be written. Possible members are:
Values of X and Y are always assumed and not particularly checked for.Declaration
public Ordinates OutputOrdinates { get; set; }
Property Value
Type | Description |
---|---|
Ordinates |
PrecisionModel
Gets or sets a PrecisionModel that should be used on the ordinates written.
If none/null is assigned, the precision model of the Factory is used.
Note: The precision model is applied to all ordinate values, not just x and y.
Declaration
public PrecisionModel PrecisionModel { get; set; }
Property Value
Type | Description |
---|---|
PrecisionModel |
Tab
Gets/sets the tab size to use for indenting.
Declaration
public int Tab { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Exceptions
Type | Condition |
---|---|
ArgumentException | If the size is non-positive |
Methods
| Improve this Doc View SourceForMicrosoftSqlServer()
Creates a new instance of the WKTWriter class suitable for MSSQL's non- standard WKT format.
Declaration
public static WKTWriter ForMicrosoftSqlServer()
Returns
Type | Description |
---|---|
WKTWriter | A new instance of the WKTWriter class suitable for MSSQL's non-standard WKT format. |
ToLineString(Coordinate, Coordinate)
Generates the WKT for a LineString
specified by two Coordinates.
Declaration
public static string ToLineString(Coordinate p0, Coordinate p1)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | p0 | The first coordinate. |
Coordinate | p1 | The second coordinate. |
Returns
Type | Description |
---|---|
String | The WKT |
ToLineString(Coordinate[])
Generates the WKT for a LINESTRING specified by an array of Coordinates.
Declaration
public static string ToLineString(Coordinate[] coord)
Parameters
Type | Name | Description |
---|---|---|
Coordinate[] | coord | An array of coordinates |
Returns
Type | Description |
---|---|
String | The WKT |
ToLineString(CoordinateSequence)
Generates the WKT for a N-point LineString
specified by a CoordinateSequence.
Declaration
public static string ToLineString(CoordinateSequence seq)
Parameters
Type | Name | Description |
---|---|---|
CoordinateSequence | seq | The sequence to write. |
Returns
Type | Description |
---|---|
String | The WKT |
ToPoint(Coordinate)
Generates the WKT for a Point
specified by a Coordinate.
Declaration
public static string ToPoint(Coordinate p0)
Parameters
Type | Name | Description |
---|---|---|
Coordinate | p0 | The point coordinate. |
Returns
Type | Description |
---|---|
String | The WKT |
Write(Geometry)
Converts a Geometry
to its Well-known Text representation.
Declaration
public virtual string Write(Geometry geometry)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geometry | A |
Returns
Type | Description |
---|---|
String | A Geometry Tagged Text string (see the OpenGIS Simple Features Specification). |
Write(Geometry, Stream)
Converts a Geometry
to its Well-known Text representation.
Declaration
public void Write(Geometry geometry, Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geometry | A |
Stream | stream | A |
Write(Geometry, TextWriter)
Converts a Geometry
to its Well-known Text representation.
Declaration
public virtual void Write(Geometry geometry, TextWriter writer)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geometry | A |
TextWriter | writer |
WriteFormatted(Geometry)
Same as write
, but with newlines and spaces to make the
well-known text more readable.
Declaration
public virtual string WriteFormatted(Geometry geometry)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geometry | A |
Returns
Type | Description |
---|---|
String | A "Geometry Tagged Text" string (see the OpenGIS Simple Features Specification), with newlines and spaces. |
WriteFormatted(Geometry, TextWriter)
Same as write
, but with newlines and spaces to make the
well-known text more readable.
Declaration
public virtual void WriteFormatted(Geometry geometry, TextWriter writer)
Parameters
Type | Name | Description |
---|---|---|
Geometry | geometry | A |
TextWriter | writer |