PROJ C++ API
Public Types | Public Member Functions | Static Public Member Functions | List of all members
osgeo::proj::io::WKTFormatter Class Reference

Formatter to WKT strings. More...

#include <io.hpp>

Public Types

enum  Convention {
  Convention::WKT2, WKT2_2015 = WKT2, Convention::WKT2_SIMPLIFIED, WKT2_2015_SIMPLIFIED = WKT2_SIMPLIFIED,
  Convention::WKT2_2018, Convention::WKT2_2018_SIMPLIFIED, Convention::WKT1_GDAL
}
 

Public Member Functions

WKTFormattersetMultiLine (bool multiLine)
 Whether to use multi line output or not.
 
WKTFormattersetIndendationWidth (int width)
 Set number of spaces for each indentation level (defaults to 4).
 
WKTFormattersetStrict (bool strict)
 Set whether the formatter should operate on strict more or not. More...
 
bool isStrict () const
 Returns whether the formatter is in strict mode.
 
const std::string & toString () const
 

Static Public Member Functions

static WKTFormatterNNPtr create (Convention convention=Convention::WKT2)
 Constructs a new formatter. More...
 
static WKTFormatterNNPtr create (const WKTFormatterNNPtr &other)
 Constructs a new formatter from another one. More...
 

Detailed Description

Formatter to WKT strings.

An instance of this class can only be used by a single thread at a time.

Member Enumeration Documentation

WKT variant.

Enumerator
WKT2 

Full WKT2 string, conforming to ISO 19162:2015(E) / OGC 12-063r5, with all possible nodes and new keyword names.

WKT2_SIMPLIFIED 

Same as WKT2 with the following exceptions:

  • UNIT keyword used.
  • ID node only on top element.
  • No ORDER element in AXIS element.
  • PRIMEM node omitted if it is Greenwich.
  • ELLIPSOID.UNIT node omitted if it is UnitOfMeasure::METRE.
  • PARAMETER.UNIT / PRIMEM.UNIT omitted if same as AXIS.
  • AXIS.UNIT omitted and replaced by a common GEODCRS.UNIT if they are all the same on all axis.
WKT2_2018 

Full WKT2 string, conforming to ISO 19162:2018 / OGC 18-010, with all possible nodes and new keyword names. Non-normative list of differences:

  • WKT2_2018 uses GEOGCRS / BASEGEOGCRS keywords for GeographicCRS.
WKT2_2018_SIMPLIFIED 

WKT2_2018 with the simplification rule of WKT2_SIMPLIFIED

WKT1_GDAL 

WKT1 as traditionally output by GDAL

Member Function Documentation

WKTFormatterNNPtr osgeo::proj::io::WKTFormatter::create ( Convention  convention = Convention::WKT2)
static

Constructs a new formatter.

A formatter can be used only once (its internal state is mutated)

Its default behaviour can be adjusted with the different setters.

Parameters
conventionWKT flavor. Defaults to Convention::WKT2
Returns
new formatter.
WKTFormatterNNPtr osgeo::proj::io::WKTFormatter::create ( const WKTFormatterNNPtr other)
static

Constructs a new formatter from another one.

A formatter can be used only once (its internal state is mutated)

Its default behaviour can be adjusted with the different setters.

Parameters
othersource formatter.
Returns
new formatter.
WKTFormatter & osgeo::proj::io::WKTFormatter::setStrict ( bool  strictIn)

Set whether the formatter should operate on strict more or not.

The default is strit mode, in which case a FormattingException can be thrown.

const std::string & osgeo::proj::io::WKTFormatter::toString ( ) const

Returns the WKT string from the formatter.


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