OGRGeometry C++ API
Include file: ogr_geometry.h
OGRGeometryFactory class

class OGRGeometryFactory
Create geometry objects from well known text/binary.
Public Static Functions

static OGRErr createFromWkb(const void*, OGRSpatialReference*, OGRGeometry**, size_t = static_cast<size_t>(1), OGRwkbVariant = wkbVariantOldOgc)
Create a geometry object of the appropriate type from its well known binary representation.
Note that if nBytes is passed as zero, no checking can be done on whether the pabyData is sufficient. This can result in a crash if the input data is corrupt. This function returns no indication of the number of bytes from the data source actually used to represent the returned geometry object. Use OGRGeometry::WkbSize() on the returned geometry to establish the number of bytes it required in WKB format.
Also note that this is a static method, and that there is no need to instantiate an OGRGeometryFactory object.
The C function OGR_G_CreateFromWkb() is the same as this method.
 Parameters:
pabyData – pointer to the input BLOB data.
poSR – pointer to the spatial reference to be assigned to the created geometry object. This may be NULL.
ppoReturn – the newly created geometry object will be assigned to the indicated pointer on return. This will be NULL in case of failure. If not NULL, *ppoReturn should be freed with OGRGeometryFactory::destroyGeometry() after use.
nBytes – the number of bytes available in pabyData, or 1 if it isn’t known
eWkbVariant – WKB variant.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

static OGRErr createFromWkb(const void *pabyData, OGRSpatialReference*, OGRGeometry**, size_t nSize, OGRwkbVariant eVariant, size_t &nBytesConsumedOut)
Create a geometry object of the appropriate type from its well known binary representation.
Note that if nBytes is passed as zero, no checking can be done on whether the pabyData is sufficient. This can result in a crash if the input data is corrupt. This function returns no indication of the number of bytes from the data source actually used to represent the returned geometry object. Use OGRGeometry::WkbSize() on the returned geometry to establish the number of bytes it required in WKB format.
Also note that this is a static method, and that there is no need to instantiate an OGRGeometryFactory object.
The C function OGR_G_CreateFromWkb() is the same as this method.
 Since
GDAL 2.3
 Parameters:
pabyData – pointer to the input BLOB data.
poSR – pointer to the spatial reference to be assigned to the created geometry object. This may be NULL.
ppoReturn – the newly created geometry object will be assigned to the indicated pointer on return. This will be NULL in case of failure. If not NULL, *ppoReturn should be freed with OGRGeometryFactory::destroyGeometry() after use.
nBytes – the number of bytes available in pabyData, or 1 if it isn’t known
eWkbVariant – WKB variant.
nBytesConsumedOut – output parameter. Number of bytes consumed.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

static OGRErr createFromWkt(const char*, OGRSpatialReference*, OGRGeometry**)
Create a geometry object of the appropriate type from its well known text representation.
The C function OGR_G_CreateFromWkt() is the same as this method.
 Since
GDAL 2.3
 Parameters:
pszData – input zero terminated string containing well known text representation of the geometry to be created.
poSR – pointer to the spatial reference to be assigned to the created geometry object. This may be NULL.
ppoReturn – the newly created geometry object will be assigned to the indicated pointer on return. This will be NULL if the method fails. If not NULL, *ppoReturn should be freed with OGRGeometryFactory::destroyGeometry() after use.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

static OGRErr createFromWkt(const char**, OGRSpatialReference*, OGRGeometry**)
Create a geometry object of the appropriate type from its well known text representation.
The C function OGR_G_CreateFromWkt() is the same as this method.
Example:
const char* wkt= "POINT(0 0)"; // cast because OGR_G_CreateFromWkt will move the pointer char* pszWkt = (char*) wkt; OGRSpatialReferenceH ref = OSRNewSpatialReference(NULL); OGRGeometryH new_geom; OSRSetAxisMappingStrategy(poSR, OAMS_TRADITIONAL_GIS_ORDER); OGRErr err = OGR_G_CreateFromWkt(&pszWkt, ref, &new_geom);
 Parameters:
ppszData – input zero terminated string containing well known text representation of the geometry to be created. The pointer is updated to point just beyond that last character consumed.
poSR – pointer to the spatial reference to be assigned to the created geometry object. This may be NULL.
ppoReturn – the newly created geometry object will be assigned to the indicated pointer on return. This will be NULL if the method fails. If not NULL, *ppoReturn should be freed with OGRGeometryFactory::destroyGeometry() after use.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

static inline OGRErr createFromWkt(char **ppszInput, OGRSpatialReference *poSRS, OGRGeometry **ppoGeom)
Deprecated.
 Deprecated:
in GDAL 2.3

static OGRErr createFromFgf(const void*, OGRSpatialReference*, OGRGeometry**, int = 1, int* = nullptr)
Create a geometry object of the appropriate type from its FGF (FDO Geometry Format) binary representation.
Also note that this is a static method, and that there is no need to instantiate an OGRGeometryFactory object.
The C function OGR_G_CreateFromFgf() is the same as this method.
 Parameters:
pabyData – pointer to the input BLOB data.
poSR – pointer to the spatial reference to be assigned to the created geometry object. This may be NULL.
ppoReturn – the newly created geometry object will be assigned to the indicated pointer on return. This will be NULL in case of failure, but NULL might be a valid return for a NULL shape.
nBytes – the number of bytes available in pabyData.
pnBytesConsumed – if not NULL, it will be set to the number of bytes consumed (at most nBytes).
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

static OGRGeometry *createFromGML(const char*)
Create geometry from GML.
This method translates a fragment of GML containing only the geometry portion into a corresponding OGRGeometry. There are many limitations on the forms of GML geometries supported by this parser, but they are too numerous to list here.
The following GML2 elements are parsed : Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, MultiGeometry.
(OGR >= 1.8.0) The following GML3 elements are parsed : Surface, MultiSurface, PolygonPatch, Triangle, Rectangle, Curve, MultiCurve, LineStringSegment, Arc, Circle, CompositeSurface, OrientableSurface, Solid, Tin, TriangulatedSurface.
Arc and Circle elements are stroked to linestring, by using a 4 degrees step, unless the user has overridden the value with the OGR_ARC_STEPSIZE configuration variable.
The C function OGR_G_CreateFromGML() is the same as this method.
 Parameters:
pszData – The GML fragment for the geometry.
 Returns:
a geometry on success, or NULL on error.

static OGRGeometry *createFromGEOS(GEOSContextHandle_t hGEOSCtxt, GEOSGeom)
Builds a OGRGeometry* from a GEOSGeom.
 Parameters:
hGEOSCtxt – GEOS context
geosGeom – GEOS geometry
 Returns:
a OGRGeometry*

static OGRGeometry *createFromGeoJson(const char*, int = 1)
Create geometry from GeoJson fragment.
 Since
GDAL 2.3
 Parameters:
pszJsonString – The GeoJSON fragment for the geometry.
nSize – (new in GDAL 3.4) Optional length of the string if it is not nullterminated
 Returns:
a geometry on success, or NULL on error.

static OGRGeometry *createFromGeoJson(const CPLJSONObject &oJSONObject)
Create geometry from GeoJson fragment.
 Since
GDAL 2.3
 Parameters:
oJsonObject – The JSONObject class describes the GeoJSON geometry.
 Returns:
a geometry on success, or NULL on error.

static void destroyGeometry(OGRGeometry*)
Destroy geometry object.
Equivalent to invoking delete on a geometry, but it guaranteed to take place within the context of the GDAL/OGR heap.
This method is the same as the C function OGR_G_DestroyGeometry().
 Parameters:
poGeom – the geometry to deallocate.

static OGRGeometry *createGeometry(OGRwkbGeometryType)
Create an empty geometry of desired type.
This is equivalent to allocating the desired geometry with new, but the allocation is guaranteed to take place in the context of the GDAL/OGR heap.
This method is the same as the C function OGR_G_CreateGeometry().
 Parameters:
eGeometryType – the type code of the geometry class to be instantiated.
 Returns:
the newly create geometry or NULL on failure. Should be freed with OGRGeometryFactory::destroyGeometry() after use.

static OGRGeometry *forceToPolygon(OGRGeometry*)
Convert to polygon.
Tries to force the provided geometry to be a polygon. This effects a change on multipolygons. Starting with GDAL 2.0, curve polygons or closed curves will be changed to polygons. The passed in geometry is consumed and a new one returned (or potentially the same one).
Note: the resulting polygon may break the Simple Features rules for polygons, for example when converting from a multipart multipolygon.
 Parameters:
poGeom – the input geometry  ownership is passed to the method.
 Returns:
new geometry.

static OGRGeometry *forceToLineString(OGRGeometry*, bool bOnlyInOrder = true)
Convert to line string.
Tries to force the provided geometry to be a line string. This nominally effects a change on multilinestrings. In GDAL 2.0, for polygons or curvepolygons that have a single exterior ring, it will return the ring. For circular strings or compound curves, it will return an approximated line string.
The passed in geometry is consumed and a new one returned (or potentially the same one).
 Parameters:
poGeom – the input geometry  ownership is passed to the method.
bOnlyInOrder – flag that, if set to FALSE, indicate that the order of points in a linestring might be reversed if it enables to match the extremity of another linestring. If set to TRUE, the start of a linestring must match the end of another linestring.
 Returns:
new geometry.

static OGRGeometry *forceToMultiPolygon(OGRGeometry*)
Convert to multipolygon.
Tries to force the provided geometry to be a multipolygon. Currently this just effects a change on polygons. The passed in geometry is consumed and a new one returned (or potentially the same one).
 Returns:
new geometry.

static OGRGeometry *forceToMultiPoint(OGRGeometry*)
Convert to multipoint.
Tries to force the provided geometry to be a multipoint. Currently this just effects a change on points or collection of points. The passed in geometry is consumed and a new one returned (or potentially the same one).
 Returns:
new geometry.

static OGRGeometry *forceToMultiLineString(OGRGeometry*)
Convert to multilinestring.
Tries to force the provided geometry to be a multilinestring.
linestrings are placed in a multilinestring.
circularstrings and compoundcurves will be approximated and placed in a multilinestring.
geometry collections will be converted to multilinestring if they only contain linestrings.
polygons will be changed to a collection of linestrings (one per ring).
curvepolygons will be approximated and changed to a collection of ( linestrings (one per ring).
The passed in geometry is consumed and a new one returned (or potentially the same one).
 Returns:
new geometry.

static OGRGeometry *forceTo(OGRGeometry *poGeom, OGRwkbGeometryType eTargetType, const char *const *papszOptions = nullptr)
Convert to another geometry type.
Tries to force the provided geometry to the specified geometry type.
It can promote ‘single’ geometry type to their corresponding collection type (see OGR_GT_GetCollection()) or the reverse. nonlinear geometry type to their corresponding linear geometry type (see OGR_GT_GetLinear()), by possibly approximating circular arcs they may contain. Regarding conversion from linear geometry types to curve geometry types, only “wrapping” will be done. No attempt to retrieve potential circular arcs by deapproximating stroking will be done. For that, OGRGeometry::getCurveGeometry() can be used.
The passed in geometry is consumed and a new one returned (or potentially the same one).
 Since
GDAL 2.0
 Parameters:
poGeom – the input geometry  ownership is passed to the method.
eTargetType – target output geometry type.
papszOptions – options as a nullterminated list of strings or NULL.
 Returns:
new geometry.

static OGRGeometry *removeLowerDimensionSubGeoms(const OGRGeometry *poGeom)
Remove subgeometries from a geometry collection that do not have the maximum topological dimensionality of the collection.
This is typically to be used as a cleanup phase after running OGRGeometry::MakeValid()
For example, MakeValid() on a polygon can return a geometry collection of polygons and linestrings. Calling this method will return either a polygon or multipolygon by dropping those linestrings.
On a nongeometry collection, this will return a clone of the passed geometry.
 Since
GDAL 3.1.0
 Parameters:
poGeom – input geometry
 Returns:
a new geometry.

static OGRGeometry *organizePolygons(OGRGeometry **papoPolygons, int nPolygonCount, int *pbResultValidGeometry, const char **papszOptions = nullptr)
Organize polygons based on geometries.
Analyse a set of rings (passed as simple polygons), and based on a geometric analysis convert them into a polygon with inner rings, (or a MultiPolygon if dealing with more than one polygon) that follow the OGC Simple Feature specification.
All the input geometries must be OGRPolygon/OGRCurvePolygon with only a valid exterior ring (at least 4 points) and no interior rings.
The passed in geometries become the responsibility of the method, but the papoPolygons “pointer array” remains owned by the caller.
For faster computation, a polygon is considered to be inside another one if a single point of its external ring is included into the other one. (unless ‘OGR_DEBUG_ORGANIZE_POLYGONS’ configuration option is set to TRUE. In that case, a slower algorithm that tests exact topological relationships is used if GEOS is available.)
In cases where a big number of polygons is passed to this function, the default processing may be really slow. You can skip the processing by adding METHOD=SKIP to the option list (the result of the function will be a multipolygon with all polygons as toplevel polygons) or only make it analyze counterclockwise polygons by adding METHOD=ONLY_CCW to the option list if you can assume that the outline of holes is counterclockwise defined (this is the convention for example in shapefiles, Personal Geodatabases or File Geodatabases).
For FileGDB, in most cases, but not always, a faster method than ONLY_CCW can be used. It is CCW_INNER_JUST_AFTER_CW_OUTER. When using it, inner rings are assumed to be counterclockwise oriented, and following immediately the outer ring (clockwise oriented) that they belong to. If that assumption is not met, an inner ring could be attached to the wrong outer ring, so this method must be used with care.
If the OGR_ORGANIZE_POLYGONS configuration option is defined, its value will override the value of the METHOD option of papszOptions (useful to modify the behavior of the shapefile driver)
 Parameters:
papoPolygons – array of geometry pointers  should all be OGRPolygons. Ownership of the geometries is passed, but not of the array itself.
nPolygonCount – number of items in papoPolygons
pbIsValidGeometry – value will be set TRUE if result is valid or FALSE otherwise.
papszOptions – a list of strings for passing options
 Returns:
a single resulting geometry (either OGRPolygon, OGRCurvePolygon, OGRMultiPolygon, OGRMultiSurface or OGRGeometryCollection). Returns a POLYGON EMPTY in the case of nPolygonCount being 0.

static bool haveGEOS()
Test if GEOS enabled.
This static method returns TRUE if GEOS support is built into OGR, otherwise it returns FALSE.
 Returns:
TRUE if available, otherwise FALSE.

static OGRGeometry *transformWithOptions(const OGRGeometry *poSrcGeom, OGRCoordinateTransformation *poCT, char **papszOptions, const TransformWithOptionsCache &cache = TransformWithOptionsCache())
Transform a geometry.
 Parameters:
poSrcGeom – source geometry
poCT – coordinate transformation object, or NULL.
papszOptions – options. Including WRAPDATELINE=YES and DATELINEOFFSET=.
cache – Cache. May increase performance if persisted between invocations
 Returns:
(new) transformed geometry.

static OGRGeometry *approximateArcAngles(double dfX, double dfY, double dfZ, double dfPrimaryRadius, double dfSecondaryAxis, double dfRotation, double dfStartAngle, double dfEndAngle, double dfMaxAngleStepSizeDegrees, const bool bUseMaxGap = false)
Stroke arc to linestring.
Stroke an arc of a circle to a linestring based on a center point, radius, start angle and end angle, all angles in degrees.
If the dfMaxAngleStepSizeDegrees is zero, then a default value will be used. This is currently 4 degrees unless the user has overridden the value with the OGR_ARC_STEPSIZE configuration variable.
If the OGR_ARC_MAX_GAP configuration variable is set, the straightline distance between adjacent pairs of interpolated points will be limited to the specified distance. If the distance between a pair of points exceeds this maximum, additional points are interpolated between the two points.
See also
 Since
OGR 1.8.0
 Parameters:
dfCenterX – center X
dfCenterY – center Y
dfZ – center Z
dfPrimaryRadius – X radius of ellipse.
dfSecondaryRadius – Y radius of ellipse.
dfRotation – rotation of the ellipse clockwise.
dfStartAngle – angle to first point on arc (clockwise of Xpositive)
dfEndAngle – angle to last point on arc (clockwise of Xpositive)
dfMaxAngleStepSizeDegrees – the largest step in degrees along the arc, zero to use the default setting.
bUseMaxGap – Optional: whether to honor OGR_ARC_MAX_GAP.
 Returns:
OGRLineString geometry representing an approximation of the arc.

static int GetCurveParameters(double x0, double y0, double x1, double y1, double x2, double y2, double &R, double &cx, double &cy, double &alpha0, double &alpha1, double &alpha2)
Returns the parameter of an arc circle.
Angles are return in radians, with trigonometic convention (counter clock wise)
 Since
GDAL 2.0
 Parameters:
x0 – x of first point
y0 – y of first point
x1 – x of intermediate point
y1 – y of intermediate point
x2 – x of final point
y2 – y of final point
R – radius (output)
cx – x of arc center (output)
cy – y of arc center (output)
alpha0 – angle between center and first point, in radians (output)
alpha1 – angle between center and intermediate point, in radians (output)
alpha2 – angle between center and final point, in radians (output)
 Returns:
TRUE if the points are not aligned and define an arc circle.

static OGRLineString *curveToLineString(double x0, double y0, double z0, double x1, double y1, double z1, double x2, double y2, double z2, int bHasZ, double dfMaxAngleStepSizeDegrees, const char *const *papszOptions = nullptr)
Converts an arc circle into an approximate line string.
The arc circle is defined by a first point, an intermediate point and a final point.
The provided dfMaxAngleStepSizeDegrees is a hint. The discretization algorithm may pick a slightly different value.
So as to avoid gaps when rendering curve polygons that share common arcs, this method is guaranteed to return a line with reversed vertex if called with inverted first and final point, and identical intermediate point.
 Since
GDAL 2.0
 Parameters:
x0 – x of first point
y0 – y of first point
z0 – z of first point
x1 – x of intermediate point
y1 – y of intermediate point
z1 – z of intermediate point
x2 – x of final point
y2 – y of final point
z2 – z of final point
bHasZ – TRUE if z must be taken into account
dfMaxAngleStepSizeDegrees – the largest step in degrees along the arc, zero to use the default setting.
papszOptions – options as a nullterminated list of strings or NULL. Recognized options:
ADD_INTERMEDIATE_POINT=STEALTH/YES/NO (Default to STEALTH). Determine if and how the intermediate point must be output in the linestring. If set to STEALTH, no explicit intermediate point is added but its properties are encoded in low significant bits of intermediate points and OGRGeometryFactory::curveFromLineString() can decode them. This is the best compromise for roundtripping in OGR and better results with PostGIS ST_LineToCurve() If set to YES, the intermediate point is explicitly added to the linestring. If set to NO, the intermediate point is not explicitly added.
 Returns:
the converted geometry (ownership to caller).

static OGRCurve *curveFromLineString(const OGRLineString *poLS, const char *const *papszOptions = nullptr)
Try to convert a linestring approximating curves into a curve.
This method can return a COMPOUNDCURVE, a CIRCULARSTRING or a LINESTRING.
This method is the reverse of curveFromLineString().
 Since
GDAL 2.0
 Parameters:
poLS – handle to the geometry to convert.
papszOptions – options as a nullterminated list of strings. Unused for now. Must be set to NULL.
 Returns:
the converted geometry (ownership to caller).

class TransformWithOptionsCache
Opaque class used as argument to transformWithOptions()

struct Private

struct Private

static OGRErr createFromWkb(const void*, OGRSpatialReference*, OGRGeometry**, size_t = static_cast<size_t>(1), OGRwkbVariant = wkbVariantOldOgc)
OGRGeometry class

class OGRGeometry
Abstract base class for all geometry classes.
Some spatial analysis methods require that OGR is built on the GEOS library to work properly. The precise meaning of methods that describe spatial relationships between geometries is described in the SFCOM, or other simple features interface specifications, like “OpenGIS® Implementation
Specification for Geographic information  Simple feature access  Part 1:
Common architecture”:
OGC 06103r4In GDAL 2.0, the hierarchy of classes has been extended with (working draft) ISO SQL/MM Part 3 (ISO/IEC 132493) curve geometries : CIRCULARSTRING (OGRCircularString), COMPOUNDCURVE (OGRCompoundCurve), CURVEPOLYGON (OGRCurvePolygon), MULTICURVE (OGRMultiCurve) and MULTISURFACE (OGRMultiSurface).
Subclassed by OGRCurve, OGRGeometryCollection, OGRPoint, OGRSurface
Public Functions

OGRGeometry(const OGRGeometry &other)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

OGRGeometry &operator=(const OGRGeometry &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

inline bool operator==(const OGRGeometry &other) const
Returns if two geometries are equal.

inline bool operator!=(const OGRGeometry &other) const
Returns if two geometries are different.

virtual int getDimension() const = 0
Get the dimension of this object.
This method corresponds to the SFCOM IGeometry::GetDimension() method. It indicates the dimension of the object, but does not indicate the dimension of the underlying space (as indicated by OGRGeometry::getCoordinateDimension()).
This method is the same as the C function OGR_G_GetDimension().
 Returns:
0 for points, 1 for lines and 2 for surfaces.

virtual int getCoordinateDimension() const
Get the dimension of the coordinates in this object.
This method is the same as the C function OGR_G_GetCoordinateDimension().
 Deprecated:
 Returns:
this will return 2 or 3.

int CoordinateDimension() const
Get the dimension of the coordinates in this object.
This method is the same as the C function OGR_G_CoordinateDimension().
 Since
GDAL 2.1
 Returns:
this will return 2 for XY, 3 for XYZ and XYM, and 4 for XYZM data.

virtual OGRBoolean IsEmpty() const = 0
Returns TRUE (nonzero) if the object has no points.
Normally this returns FALSE except between when an object is instantiated and points have been assigned.
This method relates to the SFCOM IGeometry::IsEmpty() method.
 Returns:
TRUE if object is empty, otherwise FALSE.

virtual OGRBoolean IsValid() const
Test if the geometry is valid.
This method is the same as the C function OGR_G_IsValid().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always return FALSE.
 Returns:
TRUE if the geometry has no points, otherwise FALSE.

virtual OGRGeometry *MakeValid(CSLConstList papszOptions = nullptr) const
Attempts to make an invalid geometry valid without losing vertices.
Alreadyvalid geometries are cloned without further intervention.
Running OGRGeometryFactory::removeLowerDimensionSubGeoms() as a postprocessing step is often desired.
This method is the same as the C function OGR_G_MakeValid().
This function is built on the GEOS >= 3.8 library, check it for the definition of the geometry operation. If OGR is built without the GEOS >= 3.8 library, this function will return a clone of the input geometry if it is valid, or NULL if it is invalid
 Since
GDAL 3.0
 Parameters:
papszOptions – NULL terminated list of options, or NULL. The following options are available:
METHOD=LINEWORK/STRUCTURE. LINEWORK is the default method, which combines all rings into a set of noded lines and then extracts valid polygons from that linework. The STRUCTURE method (requires GEOS >= 3.10 and GDAL >= 3.4) first makes all rings valid, then merges shells and subtracts holes from shells to generate valid result. Assumes that holes and shells are correctly categorized.
KEEP_COLLAPSED=YES/NO. Only for METHOD=STRUCTURE. NO (default): collapses are converted to empty geometries YES: collapses are converted to a valid geometry of lower dimension.
 Returns:
a newly allocated geometry now owned by the caller, or NULL on failure.

virtual OGRGeometry *Normalize() const
Attempts to bring geometry into normalized/canonical form.
This method is the same as the C function OGR_G_Normalize().
This function is built on the GEOS library; check it for the definition of the geometry operation. If OGR is built without the GEOS library, this function will always fail, issuing a CPLE_NotSupported error.
 Since
GDAL 3.3
 Returns:
a newly allocated geometry now owned by the caller, or NULL on failure.

virtual OGRBoolean IsSimple() const
Test if the geometry is simple.
This method is the same as the C function OGR_G_IsSimple().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always return FALSE.
 Returns:
TRUE if the geometry has no points, otherwise FALSE.

inline OGRBoolean Is3D() const
Returns whether the geometry has a Z component.

inline OGRBoolean IsMeasured() const
Returns whether the geometry has a M component.

virtual OGRBoolean IsRing() const
Test if the geometry is a ring.
This method is the same as the C function OGR_G_IsRing().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always return FALSE.
 Returns:
TRUE if the geometry has no points, otherwise FALSE.

virtual void empty() = 0
Clear geometry information.
This restores the geometry to its initial state after construction, and before assignment of actual geometry.
This method relates to the SFCOM IGeometry::Empty() method.
This method is the same as the C function OGR_G_Empty().

virtual OGRGeometry *clone() const = 0
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual void getEnvelope(OGREnvelope *psEnvelope) const = 0
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
This method is the same as the C function OGR_G_GetEnvelope().
 Parameters:
psEnvelope – the structure in which to place the results.

virtual void getEnvelope(OGREnvelope3D *psEnvelope) const = 0
Computes and returns the bounding envelope (3D) for this geometry in the passed psEnvelope structure.
This method is the same as the C function OGR_G_GetEnvelope3D().
 Since
OGR 1.9.0
 Parameters:
psEnvelope – the structure in which to place the results.

virtual size_t WkbSize() const = 0
Returns size of related binary representation.
This method returns the exact number of bytes required to hold the well known binary representation of this geometry object. Its computation may be slightly expensive for complex geometries.
This method relates to the SFCOM IWks::WkbSize() method.
This method is the same as the C function OGR_G_WkbSize().
 Returns:
size of binary representation in bytes.

OGRErr importFromWkb(const GByte*, size_t = static_cast<size_t>(1), OGRwkbVariant = wkbVariantOldOgc)
Assign geometry from well known binary data.
The object must have already been instantiated as the correct derived type of geometry object to match the binaries type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKB() method.
This method is the same as the C function OGR_G_ImportFromWkb().
 Parameters:
pabyData – the binary input data.
nSize – the size of pabyData in bytes, or 1 if not known.
eWkbVariant – if wkbVariantPostGIS1, special interpretation is done for curve geometries code
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual OGRErr importFromWkb(const unsigned char*, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) = 0
Assign geometry from well known binary data.
The object must have already been instantiated as the correct derived type of geometry object to match the binaries type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKB() method.
This method is the same as the C function OGR_G_ImportFromWkb().
 Since
GDAL 2.3
 Parameters:
pabyData – the binary input data.
nSize – the size of pabyData in bytes, or 1 if not known.
eWkbVariant – if wkbVariantPostGIS1, special interpretation is done for curve geometries code
nBytesConsumedOut – output parameter. Number of bytes consumed.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char*, OGRwkbVariant = wkbVariantOldOgc) const = 0
Convert a geometry into well known binary format.
This method relates to the SFCOM IWks::ExportToWKB() method.
This method is the same as the C function OGR_G_ExportToWkb() or OGR_G_ExportToIsoWkb(), depending on the value of eWkbVariant.
 Parameters:
eByteOrder – One of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
pabyData – a buffer into which the binary representation is written. This buffer must be at least OGRGeometry::WkbSize() byte in size.
eWkbVariant – What standard to use when exporting geometries with three dimensions (or more). The default wkbVariantOldOgc is the historical OGR variant. wkbVariantIso is the variant defined in ISO SQL/MM and adopted by OGC for SFSQL 1.2.
 Returns:
Currently OGRERR_NONE is always returned.

virtual OGRErr importFromWkt(const char **ppszInput) = 0
Assign geometry from well known text data.
The object must have already been instantiated as the correct derived type of geometry object to match the text type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKT() method.
This method is the same as the C function OGR_G_ImportFromWkt().
 Parameters:
ppszInput – pointer to a pointer to the source text. The pointer is updated to pointer after the consumed text.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant = wkbVariantOldOgc) const
Convert a geometry into well known text format.
This method relates to the SFCOM IWks::ExportToWKT() method.
This method is the same as the C function OGR_G_ExportToWkt().
 Parameters:
ppszDstText – a text buffer is allocated by the program, and assigned to the passed pointer. After use, *ppszDstText should be freed with CPLFree().
variant – the specification that must be conformed too :
wkbVariantOgc for oldstyle 99402 extended dimension (Z) WKB types
wkbVariantIso for SFSQL 1.2 and ISO SQL/MM Part 3
 Returns:
Currently OGRERR_NONE is always returned.

virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(), OGRErr *err = nullptr) const = 0
Export a WKT geometry.
 Parameters:
opts – Output options.
err – Pointer to error code, if desired.
 Returns:
WKT string representing this geometry.

virtual OGRwkbGeometryType getGeometryType() const = 0
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

OGRwkbGeometryType getIsoGeometryType() const
Get the geometry type that conforms with ISO SQL/MM Part3.
 Returns:
the geometry type that conforms with ISO SQL/MM Part3

virtual const char *getGeometryName() const = 0
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual void dumpReadable(FILE*, const char* = nullptr, char **papszOptions = nullptr) const
Dump geometry in well known text format to indicated output file.
A few options can be defined to change the default dump :
DISPLAY_GEOMETRY=NO : to hide the dump of the geometry
DISPLAY_GEOMETRY=WKT or YES (default) : dump the geometry as a WKT
DISPLAY_GEOMETRY=SUMMARY : to get only a summary of the geometry
This method is the same as the C function OGR_G_DumpReadable().
 Parameters:
fp – the text file to write the geometry to.
pszPrefix – the prefix to put on each line of output.
papszOptions – NULL terminated list of options (may be NULL)

virtual void flattenTo2D() = 0
Convert geometry to strictly 2D.
In a sense this converts all Z coordinates to 0.0.
This method is the same as the C function OGR_G_FlattenTo2D().

virtual char *exportToGML(const char *const *papszOptions = nullptr) const
Convert a geometry into GML format.
The GML geometry is expressed directly in terms of GML basic data types assuming the this is available in the gml namespace. The returned string should be freed with CPLFree() when no longer required.
The supported options in OGR 1.8.0 are :
FORMAT=GML3. Otherwise it will default to GML 2.1.2 output.
GML3_LINESTRING_ELEMENT=curve. (Only valid for FORMAT=GML3) To use gml:Curve element for linestrings. Otherwise gml:LineString will be used .
GML3_LONGSRS=YES/NO. (Only valid for FORMAT=GML3) Default to YES. If YES, SRS with EPSG authority will be written with the “urn:ogc:def:crs:EPSG::” prefix. In the case, if the SRS is a geographic SRS without explicit AXIS order, but that the same SRS authority code imported with ImportFromEPSGA() should be treated as lat/long, then the function will take care of coordinate order swapping. If set to NO, SRS with EPSG authority will be written with the “EPSG:” prefix, even if they are in lat/long order.
This method is the same as the C function OGR_G_ExportToGMLEx().
 Parameters:
papszOptions – NULLterminated list of options.
 Returns:
A GML fragment or NULL in case of error.

virtual char *exportToKML() const
Convert a geometry into KML format.
The returned string should be freed with CPLFree() when no longer required.
This method is the same as the C function OGR_G_ExportToKML().
 Returns:
A KML fragment or NULL in case of error.

virtual char *exportToJson() const
Convert a geometry into GeoJSON format.
The returned string should be freed with CPLFree() when no longer required.
This method is the same as the C function OGR_G_ExportToJson().
 Returns:
A GeoJSON fragment or NULL in case of error.

virtual void accept(IOGRGeometryVisitor *visitor) = 0
Accept a visitor.

virtual void accept(IOGRConstGeometryVisitor *visitor) const = 0
Accept a visitor.

virtual GEOSGeom exportToGEOS(GEOSContextHandle_t hGEOSCtxt) const
Returns a GEOSGeom object corresponding to the geometry.
 Parameters:
hGEOSCtxt – GEOS context
 Returns:
a GEOSGeom object corresponding to the geometry.

virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const
Returns if this geometry is or has curve geometry.
Returns if a geometry is, contains or may contain a CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE.
If bLookForNonLinear is set to TRUE, it will be actually looked if the geometry or its subgeometries are or contain a nonlinear geometry in them. In which case, if the method returns TRUE, it means that getLinearGeometry() would return an approximate version of the geometry. Otherwise, getLinearGeometry() would do a conversion, but with just converting container type, like COMPOUNDCURVE > LINESTRING, MULTICURVE > MULTILINESTRING or MULTISURFACE > MULTIPOLYGON, resulting in a “lossless” conversion.
This method is the same as the C function OGR_G_HasCurveGeometry().
 Since
GDAL 2.0
 Parameters:
bLookForNonLinear – set it to TRUE to check if the geometry is or contains a CIRCULARSTRING.
 Returns:
TRUE if this geometry is or has curve geometry.

virtual OGRGeometry *getCurveGeometry(const char *const *papszOptions = nullptr) const
Return curve version of this geometry.
Returns a geometry that has possibly CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE in it, by deapproximating curve geometries.
If the geometry has no curve portion, the returned geometry will be a clone of it.
The ownership of the returned geometry belongs to the caller.
The reverse method is OGRGeometry::getLinearGeometry().
This function is the same as C function OGR_G_GetCurveGeometry().
 Since
GDAL 2.0
 Parameters:
papszOptions – options as a nullterminated list of strings. Unused for now. Must be set to NULL.
 Returns:
a new geometry.

virtual OGRGeometry *getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0, const char *const *papszOptions = nullptr) const
Return, possibly approximate, noncurve version of this geometry.
Returns a geometry that has no CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE in it, by approximating curve geometries.
The ownership of the returned geometry belongs to the caller.
The reverse method is OGRGeometry::getCurveGeometry().
This method is the same as the C function OGR_G_GetLinearGeometry().
 Since
GDAL 2.0
 Parameters:
dfMaxAngleStepSizeDegrees – the largest step in degrees along the arc, zero to use the default setting.
papszOptions – options as a nullterminated list of strings. See OGRGeometryFactory::curveToLineString() for valid options.
 Returns:
a new geometry.

virtual void closeRings()
Force rings to be closed.
If this geometry, or any contained geometries has polygon rings that are not closed, they will be closed by adding the starting point at the end.

virtual void setCoordinateDimension(int nDimension)
Set the coordinate dimension.
This method sets the explicit coordinate dimension. Setting the coordinate dimension of a geometry to 2 should zero out any existing Z values. Setting the dimension of a geometry collection, a compound curve, a polygon, etc. will affect the children geometries. This will also remove the M dimension if present before this call.
 Deprecated:
use set3D() or setMeasured().
 Parameters:
nNewDimension – New coordinate dimension value, either 2 or 3.

virtual void set3D(OGRBoolean bIs3D)
Add or remove the Z coordinate dimension.
This method adds or removes the explicit Z coordinate dimension. Removing the Z coordinate dimension of a geometry will remove any existing Z values. Adding the Z dimension to a geometry collection, a compound curve, a polygon, etc. will affect the children geometries.
 Since
GDAL 2.1
 Parameters:
bIs3D – Should the geometry have a Z dimension, either TRUE or FALSE.

virtual void setMeasured(OGRBoolean bIsMeasured)
Add or remove the M coordinate dimension.
This method adds or removes the explicit M coordinate dimension. Removing the M coordinate dimension of a geometry will remove any existing M values. Adding the M dimension to a geometry collection, a compound curve, a polygon, etc. will affect the children geometries.
 Since
GDAL 2.1
 Parameters:
bIsMeasured – Should the geometry have a M dimension, either TRUE or FALSE.

virtual void assignSpatialReference(OGRSpatialReference *poSR)
Assign spatial reference to this object.
Any existing spatial reference is replaced, but under no circumstances does this result in the object being reprojected. It is just changing the interpretation of the existing geometry. Note that assigning a spatial reference increments the reference count on the OGRSpatialReference, but does not copy it.
Starting with GDAL 2.3, this will also assign the spatial reference to potential subgeometries of the geometry (OGRGeometryCollection, OGRCurvePolygon/OGRPolygon, OGRCompoundCurve, OGRPolyhedralSurface and their derived classes).
This is similar to the SFCOM IGeometry::put_SpatialReference() method.
This method is the same as the C function OGR_G_AssignSpatialReference().
 Parameters:
poSR – new spatial reference system to apply.

inline OGRSpatialReference *getSpatialReference(void) const
Returns spatial reference system for object.
This method relates to the SFCOM IGeometry::get_SpatialReference() method.
This method is the same as the C function OGR_G_GetSpatialReference().
 Returns:
a reference to the spatial reference object. The object may be shared with many geometry objects, and should not be modified.

virtual OGRErr transform(OGRCoordinateTransformation *poCT) = 0
Apply arbitrary coordinate transformation to geometry.
This method will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.
Note that this method does not require that the geometry already have a spatial reference system. It will be assumed that they can be treated as having the source spatial reference system of the OGRCoordinateTransformation object, and the actual SRS of the geometry will be ignored. On successful completion the output OGRSpatialReference of the OGRCoordinateTransformation will be assigned to the geometry.
This method is the same as the C function OGR_G_Transform().
 Parameters:
poCT – the transformation to apply.
 Returns:
OGRERR_NONE on success or an error code.

OGRErr transformTo(OGRSpatialReference *poSR)
Transform geometry to new spatial reference system.
This method will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.
This method will only work if the geometry already has an assigned spatial reference system, and if it is transformable to the target coordinate system.
Because this method requires internal creation and initialization of an OGRCoordinateTransformation object it is significantly more expensive to use this method to transform many geometries than it is to create the OGRCoordinateTransformation in advance, and call transform() with that transformation. This method exists primarily for convenience when only transforming a single geometry.
This method is the same as the C function OGR_G_TransformTo().
 Parameters:
poSR – spatial reference system to transform to.
 Returns:
OGRERR_NONE on success, or an error code.

virtual void segmentize(double dfMaxLength)
Modify the geometry such it has no segment longer then the given distance.
This method modifies the geometry to add intermediate vertices if necessary so that the maximum length between 2 consecutive vertices is lower than dfMaxLength.
Interpolated points will have Z and M values (if needed) set to 0. Distance computation is performed in 2d only
This function is the same as the C function OGR_G_Segmentize()
 Parameters:
dfMaxLength – the maximum distance between 2 points after segmentization

virtual OGRBoolean Intersects(const OGRGeometry*) const
Do these features intersect?
Determines whether two geometries intersect. If GEOS is enabled, then this is done in rigorous fashion otherwise TRUE is returned if the envelopes (bounding boxes) of the two geometries overlap.
The poOtherGeom argument may be safely NULL, but in this case the method will always return TRUE. That is, a NULL geometry is treated as being everywhere.
This method is the same as the C function OGR_G_Intersects().
 Parameters:
poOtherGeom – the other geometry to test against.
 Returns:
TRUE if the geometries intersect, otherwise FALSE.

virtual OGRBoolean Equals(const OGRGeometry*) const = 0
Returns TRUE if two geometries are equivalent.
This operation implements the SQL/MM ST_OrderingEquals() operation.
The comparison is done in a structural way, that is to say that the geometry types must be identical, as well as the number and ordering of subgeometries and vertices. Or equivalently, two geometries are considered equal by this method if their WKT/WKB representation is equal. Note: this must be distinguished for equality in a spatial way (which is the purpose of the ST_Equals() operation).
This method is the same as the C function OGR_G_Equals().
 Returns:
TRUE if equivalent or FALSE otherwise.

virtual OGRBoolean Disjoint(const OGRGeometry*) const
Test for disjointness.
Tests if this geometry and the other passed into the method are disjoint.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_Disjoint().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
poOtherGeom – the geometry to compare to this geometry.
 Returns:
TRUE if they are disjoint, otherwise FALSE.

virtual OGRBoolean Touches(const OGRGeometry*) const
Test for touching.
Tests if this geometry and the other passed into the method are touching.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_Touches().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
poOtherGeom – the geometry to compare to this geometry.
 Returns:
TRUE if they are touching, otherwise FALSE.

virtual OGRBoolean Crosses(const OGRGeometry*) const
Test for crossing.
Tests if this geometry and the other passed into the method are crossing.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_Crosses().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
poOtherGeom – the geometry to compare to this geometry.
 Returns:
TRUE if they are crossing, otherwise FALSE.

virtual OGRBoolean Within(const OGRGeometry*) const
Test for containment.
Tests if actual geometry object is within the passed geometry.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_Within().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
poOtherGeom – the geometry to compare to this geometry.
 Returns:
TRUE if poOtherGeom is within this geometry, otherwise FALSE.

virtual OGRBoolean Contains(const OGRGeometry*) const
Test for containment.
Tests if actual geometry object contains the passed geometry.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_Contains().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
poOtherGeom – the geometry to compare to this geometry.
 Returns:
TRUE if poOtherGeom contains this geometry, otherwise FALSE.

virtual OGRBoolean Overlaps(const OGRGeometry*) const
Test for overlap.
Tests if this geometry and the other passed into the method overlap, that is their intersection has a nonzero area.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_Overlaps().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
poOtherGeom – the geometry to compare to this geometry.
 Returns:
TRUE if they are overlapping, otherwise FALSE.

virtual OGRGeometry *Boundary() const
Compute boundary.
A new geometry object is created and returned containing the boundary of the geometry on which the method is invoked.
This method is the same as the C function OGR_G_Boundary().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Since
OGR 1.8.0
 Returns:
a newly allocated geometry now owned by the caller, or NULL on failure.

virtual double Distance(const OGRGeometry*) const
Compute distance between two geometries.
Returns the shortest distance between the two geometries. The distance is expressed into the same unit as the coordinates of the geometries.
This method is the same as the C function OGR_G_Distance().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
poOtherGeom – the other geometry to compare against.
 Returns:
the distance between the geometries or 1 if an error occurs.

virtual OGRGeometry *ConvexHull() const
Compute convex hull.
A new geometry object is created and returned containing the convex hull of the geometry on which the method is invoked.
This method is the same as the C function OGR_G_ConvexHull().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Returns:
a newly allocated geometry now owned by the caller, or NULL on failure.

virtual OGRGeometry *ConcaveHull(double dfRatio, bool bAllowHoles) const
Compute “concave hull” of a geometry.
The concave hull is fully contained within the convex hull and also contains all the points of the input, but in a smaller area. The area ratio is the ratio of the area of the convex hull and the concave hull. Frequently used to convert a multipoint into a polygonal area. that contains all the points in the input Geometry.
A new geometry object is created and returned containing the concave hull of the geometry on which the method is invoked.
This method is the same as the C function OGR_G_ConcaveHull().
This method is built on the GEOS >= 3.11 library If OGR is built without the GEOS >= 3.11 librray, this method will always fail, issuing a CPLE_NotSupported error.
 Since
GDAL 3.6
 Parameters:
dfRatio – Ratio of the area of the convex hull and the concave hull.
bAllowHoles – Whether holes are allowed.
 Returns:
a newly allocated geometry now owned by the caller, or NULL on failure.

virtual OGRGeometry *Buffer(double dfDist, int nQuadSegs = 30) const
Compute buffer of geometry.
Builds a new geometry containing the buffer region around the geometry on which it is invoked. The buffer is a polygon containing the region within the buffer distance of the original geometry.
Some buffer sections are properly described as curves, but are converted to approximate polygons. The nQuadSegs parameter can be used to control how many segments should be used to define a 90 degree curve  a quadrant of a circle. A value of 30 is a reasonable default. Large values result in large numbers of vertices in the resulting buffer geometry while small numbers reduce the accuracy of the result.
This method is the same as the C function OGR_G_Buffer().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
dfDist – the buffer distance to be applied. Should be expressed into the same unit as the coordinates of the geometry.
nQuadSegs – the number of segments used to approximate a 90 degree (quadrant) of curvature.
 Returns:
the newly created geometry, or NULL if an error occurs.

virtual OGRGeometry *Intersection(const OGRGeometry*) const
Compute intersection.
Generates a new geometry which is the region of intersection of the two geometries operated on. The Intersects() method can be used to test if two geometries intersect.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_Intersection().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
poOtherGeom – the other geometry intersected with “this” geometry.
 Returns:
a new geometry representing the intersection or NULL if there is no intersection or an error occurs.

virtual OGRGeometry *Union(const OGRGeometry*) const
Compute union.
Generates a new geometry which is the region of union of the two geometries operated on.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_Union().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
poOtherGeom – the other geometry unioned with “this” geometry.
 Returns:
a new geometry representing the union or NULL if an error occurs.

virtual OGRGeometry *UnionCascaded() const
Compute union using cascading.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_UnionCascaded().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Since
OGR 1.8.0
 Returns:
a new geometry representing the union or NULL if an error occurs.

virtual OGRGeometry *Difference(const OGRGeometry*) const
Compute difference.
Generates a new geometry which is the region of this geometry with the region of the second geometry removed.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_Difference().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
poOtherGeom – the other geometry removed from “this” geometry.
 Returns:
a new geometry representing the difference or NULL if the difference is empty or an error occurs.

virtual OGRGeometry *SymDifference(const OGRGeometry*) const
Compute symmetric difference.
Generates a new geometry which is the symmetric difference of this geometry and the second geometry passed into the method.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_SymDifference().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Since
OGR 1.8.0
 Parameters:
poOtherGeom – the other geometry.
 Returns:
a new geometry representing the symmetric difference or NULL if the difference is empty or an error occurs.

virtual OGRErr Centroid(OGRPoint *poPoint) const
Compute the geometry centroid.
The centroid location is applied to the passed in OGRPoint object. The centroid is not necessarily within the geometry.
This method relates to the SFCOM ISurface::get_Centroid() method however the current implementation based on GEOS can operate on other geometry types such as multipoint, linestring, geometrycollection such as multipolygons. OGC SF SQL 1.1 defines the operation for surfaces (polygons). SQL/MMPart 3 defines the operation for surfaces and multisurfaces (multipolygons).
This function is the same as the C function OGR_G_Centroid().
This function is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this function will always fail, issuing a CPLE_NotSupported error.
 Since
OGR 1.8.0 as a OGRGeometry method (previously was restricted to OGRPolygon)
 Returns:
OGRERR_NONE on success or OGRERR_FAILURE on error.

virtual OGRGeometry *Simplify(double dTolerance) const
Simplify the geometry.
This function is the same as the C function OGR_G_Simplify().
This function is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this function will always fail, issuing a CPLE_NotSupported error.
 Since
OGR 1.8.0
 Parameters:
dTolerance – the distance tolerance for the simplification.
 Returns:
the simplified geometry or NULL if an error occurs.

OGRGeometry *SimplifyPreserveTopology(double dTolerance) const
Simplify the geometry while preserving topology.
This function is the same as the C function OGR_G_SimplifyPreserveTopology().
This function is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this function will always fail, issuing a CPLE_NotSupported error.
 Since
OGR 1.9.0
 Parameters:
dTolerance – the distance tolerance for the simplification.
 Returns:
the simplified geometry or NULL if an error occurs.

virtual OGRGeometry *DelaunayTriangulation(double dfTolerance, int bOnlyEdges) const
Return a Delaunay triangulation of the vertices of the geometry.
This function is the same as the C function OGR_G_DelaunayTriangulation().
This function is built on the GEOS library, v3.4 or above. If OGR is built without the GEOS library, this function will always fail, issuing a CPLE_NotSupported error.
 Since
OGR 2.1
 Parameters:
dfTolerance – optional snapping tolerance to use for improved robustness
bOnlyEdges – if TRUE, will return a MULTILINESTRING, otherwise it will return a GEOMETRYCOLLECTION containing triangular POLYGONs.
 Returns:
the geometry resulting from the Delaunay triangulation or NULL if an error occurs.

virtual OGRGeometry *Polygonize() const
Polygonizes a set of sparse edges.
A new geometry object is created and returned containing a collection of reassembled Polygons: NULL will be returned if the input collection doesn’t corresponds to a MultiLinestring, or when reassembling Edges into Polygons is impossible due to topological inconsistencies.
This method is the same as the C function OGR_G_Polygonize().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Since
OGR 1.9.0
 Returns:
a newly allocated geometry now owned by the caller, or NULL on failure.

virtual double Distance3D(const OGRGeometry *poOtherGeom) const
Returns the 3D distance between two geometries.
The distance is expressed into the same unit as the coordinates of the geometries.
This method is built on the SFCGAL library, check it for the definition of the geometry operation. If OGR is built without the SFCGAL library, this method will always return 1.0
This function is the same as the C function OGR_G_Distance3D().
 Since
GDAL 2.2
 Returns:
distance between the two geometries

virtual void swapXY()
Swap x and y coordinates.
 Since
OGR 1.8.0

inline OGRPoint *toPoint()
Downcast to OGRPoint*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbPoint.
 Since
GDAL 2.3

inline const OGRPoint *toPoint() const
Downcast to OGRPoint*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbPoint.
 Since
GDAL 2.3

inline OGRCurve *toCurve()
Downcast to OGRCurve*.
Implies prior checking that OGR_GT_IsSubClass(getGeometryType(), wkbCurve).
 Since
GDAL 2.3

inline const OGRCurve *toCurve() const
Downcast to OGRCurve*.
Implies prior checking that OGR_GT_IsSubClass(getGeometryType(), wkbCurve).
 Since
GDAL 2.3

inline OGRSimpleCurve *toSimpleCurve()
Downcast to OGRSimpleCurve*.
Implies prior checking that getGeometryType() is wkbLineString, wkbCircularString or a derived type.
 Since
GDAL 2.3

inline const OGRSimpleCurve *toSimpleCurve() const
Downcast to OGRSimpleCurve*.
Implies prior checking that getGeometryType() is wkbLineString, wkbCircularString or a derived type.
 Since
GDAL 2.3

inline OGRLineString *toLineString()
Downcast to OGRLineString*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbLineString.
 Since
GDAL 2.3

inline const OGRLineString *toLineString() const
Downcast to OGRLineString*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbLineString.
 Since
GDAL 2.3

inline OGRLinearRing *toLinearRing()
Downcast to OGRLinearRing*.
Implies prior checking that EQUAL(getGeometryName(), “LINEARRING”).
 Since
GDAL 2.3

inline const OGRLinearRing *toLinearRing() const
Downcast to OGRLinearRing*.
Implies prior checking that EQUAL(getGeometryName(), “LINEARRING”).
 Since
GDAL 2.3

inline OGRCircularString *toCircularString()
Downcast to OGRCircularString*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbCircularString.
 Since
GDAL 2.3

inline const OGRCircularString *toCircularString() const
Downcast to OGRCircularString*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbCircularString.
 Since
GDAL 2.3

inline OGRCompoundCurve *toCompoundCurve()
Downcast to OGRCompoundCurve*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbCompoundCurve.
 Since
GDAL 2.3

inline const OGRCompoundCurve *toCompoundCurve() const
Downcast to OGRCompoundCurve*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbCompoundCurve.
 Since
GDAL 2.3

inline OGRSurface *toSurface()
Downcast to OGRSurface*.
Implies prior checking that OGR_GT_IsSubClass(getGeometryType(), wkbSurface).
 Since
GDAL 2.3

inline const OGRSurface *toSurface() const
Downcast to OGRSurface*.
Implies prior checking that OGR_GT_IsSubClass(getGeometryType(), wkbSurface).
 Since
GDAL 2.3

inline OGRPolygon *toPolygon()
Downcast to OGRPolygon*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbPolygon or wkbTriangle.
 Since
GDAL 2.3

inline const OGRPolygon *toPolygon() const
Downcast to OGRPolygon*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbPolygon or wkbTriangle.
 Since
GDAL 2.3

inline OGRTriangle *toTriangle()
Downcast to OGRTriangle*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbTriangle.
 Since
GDAL 2.3

inline const OGRTriangle *toTriangle() const
Downcast to OGRTriangle*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbTriangle.
 Since
GDAL 2.3

inline OGRCurvePolygon *toCurvePolygon()
Downcast to OGRCurvePolygon*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbCurvePolygon or wkbPolygon or wkbTriangle.
 Since
GDAL 2.3

inline const OGRCurvePolygon *toCurvePolygon() const
Downcast to OGRCurvePolygon*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbCurvePolygon or wkbPolygon or wkbTriangle.
 Since
GDAL 2.3

inline OGRGeometryCollection *toGeometryCollection()
Downcast to OGRGeometryCollection*.
Implies prior checking that OGR_GT_IsSubClass(getGeometryType(), wkbGeometryCollection).
 Since
GDAL 2.3

inline const OGRGeometryCollection *toGeometryCollection() const
Downcast to OGRGeometryCollection*.
Implies prior checking that OGR_GT_IsSubClass(getGeometryType(), wkbGeometryCollection).
 Since
GDAL 2.3

inline OGRMultiPoint *toMultiPoint()
Downcast to OGRMultiPoint*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbMultiPoint.
 Since
GDAL 2.3

inline const OGRMultiPoint *toMultiPoint() const
Downcast to OGRMultiPoint*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbMultiPoint.
 Since
GDAL 2.3

inline OGRMultiLineString *toMultiLineString()
Downcast to OGRMultiLineString*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbMultiLineString.
 Since
GDAL 2.3

inline const OGRMultiLineString *toMultiLineString() const
Downcast to OGRMultiLineString*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbMultiLineString.
 Since
GDAL 2.3

inline OGRMultiPolygon *toMultiPolygon()
Downcast to OGRMultiPolygon*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbMultiPolygon.
 Since
GDAL 2.3

inline const OGRMultiPolygon *toMultiPolygon() const
Downcast to OGRMultiPolygon*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbMultiPolygon.
 Since
GDAL 2.3

inline OGRMultiCurve *toMultiCurve()
Downcast to OGRMultiCurve*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbMultiCurve and derived types.
 Since
GDAL 2.3

inline const OGRMultiCurve *toMultiCurve() const
Downcast to OGRMultiCurve*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbMultiCurve and derived types.
 Since
GDAL 2.3

inline OGRMultiSurface *toMultiSurface()
Downcast to OGRMultiSurface*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbMultiSurface and derived types.
 Since
GDAL 2.3

inline const OGRMultiSurface *toMultiSurface() const
Downcast to OGRMultiSurface*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbMultiSurface and derived types.
 Since
GDAL 2.3

inline OGRPolyhedralSurface *toPolyhedralSurface()
Downcast to OGRPolyhedralSurface*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbPolyhedralSurface or wkbTIN.
 Since
GDAL 2.3

inline const OGRPolyhedralSurface *toPolyhedralSurface() const
Downcast to OGRPolyhedralSurface*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbPolyhedralSurface or wkbTIN.
 Since
GDAL 2.3

inline OGRTriangulatedSurface *toTriangulatedSurface()
Downcast to OGRTriangulatedSurface*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbTIN.
 Since
GDAL 2.3

inline const OGRTriangulatedSurface *toTriangulatedSurface() const
Downcast to OGRTriangulatedSurface*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbTIN.
 Since
GDAL 2.3
Public Static Functions

static GEOSContextHandle_t createGEOSContext()
Create a new GEOS context.
 Returns:
a new GEOS context.

static void freeGEOSContext(GEOSContextHandle_t hGEOSCtxt)
Destroy a GEOS context.
 Parameters:
hGEOSCtxt – GEOS context

static inline OGRGeometryH ToHandle(OGRGeometry *poGeom)
Convert a OGRGeometry* to a OGRGeometryH.
 Since
GDAL 2.3

static inline OGRGeometry *FromHandle(OGRGeometryH hGeom)
Convert a OGRGeometryH to a OGRGeometry*.
 Since
GDAL 2.3

OGRGeometry(const OGRGeometry &other)
OGRPoint class

class OGRPoint : public OGRGeometry
Point class.
Implements SFCOM IPoint methods.
Subclassed by OGRIteratedPoint
Public Functions

OGRPoint()
Create an empty point.

OGRPoint(double x, double y)
Create a point.
 Parameters:
xIn – x
yIn – y

OGRPoint(double x, double y, double z)
Create a point.
 Parameters:
xIn – x
yIn – y
zIn – z

OGRPoint(double x, double y, double z, double m)
Create a point.
 Parameters:
xIn – x
yIn – y
zIn – z
mIn – m

OGRPoint(const OGRPoint &other)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

OGRPoint &operator=(const OGRPoint &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

virtual size_t WkbSize() const override
Returns size of related binary representation.
This method returns the exact number of bytes required to hold the well known binary representation of this geometry object. Its computation may be slightly expensive for complex geometries.
This method relates to the SFCOM IWks::WkbSize() method.
This method is the same as the C function OGR_G_WkbSize().
 Returns:
size of binary representation in bytes.

virtual OGRErr importFromWkb(const unsigned char*, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
The object must have already been instantiated as the correct derived type of geometry object to match the binaries type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKB() method.
This method is the same as the C function OGR_G_ImportFromWkb().
 Since
GDAL 2.3
 Parameters:
pabyData – the binary input data.
nSize – the size of pabyData in bytes, or 1 if not known.
eWkbVariant – if wkbVariantPostGIS1, special interpretation is done for curve geometries code
nBytesConsumedOut – output parameter. Number of bytes consumed.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char*, OGRwkbVariant = wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
This method relates to the SFCOM IWks::ExportToWKB() method.
This method is the same as the C function OGR_G_ExportToWkb() or OGR_G_ExportToIsoWkb(), depending on the value of eWkbVariant.
 Parameters:
eByteOrder – One of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
pabyData – a buffer into which the binary representation is written. This buffer must be at least OGRGeometry::WkbSize() byte in size.
eWkbVariant – What standard to use when exporting geometries with three dimensions (or more). The default wkbVariantOldOgc is the historical OGR variant. wkbVariantIso is the variant defined in ISO SQL/MM and adopted by OGC for SFSQL 1.2.
 Returns:
Currently OGRERR_NONE is always returned.

virtual OGRErr importFromWkt(const char**) override
Assign geometry from well known text data.
The object must have already been instantiated as the correct derived type of geometry object to match the text type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKT() method.
This method is the same as the C function OGR_G_ImportFromWkt().
 Parameters:
ppszInput – pointer to a pointer to the source text. The pointer is updated to pointer after the consumed text.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(), OGRErr *err = nullptr) const override
Export a point to WKT.
 Parameters:
opts – Output options.
err – Pointer to error code, if desired.
 Returns:
WKT string representing this point.

virtual int getDimension() const override
Get the dimension of this object.
This method corresponds to the SFCOM IGeometry::GetDimension() method. It indicates the dimension of the object, but does not indicate the dimension of the underlying space (as indicated by OGRGeometry::getCoordinateDimension()).
This method is the same as the C function OGR_G_GetDimension().
 Returns:
0 for points, 1 for lines and 2 for surfaces.

virtual OGRPoint *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual void empty() override
Clear geometry information.
This restores the geometry to its initial state after construction, and before assignment of actual geometry.
This method relates to the SFCOM IGeometry::Empty() method.
This method is the same as the C function OGR_G_Empty().

virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
This method is the same as the C function OGR_G_GetEnvelope().
 Parameters:
psEnvelope – the structure in which to place the results.

virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override
Computes and returns the bounding envelope (3D) for this geometry in the passed psEnvelope structure.
This method is the same as the C function OGR_G_GetEnvelope3D().
 Since
OGR 1.9.0
 Parameters:
psEnvelope – the structure in which to place the results.

inline virtual OGRBoolean IsEmpty() const override
Returns TRUE (nonzero) if the object has no points.
Normally this returns FALSE except between when an object is instantiated and points have been assigned.
This method relates to the SFCOM IGeometry::IsEmpty() method.
 Returns:
TRUE if object is empty, otherwise FALSE.

inline double getX() const
Return x.
Fetch X coordinate.
Relates to the SFCOM IPoint::get_X() method.
 Returns:
the X coordinate of this point.

inline double getY() const
Return y.
Fetch Y coordinate.
Relates to the SFCOM IPoint::get_Y() method.
 Returns:
the Y coordinate of this point.

inline double getZ() const
Return z.
Fetch Z coordinate.
Relates to the SFCOM IPoint::get_Z() method.
 Returns:
the Z coordinate of this point, or zero if it is a 2D point.

inline double getM() const
Return m.

virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
This method sets the explicit coordinate dimension. Setting the coordinate dimension of a geometry to 2 should zero out any existing Z values. Setting the dimension of a geometry collection, a compound curve, a polygon, etc. will affect the children geometries. This will also remove the M dimension if present before this call.
 Deprecated:
use set3D() or setMeasured().
 Parameters:
nNewDimension – New coordinate dimension value, either 2 or 3.

inline void setX(double xIn)
Set x.
Assign point X coordinate.
There is no corresponding SFCOM method.
 Parameters:
xIn – x

inline void setY(double yIn)
Set y.
Assign point Y coordinate.
There is no corresponding SFCOM method.
 Parameters:
yIn – y

inline void setZ(double zIn)
Set z.
Assign point Z coordinate.
Calling this method will force the geometry coordinate dimension to 3D (wkbPointwkbZ).
There is no corresponding SFCOM method.
 Parameters:
zIn – z

inline void setM(double mIn)
Set m.
 Parameters:
mIn – m

virtual OGRBoolean Equals(const OGRGeometry*) const override
Returns TRUE if two geometries are equivalent.
This operation implements the SQL/MM ST_OrderingEquals() operation.
The comparison is done in a structural way, that is to say that the geometry types must be identical, as well as the number and ordering of subgeometries and vertices. Or equivalently, two geometries are considered equal by this method if their WKT/WKB representation is equal. Note: this must be distinguished for equality in a spatial way (which is the purpose of the ST_Equals() operation).
This method is the same as the C function OGR_G_Equals().
 Returns:
TRUE if equivalent or FALSE otherwise.

virtual OGRBoolean Intersects(const OGRGeometry*) const override
Do these features intersect?
Determines whether two geometries intersect. If GEOS is enabled, then this is done in rigorous fashion otherwise TRUE is returned if the envelopes (bounding boxes) of the two geometries overlap.
The poOtherGeom argument may be safely NULL, but in this case the method will always return TRUE. That is, a NULL geometry is treated as being everywhere.
This method is the same as the C function OGR_G_Intersects().
 Parameters:
poOtherGeom – the other geometry to test against.
 Returns:
TRUE if the geometries intersect, otherwise FALSE.

virtual OGRBoolean Within(const OGRGeometry*) const override
Test for containment.
Tests if actual geometry object is within the passed geometry.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_Within().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
poOtherGeom – the geometry to compare to this geometry.
 Returns:
TRUE if poOtherGeom is within this geometry, otherwise FALSE.

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
This method will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.
Note that this method does not require that the geometry already have a spatial reference system. It will be assumed that they can be treated as having the source spatial reference system of the OGRCoordinateTransformation object, and the actual SRS of the geometry will be ignored. On successful completion the output OGRSpatialReference of the OGRCoordinateTransformation will be assigned to the geometry.
This method is the same as the C function OGR_G_Transform().
 Parameters:
poCT – the transformation to apply.
 Returns:
OGRERR_NONE on success or an error code.

virtual void flattenTo2D() override
Convert geometry to strictly 2D.
In a sense this converts all Z coordinates to 0.0.
This method is the same as the C function OGR_G_FlattenTo2D().

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.

virtual void swapXY() override
Swap x and y coordinates.
 Since
OGR 1.8.0

OGRPoint()
OGRLineString class

class OGRLineString : public OGRSimpleCurve
Concrete representation of a multivertex line.
Note: for implementation convenience, we make it inherit from OGRSimpleCurve whereas SFSQL and SQL/MM only make it inherits from OGRCurve.
Subclassed by OGRLinearRing
Public Functions

OGRLineString()
Create an empty line string.

OGRLineString(const OGRLineString &other)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

OGRLineString &operator=(const OGRLineString &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

virtual OGRLineString *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual OGRLineString *CurveToLine(double dfMaxAngleStepSizeDegrees = 0, const char *const *papszOptions = nullptr) const override
Return a linestring from a curve geometry.
The returned geometry is a new instance whose ownership belongs to the caller.
If the dfMaxAngleStepSizeDegrees is zero, then a default value will be used. This is currently 4 degrees unless the user has overridden the value with the OGR_ARC_STEPSIZE configuration variable.
This method relates to the ISO SQL/MM Part 3 ICurve::CurveToLine() method.
This function is the same as C function OGR_G_CurveToLine().
 Since
GDAL 2.0
 Parameters:
dfMaxAngleStepSizeDegrees – the largest step in degrees along the arc, zero to use the default setting.
papszOptions – options as a nullterminated list of strings or NULL. See OGRGeometryFactory::curveToLineString() for valid options.
 Returns:
a line string approximating the curve

virtual OGRGeometry *getCurveGeometry(const char *const *papszOptions = nullptr) const override
Return curve version of this geometry.
Returns a geometry that has possibly CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE in it, by deapproximating curve geometries.
If the geometry has no curve portion, the returned geometry will be a clone of it.
The ownership of the returned geometry belongs to the caller.
The reverse method is OGRGeometry::getLinearGeometry().
This function is the same as C function OGR_G_GetCurveGeometry().
 Since
GDAL 2.0
 Parameters:
papszOptions – options as a nullterminated list of strings. Unused for now. Must be set to NULL.
 Returns:
a new geometry.

virtual double get_Area() const override
Get the area of the (closed) curve.
This method is designed to be used by OGRCurvePolygon::get_Area().
 Since
GDAL 2.0
 Returns:
the area of the feature in square units of the spatial reference system in use.

virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual int isClockwise() const override
Returns TRUE if the ring has clockwise winding (or less than 2 points)
Assumes that the line is closed.
 Returns:
TRUE if clockwise otherwise FALSE.

inline OGRSimpleCurve *toUpperClass()
Return pointer of this in upper class.

inline const OGRSimpleCurve *toUpperClass() const
Return pointer of this in upper class.

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.

OGRLineString()
OGRLinearRing class

class OGRLinearRing : public OGRLineString
Concrete representation of a closed ring.
This class is functionally equivalent to an OGRLineString, but has a separate identity to maintain alignment with the OpenGIS simple feature data model. It exists to serve as a component of an OGRPolygon.
The OGRLinearRing has no corresponding free standing well known binary representation, so importFromWkb() and exportToWkb() will not actually work. There is a nonstandard GDAL WKT representation though.
Because OGRLinearRing is not a “proper” free standing simple features object, it cannot be directly used on a feature via SetGeometry(), and cannot generally be used with GEOS for operations like Intersects(). Instead the polygon should be used, or the OGRLinearRing should be converted to an OGRLineString for such operations.
Note: this class exists in SFSQL 1.2, but not in ISO SQL/MM Part 3.
Public Functions

OGRLinearRing()
Constructor.

OGRLinearRing(const OGRLinearRing &other)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

explicit OGRLinearRing(OGRLinearRing*)
Constructor.
 Parameters:
poSrcRing – source ring.

OGRLinearRing &operator=(const OGRLinearRing &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual OGRLinearRing *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual void reverseWindingOrder()
Reverse order of points.

virtual void closeRings() override
Force rings to be closed.
If this geometry, or any contained geometries has polygon rings that are not closed, they will be closed by adding the starting point at the end.

OGRBoolean isPointInRing(const OGRPoint *pt, int bTestEnvelope = TRUE) const
Returns whether the point is inside the ring.
 Parameters:
poPoint – point
bTestEnvelope – set to TRUE if the presence of the point inside the ring envelope must be checked first.
 Returns:
TRUE or FALSE.

OGRBoolean isPointOnRingBoundary(const OGRPoint *pt, int bTestEnvelope = TRUE) const
Returns whether the point is on the ring boundary.
 Parameters:
poPoint – point
bTestEnvelope – set to TRUE if the presence of the point inside the ring envelope must be checked first.
 Returns:
TRUE or FALSE.

virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
This method will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.
Note that this method does not require that the geometry already have a spatial reference system. It will be assumed that they can be treated as having the source spatial reference system of the OGRCoordinateTransformation object, and the actual SRS of the geometry will be ignored. On successful completion the output OGRSpatialReference of the OGRCoordinateTransformation will be assigned to the geometry.
This method is the same as the C function OGR_G_Transform().
 Parameters:
poCT – the transformation to apply.
 Returns:
OGRERR_NONE on success or an error code.

inline OGRLineString *toUpperClass()
Return pointer of this in upper class.

inline const OGRLineString *toUpperClass() const
Return pointer of this in upper class.

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.

OGRLinearRing()
OGRCircularString class

class OGRCircularString : public OGRSimpleCurve
Concrete representation of a circular string, that is to say a curve made of one or several arc circles.
Note: for implementation convenience, we make it inherit from OGRSimpleCurve whereas SQL/MM only makes it inherits from OGRCurve.
Compatibility: ISO SQL/MM Part 3.
 Since
GDAL 2.0
Public Functions

OGRCircularString()
Create an empty circular string.

OGRCircularString(const OGRCircularString &other)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

OGRCircularString &operator=(const OGRCircularString &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

virtual OGRErr importFromWkb(const unsigned char*, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
The object must have already been instantiated as the correct derived type of geometry object to match the binaries type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKB() method.
This method is the same as the C function OGR_G_ImportFromWkb().
 Since
GDAL 2.3
 Parameters:
pabyData – the binary input data.
nSize – the size of pabyData in bytes, or 1 if not known.
eWkbVariant – if wkbVariantPostGIS1, special interpretation is done for curve geometries code
nBytesConsumedOut – output parameter. Number of bytes consumed.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char*, OGRwkbVariant = wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
This method relates to the SFCOM IWks::ExportToWKB() method.
This method is the same as the C function OGR_G_ExportToWkb() or OGR_G_ExportToIsoWkb(), depending on the value of eWkbVariant.
 Parameters:
eByteOrder – One of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
pabyData – a buffer into which the binary representation is written. This buffer must be at least OGRGeometry::WkbSize() byte in size.
eWkbVariant – What standard to use when exporting geometries with three dimensions (or more). The default wkbVariantOldOgc is the historical OGR variant. wkbVariantIso is the variant defined in ISO SQL/MM and adopted by OGC for SFSQL 1.2.
 Returns:
Currently OGRERR_NONE is always returned.

virtual OGRErr importFromWkt(const char**) override
Assign geometry from well known text data.
The object must have already been instantiated as the correct derived type of geometry object to match the text type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKT() method.
This method is the same as the C function OGR_G_ImportFromWkt().
 Parameters:
ppszInput – pointer to a pointer to the source text. The pointer is updated to pointer after the consumed text.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(), OGRErr *err = nullptr) const override
Export a circular string to WKT.
 Parameters:
opts – Output options.
err – Pointer to error code, if desired.
 Returns:
WKT string representing this circular string.

virtual OGRBoolean IsValid() const override
Test if the geometry is valid.
This method is the same as the C function OGR_G_IsValid().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always return FALSE.
 Returns:
TRUE if the geometry has no points, otherwise FALSE.

virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
This method is the same as the C function OGR_G_GetEnvelope().
 Parameters:
psEnvelope – the structure in which to place the results.

virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override
Computes and returns the bounding envelope (3D) for this geometry in the passed psEnvelope structure.
This method is the same as the C function OGR_G_GetEnvelope3D().
 Since
OGR 1.9.0
 Parameters:
psEnvelope – the structure in which to place the results.

virtual OGRCircularString *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual double get_Length() const override
Returns the length of the curve.
This method relates to the SFCOM ICurve::get_Length() method.
 Returns:
the length of the curve, zero if the curve hasn’t been initialized.

virtual OGRLineString *CurveToLine(double dfMaxAngleStepSizeDegrees = 0, const char *const *papszOptions = nullptr) const override
Return a linestring from a curve geometry.
The returned geometry is a new instance whose ownership belongs to the caller.
If the dfMaxAngleStepSizeDegrees is zero, then a default value will be used. This is currently 4 degrees unless the user has overridden the value with the OGR_ARC_STEPSIZE configuration variable.
This method relates to the ISO SQL/MM Part 3 ICurve::CurveToLine() method.
This function is the same as C function OGR_G_CurveToLine().
 Since
GDAL 2.0
 Parameters:
dfMaxAngleStepSizeDegrees – the largest step in degrees along the arc, zero to use the default setting.
papszOptions – options as a nullterminated list of strings or NULL. See OGRGeometryFactory::curveToLineString() for valid options.
 Returns:
a line string approximating the curve

virtual void Value(double, OGRPoint*) const override
Fetch point at given distance along curve.
This method relates to the SF COM ICurve::get_Value() method.
This function is the same as the C function OGR_G_Value().
 Parameters:
dfDistance – distance along the curve at which to sample position. This distance should be between zero and get_Length() for this curve.
poPoint – the point to be assigned the curve position.

virtual double get_Area() const override
Get the area of the (closed) curve.
This method is designed to be used by OGRCurvePolygon::get_Area().
 Since
GDAL 2.0
 Returns:
the area of the feature in square units of the spatial reference system in use.

virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
This method modifies the geometry to add intermediate vertices if necessary so that the maximum length between 2 consecutive vertices is lower than dfMaxLength.
Interpolated points will have Z and M values (if needed) set to 0. Distance computation is performed in 2d only
This function is the same as the C function OGR_G_Segmentize()
 Parameters:
dfMaxLength – the maximum distance between 2 points after segmentization

virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const override
Returns if this geometry is or has curve geometry.
Returns if a geometry is, contains or may contain a CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE.
If bLookForNonLinear is set to TRUE, it will be actually looked if the geometry or its subgeometries are or contain a nonlinear geometry in them. In which case, if the method returns TRUE, it means that getLinearGeometry() would return an approximate version of the geometry. Otherwise, getLinearGeometry() would do a conversion, but with just converting container type, like COMPOUNDCURVE > LINESTRING, MULTICURVE > MULTILINESTRING or MULTISURFACE > MULTIPOLYGON, resulting in a “lossless” conversion.
This method is the same as the C function OGR_G_HasCurveGeometry().
 Since
GDAL 2.0
 Parameters:
bLookForNonLinear – set it to TRUE to check if the geometry is or contains a CIRCULARSTRING.
 Returns:
TRUE if this geometry is or has curve geometry.

virtual OGRGeometry *getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0, const char *const *papszOptions = nullptr) const override
Return, possibly approximate, noncurve version of this geometry.
Returns a geometry that has no CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE in it, by approximating curve geometries.
The ownership of the returned geometry belongs to the caller.
The reverse method is OGRGeometry::getCurveGeometry().
This method is the same as the C function OGR_G_GetLinearGeometry().
 Since
GDAL 2.0
 Parameters:
dfMaxAngleStepSizeDegrees – the largest step in degrees along the arc, zero to use the default setting.
papszOptions – options as a nullterminated list of strings. See OGRGeometryFactory::curveToLineString() for valid options.
 Returns:
a new geometry.

inline OGRSimpleCurve *toUpperClass()
Return pointer of this in upper class.

inline const OGRSimpleCurve *toUpperClass() const
Return pointer of this in upper class.

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
OGRCurve class

class OGRCurve : public OGRGeometry
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Subclassed by OGRCompoundCurve, OGRSimpleCurve
Public Functions

ConstIterator begin() const
Return begin of a point iterator.
Using this iterator for standard rangebased loops is safe, but due to implementation limitations, you shouldn’t try to access (dereference) more than one iterator step at a time, since you will get a reference to the same OGRPoint& object.
 Since
GDAL 2.3

ConstIterator end() const
Return end of a point iterator.

virtual OGRCurve *clone() const override = 0
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual double get_Length() const = 0
Returns the length of the curve.
This method relates to the SFCOM ICurve::get_Length() method.
 Returns:
the length of the curve, zero if the curve hasn’t been initialized.

virtual void StartPoint(OGRPoint*) const = 0
Return the curve start point.
This method relates to the SF COM ICurve::get_StartPoint() method.
 Parameters:
poPoint – the point to be assigned the start location.

virtual void EndPoint(OGRPoint*) const = 0
Return the curve end point.
This method relates to the SF COM ICurve::get_EndPoint() method.
 Parameters:
poPoint – the point to be assigned the end location.

virtual int get_IsClosed() const
Return TRUE if curve is closed.
Tests if a curve is closed. A curve is closed if its start point is equal to its end point.
For equality tests, the M dimension is ignored.
This method relates to the SFCOM ICurve::get_IsClosed() method.
 Returns:
TRUE if closed, else FALSE.

virtual void Value(double, OGRPoint*) const = 0
Fetch point at given distance along curve.
This method relates to the SF COM ICurve::get_Value() method.
This function is the same as the C function OGR_G_Value().
 Parameters:
dfDistance – distance along the curve at which to sample position. This distance should be between zero and get_Length() for this curve.
poPoint – the point to be assigned the curve position.

virtual OGRLineString *CurveToLine(double dfMaxAngleStepSizeDegrees = 0, const char *const *papszOptions = nullptr) const = 0
Return a linestring from a curve geometry.
The returned geometry is a new instance whose ownership belongs to the caller.
If the dfMaxAngleStepSizeDegrees is zero, then a default value will be used. This is currently 4 degrees unless the user has overridden the value with the OGR_ARC_STEPSIZE configuration variable.
This method relates to the ISO SQL/MM Part 3 ICurve::CurveToLine() method.
This function is the same as C function OGR_G_CurveToLine().
 Since
GDAL 2.0
 Parameters:
dfMaxAngleStepSizeDegrees – the largest step in degrees along the arc, zero to use the default setting.
papszOptions – options as a nullterminated list of strings or NULL. See OGRGeometryFactory::curveToLineString() for valid options.
 Returns:
a line string approximating the curve

virtual int getDimension() const override
Get the dimension of this object.
This method corresponds to the SFCOM IGeometry::GetDimension() method. It indicates the dimension of the object, but does not indicate the dimension of the underlying space (as indicated by OGRGeometry::getCoordinateDimension()).
This method is the same as the C function OGR_G_GetDimension().
 Returns:
0 for points, 1 for lines and 2 for surfaces.

virtual int getNumPoints() const = 0
Return the number of points of a curve geometry.
This method, as a method of OGRCurve, does not relate to a standard. For circular strings or linestrings, it returns the number of points, conforming to SF COM NumPoints(). For compound curves, it returns the sum of the number of points of each of its components (non including intermediate starting/ending points of the different parts).
 Since
GDAL 2.0
 Returns:
the number of points of the curve.

virtual OGRPointIterator *getPointIterator() const = 0
Returns a point iterator over the curve.
The curve must not be modified while an iterator exists on it.
The iterator must be destroyed with OGRPointIterator::destroy().
 Since
GDAL 2.0
 Returns:
a point iterator over the curve.

virtual OGRBoolean IsConvex() const
Returns if a (closed) curve forms a convex shape.
 Since
GDAL 2.0
 Returns:
TRUE if the curve forms a convex shape.

virtual double get_Area() const = 0
Get the area of the (closed) curve.
This method is designed to be used by OGRCurvePolygon::get_Area().
 Since
GDAL 2.0
 Returns:
the area of the feature in square units of the spatial reference system in use.

virtual int isClockwise() const
Returns TRUE if the ring has clockwise winding (or less than 2 points)
Assumes that the line is closed.
 Returns:
TRUE if clockwise otherwise FALSE.

inline OGRSimpleCurve *toSimpleCurve()
Downcast to OGRSimpleCurve*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbLineString or wkbCircularString.

inline const OGRSimpleCurve *toSimpleCurve() const
Downcast to OGRSimpleCurve*.
Implies prior checking that wkbFlatten(getGeometryType()) == wkbLineString or wkbCircularString.
Public Static Functions

static OGRCompoundCurve *CastToCompoundCurve(OGRCurve *puCurve)
Cast to compound curve.
The passed in geometry is consumed and a new one returned (or NULL in case of failure)
 Since
GDAL 2.0
 Parameters:
poCurve – the input geometry  ownership is passed to the method.
 Returns:
new geometry

static OGRLineString *CastToLineString(OGRCurve *poCurve)
Cast to linestring.
The passed in geometry is consumed and a new one returned (or NULL in case of failure)
 Since
GDAL 2.0
 Parameters:
poCurve – the input geometry  ownership is passed to the method.
 Returns:
new geometry.

static OGRLinearRing *CastToLinearRing(OGRCurve *poCurve)
Cast to linear ring.
The passed in geometry is consumed and a new one returned (or NULL in case of failure)
 Since
GDAL 2.0
 Parameters:
poCurve – the input geometry  ownership is passed to the method.
 Returns:
new geometry.

ConstIterator begin() const
OGRSurface class

class OGRSurface : public OGRGeometry
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Subclassed by OGRCurvePolygon, OGRPolyhedralSurface
Public Functions

virtual double get_Area() const = 0
Get the area of the surface object.
For polygons the area is computed as the area of the outer ring less the area of all internal rings.
This method relates to the SFCOM ISurface::get_Area() method.
 Returns:
the area of the feature in square units of the spatial reference system in use.

inline virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
NOTE: Only implemented when GEOS included in build.
 Parameters:
poPoint – point to be set with an internal point.
 Returns:
OGRERR_NONE if it succeeds or OGRERR_FAILURE otherwise.

virtual OGRSurface *clone() const override = 0
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual double get_Area() const = 0
OGRPolygon class

class OGRPolygon : public OGRCurvePolygon
Concrete class representing polygons.
Note that the OpenGIS simple features polygons consist of one outer ring (linearring), and zero or more inner rings. A polygon cannot represent disconnected regions (such as multiple islands in a political body). The OGRMultiPolygon must be used for this.
Subclassed by OGRTriangle
Public Types

typedef OGRLinearRing ChildType
Type of child elements.
Public Functions

OGRPolygon()
Create an empty polygon.

OGRPolygon(const OGRPolygon &other)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

OGRPolygon &operator=(const OGRPolygon &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

virtual OGRPolygon *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const override
Returns if this geometry is or has curve geometry.
Returns if a geometry is, contains or may contain a CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE.
If bLookForNonLinear is set to TRUE, it will be actually looked if the geometry or its subgeometries are or contain a nonlinear geometry in them. In which case, if the method returns TRUE, it means that getLinearGeometry() would return an approximate version of the geometry. Otherwise, getLinearGeometry() would do a conversion, but with just converting container type, like COMPOUNDCURVE > LINESTRING, MULTICURVE > MULTILINESTRING or MULTISURFACE > MULTIPOLYGON, resulting in a “lossless” conversion.
This method is the same as the C function OGR_G_HasCurveGeometry().
 Since
GDAL 2.0
 Parameters:
bLookForNonLinear – set it to TRUE to check if the geometry is or contains a CIRCULARSTRING.
 Returns:
TRUE if this geometry is or has curve geometry.

virtual OGRGeometry *getCurveGeometry(const char *const *papszOptions = nullptr) const override
Return curve version of this geometry.
Returns a geometry that has possibly CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE in it, by deapproximating curve geometries.
If the geometry has no curve portion, the returned geometry will be a clone of it.
The ownership of the returned geometry belongs to the caller.
The reverse method is OGRGeometry::getLinearGeometry().
This function is the same as C function OGR_G_GetCurveGeometry().
 Since
GDAL 2.0
 Parameters:
papszOptions – options as a nullterminated list of strings. Unused for now. Must be set to NULL.
 Returns:
a new geometry.

virtual OGRGeometry *getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0, const char *const *papszOptions = nullptr) const override
Return, possibly approximate, noncurve version of this geometry.
Returns a geometry that has no CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE in it, by approximating curve geometries.
The ownership of the returned geometry belongs to the caller.
The reverse method is OGRGeometry::getCurveGeometry().
This method is the same as the C function OGR_G_GetLinearGeometry().
 Since
GDAL 2.0
 Parameters:
dfMaxAngleStepSizeDegrees – the largest step in degrees along the arc, zero to use the default setting.
papszOptions – options as a nullterminated list of strings. See OGRGeometryFactory::curveToLineString() for valid options.
 Returns:
a new geometry.

virtual size_t WkbSize() const override
Returns size of related binary representation.
This method returns the exact number of bytes required to hold the well known binary representation of this geometry object. Its computation may be slightly expensive for complex geometries.
This method relates to the SFCOM IWks::WkbSize() method.
This method is the same as the C function OGR_G_WkbSize().
 Returns:
size of binary representation in bytes.

virtual OGRErr importFromWkb(const unsigned char*, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
The object must have already been instantiated as the correct derived type of geometry object to match the binaries type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKB() method.
This method is the same as the C function OGR_G_ImportFromWkb().
 Since
GDAL 2.3
 Parameters:
pabyData – the binary input data.
nSize – the size of pabyData in bytes, or 1 if not known.
eWkbVariant – if wkbVariantPostGIS1, special interpretation is done for curve geometries code
nBytesConsumedOut – output parameter. Number of bytes consumed.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char*, OGRwkbVariant = wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
This method relates to the SFCOM IWks::ExportToWKB() method.
This method is the same as the C function OGR_G_ExportToWkb() or OGR_G_ExportToIsoWkb(), depending on the value of eWkbVariant.
 Parameters:
eByteOrder – One of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
pabyData – a buffer into which the binary representation is written. This buffer must be at least OGRGeometry::WkbSize() byte in size.
eWkbVariant – What standard to use when exporting geometries with three dimensions (or more). The default wkbVariantOldOgc is the historical OGR variant. wkbVariantIso is the variant defined in ISO SQL/MM and adopted by OGC for SFSQL 1.2.
 Returns:
Currently OGRERR_NONE is always returned.

virtual OGRErr importFromWkt(const char**) override
Assign geometry from well known text data.
The object must have already been instantiated as the correct derived type of geometry object to match the text type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKT() method.
This method is the same as the C function OGR_G_ImportFromWkt().
 Parameters:
ppszInput – pointer to a pointer to the source text. The pointer is updated to pointer after the consumed text.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(), OGRErr *err = nullptr) const override
Export a polygon to WKT.
 Parameters:
opts – Output options.
err – Pointer to error code, if desired.
 Returns:
WKT representation of the polygon.

virtual OGRPolygon *CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0, const char *const *papszOptions = nullptr) const override
Return a polygon from a curve polygon.
This method is the same as C function OGR_G_CurvePolyToPoly().
The returned geometry is a new instance whose ownership belongs to the caller.
 Since
OGR 2.0
 Parameters:
dfMaxAngleStepSizeDegrees – the largest step in degrees along the arc, zero to use the default setting.
papszOptions – options as a nullterminated list of strings. Unused for now. Must be set to NULL.
 Returns:
a linestring

OGRLinearRing *getExteriorRing()
Fetch reference to external polygon ring.
Note that the returned ring pointer is to an internal data object of the OGRPolygon. It should not be modified or deleted by the application, and the pointer is only valid till the polygon is next modified. Use the OGRGeometry::clone() method to make a separate copy within the application.
Relates to the SFCOM IPolygon::get_ExteriorRing() method.
 Returns:
pointer to external ring. May be NULL if the OGRPolygon is empty.

const OGRLinearRing *getExteriorRing() const
Fetch reference to external polygon ring.
Note that the returned ring pointer is to an internal data object of the OGRPolygon. It should not be modified or deleted by the application, and the pointer is only valid till the polygon is next modified. Use the OGRGeometry::clone() method to make a separate copy within the application.
Relates to the SFCOM IPolygon::get_ExteriorRing() method.
 Returns:
pointer to external ring. May be NULL if the OGRPolygon is empty.

virtual OGRLinearRing *getInteriorRing(int)
Fetch reference to indicated internal ring.
Note that the returned ring pointer is to an internal data object of the OGRPolygon. It should not be modified or deleted by the application, and the pointer is only valid till the polygon is next modified. Use the OGRGeometry::clone() method to make a separate copy within the application.
Relates to the SFCOM IPolygon::get_InternalRing() method.
 Parameters:
iRing – internal ring index from 0 to getNumInteriorRings()  1.
 Returns:
pointer to interior ring. May be NULL.

virtual const OGRLinearRing *getInteriorRing(int) const
Fetch reference to indicated internal ring.
Note that the returned ring pointer is to an internal data object of the OGRPolygon. It should not be modified or deleted by the application, and the pointer is only valid till the polygon is next modified. Use the OGRGeometry::clone() method to make a separate copy within the application.
Relates to the SFCOM IPolygon::get_InternalRing() method.
 Parameters:
iRing – internal ring index from 0 to getNumInteriorRings()  1.
 Returns:
pointer to interior ring. May be NULL.

OGRLinearRing *stealExteriorRing()
“Steal” reference to external polygon ring.
After the call to that function, only call to stealInteriorRing() or destruction of the OGRPolygon is valid. Other operations may crash.
 Returns:
pointer to external ring. May be NULL if the OGRPolygon is empty.

virtual OGRLinearRing *stealInteriorRing(int)
“Steal” reference to indicated interior ring.
After the call to that function, only call to stealInteriorRing() or destruction of the OGRPolygon is valid. Other operations may crash.
 Parameters:
iRing – internal ring index from 0 to getNumInteriorRings()  1.
 Returns:
pointer to interior ring. May be NULL.

OGRBoolean IsPointOnSurface(const OGRPoint*) const
Return whether the point is on the surface.
 Returns:
TRUE or FALSE

inline OGRCurvePolygon *toUpperClass()
Return pointer of this in upper class.

inline const OGRCurvePolygon *toUpperClass() const
Return pointer of this in upper class.

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.

virtual void closeRings() override
Force rings to be closed.
If this geometry, or any contained geometries has polygon rings that are not closed, they will be closed by adding the starting point at the end.

typedef OGRLinearRing ChildType
OGRCurvePolygon class

class OGRCurvePolygon : public OGRSurface
Concrete class representing curve polygons.
Note that curve polygons consist of one outer (curve) ring, and zero or more inner rings. A curve polygon cannot represent disconnected regions (such as multiple islands in a political body). The OGRMultiSurface must be used for this.
Compatibility: ISO SQL/MM Part 3.
 Since
GDAL 2.0
Subclassed by OGRPolygon
Public Functions

OGRCurvePolygon()
Create an empty curve polygon.

OGRCurvePolygon(const OGRCurvePolygon&)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

OGRCurvePolygon &operator=(const OGRCurvePolygon &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

virtual OGRCurvePolygon *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual void empty() override
Clear geometry information.
This restores the geometry to its initial state after construction, and before assignment of actual geometry.
This method relates to the SFCOM IGeometry::Empty() method.
This method is the same as the C function OGR_G_Empty().

virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
This method will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.
Note that this method does not require that the geometry already have a spatial reference system. It will be assumed that they can be treated as having the source spatial reference system of the OGRCoordinateTransformation object, and the actual SRS of the geometry will be ignored. On successful completion the output OGRSpatialReference of the OGRCoordinateTransformation will be assigned to the geometry.
This method is the same as the C function OGR_G_Transform().
 Parameters:
poCT – the transformation to apply.
 Returns:
OGRERR_NONE on success or an error code.

virtual void flattenTo2D() override
Convert geometry to strictly 2D.
In a sense this converts all Z coordinates to 0.0.
This method is the same as the C function OGR_G_FlattenTo2D().

virtual OGRBoolean IsEmpty() const override
Returns TRUE (nonzero) if the object has no points.
Normally this returns FALSE except between when an object is instantiated and points have been assigned.
This method relates to the SFCOM IGeometry::IsEmpty() method.
 Returns:
TRUE if object is empty, otherwise FALSE.

virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
This method modifies the geometry to add intermediate vertices if necessary so that the maximum length between 2 consecutive vertices is lower than dfMaxLength.
Interpolated points will have Z and M values (if needed) set to 0. Distance computation is performed in 2d only
This function is the same as the C function OGR_G_Segmentize()
 Parameters:
dfMaxLength – the maximum distance between 2 points after segmentization

virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const override
Returns if this geometry is or has curve geometry.
Returns if a geometry is, contains or may contain a CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE.
If bLookForNonLinear is set to TRUE, it will be actually looked if the geometry or its subgeometries are or contain a nonlinear geometry in them. In which case, if the method returns TRUE, it means that getLinearGeometry() would return an approximate version of the geometry. Otherwise, getLinearGeometry() would do a conversion, but with just converting container type, like COMPOUNDCURVE > LINESTRING, MULTICURVE > MULTILINESTRING or MULTISURFACE > MULTIPOLYGON, resulting in a “lossless” conversion.
This method is the same as the C function OGR_G_HasCurveGeometry().
 Since
GDAL 2.0
 Parameters:
bLookForNonLinear – set it to TRUE to check if the geometry is or contains a CIRCULARSTRING.
 Returns:
TRUE if this geometry is or has curve geometry.

virtual OGRGeometry *getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0, const char *const *papszOptions = nullptr) const override
Return, possibly approximate, noncurve version of this geometry.
Returns a geometry that has no CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE in it, by approximating curve geometries.
The ownership of the returned geometry belongs to the caller.
The reverse method is OGRGeometry::getCurveGeometry().
This method is the same as the C function OGR_G_GetLinearGeometry().
 Since
GDAL 2.0
 Parameters:
dfMaxAngleStepSizeDegrees – the largest step in degrees along the arc, zero to use the default setting.
papszOptions – options as a nullterminated list of strings. See OGRGeometryFactory::curveToLineString() for valid options.
 Returns:
a new geometry.

virtual double get_Area() const override
Get the area of the surface object.
For polygons the area is computed as the area of the outer ring less the area of all internal rings.
This method relates to the SFCOM ISurface::get_Area() method.
 Returns:
the area of the feature in square units of the spatial reference system in use.

virtual size_t WkbSize() const override
Returns size of related binary representation.
This method returns the exact number of bytes required to hold the well known binary representation of this geometry object. Its computation may be slightly expensive for complex geometries.
This method relates to the SFCOM IWks::WkbSize() method.
This method is the same as the C function OGR_G_WkbSize().
 Returns:
size of binary representation in bytes.

virtual OGRErr importFromWkb(const unsigned char*, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
The object must have already been instantiated as the correct derived type of geometry object to match the binaries type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKB() method.
This method is the same as the C function OGR_G_ImportFromWkb().
 Since
GDAL 2.3
 Parameters:
pabyData – the binary input data.
nSize – the size of pabyData in bytes, or 1 if not known.
eWkbVariant – if wkbVariantPostGIS1, special interpretation is done for curve geometries code
nBytesConsumedOut – output parameter. Number of bytes consumed.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char*, OGRwkbVariant = wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
This method relates to the SFCOM IWks::ExportToWKB() method.
This method is the same as the C function OGR_G_ExportToWkb() or OGR_G_ExportToIsoWkb(), depending on the value of eWkbVariant.
 Parameters:
eByteOrder – One of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
pabyData – a buffer into which the binary representation is written. This buffer must be at least OGRGeometry::WkbSize() byte in size.
eWkbVariant – What standard to use when exporting geometries with three dimensions (or more). The default wkbVariantOldOgc is the historical OGR variant. wkbVariantIso is the variant defined in ISO SQL/MM and adopted by OGC for SFSQL 1.2.
 Returns:
Currently OGRERR_NONE is always returned.

virtual OGRErr importFromWkt(const char**) override
Assign geometry from well known text data.
The object must have already been instantiated as the correct derived type of geometry object to match the text type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKT() method.
This method is the same as the C function OGR_G_ImportFromWkt().
 Parameters:
ppszInput – pointer to a pointer to the source text. The pointer is updated to pointer after the consumed text.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(), OGRErr *err = nullptr) const override
Export a curve polygon to WKT.
 Parameters:
opts – Output options.
err – Pointer to error code, if desired.
 Returns:
WKT representation of the curve polygon.

virtual int getDimension() const override
Get the dimension of this object.
This method corresponds to the SFCOM IGeometry::GetDimension() method. It indicates the dimension of the object, but does not indicate the dimension of the underlying space (as indicated by OGRGeometry::getCoordinateDimension()).
This method is the same as the C function OGR_G_GetDimension().
 Returns:
0 for points, 1 for lines and 2 for surfaces.

virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
This method is the same as the C function OGR_G_GetEnvelope().
 Parameters:
psEnvelope – the structure in which to place the results.

virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override
Computes and returns the bounding envelope (3D) for this geometry in the passed psEnvelope structure.
This method is the same as the C function OGR_G_GetEnvelope3D().
 Since
OGR 1.9.0
 Parameters:
psEnvelope – the structure in which to place the results.

virtual OGRPolygon *CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0, const char *const *papszOptions = nullptr) const
Return a polygon from a curve polygon.
This method is the same as C function OGR_G_CurvePolyToPoly().
The returned geometry is a new instance whose ownership belongs to the caller.
 Since
OGR 2.0
 Parameters:
dfMaxAngleStepSizeDegrees – the largest step in degrees along the arc, zero to use the default setting.
papszOptions – options as a nullterminated list of strings. Unused for now. Must be set to NULL.
 Returns:
a linestring

virtual OGRBoolean Equals(const OGRGeometry*) const override
Returns TRUE if two geometries are equivalent.
This operation implements the SQL/MM ST_OrderingEquals() operation.
The comparison is done in a structural way, that is to say that the geometry types must be identical, as well as the number and ordering of subgeometries and vertices. Or equivalently, two geometries are considered equal by this method if their WKT/WKB representation is equal. Note: this must be distinguished for equality in a spatial way (which is the purpose of the ST_Equals() operation).
This method is the same as the C function OGR_G_Equals().
 Returns:
TRUE if equivalent or FALSE otherwise.

virtual OGRBoolean Intersects(const OGRGeometry*) const override
Do these features intersect?
Determines whether two geometries intersect. If GEOS is enabled, then this is done in rigorous fashion otherwise TRUE is returned if the envelopes (bounding boxes) of the two geometries overlap.
The poOtherGeom argument may be safely NULL, but in this case the method will always return TRUE. That is, a NULL geometry is treated as being everywhere.
This method is the same as the C function OGR_G_Intersects().
 Parameters:
poOtherGeom – the other geometry to test against.
 Returns:
TRUE if the geometries intersect, otherwise FALSE.

virtual OGRBoolean Contains(const OGRGeometry*) const override
Test for containment.
Tests if actual geometry object contains the passed geometry.
Geometry validity is not checked. In case you are unsure of the validity of the input geometries, call IsValid() before, otherwise the result might be wrong.
This method is the same as the C function OGR_G_Contains().
This method is built on the GEOS library, check it for the definition of the geometry operation. If OGR is built without the GEOS library, this method will always fail, issuing a CPLE_NotSupported error.
 Parameters:
poOtherGeom – the geometry to compare to this geometry.
 Returns:
TRUE if poOtherGeom contains this geometry, otherwise FALSE.

virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
This method sets the explicit coordinate dimension. Setting the coordinate dimension of a geometry to 2 should zero out any existing Z values. Setting the dimension of a geometry collection, a compound curve, a polygon, etc. will affect the children geometries. This will also remove the M dimension if present before this call.
 Deprecated:
use set3D() or setMeasured().
 Parameters:
nNewDimension – New coordinate dimension value, either 2 or 3.

virtual void set3D(OGRBoolean bIs3D) override
Add or remove the Z coordinate dimension.
This method adds or removes the explicit Z coordinate dimension. Removing the Z coordinate dimension of a geometry will remove any existing Z values. Adding the Z dimension to a geometry collection, a compound curve, a polygon, etc. will affect the children geometries.
 Since
GDAL 2.1
 Parameters:
bIs3D – Should the geometry have a Z dimension, either TRUE or FALSE.

virtual void setMeasured(OGRBoolean bIsMeasured) override
Add or remove the M coordinate dimension.
This method adds or removes the explicit M coordinate dimension. Removing the M coordinate dimension of a geometry will remove any existing M values. Adding the M dimension to a geometry collection, a compound curve, a polygon, etc. will affect the children geometries.
 Since
GDAL 2.1
 Parameters:
bIsMeasured – Should the geometry have a M dimension, either TRUE or FALSE.

virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Any existing spatial reference is replaced, but under no circumstances does this result in the object being reprojected. It is just changing the interpretation of the existing geometry. Note that assigning a spatial reference increments the reference count on the OGRSpatialReference, but does not copy it.
Starting with GDAL 2.3, this will also assign the spatial reference to potential subgeometries of the geometry (OGRGeometryCollection, OGRCurvePolygon/OGRPolygon, OGRCompoundCurve, OGRPolyhedralSurface and their derived classes).
This is similar to the SFCOM IGeometry::put_SpatialReference() method.
This method is the same as the C function OGR_G_AssignSpatialReference().
 Parameters:
poSR – new spatial reference system to apply.

virtual OGRErr addRing(OGRCurve*)
Add a ring to a polygon.
If the polygon has no external ring (it is empty) this will be used as the external ring, otherwise it is used as an internal ring. The passed OGRCurve remains the responsibility of the caller (an internal copy is made).
This method has no SFCOM analog.
 Parameters:
poNewRing – ring to be added to the polygon.
 Returns:
OGRERR_NONE in case of success

virtual OGRErr addRingDirectly(OGRCurve*)
Add a ring to a polygon.
If the polygon has no external ring (it is empty) this will be used as the external ring, otherwise it is used as an internal ring. Ownership of the passed ring is assumed by the OGRCurvePolygon, but otherwise this method operates the same as OGRCurvePolygon::AddRing().
This method has no SFCOM analog.
 Parameters:
poNewRing – ring to be added to the polygon.
 Returns:
OGRERR_NONE in case of success

OGRCurve *getExteriorRingCurve()
Fetch reference to external polygon ring.
Note that the returned ring pointer is to an internal data object of the OGRCurvePolygon. It should not be modified or deleted by the application, and the pointer is only valid till the polygon is next modified. Use the OGRGeometry::clone() method to make a separate copy within the application.
Relates to the Simple Features for COM (SFCOM) IPolygon::get_ExteriorRing() method. TODO(rouault): What does that mean?
 Returns:
pointer to external ring. May be NULL if the OGRCurvePolygon is empty.

const OGRCurve *getExteriorRingCurve() const
Fetch reference to external polygon ring.
Note that the returned ring pointer is to an internal data object of the OGRCurvePolygon. It should not be modified or deleted by the application, and the pointer is only valid till the polygon is next modified. Use the OGRGeometry::clone() method to make a separate copy within the application.
Relates to the SFCOM IPolygon::get_ExteriorRing() method.
 Returns:
pointer to external ring. May be NULL if the OGRCurvePolygon is empty.

int getNumInteriorRings() const
Fetch the number of internal rings.
Relates to the SFCOM IPolygon::get_NumInteriorRings() method.
 Returns:
count of internal rings, zero or more.

OGRCurve *getInteriorRingCurve(int)
Fetch reference to indicated internal ring.
Note that the returned ring pointer is to an internal data object of the OGRCurvePolygon. It should not be modified or deleted by the application, and the pointer is only valid till the polygon is next modified. Use the OGRGeometry::clone() method to make a separate copy within the application.
Relates to the SFCOM IPolygon::get_InternalRing() method.
 Parameters:
iRing – internal ring index from 0 to getNumInteriorRings()  1.
 Returns:
pointer to interior ring. May be NULL.

const OGRCurve *getInteriorRingCurve(int) const
Fetch reference to indicated internal ring.
Note that the returned ring pointer is to an internal data object of the OGRCurvePolygon. It should not be modified or deleted by the application, and the pointer is only valid till the polygon is next modified. Use the OGRGeometry::clone() method to make a separate copy within the application.
Relates to the SFCOM IPolygon::get_InternalRing() method.
 Parameters:
iRing – internal ring index from 0 to getNumInteriorRings()  1.
 Returns:
pointer to interior ring. May be NULL.

OGRCurve *stealExteriorRingCurve()
“Steal” reference to external ring.
After the call to that function, only call to stealInteriorRing() or destruction of the OGRCurvePolygon is valid. Other operations may crash.
 Returns:
pointer to external ring. May be NULL if the OGRCurvePolygon is empty.

OGRErr removeRing(int iIndex, bool bDelete = true)
Remove a geometry from the container.
Removing a geometry will cause the geometry count to drop by one, and all “higher” geometries will shuffle down one in index.
There is no SFCOM analog to this method.
 Parameters:
iIndex – the index of the geometry to delete. A value of 1 is a special flag meaning that all geometries should be removed.
bDelete – if true the geometry will be deallocated, otherwise it will not. The default is true as the container is considered to own the geometries in it.
 Returns:
OGRERR_NONE if successful, or OGRERR_FAILURE if the index is out of range.

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.

virtual void swapXY() override
Swap x and y coordinates.
 Since
OGR 1.8.0
OGRMultiPoint class

class OGRMultiPoint : public OGRGeometryCollection
A collection of OGRPoint.
Public Functions

OGRMultiPoint()
Create an empty multi point collection.

OGRMultiPoint(const OGRMultiPoint &other)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

OGRMultiPoint &operator=(const OGRMultiPoint &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

virtual OGRMultiPoint *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual OGRErr importFromWkt(const char**) override
Assign geometry from well known text data.
The object must have already been instantiated as the correct derived type of geometry object to match the text type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKT() method.
This method is the same as the C function OGR_G_ImportFromWkt().
 Parameters:
ppszInput – pointer to a pointer to the source text. The pointer is updated to pointer after the consumed text.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(), OGRErr *err = nullptr) const override
Export a multipoint to WKT.
 Parameters:
opts – Output options.
err – Pointer to error code, if desired.
 Returns:
WKT representation of the multipoint.

virtual int getDimension() const override
Get the dimension of this object.
This method corresponds to the SFCOM IGeometry::GetDimension() method. It indicates the dimension of the object, but does not indicate the dimension of the underlying space (as indicated by OGRGeometry::getCoordinateDimension()).
This method is the same as the C function OGR_G_GetDimension().
 Returns:
0 for points, 1 for lines and 2 for surfaces.

inline OGRGeometryCollection *toUpperClass()
Return pointer of this in upper class.

inline const OGRGeometryCollection *toUpperClass() const
Return pointer of this in upper class.

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.

virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const override
Returns if this geometry is or has curve geometry.
Returns if a geometry is, contains or may contain a CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE.
If bLookForNonLinear is set to TRUE, it will be actually looked if the geometry or its subgeometries are or contain a nonlinear geometry in them. In which case, if the method returns TRUE, it means that getLinearGeometry() would return an approximate version of the geometry. Otherwise, getLinearGeometry() would do a conversion, but with just converting container type, like COMPOUNDCURVE > LINESTRING, MULTICURVE > MULTILINESTRING or MULTISURFACE > MULTIPOLYGON, resulting in a “lossless” conversion.
This method is the same as the C function OGR_G_HasCurveGeometry().
 Since
GDAL 2.0
 Parameters:
bLookForNonLinear – set it to TRUE to check if the geometry is or contains a CIRCULARSTRING.
 Returns:
TRUE if this geometry is or has curve geometry.

OGRMultiPoint()
OGRMultiLineString class

class OGRMultiLineString : public OGRMultiCurve
A collection of OGRLineString.
Public Types

typedef OGRLineString ChildType
Type of child elements.
Public Functions

OGRMultiLineString()
Create an empty multi line string collection.

OGRMultiLineString(const OGRMultiLineString &other)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

OGRMultiLineString &operator=(const OGRMultiLineString &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

inline OGRLineString *getGeometryRef(int i)

inline const OGRLineString *getGeometryRef(int i) const

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

virtual OGRMultiLineString *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(), OGRErr *err = nullptr) const override
Export a multilinestring to WKT.
 Parameters:
opts – Output options.
err – Pointer to error code, if desired.
 Returns:
WKT representation of the multilinestring.

virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const override
Returns if this geometry is or has curve geometry.
Returns if a geometry is, contains or may contain a CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE.
If bLookForNonLinear is set to TRUE, it will be actually looked if the geometry or its subgeometries are or contain a nonlinear geometry in them. In which case, if the method returns TRUE, it means that getLinearGeometry() would return an approximate version of the geometry. Otherwise, getLinearGeometry() would do a conversion, but with just converting container type, like COMPOUNDCURVE > LINESTRING, MULTICURVE > MULTILINESTRING or MULTISURFACE > MULTIPOLYGON, resulting in a “lossless” conversion.
This method is the same as the C function OGR_G_HasCurveGeometry().
 Since
GDAL 2.0
 Parameters:
bLookForNonLinear – set it to TRUE to check if the geometry is or contains a CIRCULARSTRING.
 Returns:
TRUE if this geometry is or has curve geometry.

inline OGRGeometryCollection *toUpperClass()
Return pointer of this in upper class.

inline const OGRGeometryCollection *toUpperClass() const
Return pointer of this in upper class.

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Public Static Functions

static OGRMultiCurve *CastToMultiCurve(OGRMultiLineString *poMLS)
Cast to multicurve.
The passed in geometry is consumed and a new one returned.
 Parameters:
poMLS – the input geometry  ownership is passed to the method.
 Returns:
new geometry.

typedef OGRLineString ChildType
OGRMultiPolygon class

class OGRMultiPolygon : public OGRMultiSurface
A collection of nonoverlapping OGRPolygon.
Public Types

typedef OGRPolygon ChildType
Type of child elements.
Public Functions

OGRMultiPolygon()
Create an empty multi polygon collection.

OGRMultiPolygon(const OGRMultiPolygon &other)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

OGRMultiPolygon &operator=(const OGRMultiPolygon &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

inline OGRPolygon *getGeometryRef(int i)

inline const OGRPolygon *getGeometryRef(int i) const

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

virtual OGRMultiPolygon *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(), OGRErr *err = nullptr) const override
Export a multipolygon to WKT.
 Parameters:
opts – Output options.
err – Pointer to error code, if desired.
 Returns:
WKT representation of the multipolygon.

virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const override
Returns if this geometry is or has curve geometry.
Returns if a geometry is, contains or may contain a CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE.
If bLookForNonLinear is set to TRUE, it will be actually looked if the geometry or its subgeometries are or contain a nonlinear geometry in them. In which case, if the method returns TRUE, it means that getLinearGeometry() would return an approximate version of the geometry. Otherwise, getLinearGeometry() would do a conversion, but with just converting container type, like COMPOUNDCURVE > LINESTRING, MULTICURVE > MULTILINESTRING or MULTISURFACE > MULTIPOLYGON, resulting in a “lossless” conversion.
This method is the same as the C function OGR_G_HasCurveGeometry().
 Since
GDAL 2.0
 Parameters:
bLookForNonLinear – set it to TRUE to check if the geometry is or contains a CIRCULARSTRING.
 Returns:
TRUE if this geometry is or has curve geometry.

inline OGRGeometryCollection *toUpperClass()
Return pointer of this in upper class.

inline const OGRGeometryCollection *toUpperClass() const
Return pointer of this in upper class.

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Public Static Functions

static OGRMultiSurface *CastToMultiSurface(OGRMultiPolygon *poMP)
Cast to multisurface.
The passed in geometry is consumed and a new one returned .
 Parameters:
poMP – the input geometry  ownership is passed to the method.
 Returns:
new geometry.

typedef OGRPolygon ChildType
OGRGeometryCollection class

class OGRGeometryCollection : public OGRGeometry
A collection of 1 or more geometry objects.
All geometries must share a common spatial reference system, and Subclasses may impose additional restrictions on the contents.
Subclassed by OGRMultiCurve, OGRMultiPoint, OGRMultiSurface
Public Types

typedef OGRGeometry ChildType
Type of child elements.
Public Functions

OGRGeometryCollection()
Create an empty geometry collection.

OGRGeometryCollection(const OGRGeometryCollection &other)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

OGRGeometryCollection &operator=(const OGRGeometryCollection &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

virtual OGRGeometryCollection *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual void empty() override
Clear geometry information.
This restores the geometry to its initial state after construction, and before assignment of actual geometry.
This method relates to the SFCOM IGeometry::Empty() method.
This method is the same as the C function OGR_G_Empty().

virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
This method will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.
Note that this method does not require that the geometry already have a spatial reference system. It will be assumed that they can be treated as having the source spatial reference system of the OGRCoordinateTransformation object, and the actual SRS of the geometry will be ignored. On successful completion the output OGRSpatialReference of the OGRCoordinateTransformation will be assigned to the geometry.
This method is the same as the C function OGR_G_Transform().
 Parameters:
poCT – the transformation to apply.
 Returns:
OGRERR_NONE on success or an error code.

virtual void flattenTo2D() override
Convert geometry to strictly 2D.
In a sense this converts all Z coordinates to 0.0.
This method is the same as the C function OGR_G_FlattenTo2D().

virtual OGRBoolean IsEmpty() const override
Returns TRUE (nonzero) if the object has no points.
Normally this returns FALSE except between when an object is instantiated and points have been assigned.
This method relates to the SFCOM IGeometry::IsEmpty() method.
 Returns:
TRUE if object is empty, otherwise FALSE.

virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
This method modifies the geometry to add intermediate vertices if necessary so that the maximum length between 2 consecutive vertices is lower than dfMaxLength.
Interpolated points will have Z and M values (if needed) set to 0. Distance computation is performed in 2d only
This function is the same as the C function OGR_G_Segmentize()
 Parameters:
dfMaxLength – the maximum distance between 2 points after segmentization

virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const override
Returns if this geometry is or has curve geometry.
Returns if a geometry is, contains or may contain a CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE.
If bLookForNonLinear is set to TRUE, it will be actually looked if the geometry or its subgeometries are or contain a nonlinear geometry in them. In which case, if the method returns TRUE, it means that getLinearGeometry() would return an approximate version of the geometry. Otherwise, getLinearGeometry() would do a conversion, but with just converting container type, like COMPOUNDCURVE > LINESTRING, MULTICURVE > MULTILINESTRING or MULTISURFACE > MULTIPOLYGON, resulting in a “lossless” conversion.
This method is the same as the C function OGR_G_HasCurveGeometry().
 Since
GDAL 2.0
 Parameters:
bLookForNonLinear – set it to TRUE to check if the geometry is or contains a CIRCULARSTRING.
 Returns:
TRUE if this geometry is or has curve geometry.

virtual OGRGeometry *getCurveGeometry(const char *const *papszOptions = nullptr) const override
Return curve version of this geometry.
Returns a geometry that has possibly CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE in it, by deapproximating curve geometries.
If the geometry has no curve portion, the returned geometry will be a clone of it.
The ownership of the returned geometry belongs to the caller.
The reverse method is OGRGeometry::getLinearGeometry().
This function is the same as C function OGR_G_GetCurveGeometry().
 Since
GDAL 2.0
 Parameters:
papszOptions – options as a nullterminated list of strings. Unused for now. Must be set to NULL.
 Returns:
a new geometry.

virtual OGRGeometry *getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0, const char *const *papszOptions = nullptr) const override
Return, possibly approximate, noncurve version of this geometry.
Returns a geometry that has no CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE in it, by approximating curve geometries.
The ownership of the returned geometry belongs to the caller.
The reverse method is OGRGeometry::getCurveGeometry().
This method is the same as the C function OGR_G_GetLinearGeometry().
 Since
GDAL 2.0
 Parameters:
dfMaxAngleStepSizeDegrees – the largest step in degrees along the arc, zero to use the default setting.
papszOptions – options as a nullterminated list of strings. See OGRGeometryFactory::curveToLineString() for valid options.
 Returns:
a new geometry.

virtual size_t WkbSize() const override
Returns size of related binary representation.
This method returns the exact number of bytes required to hold the well known binary representation of this geometry object. Its computation may be slightly expensive for complex geometries.
This method relates to the SFCOM IWks::WkbSize() method.
This method is the same as the C function OGR_G_WkbSize().
 Returns:
size of binary representation in bytes.

virtual OGRErr importFromWkb(const unsigned char*, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
The object must have already been instantiated as the correct derived type of geometry object to match the binaries type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKB() method.
This method is the same as the C function OGR_G_ImportFromWkb().
 Since
GDAL 2.3
 Parameters:
pabyData – the binary input data.
nSize – the size of pabyData in bytes, or 1 if not known.
eWkbVariant – if wkbVariantPostGIS1, special interpretation is done for curve geometries code
nBytesConsumedOut – output parameter. Number of bytes consumed.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char*, OGRwkbVariant = wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
This method relates to the SFCOM IWks::ExportToWKB() method.
This method is the same as the C function OGR_G_ExportToWkb() or OGR_G_ExportToIsoWkb(), depending on the value of eWkbVariant.
 Parameters:
eByteOrder – One of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
pabyData – a buffer into which the binary representation is written. This buffer must be at least OGRGeometry::WkbSize() byte in size.
eWkbVariant – What standard to use when exporting geometries with three dimensions (or more). The default wkbVariantOldOgc is the historical OGR variant. wkbVariantIso is the variant defined in ISO SQL/MM and adopted by OGC for SFSQL 1.2.
 Returns:
Currently OGRERR_NONE is always returned.

virtual OGRErr importFromWkt(const char**) override
Assign geometry from well known text data.
The object must have already been instantiated as the correct derived type of geometry object to match the text type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKT() method.
This method is the same as the C function OGR_G_ImportFromWkt().
 Parameters:
ppszInput – pointer to a pointer to the source text. The pointer is updated to pointer after the consumed text.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(), OGRErr *err = nullptr) const override
Export a geometry collection to WKT.
 Parameters:
opts – Output options.
err – Pointer to error code, if desired.
 Returns:
WKT representation of the geometry collection.

virtual double get_Length() const
Compute the length of a multicurve.
The length is computed as the sum of the length of all members in this collection.
Note
No warning will be issued if a member of the collection does not support the get_Length method.
 Returns:
computed length.

virtual double get_Area() const
Compute area of geometry collection.
The area is computed as the sum of the areas of all members in this collection.
Note
No warning will be issued if a member of the collection does not support the get_Area method.
 Returns:
computed area.

virtual int getDimension() const override
Get the dimension of this object.
This method corresponds to the SFCOM IGeometry::GetDimension() method. It indicates the dimension of the object, but does not indicate the dimension of the underlying space (as indicated by OGRGeometry::getCoordinateDimension()).
This method is the same as the C function OGR_G_GetDimension().
 Returns:
0 for points, 1 for lines and 2 for surfaces.

virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
This method is the same as the C function OGR_G_GetEnvelope().
 Parameters:
psEnvelope – the structure in which to place the results.

virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override
Computes and returns the bounding envelope (3D) for this geometry in the passed psEnvelope structure.
This method is the same as the C function OGR_G_GetEnvelope3D().
 Since
OGR 1.9.0
 Parameters:
psEnvelope – the structure in which to place the results.

int getNumGeometries() const
Fetch number of geometries in container.
This method relates to the SFCOM IGeometryCollect::get_NumGeometries() method.
 Returns:
count of children geometries. May be zero.

OGRGeometry *getGeometryRef(int)
Fetch geometry from container.
This method returns a pointer to a geometry within the container. The returned geometry remains owned by the container, and should not be modified. The pointer is only valid until the next change to the geometry container. Use IGeometry::clone() to make a copy.
This method relates to the SFCOM IGeometryCollection::get_Geometry() method.
 Parameters:
i – the index of the geometry to fetch, between 0 and getNumGeometries()  1.
 Returns:
pointer to requested geometry.

const OGRGeometry *getGeometryRef(int) const
Fetch geometry from container.
This method returns a pointer to a geometry within the container. The returned geometry remains owned by the container, and should not be modified. The pointer is only valid until the next change to the geometry container. Use IGeometry::clone() to make a copy.
This method relates to the SFCOM IGeometryCollection::get_Geometry() method.
 Parameters:
i – the index of the geometry to fetch, between 0 and getNumGeometries()  1.
 Returns:
pointer to requested geometry.

virtual OGRBoolean Equals(const OGRGeometry*) const override
Returns TRUE if two geometries are equivalent.
This operation implements the SQL/MM ST_OrderingEquals() operation.
The comparison is done in a structural way, that is to say that the geometry types must be identical, as well as the number and ordering of subgeometries and vertices. Or equivalently, two geometries are considered equal by this method if their WKT/WKB representation is equal. Note: this must be distinguished for equality in a spatial way (which is the purpose of the ST_Equals() operation).
This method is the same as the C function OGR_G_Equals().
 Returns:
TRUE if equivalent or FALSE otherwise.

virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
This method sets the explicit coordinate dimension. Setting the coordinate dimension of a geometry to 2 should zero out any existing Z values. Setting the dimension of a geometry collection, a compound curve, a polygon, etc. will affect the children geometries. This will also remove the M dimension if present before this call.
 Deprecated:
use set3D() or setMeasured().
 Parameters:
nNewDimension – New coordinate dimension value, either 2 or 3.

virtual void set3D(OGRBoolean bIs3D) override
Add or remove the Z coordinate dimension.
This method adds or removes the explicit Z coordinate dimension. Removing the Z coordinate dimension of a geometry will remove any existing Z values. Adding the Z dimension to a geometry collection, a compound curve, a polygon, etc. will affect the children geometries.
 Since
GDAL 2.1
 Parameters:
bIs3D – Should the geometry have a Z dimension, either TRUE or FALSE.

virtual void setMeasured(OGRBoolean bIsMeasured) override
Add or remove the M coordinate dimension.
This method adds or removes the explicit M coordinate dimension. Removing the M coordinate dimension of a geometry will remove any existing M values. Adding the M dimension to a geometry collection, a compound curve, a polygon, etc. will affect the children geometries.
 Since
GDAL 2.1
 Parameters:
bIsMeasured – Should the geometry have a M dimension, either TRUE or FALSE.

virtual OGRErr addGeometry(const OGRGeometry*)
Add a geometry to the container.
Some subclasses of OGRGeometryCollection restrict the types of geometry that can be added, and may return an error. The passed geometry is cloned to make an internal copy.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_AddGeometry().
 Parameters:
poNewGeom – geometry to add to the container.
 Returns:
OGRERR_NONE if successful, or OGRERR_UNSUPPORTED_GEOMETRY_TYPE if the geometry type is illegal for the type of geometry container.

virtual OGRErr addGeometryDirectly(OGRGeometry*)
Add a geometry directly to the container.
Some subclasses of OGRGeometryCollection restrict the types of geometry that can be added, and may return an error. Ownership of the passed geometry is taken by the container rather than cloning as addGeometry() does.
This method is the same as the C function OGR_G_AddGeometryDirectly().
There is no SFCOM analog to this method.
 Parameters:
poNewGeom – geometry to add to the container.
 Returns:
OGRERR_NONE if successful, or OGRERR_UNSUPPORTED_GEOMETRY_TYPE if the geometry type is illegal for the type of geometry container.

virtual OGRErr removeGeometry(int iIndex, int bDelete = TRUE)
Remove a geometry from the container.
Removing a geometry will cause the geometry count to drop by one, and all “higher” geometries will shuffle down one in index.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_RemoveGeometry().
 Parameters:
iGeom – the index of the geometry to delete. A value of 1 is a special flag meaning that all geometries should be removed.
bDelete – if TRUE the geometry will be deallocated, otherwise it will not. The default is TRUE as the container is considered to own the geometries in it.
 Returns:
OGRERR_NONE if successful, or OGRERR_FAILURE if the index is out of range.

virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Any existing spatial reference is replaced, but under no circumstances does this result in the object being reprojected. It is just changing the interpretation of the existing geometry. Note that assigning a spatial reference increments the reference count on the OGRSpatialReference, but does not copy it.
Starting with GDAL 2.3, this will also assign the spatial reference to potential subgeometries of the geometry (OGRGeometryCollection, OGRCurvePolygon/OGRPolygon, OGRCompoundCurve, OGRPolyhedralSurface and their derived classes).
This is similar to the SFCOM IGeometry::put_SpatialReference() method.
This method is the same as the C function OGR_G_AssignSpatialReference().
 Parameters:
poSR – new spatial reference system to apply.

virtual void closeRings() override
Force rings to be closed.
If this geometry, or any contained geometries has polygon rings that are not closed, they will be closed by adding the starting point at the end.

virtual void swapXY() override
Swap x and y coordinates.
 Since
OGR 1.8.0

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Public Static Functions

static OGRGeometryCollection *CastToGeometryCollection(OGRGeometryCollection *poSrc)
Cast to geometry collection.
This methods cast a derived class of geometry collection to a plain geometry collection.
The passed in geometry is consumed and a new one returned (or NULL in case of failure).
 Since
GDAL 2.2
 Parameters:
poSrc – the input geometry  ownership is passed to the method.
 Returns:
new geometry.

typedef OGRGeometry ChildType
OGRMultiCurve class

class OGRMultiCurve : public OGRGeometryCollection
A collection of OGRCurve.
 Since
GDAL 2.0
Subclassed by OGRMultiLineString
Public Functions

OGRMultiCurve()
Create an empty multi curve collection.

OGRMultiCurve(const OGRMultiCurve &other)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

OGRMultiCurve &operator=(const OGRMultiCurve &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

virtual OGRMultiCurve *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual OGRErr importFromWkt(const char**) override
Assign geometry from well known text data.
The object must have already been instantiated as the correct derived type of geometry object to match the text type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKT() method.
This method is the same as the C function OGR_G_ImportFromWkt().
 Parameters:
ppszInput – pointer to a pointer to the source text. The pointer is updated to pointer after the consumed text.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(), OGRErr *err = nullptr) const override
Export a multicurve to WKT.
 Parameters:
opts – Output options.
err – Pointer to error code, if desired.
 Returns:
WKT representation of the multicurve.

virtual int getDimension() const override
Get the dimension of this object.
This method corresponds to the SFCOM IGeometry::GetDimension() method. It indicates the dimension of the object, but does not indicate the dimension of the underlying space (as indicated by OGRGeometry::getCoordinateDimension()).
This method is the same as the C function OGR_G_GetDimension().
 Returns:
0 for points, 1 for lines and 2 for surfaces.

virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const override
Returns if this geometry is or has curve geometry.
Returns if a geometry is, contains or may contain a CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE.
If bLookForNonLinear is set to TRUE, it will be actually looked if the geometry or its subgeometries are or contain a nonlinear geometry in them. In which case, if the method returns TRUE, it means that getLinearGeometry() would return an approximate version of the geometry. Otherwise, getLinearGeometry() would do a conversion, but with just converting container type, like COMPOUNDCURVE > LINESTRING, MULTICURVE > MULTILINESTRING or MULTISURFACE > MULTIPOLYGON, resulting in a “lossless” conversion.
This method is the same as the C function OGR_G_HasCurveGeometry().
 Since
GDAL 2.0
 Parameters:
bLookForNonLinear – set it to TRUE to check if the geometry is or contains a CIRCULARSTRING.
 Returns:
TRUE if this geometry is or has curve geometry.

inline OGRGeometryCollection *toUpperClass()
Return pointer of this in upper class.

inline const OGRGeometryCollection *toUpperClass() const
Return pointer of this in upper class.

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Public Static Functions

static OGRMultiLineString *CastToMultiLineString(OGRMultiCurve *poMC)
Cast to multi line string.
This method should only be called if the multicurve actually only contains instances of OGRLineString. This can be verified if hasCurveGeometry(TRUE) returns FALSE. It is not intended to approximate circular curves. For that use getLinearGeometry().
The passed in geometry is consumed and a new one returned (or NULL in case of failure).
 Parameters:
poMC – the input geometry  ownership is passed to the method.
 Returns:
new geometry.
OGRMultiSurface class

class OGRMultiSurface : public OGRGeometryCollection
A collection of nonoverlapping OGRSurface.
 Since
GDAL 2.0
Subclassed by OGRMultiPolygon
Public Types

typedef OGRSurface ChildType
Type of child elements.
Public Functions

OGRMultiSurface()
Create an empty multi surface collection.

OGRMultiSurface(const OGRMultiSurface &other)
Copy constructor.
Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.
 Since
GDAL 2.1

OGRMultiSurface &operator=(const OGRMultiSurface &other)
Assignment operator.
Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.
 Since
GDAL 2.1

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

virtual OGRMultiSurface *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual OGRErr importFromWkt(const char**) override
Assign geometry from well known text data.
The object must have already been instantiated as the correct derived type of geometry object to match the text type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKT() method.
This method is the same as the C function OGR_G_ImportFromWkt().
 Parameters:
ppszInput – pointer to a pointer to the source text. The pointer is updated to pointer after the consumed text.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(), OGRErr *err = nullptr) const override
Export a geometry collection to WKT.
 Parameters:
opts – Output options.
err – Pointer to error code, if desired.
 Returns:
WKT representation of the geometry collection.

virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM IMultiSurface::get_PointOnSurface() method.
NOTE: Only implemented when GEOS included in build.
 Parameters:
poPoint – point to be set with an internal point.
 Returns:
OGRERR_NONE if it succeeds or OGRERR_FAILURE otherwise.

virtual int getDimension() const override
Get the dimension of this object.
This method corresponds to the SFCOM IGeometry::GetDimension() method. It indicates the dimension of the object, but does not indicate the dimension of the underlying space (as indicated by OGRGeometry::getCoordinateDimension()).
This method is the same as the C function OGR_G_GetDimension().
 Returns:
0 for points, 1 for lines and 2 for surfaces.

inline OGRSurface *getGeometryRef(int i)

inline const OGRSurface *getGeometryRef(int i) const

virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const override
Returns if this geometry is or has curve geometry.
Returns if a geometry is, contains or may contain a CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE.
If bLookForNonLinear is set to TRUE, it will be actually looked if the geometry or its subgeometries are or contain a nonlinear geometry in them. In which case, if the method returns TRUE, it means that getLinearGeometry() would return an approximate version of the geometry. Otherwise, getLinearGeometry() would do a conversion, but with just converting container type, like COMPOUNDCURVE > LINESTRING, MULTICURVE > MULTILINESTRING or MULTISURFACE > MULTIPOLYGON, resulting in a “lossless” conversion.
This method is the same as the C function OGR_G_HasCurveGeometry().
 Since
GDAL 2.0
 Parameters:
bLookForNonLinear – set it to TRUE to check if the geometry is or contains a CIRCULARSTRING.
 Returns:
TRUE if this geometry is or has curve geometry.

inline OGRGeometryCollection *toUpperClass()
Return pointer of this in upper class.

inline const OGRGeometryCollection *toUpperClass() const
Return pointer of this in upper class.

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Public Static Functions

static OGRMultiPolygon *CastToMultiPolygon(OGRMultiSurface *poMS)
Cast to multipolygon.
This method should only be called if the multisurface actually only contains instances of OGRPolygon. This can be verified if hasCurveGeometry(TRUE) returns FALSE. It is not intended to approximate curve polygons. For that use getLinearGeometry().
The passed in geometry is consumed and a new one returned (or NULL in case of failure).
 Parameters:
poMS – the input geometry  ownership is passed to the method.
 Returns:
new geometry.
OGRPolyhedralSurface class

class OGRPolyhedralSurface : public OGRSurface
PolyhedralSurface class.
 Since
GDAL 2.2
Subclassed by OGRTriangulatedSurface
Public Types

typedef OGRPolygon ChildType
Type of child elements.
Public Functions

OGRPolyhedralSurface()
Create an empty PolyhedralSurface.

OGRPolyhedralSurface(const OGRPolyhedralSurface &poGeom)
Copy constructor.

~OGRPolyhedralSurface() override
Destructor.

OGRPolyhedralSurface &operator=(const OGRPolyhedralSurface &other)
Assignment operator.

virtual size_t WkbSize() const override
Returns size of related binary representation.
This method returns the exact number of bytes required to hold the well known binary representation of this geometry object. Its computation may be slightly expensive for complex geometries.
This method relates to the SFCOM IWks::WkbSize() method.
This method is the same as the C function OGR_G_WkbSize().
 Returns:
size of binary representation in bytes.

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual OGRwkbGeometryType getGeometryType() const override
Returns the WKB Type of PolyhedralSurface.

virtual OGRErr importFromWkb(const unsigned char*, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
The object must have already been instantiated as the correct derived type of geometry object to match the binaries type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKB() method.
This method is the same as the C function OGR_G_ImportFromWkb().
 Since
GDAL 2.3
 Parameters:
pabyData – the binary input data.
nSize – the size of pabyData in bytes, or 1 if not known.
eWkbVariant – if wkbVariantPostGIS1, special interpretation is done for curve geometries code
nBytesConsumedOut – output parameter. Number of bytes consumed.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char*, OGRwkbVariant = wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
This method relates to the SFCOM IWks::ExportToWKB() method.
This method is the same as the C function OGR_G_ExportToWkb() or OGR_G_ExportToIsoWkb(), depending on the value of eWkbVariant.
 Parameters:
eByteOrder – One of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
pabyData – a buffer into which the binary representation is written. This buffer must be at least OGRGeometry::WkbSize() byte in size.
eWkbVariant – What standard to use when exporting geometries with three dimensions (or more). The default wkbVariantOldOgc is the historical OGR variant. wkbVariantIso is the variant defined in ISO SQL/MM and adopted by OGC for SFSQL 1.2.
 Returns:
Currently OGRERR_NONE is always returned.

virtual OGRErr importFromWkt(const char**) override
Assign geometry from well known text data.
The object must have already been instantiated as the correct derived type of geometry object to match the text type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKT() method.
This method is the same as the C function OGR_G_ImportFromWkt().
 Parameters:
ppszInput – pointer to a pointer to the source text. The pointer is updated to pointer after the consumed text.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(), OGRErr *err = nullptr) const override
Export a polyhedral surface to WKT.
 Parameters:
opts – Output options.
err – Pointer to error code, if desired.
 Returns:
WKT representation of the polyhedral surface.

virtual int getDimension() const override
Get the dimension of this object.
This method corresponds to the SFCOM IGeometry::GetDimension() method. It indicates the dimension of the object, but does not indicate the dimension of the underlying space (as indicated by OGRGeometry::getCoordinateDimension()).
This method is the same as the C function OGR_G_GetDimension().
 Returns:
0 for points, 1 for lines and 2 for surfaces.

virtual void empty() override
Clear geometry information.
This restores the geometry to its initial state after construction, and before assignment of actual geometry.
This method relates to the SFCOM IGeometry::Empty() method.
This method is the same as the C function OGR_G_Empty().

virtual OGRPolyhedralSurface *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
This method is the same as the C function OGR_G_GetEnvelope().
 Parameters:
psEnvelope – the structure in which to place the results.

virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override
Computes and returns the bounding envelope (3D) for this geometry in the passed psEnvelope structure.
This method is the same as the C function OGR_G_GetEnvelope3D().
 Since
OGR 1.9.0
 Parameters:
psEnvelope – the structure in which to place the results.

virtual void flattenTo2D() override
Convert geometry to strictly 2D.
In a sense this converts all Z coordinates to 0.0.
This method is the same as the C function OGR_G_FlattenTo2D().

virtual OGRErr transform(OGRCoordinateTransformation*) override
Apply arbitrary coordinate transformation to geometry.
This method will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.
Note that this method does not require that the geometry already have a spatial reference system. It will be assumed that they can be treated as having the source spatial reference system of the OGRCoordinateTransformation object, and the actual SRS of the geometry will be ignored. On successful completion the output OGRSpatialReference of the OGRCoordinateTransformation will be assigned to the geometry.
This method is the same as the C function OGR_G_Transform().
 Parameters:
poCT – the transformation to apply.
 Returns:
OGRERR_NONE on success or an error code.

virtual OGRBoolean Equals(const OGRGeometry*) const override
Returns TRUE if two geometries are equivalent.
This operation implements the SQL/MM ST_OrderingEquals() operation.
The comparison is done in a structural way, that is to say that the geometry types must be identical, as well as the number and ordering of subgeometries and vertices. Or equivalently, two geometries are considered equal by this method if their WKT/WKB representation is equal. Note: this must be distinguished for equality in a spatial way (which is the purpose of the ST_Equals() operation).
This method is the same as the C function OGR_G_Equals().
 Returns:
TRUE if equivalent or FALSE otherwise.

virtual double get_Area() const override
Returns the area enclosed.
This method is built on the SFCGAL library, check it for the definition of the geometry operation. If OGR is built without the SFCGAL library, this method will always return 1.0
 Returns:
area enclosed by the PolyhedralSurface

virtual OGRErr PointOnSurface(OGRPoint*) const override
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
NOTE: Only implemented when GEOS included in build.
 Parameters:
poPoint – point to be set with an internal point.
 Returns:
OGRERR_NONE if it succeeds or OGRERR_FAILURE otherwise.

virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const override
Returns if this geometry is or has curve geometry.
Returns if a geometry is, contains or may contain a CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON, MULTICURVE or MULTISURFACE.
If bLookForNonLinear is set to TRUE, it will be actually looked if the geometry or its subgeometries are or contain a nonlinear geometry in them. In which case, if the method returns TRUE, it means that getLinearGeometry() would return an approximate version of the geometry. Otherwise, getLinearGeometry() would do a conversion, but with just converting container type, like COMPOUNDCURVE > LINESTRING, MULTICURVE > MULTILINESTRING or MULTISURFACE > MULTIPOLYGON, resulting in a “lossless” conversion.
This method is the same as the C function OGR_G_HasCurveGeometry().
 Since
GDAL 2.0
 Parameters:
bLookForNonLinear – set it to TRUE to check if the geometry is or contains a CIRCULARSTRING.
 Returns:
TRUE if this geometry is or has curve geometry.

virtual OGRErr addGeometry(const OGRGeometry*)
Add a new geometry to a collection.
Only a POLYGON can be added to a POLYHEDRALSURFACE.
 Returns:
OGRErr OGRERR_NONE if the polygon is successfully added

OGRErr addGeometryDirectly(OGRGeometry *poNewGeom)
Add a geometry directly to the container.
This method is the same as the C function OGR_G_AddGeometryDirectly().
There is no SFCOM analog to this method.
 Parameters:
poNewGeom – geometry to add to the container.
 Returns:
OGRERR_NONE if successful, or OGRERR_UNSUPPORTED_GEOMETRY_TYPE if the geometry type is illegal for the type of geometry container.

int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
 Returns:
count of children geometries. May be zero.

OGRPolygon *getGeometryRef(int i)
Fetch geometry from container.
This method returns a pointer to an geometry within the container. The returned geometry remains owned by the container, and should not be modified. The pointer is only valid until the next change to the geometry container. Use IGeometry::clone() to make a copy.
 Parameters:
i – the index of the geometry to fetch, between 0 and getNumGeometries()  1.
 Returns:
pointer to requested geometry.

const OGRPolygon *getGeometryRef(int i) const
Fetch geometry from container.
This method returns a pointer to an geometry within the container. The returned geometry remains owned by the container, and should not be modified. The pointer is only valid until the next change to the geometry container. Use IGeometry::clone() to make a copy.
 Parameters:
i – the index of the geometry to fetch, between 0 and getNumGeometries()  1.
 Returns:
pointer to requested geometry.

virtual OGRBoolean IsEmpty() const override
Checks if the PolyhedralSurface is empty.
 Returns:
TRUE if the PolyhedralSurface is empty, FALSE otherwise

virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
This method sets the explicit coordinate dimension. Setting the coordinate dimension of a geometry to 2 should zero out any existing Z values. This will also remove the M dimension if present before this call.
 Parameters:
nNewDimension – New coordinate dimension value, either 2 or 3.

virtual void set3D(OGRBoolean bIs3D) override
Set the type as 3D geometry.

virtual void setMeasured(OGRBoolean bIsMeasured) override
Set the type as Measured.

virtual void swapXY() override
Swap x and y coordinates.

OGRErr removeGeometry(int iIndex, int bDelete = TRUE)
Remove a geometry from the container.
Removing a geometry will cause the geometry count to drop by one, and all “higher” geometries will shuffle down one in index.
 Parameters:
iGeom – the index of the geometry to delete. A value of 1 is a special flag meaning that all geometries should be removed.
bDelete – if TRUE the geometry will be deallocated, otherwise it will not. The default is TRUE as the container is considered to own the geometries in it.
 Returns:
OGRERR_NONE if successful, or OGRERR_FAILURE if the index is out of range.

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.

virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Any existing spatial reference is replaced, but under no circumstances does this result in the object being reprojected. It is just changing the interpretation of the existing geometry. Note that assigning a spatial reference increments the reference count on the OGRSpatialReference, but does not copy it.
Starting with GDAL 2.3, this will also assign the spatial reference to potential subgeometries of the geometry (OGRGeometryCollection, OGRCurvePolygon/OGRPolygon, OGRCompoundCurve, OGRPolyhedralSurface and their derived classes).
This is similar to the SFCOM IGeometry::put_SpatialReference() method.
This method is the same as the C function OGR_G_AssignSpatialReference().
 Parameters:
poSR – new spatial reference system to apply.
Public Static Functions

static OGRMultiPolygon *CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
The passed in geometry is consumed and a new one returned (or NULL in case of failure)
 Parameters:
poPS – the input geometry  ownership is passed to the method.
 Returns:
new geometry.
OGRTriangle class

class OGRTriangle : public OGRPolygon
Triangle class.
 Since
GDAL 2.2
Public Functions

OGRTriangle()
Constructor.

OGRTriangle(const OGRPoint &p, const OGRPoint &q, const OGRPoint &r)
Construct a triangle from points.
 Parameters:
p – Point 1
q – Point 2
r – Point 3

OGRTriangle(const OGRTriangle &other)
Copy constructor.

OGRTriangle(const OGRPolygon &other, OGRErr &eErr)
Constructs an OGRTriangle from a valid OGRPolygon.
In case of error, NULL is returned.
 Parameters:
other – the Polygon we wish to construct a triangle from
eErr – encapsulates an error code; contains OGRERR_NONE if the triangle is constructed successfully

OGRTriangle &operator=(const OGRTriangle &other)
Assignment operator.
 Parameters:
other – A triangle passed as a parameter
 Returns:
OGRTriangle A copy of other

~OGRTriangle() override
Destructor.

virtual const char *getGeometryName() const override
Fetch WKT name for geometry type.
There is no SFCOM analog to this method.
This method is the same as the C function OGR_G_GetGeometryName().
 Returns:
name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.
This method is the same as the C function OGR_G_GetGeometryType().
 Returns:
the geometry type code.

virtual OGRTriangle *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

virtual OGRErr importFromWkb(const unsigned char*, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
The object must have already been instantiated as the correct derived type of geometry object to match the binaries type. This method is used by the OGRGeometryFactory class, but not normally called by application code.
This method relates to the SFCOM IWks::ImportFromWKB() method.
This method is the same as the C function OGR_G_ImportFromWkb().
 Since
GDAL 2.3
 Parameters:
pabyData – the binary input data.
nSize – the size of pabyData in bytes, or 1 if not known.
eWkbVariant – if wkbVariantPostGIS1, special interpretation is done for curve geometries code
nBytesConsumedOut – output parameter. Number of bytes consumed.
 Returns:
OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

virtual OGRErr addRingDirectly(OGRCurve *poNewRing) override
Add a ring to a polygon.
If the polygon has no external ring (it is empty) this will be used as the external ring, otherwise it is used as an internal ring. Ownership of the passed ring is assumed by the OGRCurvePolygon, but otherwise this method operates the same as OGRCurvePolygon::AddRing().
This method has no SFCOM analog.
 Parameters:
poNewRing – ring to be added to the polygon.
 Returns:
OGRERR_NONE in case of success

inline OGRPolygon *toUpperClass()
Return pointer of this in upper class.

inline const OGRPolygon *toUpperClass() const
Return pointer of this in upper class.

inline virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.

inline virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
OGRTriangulatedSurface class

class OGRTriangulatedSurface : public OGRPolyhedralSurface
TriangulatedSurface class.
 Since
GDAL 2.2
Public Types

typedef OGRTriangle ChildType
Type of child elements.
Public Functions

OGRTriangulatedSurface()
Constructor.

OGRTriangulatedSurface(const OGRTriangulatedSurface &other)
Copy constructor.

~OGRTriangulatedSurface()
Destructor.

OGRTriangulatedSurface &operator=(const OGRTriangulatedSurface &other)
Assignment operator.

virtual const char *getGeometryName() const override
Returns the geometry name of the TriangulatedSurface.
 Returns:
“TIN”

virtual OGRwkbGeometryType getGeometryType() const override
Returns the WKB Type of TriangulatedSurface.

virtual OGRTriangulatedSurface *clone() const override
Make a copy of this object.
This method relates to the SFCOM IGeometry::clone() method.
This method is the same as the C function OGR_G_Clone().
 Returns:
a new object instance with the same geometry, and spatial reference system as the original.

inline OGRTriangle *getGeometryRef(int i)

inline const OGRTriangle *getGeometryRef(int i) const

virtual OGRErr addGeometry(const OGRGeometry*) override
Add a new geometry to a collection.
Only a POLYGON can be added to a POLYHEDRALSURFACE.
 Returns:
OGRErr OGRERR_NONE if the polygon is successfully added

inline OGRPolyhedralSurface *toUpperClass()
Return pointer of this in upper class.

inline const OGRPolyhedralSurface *toUpperClass() const
Return pointer of this in upper class.
 inline virtual void accept<