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

# Class Feature

source code

Proxy of C++ OGRFeatureShadow class.

Instance Methods | [hide private]
__repr__(self) | source code
__init__(self, *args, **kwargs) __init__(OGRFeatureShadow self, FeatureDefn feature_def) -> Feature | source code
GetDefnRef(self, *args) GetDefnRef(Feature self) -> FeatureDefn | source code
SetGeometry(self, *args) SetGeometry(Feature self, Geometry geom) -> OGRErr | source code
SetGeometryDirectly(self, *args) SetGeometryDirectly(Feature self, Geometry geom) -> OGRErr | source code
GetGeometryRef(self, *args) GetGeometryRef(Feature self) -> Geometry | source code
SetGeomField(self, *args) SetGeomField(Feature self, int iField, Geometry geom) -> OGRErr SetGeomField(Feature self, char const * field_name, Geometry geom) -> OGRErr | source code
SetGeomFieldDirectly(self, *args) SetGeomFieldDirectly(Feature self, int iField, Geometry geom) -> OGRErr SetGeomFieldDirectly(Feature self, char const * field_name, Geometry geom) -> OGRErr | source code
GetGeomFieldRef(self, *args) GetGeomFieldRef(Feature self, int iField) -> Geometry GetGeomFieldRef(Feature self, char const * field_name) -> Geometry | source code
Clone(self, *args) Clone(Feature self) -> Feature | source code
Equal(self, *args) Equal(Feature self, Feature feature) -> bool | source code
GetFieldCount(self, *args) GetFieldCount(Feature self) -> int | source code
GetFieldDefnRef(self, *args) GetFieldDefnRef(Feature self, int id) -> FieldDefn GetFieldDefnRef(Feature self, char const * field_name) -> FieldDefn | source code
GetGeomFieldCount(self, *args) GetGeomFieldCount(Feature self) -> int | source code
GetGeomFieldDefnRef(self, *args) GetGeomFieldDefnRef(Feature self, int id) -> GeomFieldDefn GetGeomFieldDefnRef(Feature self, char const * field_name) -> GeomFieldDefn | source code
GetFieldAsString(self, *args) GetFieldAsString(Feature self, int id) -> char const GetFieldAsString(Feature self, char const * field_name) -> char const * | source code
GetFieldAsInteger(self, *args) GetFieldAsInteger(Feature self, int id) -> int GetFieldAsInteger(Feature self, char const * field_name) -> int | source code
GetFieldAsInteger64(self, *args) GetFieldAsInteger64(Feature self, int id) -> GIntBig GetFieldAsInteger64(Feature self, char const * field_name) -> GIntBig | source code
GetFieldAsDouble(self, *args) GetFieldAsDouble(Feature self, int id) -> double GetFieldAsDouble(Feature self, char const * field_name) -> double | source code
GetFieldAsDateTime(self, *args) GetFieldAsDateTime(Feature self, int id) GetFieldAsDateTime(Feature self, char const * field_name) | source code
GetFieldAsIntegerList(self, *args) GetFieldAsIntegerList(Feature self, int id) GetFieldAsIntegerList(Feature self, char const * field_name) | source code
GetFieldAsInteger64List(self, *args) GetFieldAsInteger64List(Feature self, int id) | source code
GetFieldAsDoubleList(self, *args) GetFieldAsDoubleList(Feature self, int id) GetFieldAsDoubleList(Feature self, char const * field_name) | source code
GetFieldAsStringList(self, *args) GetFieldAsStringList(Feature self, int id) -> char ** | source code
GetFieldAsBinary(self, *args) GetFieldAsBinary(Feature self, int id) -> OGRErr GetFieldAsBinary(Feature self, char const * field_name) -> OGRErr | source code
IsFieldSet(self, *args) IsFieldSet(Feature self, int id) -> bool IsFieldSet(Feature self, char const * field_name) -> bool | source code
IsFieldNull(self, *args) IsFieldNull(Feature self, int id) -> bool IsFieldNull(Feature self, char const * field_name) -> bool | source code
IsFieldSetAndNotNull(self, *args) IsFieldSetAndNotNull(Feature self, int id) -> bool IsFieldSetAndNotNull(Feature self, char const * field_name) -> bool | source code
GetFieldIndex(self, *args) GetFieldIndex(Feature self, char const * field_name) -> int | source code
GetGeomFieldIndex(self, *args) GetGeomFieldIndex(Feature self, char const * field_name) -> int | source code
GetFID(self, *args) GetFID(Feature self) -> GIntBig | source code
SetFID(self, *args) SetFID(Feature self, GIntBig fid) -> OGRErr | source code
DumpReadable(self, *args) DumpReadable(Feature self) | source code
UnsetField(self, *args) UnsetField(Feature self, int id) UnsetField(Feature self, char const * field_name) | source code
SetFieldNull(self, *args) SetFieldNull(Feature self, int id) SetFieldNull(Feature self, char const * field_name) | source code
SetFieldInteger64(self, *args) SetFieldInteger64(Feature self, int id, GIntBig value) | source code
SetFieldIntegerList(self, *args) SetFieldIntegerList(Feature self, int id, int nList) | source code
SetFieldInteger64List(self, *args) SetFieldInteger64List(Feature self, int id, int nList) | source code
SetFieldDoubleList(self, *args) SetFieldDoubleList(Feature self, int id, int nList) | source code
SetFieldStringList(self, *args) SetFieldStringList(Feature self, int id, char ** pList) | source code
SetFieldBinaryFromHexString(self, *args) SetFieldBinaryFromHexString(Feature self, int id, char const * pszValue) SetFieldBinaryFromHexString(Feature self, char const * field_name, char const * pszValue) | source code
SetFrom(self, *args, **kwargs) SetFrom(Feature self, Feature other, int forgiving=1) -> OGRErr | source code
SetFromWithMap(self, *args) SetFromWithMap(Feature self, Feature other, int forgiving, int nList) -> OGRErr | source code
GetStyleString(self, *args) GetStyleString(Feature self) -> char const * | source code
SetStyleString(self, *args) SetStyleString(Feature self, char const * the_string) | source code
GetFieldType(self, *args) GetFieldType(Feature self, int id) -> OGRFieldType GetFieldType(Feature self, char const * field_name) -> OGRFieldType | source code
Validate(self, *args) Validate(Feature self, int flags, int bEmitError=True) -> int | source code
FillUnsetWithDefault(self, *args) FillUnsetWithDefault(Feature self, int bNotNullableOnly=False, char ** options=None) | source code
GetNativeData(self, *args) GetNativeData(Feature self) -> char const * | source code
GetNativeMediaType(self, *args) GetNativeMediaType(Feature self) -> char const * | source code
SetNativeData(self, *args) SetNativeData(Feature self, char const * nativeData) | source code
SetNativeMediaType(self, *args) SetNativeMediaType(Feature self, char const * nativeMediaType) | source code
SetFieldString(self, *args) SetFieldString(Feature self, int id, char const * value) | source code
Reference(self) | source code
Dereference(self) | source code
Destroy(self) Once called, self has effectively been destroyed. | source code
__cmp__(self, other) Compares a feature to another for equality | source code
__copy__(self) | source code
_getfieldindex(self, fieldname) | source code
__getattr__(self, key) Returns the values of fields by the given name | source code
__setattr__(self, key, value) Set the values of fields by the given name | source code
__getitem__(self, key) Returns the values of fields by the given name / field_index | source code
__setitem__(self, key, value) Returns the value of a field by field name / index | source code
GetField(self, fld_index) | source code
SetField(self, *args) SetField(self, int id, char value)... | source code
SetField2(self, fld_index, value) | source code
keys(self) | source code
items(self) | source code
geometry(self) | source code
ExportToJson(self, as_object=False, options=None) Exports a GeoJSON object which represents the Feature. | source code

Class Variables | [hide private]
| __swig_setmethods__ = `{}`
| __swig_getmethods__ = `{}`
| __swig_destroy__ = `_ogr.delete_Feature`
| __del__ = `lambda self:`

Method Details | [hide private]

### GetDefnRef(self, *args) | source code
    GetDefnRef(Feature self) -> FeatureDefn

    OGRFeatureDefnH
    OGR_F_GetDefnRef(OGRFeatureH hFeat)

    Fetch feature definition.

    This function is the same as the C++ method OGRFeature::GetDefnRef().

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

    hFeat:  handle to the feature to get the feature definition from.

    a handle to the feature definition object on which feature depends.

### SetGeometry(self, *args) | source code
    SetGeometry(Feature self, Geometry geom) -> OGRErr

    OGRErr
    OGR_F_SetGeometry(OGRFeatureH hFeat, OGRGeometryH hGeom)

    Set feature geometry.

    This function updates the features geometry, and operate exactly as
    SetGeometryDirectly(), except that this function does not assume
    ownership of the passed geometry, but instead makes a copy of it.

    This function is the same as the C++ OGRFeature::SetGeometry().

    This method has only an effect on the in-memory feature object. If
    this object comes from a layer and the modifications must be
    serialized back to the datasource, OGR_L_SetFeature() must be used
    afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be
    used afterwards.

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

    hFeat:  handle to the feature on which new geometry is applied to.

    hGeom:  handle to the new geometry to apply to feature.

    OGRERR_NONE if successful, or OGR_UNSUPPORTED_GEOMETRY_TYPE if the
    geometry type is illegal for the OGRFeatureDefn (checking not yet
    implemented).

### SetGeometryDirectly(self, *args) | source code
    SetGeometryDirectly(Feature self, Geometry geom) -> OGRErr

    OGRErr
    OGR_F_SetGeometryDirectly(OGRFeatureH hFeat, OGRGeometryH hGeom)

    Set feature geometry.

    This function updates the features geometry, and operate exactly as
    SetGeometry(), except that this function assumes ownership of the
    passed geometry (even in case of failure of that function).

    This function is the same as the C++ method
    OGRFeature::SetGeometryDirectly.

    This method has only an effect on the in-memory feature object. If
    this object comes from a layer and the modifications must be
    serialized back to the datasource, OGR_L_SetFeature() must be used
    afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be
    used afterwards.

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

    hFeat:  handle to the feature on which to apply the geometry.

    hGeom:  handle to the new geometry to apply to feature.

    OGRERR_NONE if successful, or OGR_UNSUPPORTED_GEOMETRY_TYPE if the
    geometry type is illegal for the OGRFeatureDefn (checking not yet
    implemented).

### GetGeometryRef(self, *args) | source code
    GetGeometryRef(Feature self) -> Geometry

    OGRGeometryH
    OGR_F_GetGeometryRef(OGRFeatureH hFeat)

    Fetch a handle to feature geometry.

    This function is essentially the same as the C++ method
    OGRFeature::GetGeometryRef() (the only difference is that this C
    function honours OGRGetNonLinearGeometriesEnabledFlag())

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

    hFeat:  handle to the feature to get geometry from.

    a handle to internal feature geometry. This object should not be
    modified.

### SetGeomField(self, *args) | source code
    SetGeomField(Feature self, int iField, Geometry geom) -> OGRErr
    SetGeomField(Feature self, char const * field_name, Geometry geom) -> OGRErr

    OGRErr
    OGR_F_SetGeomField(OGRFeatureH hFeat, int iField, OGRGeometryH hGeom)

    Set feature geometry of a specified geometry field.

    This function updates the features geometry, and operate exactly as
    SetGeometryDirectly(), except that this function does not assume
    ownership of the passed geometry, but instead makes a copy of it.

    This function is the same as the C++ OGRFeature::SetGeomField().

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

    hFeat:  handle to the feature on which new geometry is applied to.

    iField:  geometry field to set.

    hGeom:  handle to the new geometry to apply to feature.

    OGRERR_NONE if successful, or OGR_UNSUPPORTED_GEOMETRY_TYPE if the
    geometry type is illegal for the OGRFeatureDefn (checking not yet
    implemented).

### SetGeomFieldDirectly(self, *args) | source code
    SetGeomFieldDirectly(Feature self, int iField, Geometry geom) -> OGRErr
    SetGeomFieldDirectly(Feature self, char const * field_name, Geometry geom) -> OGRErr

    OGRErr
    OGR_F_SetGeomFieldDirectly(OGRFeatureH hFeat, int iField, OGRGeometryH
    hGeom)

    Set feature geometry of a specified geometry field.

    This function updates the features geometry, and operate exactly as
    SetGeomField(), except that this function assumes ownership of the
    passed geometry (even in case of failure of that function).

    This function is the same as the C++ method
    OGRFeature::SetGeomFieldDirectly.

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

    hFeat:  handle to the feature on which to apply the geometry.

    iField:  geometry field to set.

    hGeom:  handle to the new geometry to apply to feature.

    OGRERR_NONE if successful, or OGRERR_FAILURE if the index is invalid,
    or OGR_UNSUPPORTED_GEOMETRY_TYPE if the geometry type is illegal for
    the OGRFeatureDefn (checking not yet implemented).

    GDAL 1.11

### GetGeomFieldRef(self, *args) | source code
    GetGeomFieldRef(Feature self, int iField) -> Geometry
    GetGeomFieldRef(Feature self, char const * field_name) -> Geometry

    OGRGeometryH
    OGR_F_GetGeomFieldRef(OGRFeatureH hFeat, int iField)

    Fetch a handle to feature geometry.

    This function is the same as the C++ method
    OGRFeature::GetGeomFieldRef().

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

    hFeat:  handle to the feature to get geometry from.

    iField:  geometry field to get.

    a handle to internal feature geometry. This object should not be
    modified.

    GDAL 1.11

### Clone(self, *args) | source code
    Clone(Feature self) -> Feature

    OGRFeatureH OGR_F_Clone(OGRFeatureH
    hFeat)

    Duplicate feature.

    The newly created feature is owned by the caller, and will have its
    own reference to the OGRFeatureDefn.

    This function is the same as the C++ method OGRFeature::Clone().

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

    hFeat:  handle to the feature to clone.

    a handle to the new feature, exactly matching this feature.

### Equal(self, *args) | source code
    Equal(Feature self, Feature feature) -> bool

    int OGR_F_Equal(OGRFeatureH hFeat,
    OGRFeatureH hOtherFeat)

    Test if two features are the same.

    Two features are considered equal if the share them (handle equality)
    same OGRFeatureDefn, have the same field values, and the same geometry
    (as tested by OGR_G_Equal()) as well as the same feature id.

    This function is the same as the C++ method OGRFeature::Equal().

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

    hFeat:  handle to one of the feature.

    hOtherFeat:  handle to the other feature to test this one against.

    TRUE if they are equal, otherwise FALSE.

### GetFieldCount(self, *args) | source code
    GetFieldCount(Feature self) -> int

    int
    OGR_F_GetFieldCount(OGRFeatureH hFeat)

    Fetch number of fields on this feature This will always be the same as
    the field count for the OGRFeatureDefn.

    This function is the same as the C++ method
    OGRFeature::GetFieldCount().

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

    hFeat:  handle to the feature to get the fields count from.

    count of fields.

### GetFieldDefnRef(self, *args) | source code
    GetFieldDefnRef(Feature self, int id) -> FieldDefn
    GetFieldDefnRef(Feature self, char const * field_name) -> FieldDefn

    OGRFieldDefnH
    OGR_F_GetFieldDefnRef(OGRFeatureH hFeat, int i)

    Fetch definition for this field.

    This function is the same as the C++ method
    OGRFeature::GetFieldDefnRef().

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

    hFeat:  handle to the feature on which the field is found.

    i:  the field to fetch, from 0 to GetFieldCount()-1.

    a handle to the field definition (from the OGRFeatureDefn). This is
    an internal reference, and should not be deleted or modified.

### GetGeomFieldCount(self, *args) | source code
    GetGeomFieldCount(Feature self) -> int

    int
    OGR_F_GetGeomFieldCount(OGRFeatureH hFeat)

    Fetch number of geometry fields on this feature This will always be
    the same as the geometry field count for the OGRFeatureDefn.

    This function is the same as the C++ method
    OGRFeature::GetGeomFieldCount().

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

    hFeat:  handle to the feature to get the geometry fields count from.

    count of geometry fields.

    GDAL 1.11

### GetGeomFieldDefnRef(self, *args) | source code
    GetGeomFieldDefnRef(Feature self, int id) -> GeomFieldDefn
    GetGeomFieldDefnRef(Feature self, char const * field_name) -> GeomFieldDefn

    OGRGeomFieldDefnH
    OGR_F_GetGeomFieldDefnRef(OGRFeatureH hFeat, int i)

    Fetch definition for this geometry field.

    This function is the same as the C++ method
    OGRFeature::GetGeomFieldDefnRef().

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

    hFeat:  handle to the feature on which the field is found.

    i:  the field to fetch, from 0 to GetGeomFieldCount()-1.

    a handle to the field definition (from the OGRFeatureDefn). This is
    an internal reference, and should not be deleted or modified.

    GDAL 1.11

### GetFieldAsString(self, *args) | source code
    GetFieldAsString(Feature self, int id) -> char const
    GetFieldAsString(Feature self, char const * field_name) -> char const *

    const char*
    OGR_F_GetFieldAsString(OGRFeatureH hFeat, int iField)

    Fetch field value as a string.

    OFTReal and OFTInteger fields will be translated to string using
    sprintf(), but not necessarily using the established formatting rules.
    Other field types, or errors will result in a return value of zero.

    This function is the same as the C++ method
    OGRFeature::GetFieldAsString().

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to fetch, from 0 to GetFieldCount()-1.

    the field value. This string is internal, and should not be modified,
    or freed. Its lifetime may be very brief.

### GetFieldAsInteger(self, *args) | source code
    GetFieldAsInteger(Feature self, int id) -> int
    GetFieldAsInteger(Feature self, char const * field_name) -> int

    int
    OGR_F_GetFieldAsInteger(OGRFeatureH hFeat, int iField)

    Fetch field value as integer.

    OFTString features will be translated using atoi(). OFTReal fields
    will be cast to integer. Other field types, or errors will result in a
    return value of zero.

    This function is the same as the C++ method
    OGRFeature::GetFieldAsInteger().

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to fetch, from 0 to GetFieldCount()-1.

    the field value.

### GetFieldAsInteger64(self, *args) | source code
    GetFieldAsInteger64(Feature self, int id) -> GIntBig
    GetFieldAsInteger64(Feature self, char const * field_name) -> GIntBig

    GIntBig
    OGR_F_GetFieldAsInteger64(OGRFeatureH hFeat, int iField)

    Fetch field value as integer 64 bit.

    OFTInteger are promoted to 64 bit. OFTString features will be
    translated using CPLAtoGIntBig(). OFTReal fields will be cast to
    integer. Other field types, or errors will result in a return value of
    zero.

    This function is the same as the C++ method
    OGRFeature::GetFieldAsInteger64().

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to fetch, from 0 to GetFieldCount()-1.

    the field value.

    GDAL 2.0

### GetFieldAsDouble(self, *args) | source code
    GetFieldAsDouble(Feature self, int id) -> double
    GetFieldAsDouble(Feature self, char const * field_name) -> double

    double
    OGR_F_GetFieldAsDouble(OGRFeatureH hFeat, int iField)

    Fetch field value as a double.

    OFTString features will be translated using CPLAtof(). OFTInteger
    fields will be cast to double. Other field types, or errors will
    result in a return value of zero.

    This function is the same as the C++ method
    OGRFeature::GetFieldAsDouble().

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to fetch, from 0 to GetFieldCount()-1.

    the field value.

### GetFieldAsDateTime(self, *args) | source code
    GetFieldAsDateTime(Feature self, int id)
    GetFieldAsDateTime(Feature self, char const * field_name)

    int
    OGR_F_GetFieldAsDateTime(OGRFeatureH hFeat, int iField, int *pnYear,
    int *pnMonth, int *pnDay, int *pnHour, int *pnMinute, int *pnSecond,
    int *pnTZFlag)

    Fetch field value as date and time.

    Currently this method only works for OFTDate, OFTTime and OFTDateTime
    fields.

    This function is the same as the C++ method
    OGRFeature::GetFieldAsDateTime().

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to fetch, from 0 to GetFieldCount()-1.

    pnYear:  (including century)

    pnMonth:  (1-12)

    pnDay:  (1-31)

    pnHour:  (0-23)

    pnMinute:  (0-59)

    pnSecond:  (0-59)

    pnTZFlag:  (0=unknown, 1=localtime, 100=GMT, see data model for
    details)

    TRUE on success or FALSE on failure.

    See:  Use OGR_F_GetFieldAsDateTimeEx() for second with millisecond
    accuracy.

### GetFieldAsIntegerList(self, *args) | source code
    GetFieldAsIntegerList(Feature self, int id)
    GetFieldAsIntegerList(Feature self, char const * field_name)

    const int*
    OGR_F_GetFieldAsIntegerList(OGRFeatureH hFeat, int iField, int
    *pnCount)

    Fetch field value as a list of integers.

    Currently this function only works for OFTIntegerList fields.

    This function is the same as the C++ method
    OGRFeature::GetFieldAsIntegerList().

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to fetch, from 0 to GetFieldCount()-1.

    pnCount:  an integer to put the list count (number of integers) into.

    the field value. This list is internal, and should not be modified, or
    freed. Its lifetime may be very brief. If *pnCount is zero on return
    the returned pointer may be NULL or non-NULL.

### GetFieldAsInteger64List(self, *args) | source code
    GetFieldAsInteger64List(Feature self, int id)

    const GIntBig*
    OGR_F_GetFieldAsInteger64List(OGRFeatureH hFeat, int iField, int
    *pnCount)

    Fetch field value as a list of 64 bit integers.

    Currently this function only works for OFTInteger64List fields.

    This function is the same as the C++ method
    OGRFeature::GetFieldAsInteger64List().

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to fetch, from 0 to GetFieldCount()-1.

    pnCount:  an integer to put the list count (number of integers) into.

    the field value. This list is internal, and should not be modified, or
    freed. Its lifetime may be very brief. If *pnCount is zero on return
    the returned pointer may be NULL or non-NULL.

    GDAL 2.0

### GetFieldAsDoubleList(self, *args) | source code
    GetFieldAsDoubleList(Feature self, int id)
    GetFieldAsDoubleList(Feature self, char const * field_name)

    const double*
    OGR_F_GetFieldAsDoubleList(OGRFeatureH hFeat, int iField, int
    *pnCount)

    Fetch field value as a list of doubles.

    Currently this function only works for OFTRealList fields.

    This function is the same as the C++ method
    OGRFeature::GetFieldAsDoubleList().

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to fetch, from 0 to GetFieldCount()-1.

    pnCount:  an integer to put the list count (number of doubles) into.

    the field value. This list is internal, and should not be modified, or
    freed. Its lifetime may be very brief. If *pnCount is zero on return
    the returned pointer may be NULL or non-NULL.

### GetFieldAsStringList(self, *args) | source code
    GetFieldAsStringList(Feature self, int id) -> char **

    char**
    OGR_F_GetFieldAsStringList(OGRFeatureH hFeat, int iField)

    Fetch field value as a list of strings.

    Currently this method only works for OFTStringList fields.

    The returned list is terminated by a NULL pointer. The number of
    elements can also be calculated using CSLCount().

    This function is the same as the C++ method
    OGRFeature::GetFieldAsStringList().

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to fetch, from 0 to GetFieldCount()-1.

    the field value. This list is internal, and should not be modified, or
    freed. Its lifetime may be very brief.

### GetFieldAsBinary(self, *args) | source code
    GetFieldAsBinary(Feature self, int id) -> OGRErr
    GetFieldAsBinary(Feature self, char const * field_name) -> OGRErr

    GByte*
    OGR_F_GetFieldAsBinary(OGRFeatureH hFeat, int iField, int *pnBytes)

    Fetch field value as binary.

    This method only works for OFTBinary and OFTString fields.

    This function is the same as the C++ method
    OGRFeature::GetFieldAsBinary().

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to fetch, from 0 to GetFieldCount()-1.

    pnBytes:  location to place count of bytes returned.

    the field value. This list is internal, and should not be modified, or
    freed. Its lifetime may be very brief.

### IsFieldSet(self, *args) | source code
    IsFieldSet(Feature self, int id) -> bool
    IsFieldSet(Feature self, char const * field_name) -> bool

    int OGR_F_IsFieldSet(OGRFeatureH
    hFeat, int iField)

    Test if a field has ever been assigned a value or not.

    This function is the same as the C++ method OGRFeature::IsFieldSet().

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

    hFeat:  handle to the feature on which the field is.

    iField:  the field to test.

    TRUE if the field has been set, otherwise false.

### IsFieldNull(self, *args) | source code
    IsFieldNull(Feature self, int id) -> bool
    IsFieldNull(Feature self, char const * field_name) -> bool

    int OGR_F_IsFieldNull(OGRFeatureH
    hFeat, int iField)

    Test if a field is null.

    This function is the same as the C++ method OGRFeature::IsFieldNull().

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

    hFeat:  handle to the feature on which the field is.

    iField:  the field to test.

    TRUE if the field is null, otherwise false.

    GDAL 2.2

### IsFieldSetAndNotNull(self, *args) | source code
    IsFieldSetAndNotNull(Feature self, int id) -> bool
    IsFieldSetAndNotNull(Feature self, char const * field_name) -> bool

    int
    OGR_F_IsFieldSetAndNotNull(OGRFeatureH hFeat, int iField)

    Test if a field is set and not null.

    This function is the same as the C++ method
    OGRFeature::IsFieldSetAndNotNull().

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

    hFeat:  handle to the feature on which the field is.

    iField:  the field to test.

    TRUE if the field is set and not null, otherwise false.

    GDAL 2.2

### GetFieldIndex(self, *args) | source code
    GetFieldIndex(Feature self, char const * field_name) -> int

    int
    OGR_F_GetFieldIndex(OGRFeatureH hFeat, const char *pszName)

    Fetch the field index given field name.

    This is a cover for the OGRFeatureDefn::GetFieldIndex() method.

    This function is the same as the C++ method
    OGRFeature::GetFieldIndex().

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

    hFeat:  handle to the feature on which the field is found.

    pszName:  the name of the field to search for.

    the field index, or -1 if no matching field is found.

### GetGeomFieldIndex(self, *args) | source code
    GetGeomFieldIndex(Feature self, char const * field_name) -> int

    int
    OGR_F_GetGeomFieldIndex(OGRFeatureH hFeat, const char *pszName)

    Fetch the geometry field index given geometry field name.

    This is a cover for the OGRFeatureDefn::GetGeomFieldIndex() method.

    This function is the same as the C++ method
    OGRFeature::GetGeomFieldIndex().

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

    hFeat:  handle to the feature on which the geometry field is found.

    pszName:  the name of the geometry field to search for.

    the geometry field index, or -1 if no matching geometry field is
    found.

    GDAL 1.11

### GetFID(self, *args) | source code
    GetFID(Feature self) -> GIntBig

    GIntBig OGR_F_GetFID(OGRFeatureH
    hFeat)

    Get feature identifier.

    This function is the same as the C++ method OGRFeature::GetFID().
    Note: since GDAL 2.0, this method returns a GIntBig (previously a
    long)

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

    hFeat:  handle to the feature from which to get the feature
    identifier.

    feature id or OGRNullFID if none has been assigned.

### SetFID(self, *args) | source code
    SetFID(Feature self, GIntBig fid) -> OGRErr

    OGRErr OGR_F_SetFID(OGRFeatureH hFeat,
    GIntBig nFID)

    Set the feature identifier.

    For specific types of features this operation may fail on illegal
    features ids. Generally it always succeeds. Feature ids should be
    greater than or equal to zero, with the exception of OGRNullFID (-1)
    indicating that the feature id is unknown.

    This function is the same as the C++ method OGRFeature::SetFID().

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

    hFeat:  handle to the feature to set the feature id to.

    nFID:  the new feature identifier value to assign.

    On success OGRERR_NONE, or on failure some other value.

### DumpReadable(self, *args) | source code
    DumpReadable(Feature self)

    void
    OGR_F_DumpReadable(OGRFeatureH hFeat, FILE *fpOut)

    Dump this feature in a human readable form.

    This dumps the attributes, and geometry; however, it doesn't
    definition information (other than field types and names), nor does it
    report the geometry spatial reference system.

    This function is the same as the C++ method
    OGRFeature::DumpReadable().

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

    hFeat:  handle to the feature to dump.

    fpOut:  the stream to write to, such as strout.

### UnsetField(self, *args) | source code
    UnsetField(Feature self, int id)
    UnsetField(Feature self, char const * field_name)

    void OGR_F_UnsetField(OGRFeatureH
    hFeat, int iField)

    Clear a field, marking it as unset.

    This function is the same as the C++ method OGRFeature::UnsetField().

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

    hFeat:  handle to the feature on which the field is.

    iField:  the field to unset.

### SetFieldNull(self, *args) | source code
    SetFieldNull(Feature self, int id)
    SetFieldNull(Feature self, char const * field_name)

    void
    OGR_F_SetFieldNull(OGRFeatureH hFeat, int iField)

    Clear a field, marking it as null.

    This function is the same as the C++ method
    OGRFeature::SetFieldNull().

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

    hFeat:  handle to the feature on which the field is.

    iField:  the field to set to null.

    GDAL 2.2

### SetFieldInteger64(self, *args) | source code
    SetFieldInteger64(Feature self, int id, GIntBig value)

    void
    OGR_F_SetFieldInteger64(OGRFeatureH hFeat, int iField, GIntBig nValue)

    Set field to 64 bit integer value.

    OFTInteger, OFTInteger64 and OFTReal fields will be set directly.
    OFTString fields will be assigned a string representation of the
    value, but not necessarily taking into account formatting constraints
    on this field. Other field types may be unaffected.

    This function is the same as the C++ method OGRFeature::SetField().

    This method has only an effect on the in-memory feature object. If
    this object comes from a layer and the modifications must be
    serialized back to the datasource, OGR_L_SetFeature() must be used
    afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be
    used afterwards.

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to fetch, from 0 to GetFieldCount()-1.

    nValue:  the value to assign.

    GDAL 2.0

### SetFieldIntegerList(self, *args) | source code
    SetFieldIntegerList(Feature self, int id, int nList)

    void
    OGR_F_SetFieldIntegerList(OGRFeatureH hFeat, int iField, int nCount,
    const int *panValues)

    Set field to list of integers value.

    This function currently on has an effect of OFTIntegerList,
    OFTInteger64List and OFTRealList fields.

    This function is the same as the C++ method OGRFeature::SetField().

    This method has only an effect on the in-memory feature object. If
    this object comes from a layer and the modifications must be
    serialized back to the datasource, OGR_L_SetFeature() must be used
    afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be
    used afterwards.

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to set, from 0 to GetFieldCount()-1.

    nCount:  the number of values in the list being assigned.

    panValues:  the values to assign.

### SetFieldInteger64List(self, *args) | source code
    SetFieldInteger64List(Feature self, int id, int nList)

    void
    OGR_F_SetFieldInteger64List(OGRFeatureH hFeat, int iField, int nCount,
    const GIntBig *panValues)

    Set field to list of 64 bit integers value.

    This function currently on has an effect of OFTIntegerList,
    OFTInteger64List and OFTRealList fields.

    This function is the same as the C++ method OGRFeature::SetField().

    This method has only an effect on the in-memory feature object. If
    this object comes from a layer and the modifications must be
    serialized back to the datasource, OGR_L_SetFeature() must be used
    afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be
    used afterwards.

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to set, from 0 to GetFieldCount()-1.

    nCount:  the number of values in the list being assigned.

    panValues:  the values to assign.

    GDAL 2.0

### SetFieldDoubleList(self, *args) | source code
    SetFieldDoubleList(Feature self, int id, int nList)

    void
    OGR_F_SetFieldDoubleList(OGRFeatureH hFeat, int iField, int nCount,
    const double *padfValues)

    Set field to list of doubles value.

    This function currently on has an effect of OFTIntegerList,
    OFTInteger64List, OFTRealList fields.

    This function is the same as the C++ method OGRFeature::SetField().

    This method has only an effect on the in-memory feature object. If
    this object comes from a layer and the modifications must be
    serialized back to the datasource, OGR_L_SetFeature() must be used
    afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be
    used afterwards.

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to set, from 0 to GetFieldCount()-1.

    nCount:  the number of values in the list being assigned.

    padfValues:  the values to assign.

### SetFieldStringList(self, *args) | source code
    SetFieldStringList(Feature self, int id, char ** pList)

    void
    OGR_F_SetFieldStringList(OGRFeatureH hFeat, int iField, CSLConstList
    papszValues)

    Set field to list of strings value.

    This function currently on has an effect of OFTStringList fields.

    This function is the same as the C++ method OGRFeature::SetField().

    This method has only an effect on the in-memory feature object. If
    this object comes from a layer and the modifications must be
    serialized back to the datasource, OGR_L_SetFeature() must be used
    afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be
    used afterwards.

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to set, from 0 to GetFieldCount()-1.

    papszValues:  the values to assign. List of NUL-terminated string,
    ending with a NULL pointer.

### SetFrom(self, *args, **kwargs) | source code
    SetFrom(Feature self, Feature other, int forgiving=1) -> OGRErr

    OGRErr OGR_F_SetFrom(OGRFeatureH
    hFeat, OGRFeatureH hOtherFeat, int bForgiving)

    Set one feature from another.

    Overwrite the contents of this feature from the geometry and
    attributes of another. The hOtherFeature does not need to have the
    same OGRFeatureDefn. Field values are copied by corresponding field
    names. Field types do not have to exactly match. OGR_F_SetField*()
    function conversion rules will be applied as needed.

    This function is the same as the C++ method OGRFeature::SetFrom().

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

    hFeat:  handle to the feature to set to.

    hOtherFeat:  handle to the feature from which geometry, and field
    values will be copied.

    bForgiving:  TRUE if the operation should continue despite lacking
    output fields matching some of the source fields.

    OGRERR_NONE if the operation succeeds, even if some values are not
    transferred, otherwise an error code.

### SetFromWithMap(self, *args) | source code
    SetFromWithMap(Feature self, Feature other, int forgiving, int nList) -> OGRErr

    OGRErr
    OGR_F_SetFromWithMap(OGRFeatureH hFeat, OGRFeatureH hOtherFeat, int
    bForgiving, const int *panMap)

    Set one feature from another.

    Overwrite the contents of this feature from the geometry and
    attributes of another. The hOtherFeature does not need to have the
    same OGRFeatureDefn. Field values are copied according to the provided
    indices map. Field types do not have to exactly match.
    OGR_F_SetField*() function conversion rules will be applied as needed.
    This is more efficient than OGR_F_SetFrom() in that this doesn't
    lookup the fields by their names. Particularly useful when the field
    names don't match.

    This function is the same as the C++ method OGRFeature::SetFrom().

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

    hFeat:  handle to the feature to set to.

    hOtherFeat:  handle to the feature from which geometry, and field
    values will be copied.

    panMap:  Array of the indices of the destination feature's fields
    stored at the corresponding index of the source feature's fields. A
    value of -1 should be used to ignore the source's field. The array
    should not be NULL and be as long as the number of fields in the
    source feature.

    bForgiving:  TRUE if the operation should continue despite lacking
    output fields matching some of the source fields.

    OGRERR_NONE if the operation succeeds, even if some values are not
    transferred, otherwise an error code.

### GetStyleString(self, *args) | source code
    GetStyleString(Feature self) -> char const *

    const char*
    OGR_F_GetStyleString(OGRFeatureH hFeat)

    Fetch style string for this feature.

    Set the OGR Feature Style Specification for details on the format of
    this string, and ogr_featurestyle.h for services available to parse
    it.

    This function is the same as the C++ method
    OGRFeature::GetStyleString().

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

    hFeat:  handle to the feature to get the style from.

    a reference to a representation in string format, or NULL if there
    isn't one.

### SetStyleString(self, *args) | source code
    SetStyleString(Feature self, char const * the_string)

    void
    OGR_F_SetStyleString(OGRFeatureH hFeat, const char *pszStyle)

    Set feature style string.

    This method operate exactly as OGR_F_SetStyleStringDirectly() except
    that it does not assume ownership of the passed string, but instead
    makes a copy of it.

    This function is the same as the C++ method
    OGRFeature::SetStyleString().

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

    hFeat:  handle to the feature to set style to.

    pszStyle:  the style string to apply to this feature, cannot be NULL.

### Validate(self, *args) | source code
    Validate(Feature self, int flags, int bEmitError=True) -> int

    int OGR_F_Validate(OGRFeatureH
    hFeat, int nValidateFlags, int bEmitError)

    Validate that a feature meets constraints of its schema.

    The scope of test is specified with the nValidateFlags parameter.

    Regarding OGR_F_VAL_WIDTH, the test is done assuming the string width
    must be interpreted as the number of UTF-8 characters. Some drivers
    might interpret the width as the number of bytes instead. So this test
    is rather conservative (if it fails, then it will fail for all
    interpretations).

    This function is the same as the C++ method OGRFeature::Validate().

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

    hFeat:  handle to the feature to validate.

    nValidateFlags:  OGR_F_VAL_ALL or combination of OGR_F_VAL_NULL,
    OGR_F_VAL_GEOM_TYPE, OGR_F_VAL_WIDTH and
    OGR_F_VAL_ALLOW_NULL_WHEN_DEFAULT with '|' operator

    bEmitError:  TRUE if a CPLError() must be emitted when a check fails

    TRUE if all enabled validation tests pass.

    GDAL 2.0

### FillUnsetWithDefault(self, *args) | source code
    FillUnsetWithDefault(Feature self, int bNotNullableOnly=False, char ** options=None)

    void
    OGR_F_FillUnsetWithDefault(OGRFeatureH hFeat, int bNotNullableOnly,
    char **papszOptions)

    Fill unset fields with default values that might be defined.

    This function is the same as the C++ method
    OGRFeature::FillUnsetWithDefault().

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

    hFeat:  handle to the feature.

    bNotNullableOnly:  if we should fill only unset fields with a not-null
    constraint.

    papszOptions:  unused currently. Must be set to NULL.

    GDAL 2.0

### GetNativeData(self, *args) | source code
    GetNativeData(Feature self) -> char const *

    const char*
    OGR_F_GetNativeData(OGRFeatureH hFeat)

    Returns the native data for the feature.

    The native data is the representation in a "natural" form that comes
    from the driver that created this feature, or that is aimed at an
    output driver. The native data may be in different format, which is
    indicated by OGR_F_GetNativeMediaType().

    Note that most drivers do not support storing the native data in the
    feature object, and if they do, generally the NATIVE_DATA open option
    must be passed at dataset opening.

    The "native data" does not imply it is something more performant or
    powerful than what can be obtained with the rest of the API, but it
    may be useful in round-tripping scenarios where some characteristics
    of the underlying format are not captured otherwise by the OGR
    abstraction.

    This function is the same as the C++ method
    OGRFeature::GetNativeData().

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

    hFeat:  handle to the feature.

    a string with the native data, or NULL if there is none.

    GDAL 2.1

    See:
    https://trac.osgeo.org/gdal/wiki/rfc60_improved_roundtripping_in_ogr

### GetNativeMediaType(self, *args) | source code
    GetNativeMediaType(Feature self) -> char const *

    const char*
    OGR_F_GetNativeMediaType(OGRFeatureH hFeat)

    Returns the native media type for the feature.

    The native media type is the identifier for the format of the native
    data. It follows the IANA RFC 2045
    (seehttps://en.wikipedia.org/wiki/Media_type), e.g.
    "application/vnd.geo+json" for JSon.

    This function is the same as the C function
    OGR_F_GetNativeMediaType().

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

    hFeat:  handle to the feature.

    a string with the native media type, or NULL if there is none.

    GDAL 2.1

    See:
    https://trac.osgeo.org/gdal/wiki/rfc60_improved_roundtripping_in_ogr

### SetNativeData(self, *args) | source code
    SetNativeData(Feature self, char const * nativeData)

    void
    OGR_F_SetNativeData(OGRFeatureH hFeat, const char *pszNativeData)

    Sets the native data for the feature.

    The native data is the representation in a "natural" form that comes
    from the driver that created this feature, or that is aimed at an
    output driver. The native data may be in different format, which is
    indicated by OGR_F_GetNativeMediaType().

    This function is the same as the C++ method
    OGRFeature::SetNativeData().

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

    hFeat:  handle to the feature.

    pszNativeData:  a string with the native data, or NULL if there is
    none.

    GDAL 2.1

    See:
    https://trac.osgeo.org/gdal/wiki/rfc60_improved_roundtripping_in_ogr

### SetNativeMediaType(self, *args) | source code
    SetNativeMediaType(Feature self, char const * nativeMediaType)

    void
    OGR_F_SetNativeMediaType(OGRFeatureH hFeat, const char
    *pszNativeMediaType)

    Sets the native media type for the feature.

    The native media type is the identifier for the format of the native
    data. It follows the IANA RFC 2045
    (seehttps://en.wikipedia.org/wiki/Media_type), e.g.
    "application/vnd.geo+json" for JSon.

    This function is the same as the C++ method
    OGRFeature::SetNativeMediaType().

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

    hFeat:  handle to the feature.

    pszNativeMediaType:  a string with the native media type, or NULL if
    there is none.

    GDAL 2.1

    See:
    https://trac.osgeo.org/gdal/wiki/rfc60_improved_roundtripping_in_ogr

### SetFieldString(self, *args) | source code
    SetFieldString(Feature self, int id, char const * value)

    void
    OGR_F_SetFieldString(OGRFeatureH hFeat, int iField, const char
    *pszValue)

    Set field to string value.

    OFTInteger fields will be set based on an atoi() conversion of the
    string. OFTInteger64 fields will be set based on an CPLAtoGIntBig()
    conversion of the string. OFTReal fields will be set based on an
    CPLAtof() conversion of the string. Other field types may be
    unaffected.

    This function is the same as the C++ method OGRFeature::SetField().

    This method has only an effect on the in-memory feature object. If
    this object comes from a layer and the modifications must be
    serialized back to the datasource, OGR_L_SetFeature() must be used
    afterwards. Or if this is a new feature, OGR_L_CreateFeature() must be
    used afterwards.

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

    hFeat:  handle to the feature that owned the field.

    iField:  the field to fetch, from 0 to GetFieldCount()-1.

    pszValue:  the value to assign.

### Destroy(self) | source code
Once called, self has effectively been destroyed. Do not access. For backwards compatibility only

### SetField(self, *args) | source code
    SetField(self, int id, char value)
    SetField(self, char name, char value)
    SetField(self, int id, int value)
    SetField(self, char name, int value)
    SetField(self, int id, double value)
    SetField(self, char name, double value)
    SetField(self, int id, int year, int month, int day, int hour, int minute,
        int second, int tzflag)
    SetField(self, char name, int year, int month, int day, int hour,
        int minute, int second, int tzflag)

### ExportToJson(self, as_object=False, options=None) | source code
Exports a GeoJSON object which represents the Feature. The as_object parameter determines whether the returned value should be a Python object instead of a string. Defaults to False. The options parameter is passed to Geometry.ExportToJson()