GEOS  3.11.0beta3
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 <WKTWriter.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 (uint8_t 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) const
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

◆ setOld3D()

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

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

useOld3Dtrue or false

◆ setRoundingPrecision()

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

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

p0the new precision to use

◆ setTrim()

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

Enables/disables trimming of unnecessary decimals

p0the trim boolean

◆ toLineString() [1/2]

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

Generates the WKT for a 2-point LineString.

p0the first coordinate
p1the second coordinate
the WKT

◆ toLineString() [2/2]

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

Generates the WKT for a N-point LineString.

seqthe sequence to outpout
the WKT

◆ toPoint()

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

Generates the WKT for a Point.

p0the point coordinate
the WKT

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