GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | List of all members
OGRGeomFieldDefn Class Reference

Definition of a geometry field of an OGRFeatureDefn. More...

`#include <ogr_feature.h>`

## Public Member Functions
| OGRGeomFieldDefn (const char *pszNameIn, OGRwkbGeometryType eGeomTypeIn)
| Constructor. More...
| OGRGeomFieldDefn (const OGRGeomFieldDefn *)
| Constructor. More...
void | SetName (const char *)
| Reset the name of this field. More...
const char * | GetNameRef () const
| Fetch name of this field. More...
OGRwkbGeometryType | GetType () const
| Fetch geometry type of this field. More...
void | SetType (OGRwkbGeometryType eTypeIn)
| Set the geometry type of this field. More...
virtual OGRSpatialReference * | GetSpatialRef () const
| Fetch spatial reference system of this field. More...
void | SetSpatialRef (OGRSpatialReference *poSRSIn)
| Set the spatial reference of this field. More...
int | IsIgnored () const
| Return whether this field should be omitted when fetching features. More...
void | SetIgnored (int bIgnoreIn)
| Set whether this field should be omitted when fetching features. More...
int | IsNullable () const
| Return whether this geometry field can receive null values. More...
void | SetNullable (int bNullableIn)
| Set whether this geometry field can receive null values. More...
int | IsSame (const OGRGeomFieldDefn *) const
| Test if the geometry field definition is identical to the other one. More...

## Static Public Member Functions
static OGRGeomFieldDefnH | ToHandle (OGRGeomFieldDefn *poGeomFieldDefn)
| Convert a OGRGeomFieldDefn* to a OGRGeomFieldDefnH. More...
static OGRGeomFieldDefn * | FromHandle (OGRGeomFieldDefnH hGeomFieldDefn)
| Convert a OGRGeomFieldDefnH to a OGRGeomFieldDefn*. More...

## Detailed Description

Definition of a geometry field of an OGRFeatureDefn.

A geometry field is described by :

- a name. See SetName() / GetNameRef()
- a type: wkbPoint, wkbLineString, ... See SetType() / GetType()
- a spatial reference system (optional). See SetSpatialRef() / GetSpatialRef()
- a NOT NULL constraint (optional). See SetNullable() / IsNullable()
- a boolean to indicate whether it should be ignored when retrieving features. See SetIgnored() / IsIgnored()

Since
  OGR 1.11

## Constructor & Destructor Documentation

OGRGeomFieldDefn::OGRGeomFieldDefn | ( | const char * | pszNameIn,
|  | OGRwkbGeometryType | eGeomTypeIn
| ) |  |

Constructor.

Parameters

  pszNameIn | the name of the new field.
  eGeomTypeIn | the type of the new field.

Since
  GDAL 1.11

OGRGeomFieldDefn::OGRGeomFieldDefn | ( | const OGRGeomFieldDefn * | poPrototype | ) |
| explicit

Constructor.

Create by cloning an existing geometry field definition.

Parameters

  poPrototype | the geometry field definition to clone.

Since
  GDAL 1.11

## Member Function Documentation

static OGRGeomFieldDefn* OGRGeomFieldDefn::FromHandle | ( | OGRGeomFieldDefnH | hGeomFieldDefn | ) |
| inline static

Convert a OGRGeomFieldDefnH to a OGRGeomFieldDefn*.

Since
  GDAL 2.3

const char * OGRGeomFieldDefn::GetNameRef | ( |  | ) | const
| inline

Fetch name of this field.

This method is the same as the C function OGR_GFld_GetNameRef().

Returns
  pointer to an internal name string that should not be freed or modified.

Since
  GDAL 1.11

OGRSpatialReference * OGRGeomFieldDefn::GetSpatialRef | ( |  | ) | const
| virtual

Fetch spatial reference system of this field.

This method is the same as the C function OGR_GFld_GetSpatialRef().

Returns
  field spatial reference system.

Since
  GDAL 1.11

OGRwkbGeometryType OGRGeomFieldDefn::GetType | ( |  | ) | const
| inline

Fetch geometry type of this field.

This method is the same as the C function OGR_GFld_GetType().

Returns
  field geometry type.

Since
  GDAL 1.11

int OGRGeomFieldDefn::IsIgnored | ( |  | ) | const
| inline

Return whether this field should be omitted when fetching features.

This method is the same as the C function OGR_GFld_IsIgnored().

Returns
  ignore state

Since
  GDAL 1.11

int OGRGeomFieldDefn::IsNullable | ( |  | ) | const
| inline

Return whether this geometry field can receive null values.

By default, fields are nullable.

Even if this method returns FALSE (i.e not-nullable field), it doesn't mean that OGRFeature::IsFieldSet() will necessary return TRUE, as fields can be temporary unset and null/not-null validation is usually done when OGRLayer::CreateFeature()/SetFeature() is called.

Note that not-nullable geometry fields might also contain 'empty' geometries.

This method is the same as the C function OGR_GFld_IsNullable().

Returns
  TRUE if the field is authorized to be null.

Since
  GDAL 2.0

int OGRGeomFieldDefn::IsSame | ( | const OGRGeomFieldDefn * | poOtherFieldDefn | ) | const

Test if the geometry field definition is identical to the other one.

Parameters

  poOtherFieldDefn | the other field definition to compare to.

Returns
  TRUE if the geometry field definition is identical to the other one.

Since
  GDAL 1.11

void OGRGeomFieldDefn::SetIgnored | ( | int | ignore | ) |
| inline

Set whether this field should be omitted when fetching features.

This method is the same as the C function OGR_GFld_SetIgnored().

Parameters

  ignore | ignore state

Since
  GDAL 1.11

void OGRGeomFieldDefn::SetName | ( | const char * | pszNameIn | ) |

Reset the name of this field.

This method is the same as the C function OGR_GFld_SetName().

Parameters

  pszNameIn | the new name to apply.

Since
  GDAL 1.11

void OGRGeomFieldDefn::SetNullable | ( | int | bNullableIn | ) |
| inline

Set whether this geometry field can receive null values.

By default, fields are nullable, so this method is generally called with FALSE to set a not-null constraint.

Drivers that support writing not-null constraint will advertize the GDAL_DCAP_NOTNULL_GEOMFIELDS driver metadata item.

This method is the same as the C function OGR_GFld_SetNullable().

Parameters

  bNullableIn | FALSE if the field must have a not-null constraint.

Since
  GDAL 2.0

void OGRGeomFieldDefn::SetSpatialRef | ( | OGRSpatialReference * | poSRSIn | ) |

Set the spatial reference of this field.

This method is the same as the C function OGR_GFld_SetSpatialRef().

This method drops the reference of the previously set SRS object and acquires a new reference on the passed object (if non-NULL).

Parameters

  poSRSIn | the new SRS to apply.

Since
  GDAL 1.11

void OGRGeomFieldDefn::SetType | ( | OGRwkbGeometryType | eTypeIn | ) |

Set the geometry type of this field.

This should never be done to an OGRGeomFieldDefn that is already part of an OGRFeatureDefn.

This method is the same as the C function OGR_GFld_SetType().

Parameters

  eTypeIn | the new field geometry type.

Since
  GDAL 1.11

static OGRGeomFieldDefnH OGRGeomFieldDefn::ToHandle | ( | OGRGeomFieldDefn * | poGeomFieldDefn | ) |
| inline static

Convert a OGRGeomFieldDefn* to a OGRGeomFieldDefnH.

Since
  GDAL 2.3

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

- ogr_feature.h
- ogrgeomfielddefn.cpp

Generated for GDAL by 1.8.8.