GEOS 3.3.8

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
geos::io::WKTWriter Class Reference

Outputs the textual representation of a Geometry. See also WKTReader. More...

`#include <geos.h>`

## Public Member Functions
std::string | write (const geom::Geometry *geometry)
| Returns WKT string for the given Geometry.
void | write (const geom::Geometry *geometry, Writer *writer)
std::string | writeFormatted (const geom::Geometry *geometry)
void | writeFormatted (const geom::Geometry *geometry, Writer *writer)
void | setRoundingPrecision (int p0)
void | setTrim (bool p0)
void | setOld3D (bool useOld3D)
int | getOutputDimension () const
void | setOutputDimension (int newOutputDimension)

## Static Public Member Functions
static std::string | toLineString (const geom::CoordinateSequence &seq)
static std::string | toLineString (const geom::Coordinate &p0, const geom::Coordinate &p1)
static std::string | toPoint (const geom::Coordinate &p0)

## Protected Member Functions
void | appendGeometryTaggedText (const geom::Geometry *geometry, int level, Writer *writer)
void | appendPointTaggedText (const geom::Coordinate *coordinate, int level, Writer *writer)
void | appendLineStringTaggedText (const geom::LineString *lineString, int level, Writer *writer)
void | appendLinearRingTaggedText (const geom::LinearRing *lineString, int level, Writer *writer)
void | appendPolygonTaggedText (const geom::Polygon *polygon, int level, Writer *writer)
void | appendMultiPointTaggedText (const geom::MultiPoint *multipoint, int level, Writer *writer)
void | appendMultiLineStringTaggedText (const geom::MultiLineString *multiLineString, int level, Writer *writer)
void | appendMultiPolygonTaggedText (const geom::MultiPolygon *multiPolygon, int level, Writer *writer)
void | appendGeometryCollectionTaggedText (const geom::GeometryCollection *geometryCollection, int level, Writer *writer)
void | appendPointText (const geom::Coordinate *coordinate, int level, Writer *writer)
void | appendCoordinate (const geom::Coordinate *coordinate, Writer *writer)
std::string | writeNumber (double d)
void | appendLineStringText (const geom::LineString *lineString, int level, bool doIndent, Writer *writer)
void | appendPolygonText (const geom::Polygon *polygon, int level, bool indentFirst, Writer *writer)
void | appendMultiPointText (const geom::MultiPoint *multiPoint, int level, Writer *writer)
void | appendMultiLineStringText (const geom::MultiLineString *multiLineString, int level, bool indentFirst, Writer *writer)
void | appendMultiPolygonText (const geom::MultiPolygon *multiPolygon, int level, Writer *writer)
void | appendGeometryCollectionText (const geom::GeometryCollection *geometryCollection, int level, Writer *writer)

## Protected Attributes
int | decimalPlaces

## Detailed Description

Outputs the textual representation of a Geometry. See also WKTReader.

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".

See WKTReader for parsing.

## Member Function Documentation

void geos::io::WKTWriter::setOld3D | ( | bool | useOld3D | ) |
| inline

Enable old style 3D/4D WKT generation.

By default the WKBWriter produces new style 3D/4D WKT (ie. "POINT Z (10 20 30)") but if this method is used to turn on old style WKT production then the WKT will be formatted in the style "POINT (10 20 30)".

Parameters

  useOld3D | true or false

void geos::io::WKTWriter::setRoundingPrecision | ( | int | p0 | ) |

Sets the rounding precision when writing the WKT a precision of -1 disables it

Parameters

  p0 | the new precision to use

void geos::io::WKTWriter::setTrim | ( | bool | p0 | ) |

Enables/disables trimming of unnecessary decimals

Parameters

  p0 | the trim boolean

static std::string geos::io::WKTWriter::toLineString | ( | const geom::CoordinateSequence & | seq | ) |
| static

Generates the WKT for a N-point `LineString`.

Parameters

  seq | the sequence to outpout

Returns
  the WKT

static std::string geos::io::WKTWriter::toLineString | ( | const geom::Coordinate & | p0,
|  | const geom::Coordinate & | p1
| ) |  |
| static

Generates the WKT for a 2-point `LineString`.

Parameters

  p0 | the first coordinate
  p1 | the second coordinate

Returns
  the WKT

static std::string geos::io::WKTWriter::toPoint | ( | const geom::Coordinate & | p0 | ) |
| static

Generates the WKT for a `Point`.

Parameters

  p0 | the point coordinate

Returns
  the WKT

The documentation for this class was generated from the following file:

- WKTWriter.h