Package osgeo :: Module ogr :: Class FieldDefn
[hide private]
[frames] | no frames]

Class FieldDefn

source code


Proxy of C++ OGRFieldDefnShadow class.

Instance Methods [hide private]
 
__repr__(self) source code
 
__init__(self, *args, **kwargs)
__init__(OGRFieldDefnShadow self, char const * name_null_ok, OGRFieldType field_type) -> FieldDefn
source code
 
GetName(self, *args)
GetName(FieldDefn self) -> char const *
source code
 
GetNameRef(self, *args)
GetNameRef(FieldDefn self) -> char const *
source code
 
SetName(self, *args)
SetName(FieldDefn self, char const * name)
source code
 
GetAlternativeName(self, *args)
GetAlternativeName(FieldDefn self) -> char const *
source code
 
GetAlternativeNameRef(self, *args)
GetAlternativeNameRef(FieldDefn self) -> char const *
source code
 
SetAlternativeName(self, *args)
SetAlternativeName(FieldDefn self, char const * alternativeName)
source code
 
GetType(self, *args)
GetType(FieldDefn self) -> OGRFieldType
source code
 
SetType(self, *args)
SetType(FieldDefn self, OGRFieldType type)
source code
 
GetSubType(self, *args)
GetSubType(FieldDefn self) -> OGRFieldSubType
source code
 
SetSubType(self, *args)
SetSubType(FieldDefn self, OGRFieldSubType type)
source code
 
GetJustify(self, *args)
GetJustify(FieldDefn self) -> OGRJustification
source code
 
SetJustify(self, *args)
SetJustify(FieldDefn self, OGRJustification justify)
source code
 
GetWidth(self, *args)
GetWidth(FieldDefn self) -> int
source code
 
SetWidth(self, *args)
SetWidth(FieldDefn self, int width)
source code
 
GetPrecision(self, *args)
GetPrecision(FieldDefn self) -> int
source code
 
SetPrecision(self, *args)
SetPrecision(FieldDefn self, int precision)
source code
 
GetTypeName(self, *args)
GetTypeName(FieldDefn self) -> char const *
source code
 
GetFieldTypeName(self, *args)
GetFieldTypeName(FieldDefn self, OGRFieldType type) -> char const *
source code
 
IsIgnored(self, *args)
IsIgnored(FieldDefn self) -> int
source code
 
SetIgnored(self, *args)
SetIgnored(FieldDefn self, int bIgnored)
source code
 
IsNullable(self, *args)
IsNullable(FieldDefn self) -> int
source code
 
SetNullable(self, *args)
SetNullable(FieldDefn self, int bNullable)
source code
 
IsUnique(self, *args)
IsUnique(FieldDefn self) -> int
source code
 
SetUnique(self, *args)
SetUnique(FieldDefn self, int bUnique)
source code
 
GetDefault(self, *args)
GetDefault(FieldDefn self) -> char const *
source code
 
SetDefault(self, *args)
SetDefault(FieldDefn self, char const * pszValue)
source code
 
IsDefaultDriverSpecific(self, *args)
IsDefaultDriverSpecific(FieldDefn self) -> int
source code
 
Destroy(self)
Once called, self has effectively been destroyed.
source code
Class Variables [hide private]
  __swig_setmethods__ = {}
  __setattr__ = lambda self, name, value:
  __swig_getmethods__ = {}
  __getattr__ = lambda self, name:
  __swig_destroy__ = _ogr.delete_FieldDefn
  __del__ = lambda self:
  width = property(GetWidth, SetWidth)
  type = property(GetType, SetType)
  precision = property(GetPrecision, SetPrecision)
  name = property(GetName, SetName)
  justify = property(GetJustify, SetJustify)
Method Details [hide private]

GetNameRef(self, *args)

source code 

GetNameRef(FieldDefn self) -> char const *

const char*
OGR_Fld_GetNameRef(OGRFieldDefnH hDefn)

Fetch name of this field.

This function is the same as the CPP method
OGRFieldDefn::GetNameRef().

Parameters:
-----------

hDefn:  handle to the field definition.

the name of the field definition. 

SetName(self, *args)

source code 

SetName(FieldDefn self, char const * name)

void OGR_Fld_SetName(OGRFieldDefnH
hDefn, const char *pszName)

Reset the name of this field.

This function is the same as the CPP method OGRFieldDefn::SetName().

Parameters:
-----------

hDefn:  handle to the field definition to apply the new name to.

pszName:  the new name to apply. 

GetAlternativeNameRef(self, *args)

source code 

GetAlternativeNameRef(FieldDefn self) -> char const *

const char*
OGR_Fld_GetAlternativeNameRef(OGRFieldDefnH hDefn)

Fetch the alternative name (or "alias") for this field.

The alternative name is an optional attribute for a field which can
provide a more user-friendly, descriptive name of a field which is not
subject to the usual naming constraints defined by the data provider.

This is a metadata style attribute only: the alternative name cannot
be used in place of the actual field name during SQL queries or other
field name dependent API calls.

This function is the same as the CPP method
OGRFieldDefn::GetAlternativeNameRef().

Parameters:
-----------

hDefn:  handle to the field definition.

the alternative name of the field definition.

GDAL 3.2 

SetAlternativeName(self, *args)

source code 

SetAlternativeName(FieldDefn self, char const * alternativeName)

void
OGR_Fld_SetAlternativeName(OGRFieldDefnH hDefn, const char
*pszAlternativeName)

Reset the alternative name (or "alias") for this field.

The alternative name is an optional attribute for a field which can
provide a more user-friendly, descriptive name of a field which is not
subject to the usual naming constraints defined by the data provider.

This is a metadata style attribute only: the alternative name cannot
be used in place of the actual field name during SQL queries or other
field name dependent API calls.

This function is the same as the CPP method
OGRFieldDefn::SetAlternativeName().

Parameters:
-----------

hDefn:  handle to the field definition to apply the new alternative
name to.

pszAlternativeName:  the new alternative name to apply.

GDAL 3.2 

GetType(self, *args)

source code 

GetType(FieldDefn self) -> OGRFieldType

OGRFieldType
OGR_Fld_GetType(OGRFieldDefnH hDefn)

Fetch type of this field.

This function is the same as the CPP method OGRFieldDefn::GetType().

Parameters:
-----------

hDefn:  handle to the field definition to get type from.

field type. 

SetType(self, *args)

source code 

SetType(FieldDefn self, OGRFieldType type)

void OGR_Fld_SetType(OGRFieldDefnH
hDefn, OGRFieldType eType)

Set the type of this field.

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

This function is the same as the CPP method OGRFieldDefn::SetType().

Parameters:
-----------

hDefn:  handle to the field definition to set type to.

eType:  the new field type. 

GetSubType(self, *args)

source code 

GetSubType(FieldDefn self) -> OGRFieldSubType

OGRFieldSubType
OGR_Fld_GetSubType(OGRFieldDefnH hDefn)

Fetch subtype of this field.

This function is the same as the CPP method
OGRFieldDefn::GetSubType().

Parameters:
-----------

hDefn:  handle to the field definition to get subtype from.

field subtype.

GDAL 2.0 

SetSubType(self, *args)

source code 

SetSubType(FieldDefn self, OGRFieldSubType type)

void
OGR_Fld_SetSubType(OGRFieldDefnH hDefn, OGRFieldSubType eSubType)

Set the subtype of this field.

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

This function is the same as the CPP method
OGRFieldDefn::SetSubType().

Parameters:
-----------

hDefn:  handle to the field definition to set type to.

eSubType:  the new field subtype.

GDAL 2.0 

GetJustify(self, *args)

source code 

GetJustify(FieldDefn self) -> OGRJustification

OGRJustification
OGR_Fld_GetJustify(OGRFieldDefnH hDefn)

Get the justification for this field.

This function is the same as the CPP method
OGRFieldDefn::GetJustify().

Note: no driver is know to use the concept of field justification.

Parameters:
-----------

hDefn:  handle to the field definition to get justification from.

the justification. 

SetJustify(self, *args)

source code 

SetJustify(FieldDefn self, OGRJustification justify)

void
OGR_Fld_SetJustify(OGRFieldDefnH hDefn, OGRJustification eJustify)

Set the justification for this field.

Note: no driver is know to use the concept of field justification.

This function is the same as the CPP method
OGRFieldDefn::SetJustify().

Parameters:
-----------

hDefn:  handle to the field definition to set justification to.

eJustify:  the new justification. 

GetWidth(self, *args)

source code 

GetWidth(FieldDefn self) -> int

int OGR_Fld_GetWidth(OGRFieldDefnH
hDefn)

Get the formatting width for this field.

This function is the same as the CPP method OGRFieldDefn::GetWidth().

Parameters:
-----------

hDefn:  handle to the field definition to get width from.

the width, zero means no specified width. 

SetWidth(self, *args)

source code 

SetWidth(FieldDefn self, int width)

void OGR_Fld_SetWidth(OGRFieldDefnH
hDefn, int nNewWidth)

Set the formatting width for this field in characters.

This function is the same as the CPP method OGRFieldDefn::SetWidth().

Parameters:
-----------

hDefn:  handle to the field definition to set width to.

nNewWidth:  the new width. 

GetPrecision(self, *args)

source code 

GetPrecision(FieldDefn self) -> int

int
OGR_Fld_GetPrecision(OGRFieldDefnH hDefn)

Get the formatting precision for this field.

This should normally be zero for fields of types other than OFTReal.

This function is the same as the CPP method
OGRFieldDefn::GetPrecision().

Parameters:
-----------

hDefn:  handle to the field definition to get precision from.

the precision. 

SetPrecision(self, *args)

source code 

SetPrecision(FieldDefn self, int precision)

void
OGR_Fld_SetPrecision(OGRFieldDefnH hDefn, int nPrecision)

Set the formatting precision for this field in characters.

This should normally be zero for fields of types other than OFTReal.

This function is the same as the CPP method
OGRFieldDefn::SetPrecision().

Parameters:
-----------

hDefn:  handle to the field definition to set precision to.

nPrecision:  the new precision. 

IsIgnored(self, *args)

source code 

IsIgnored(FieldDefn self) -> int

int OGR_Fld_IsIgnored(OGRFieldDefnH
hDefn)

Return whether this field should be omitted when fetching features.

This method is the same as the C++ method OGRFieldDefn::IsIgnored().

Parameters:
-----------

hDefn:  handle to the field definition

ignore state 

SetIgnored(self, *args)

source code 

SetIgnored(FieldDefn self, int bIgnored)

void
OGR_Fld_SetIgnored(OGRFieldDefnH hDefn, int ignore)

Set whether this field should be omitted when fetching features.

This method is the same as the C++ method OGRFieldDefn::SetIgnored().

Parameters:
-----------

hDefn:  handle to the field definition

ignore:  ignore state 

IsNullable(self, *args)

source code 

IsNullable(FieldDefn self) -> int

int
OGR_Fld_IsNullable(OGRFieldDefnH hDefn)

Return whether this 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.

This method is the same as the C++ method OGRFieldDefn::IsNullable().

Parameters:
-----------

hDefn:  handle to the field definition

TRUE if the field is authorized to be null.

GDAL 2.0 

SetNullable(self, *args)

source code 

SetNullable(FieldDefn self, int bNullable)

void
OGR_Fld_SetNullable(OGRFieldDefnH hDefn, int bNullableIn)

Set whether this 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 advertise the
GDAL_DCAP_NOTNULL_FIELDS driver metadata item.

This method is the same as the C++ method OGRFieldDefn::SetNullable().

Parameters:
-----------

hDefn:  handle to the field definition

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

GDAL 2.0 

IsUnique(self, *args)

source code 

IsUnique(FieldDefn self) -> int

int OGR_Fld_IsUnique(OGRFieldDefnH
hDefn)

Return whether this field has a unique constraint.

By default, fields have no unique constraint.

This method is the same as the C++ method OGRFieldDefn::IsUnique().

Parameters:
-----------

hDefn:  handle to the field definition

TRUE if the field has a unique constraint.

GDAL 3.2 

SetUnique(self, *args)

source code 

SetUnique(FieldDefn self, int bUnique)

void
OGR_Fld_SetUnique(OGRFieldDefnH hDefn, int bUniqueIn)

Set whether this field has a unique constraint.

By default, fields have no unique constraint, so this method is
generally called with TRUE to set a unique constraint.

Drivers that support writing unique constraint will advertise the
GDAL_DCAP_UNIQUE_FIELDS driver metadata item. field can receive null
values.

This method is the same as the C++ method OGRFieldDefn::SetUnique().

Parameters:
-----------

hDefn:  handle to the field definition

bUniqueIn:  TRUE if the field must have a unique constraint.

GDAL 3.2 

GetDefault(self, *args)

source code 

GetDefault(FieldDefn self) -> char const *

const char*
OGR_Fld_GetDefault(OGRFieldDefnH hDefn)

Get default field value.

This function is the same as the C++ method
OGRFieldDefn::GetDefault().

Parameters:
-----------

hDefn:  handle to the field definition.

default field value or NULL.

GDAL 2.0 

SetDefault(self, *args)

source code 

SetDefault(FieldDefn self, char const * pszValue)

void
OGR_Fld_SetDefault(OGRFieldDefnH hDefn, const char *pszDefault)

Set default field value.

The default field value is taken into account by drivers (generally
those with a SQL interface) that support it at field creation time.
OGR will generally not automatically set the default field value to
null fields by itself when calling OGRFeature::CreateFeature() /
OGRFeature::SetFeature(), but will let the low-level layers to do the
job. So retrieving the feature from the layer is recommended.

The accepted values are NULL, a numeric value, a literal value
enclosed between single quote characters (and inner single quote
characters escaped by repetition of the single quote character),
CURRENT_TIMESTAMP, CURRENT_TIME, CURRENT_DATE or a driver specific
expression (that might be ignored by other drivers). For a datetime
literal value, format should be 'YYYY/MM/DD HH:MM:SS[.sss]'
(considered as UTC time).

Drivers that support writing DEFAULT clauses will advertise the
GDAL_DCAP_DEFAULT_FIELDS driver metadata item.

This function is the same as the C++ method
OGRFieldDefn::SetDefault().

Parameters:
-----------

hDefn:  handle to the field definition.

pszDefault:  new default field value or NULL pointer.

GDAL 2.0 

IsDefaultDriverSpecific(self, *args)

source code 

IsDefaultDriverSpecific(FieldDefn self) -> int

int
OGR_Fld_IsDefaultDriverSpecific(OGRFieldDefnH hDefn)

Returns whether the default value is driver specific.

Driver specific default values are those that are not NULL, a numeric
value, a literal value enclosed between single quote characters,
CURRENT_TIMESTAMP, CURRENT_TIME, CURRENT_DATE or datetime literal
value.

This function is the same as the C++ method
OGRFieldDefn::IsDefaultDriverSpecific().

Parameters:
-----------

hDefn:  handle to the field definition

TRUE if the default value is driver specific.

GDAL 2.0 

Destroy(self)

source code 

Once called, self has effectively been destroyed. Do not access. For backwards compatibility only