OGR
|
#include <ogr_feature.h>
Public Member Functions | |
OGRFeature (OGRFeatureDefn *) | |
Constructor. More... | |
OGRFeatureDefn * | GetDefnRef () |
Fetch feature definition. More... | |
OGRErr | SetGeometryDirectly (OGRGeometry *) |
Set feature geometry. More... | |
OGRErr | SetGeometry (const OGRGeometry *) |
Set feature geometry. More... | |
OGRGeometry * | GetGeometryRef () |
Fetch pointer to feature geometry. More... | |
OGRGeometry * | StealGeometry () CPL_WARN_UNUSED_RESULT |
Take away ownership of geometry. More... | |
int | GetGeomFieldCount () const |
Fetch number of geometry fields on this feature. This will always be the same as the geometry field count for the OGRFeatureDefn. More... | |
OGRGeomFieldDefn * | GetGeomFieldDefnRef (int iField) |
Fetch definition for this geometry field. More... | |
int | GetGeomFieldIndex (const char *pszName) |
Fetch the geometry field index given geometry field name. More... | |
OGRGeometry * | GetGeomFieldRef (int iField) |
Fetch pointer to feature geometry. More... | |
OGRGeometry * | StealGeometry (int iField) |
Take away ownership of geometry. More... | |
OGRGeometry * | GetGeomFieldRef (const char *pszFName) |
Fetch pointer to feature geometry. More... | |
OGRErr | SetGeomFieldDirectly (int iField, OGRGeometry *) |
Set feature geometry of a specified geometry field. More... | |
OGRErr | SetGeomField (int iField, const OGRGeometry *) |
Set feature geometry of a specified geometry field. More... | |
OGRFeature * | Clone () CPL_WARN_UNUSED_RESULT |
Duplicate feature. More... | |
virtual OGRBoolean | Equal (OGRFeature *poFeature) |
Test if two features are the same. More... | |
int | GetFieldCount () const |
Fetch number of fields on this feature. This will always be the same as the field count for the OGRFeatureDefn. More... | |
OGRFieldDefn * | GetFieldDefnRef (int iField) const |
Fetch definition for this field. More... | |
int | GetFieldIndex (const char *pszName) |
Fetch the field index given field name. More... | |
int | IsFieldSet (int iField) |
Test if a field has ever been assigned a value or not. More... | |
void | UnsetField (int iField) |
Clear a field, marking it as unset. More... | |
bool | IsFieldNull (int iField) |
Test if a field is null. More... | |
void | SetFieldNull (int iField) |
Clear a field, marking it as null. More... | |
bool | IsFieldSetAndNotNull (int iField) |
Test if a field is set and not null. More... | |
OGRField * | GetRawFieldRef (int i) |
Fetch a pointer to the internal field value given the index. More... | |
int | GetFieldAsInteger (int i) |
Fetch field value as integer. More... | |
GIntBig | GetFieldAsInteger64 (int i) |
Fetch field value as integer 64 bit. More... | |
double | GetFieldAsDouble (int i) |
Fetch field value as a double. More... | |
const char * | GetFieldAsString (int i) |
Fetch field value as a string. More... | |
const int * | GetFieldAsIntegerList (int i, int *pnCount) |
Fetch field value as a list of integers. More... | |
const GIntBig * | GetFieldAsInteger64List (int i, int *pnCount) |
Fetch field value as a list of 64 bit integers. More... | |
const double * | GetFieldAsDoubleList (int i, int *pnCount) |
Fetch field value as a list of doubles. More... | |
char ** | GetFieldAsStringList (int i) |
Fetch field value as a list of strings. More... | |
GByte * | GetFieldAsBinary (int i, int *pnCount) |
Fetch field value as binary data. More... | |
int | GetFieldAsDateTime (int i, int *pnYear, int *pnMonth, int *pnDay, int *pnHour, int *pnMinute, int *pnSecond, int *pnTZFlag) |
Fetch field value as date and time. More... | |
int | GetFieldAsDateTime (int i, int *pnYear, int *pnMonth, int *pnDay, int *pnHour, int *pnMinute, float *pfSecond, int *pnTZFlag) |
Fetch field value as date and time. More... | |
char * | GetFieldAsSerializedJSon (int i) |
Fetch field value as a serialized JSon object. More... | |
int | GetFieldAsInteger (const char *pszFName) |
Fetch field value as integer. More... | |
GIntBig | GetFieldAsInteger64 (const char *pszFName) |
Fetch field value as integer 64 bit. More... | |
double | GetFieldAsDouble (const char *pszFName) |
Fetch field value as a double. More... | |
const char * | GetFieldAsString (const char *pszFName) |
Fetch field value as a string. More... | |
const int * | GetFieldAsIntegerList (const char *pszFName, int *pnCount) |
Fetch field value as a list of integers. More... | |
const GIntBig * | GetFieldAsInteger64List (const char *pszFName, int *pnCount) |
Fetch field value as a list of 64 bit integers. More... | |
const double * | GetFieldAsDoubleList (const char *pszFName, int *pnCount) |
Fetch field value as a list of doubles. More... | |
char ** | GetFieldAsStringList (const char *pszFName) |
Fetch field value as a list of strings. More... | |
void | SetField (int i, int nValue) |
Set field to integer value. More... | |
void | SetField (int i, GIntBig nValue) |
Set field to 64 bit integer value. More... | |
void | SetField (int i, double dfValue) |
Set field to double value. More... | |
void | SetField (int i, const char *pszValue) |
Set field to string value. More... | |
void | SetField (int i, int nCount, int *panValues) |
Set field to list of integers value. More... | |
void | SetField (int i, int nCount, const GIntBig *panValues) |
Set field to list of 64 bit integers value. More... | |
void | SetField (int i, int nCount, double *padfValues) |
Set field to list of doubles value. More... | |
void | SetField (int i, char **papszValues) |
Set field to list of strings value. More... | |
void | SetField (int i, OGRField *puValue) |
Set field. More... | |
void | SetField (int i, int nCount, GByte *pabyBinary) |
Set field to binary data. More... | |
void | SetField (int i, int nYear, int nMonth, int nDay, int nHour=0, int nMinute=0, float fSecond=0.f, int nTZFlag=0) |
Set field to date. More... | |
void | SetField (const char *pszFName, int nValue) |
Set field to 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. More... | |
void | SetField (const char *pszFName, 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. More... | |
void | SetField (const char *pszFName, double dfValue) |
Set field to double value. More... | |
void | SetField (const char *pszFName, const char *pszValue) |
Set field to string value. More... | |
void | SetField (const char *pszFName, int nCount, int *panValues) |
Set field to list of integers value. More... | |
void | SetField (const char *pszFName, int nCount, const GIntBig *panValues) |
Set field to list of 64 bit integers value. More... | |
void | SetField (const char *pszFName, int nCount, double *padfValues) |
Set field to list of doubles value. More... | |
void | SetField (const char *pszFName, char **papszValues) |
Set field to list of strings value. More... | |
void | SetField (const char *pszFName, OGRField *puValue) |
Set field. More... | |
void | SetField (const char *pszFName, int nYear, int nMonth, int nDay, int nHour=0, int nMinute=0, float fSecond=0.f, int nTZFlag=0) |
Set field to date. More... | |
GIntBig | GetFID () const |
Get feature identifier. More... | |
virtual OGRErr | SetFID (GIntBig nFIDIn) |
Set the feature identifier. More... | |
void | DumpReadable (FILE *, char **papszOptions=NULL) |
Dump this feature in a human readable form. More... | |
OGRErr | SetFrom (OGRFeature *, int=TRUE) |
Set one feature from another. More... | |
OGRErr | SetFrom (OGRFeature *, int *, int=TRUE) |
Set one feature from another. More... | |
OGRErr | SetFieldsFrom (OGRFeature *, int *, int=TRUE) |
Set fields from another feature. More... | |
int | Validate (int nValidateFlags, int bEmitError) |
Validate that a feature meets constraints of its schema. More... | |
void | FillUnsetWithDefault (int bNotNullableOnly, char **papszOptions) |
Fill unset fields with default values that might be defined. More... | |
virtual const char * | GetStyleString () |
Fetch style string for this feature. More... | |
virtual void | SetStyleString (const char *) |
Set feature style string. More... | |
virtual void | SetStyleStringDirectly (char *) |
Set feature style string. More... | |
virtual OGRStyleTable * | GetStyleTable () |
virtual void | SetStyleTable (OGRStyleTable *poStyleTable) |
virtual void | SetStyleTableDirectly (OGRStyleTable *poStyleTable) |
const char * | GetNativeData () const |
Returns the native data for the feature. More... | |
const char * | GetNativeMediaType () const |
Returns the native media type for the feature. More... | |
void | SetNativeData (const char *pszNativeData) |
Sets the native data for the feature. More... | |
void | SetNativeMediaType (const char *pszNativeMediaType) |
Sets the native media type for the feature. More... | |
Static Public Member Functions | |
static OGRFeature * | CreateFeature (OGRFeatureDefn *) |
Feature factory. More... | |
static void | DestroyFeature (OGRFeature *) |
Destroy feature. More... | |
A simple feature, including geometry and attributes.
|
explicit |
Constructor.
Note that the OGRFeature will increment the reference count of it's defining OGRFeatureDefn. Destruction of the OGRFeatureDefn before destruction of all OGRFeatures that depend on it is likely to result in a crash.
This method is the same as the C function OGR_F_Create().
poDefnIn | feature class (layer) definition to which the feature will adhere. |
References OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetGeomFieldCount(), OGR_RawField_SetUnset(), OGRFeatureDefn::Reference(), VSI_CALLOC_VERBOSE, and VSI_MALLOC_VERBOSE.
Referenced by CreateFeature().
OGRFeature * OGRFeature::Clone | ( | ) |
Duplicate feature.
The newly created feature is owned by the caller, and will have it's own reference to the OGRFeatureDefn.
This method is the same as the C function OGR_F_Clone().
References OGRGeometry::clone(), CreateFeature(), GetFID(), OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetGeomFieldCount(), SetFID(), and VSI_STRDUP_VERBOSE.
|
static |
Feature factory.
This is essentially a feature factory, useful for applications creating features but wanting to ensure they are created out of the OGR/GDAL heap.
This method is the same as the C function OGR_F_Create().
poDefn | Feature definition defining schema. |
References OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetGeomFieldCount(), and OGRFeature().
Referenced by Clone(), and OGR_F_Create().
|
static |
Destroy feature.
The feature is deleted, but within the context of the GDAL/OGR heap. This is necessary when higher level applications use GDAL/OGR from a DLL and they want to delete a feature created within the DLL. If the delete is done in the calling application the memory will be freed onto the application heap which is inappropriate.
This method is the same as the C function OGR_F_Destroy().
poFeature | the feature to delete. |
void OGRFeature::DumpReadable | ( | FILE * | fpOut, |
char ** | papszOptions = NULL |
||
) |
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.
A few options can be defined to change the default dump :
This method is the same as the C function OGR_F_DumpReadable().
fpOut | the stream to write to, such as stdout. If NULL stdout will be used. |
papszOptions | NULL terminated list of options (may be NULL) |
References CPL_FRMT_GIB, CPLsnprintf(), CPLSPrintf(), CPLTestBool(), CSLFetchNameValue(), OGRGeometry::dumpReadable(), EQUAL, GetFID(), GetFieldAsString(), GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetFieldSubTypeName(), OGRFieldDefn::GetFieldTypeName(), GetGeomFieldCount(), OGRFeatureDefn::GetGeomFieldDefn(), OGRFeatureDefn::GetName(), OGRFieldDefn::GetNameRef(), OGRGeomFieldDefn::GetNameRef(), GetStyleString(), OGRFieldDefn::GetSubType(), OGRFieldDefn::GetType(), IsFieldNull(), IsFieldSet(), and OFSTNone.
|
virtual |
Test if two features are the same.
Two features are considered equal if the share them (pointer equality) same OGRFeatureDefn, have the same field values, and the same geometry (as tested by OGRGeometry::Equal()) as well as the same feature id.
This method is the same as the C function OGR_F_Equal().
poFeature | the other feature to test this one against. |
References CSLCount(), OGRGeometry::Equals(), GetDefnRef(), GetFID(), GetFieldAsBinary(), GetFieldAsDateTime(), GetFieldAsDouble(), GetFieldAsDoubleList(), GetFieldAsInteger(), GetFieldAsInteger64(), GetFieldAsInteger64List(), GetFieldAsIntegerList(), GetFieldAsString(), GetFieldAsStringList(), OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), GetGeomFieldCount(), GetGeomFieldRef(), OGRFieldDefn::GetType(), IsFieldNull(), IsFieldSet(), IsFieldSetAndNotNull(), OFTBinary, OFTDate, OFTDateTime, OFTInteger, OFTInteger64, OFTInteger64List, OFTIntegerList, OFTReal, OFTRealList, OFTString, OFTStringList, and OFTTime.
void OGRFeature::FillUnsetWithDefault | ( | int | bNotNullableOnly, |
char ** | papszOptions | ||
) |
Fill unset fields with default values that might be defined.
This method is the same as the C function OGR_F_FillUnsetWithDefault().
bNotNullableOnly | if we should fill only unset fields with a not-null constraint. |
papszOptions | unused currently. Must be set to NULL. |
References CPLES_SQL, CPLFree, CPLUnescapeString(), OGRFieldDefn::GetDefault(), OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSet(), OGRFieldDefn::IsNullable(), OFTDate, OFTDateTime, OFTString, OFTTime, SetField(), and STARTS_WITH_CI.
|
inline |
Fetch feature definition.
This method is the same as the C function OGR_F_GetDefnRef().
Referenced by Equal().
|
inline |
Get feature identifier.
This method is the same as the C function OGR_F_GetFID(). Note: since GDAL 2.0, this method returns a GIntBig (previously a long)
Referenced by Clone(), DumpReadable(), Equal(), OGRLayer::GetFeature(), GetFieldAsDouble(), GetFieldAsString(), and IsFieldSet().
GByte * OGRFeature::GetFieldAsBinary | ( | int | iField, |
int * | pnBytes | ||
) |
Fetch field value as binary data.
This method only works for OFTBinary and OFTString fields.
This method is the same as the C function OGR_F_GetFieldAsBinary().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
pnBytes | location to put the number of bytes returned. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSetAndNotNull(), OFTBinary, and OFTString.
Referenced by Equal().
int OGRFeature::GetFieldAsDateTime | ( | 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 method is the same as the C function OGR_F_GetFieldAsDateTime().
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) |
Referenced by Equal().
int OGRFeature::GetFieldAsDateTime | ( | int | iField, |
int * | pnYear, | ||
int * | pnMonth, | ||
int * | pnDay, | ||
int * | pnHour, | ||
int * | pnMinute, | ||
float * | pfSecond, | ||
int * | pnTZFlag | ||
) |
Fetch field value as date and time.
Currently this method only works for OFTDate, OFTTime and OFTDateTime fields.
This method is the same as the C function OGR_F_GetFieldAsDateTime().
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) |
pfSecond | (0-59 with millisecond accuracy) |
pnTZFlag | (0=unknown, 1=localtime, 100=GMT, see data model for details) |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSetAndNotNull(), OFTDate, OFTDateTime, and OFTTime.
double OGRFeature::GetFieldAsDouble | ( | int | iField | ) |
Fetch field value as a double.
OFTString features will be translated using CPLAtof(). OFTInteger and OFTInteger64 fields will be cast to double. Other field types, or errors will result in a return value of zero.
This method is the same as the C function OGR_F_GetFieldAsDouble().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
References CPLAtof(), GetFID(), OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), GetGeomFieldCount(), OGRFieldDefn::GetType(), IsFieldSetAndNotNull(), OFTInteger, OFTInteger64, OFTReal, OFTString, and OGR_G_Area().
Referenced by Equal(), and SetFieldsFrom().
|
inline |
Fetch field value as a double.
OFTString features will be translated using CPLAtof(). OFTInteger and OFTInteger64 fields will be cast to double. Other field types, or errors will result in a return value of zero.
pszFName | the name of the field to fetch. |
const double * OGRFeature::GetFieldAsDoubleList | ( | int | iField, |
int * | pnCount | ||
) |
Fetch field value as a list of doubles.
Currently this method only works for OFTRealList fields.
This method is the same as the C function OGR_F_GetFieldAsDoubleList().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
pnCount | an integer to put the list count (number of doubles) into. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSetAndNotNull(), and OFTRealList.
Referenced by Equal(), GetFieldAsSerializedJSon(), and SetFieldsFrom().
|
inline |
Fetch field value as a list of doubles.
Currently this method only works for OFTRealList fields.
pszFName | the name of the field to fetch. |
pnCount | an integer to put the list count (number of doubles) into. |
int OGRFeature::GetFieldAsInteger | ( | int | iField | ) |
Fetch field value as integer.
OFTString features will be translated using atoi(). OFTReal fields will be cast to integer. OFTInteger64 are demoted to 32 bit, with clamping if out-of-range. Other field types, or errors will result in a return value of zero.
This method is the same as the C function OGR_F_GetFieldAsInteger().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
References CPLError(), and OGRFeatureDefn::GetFieldCount().
Referenced by Equal(), and SetFieldsFrom().
|
inline |
Fetch field value as integer.
OFTString features will be translated using atoi(). OFTReal fields will be cast to integer. OFTInteger64 are demoted to 32 bit, with clamping if out-of-range. Other field types, or errors will result in a return value of zero.
pszFName | the name of the field to fetch. |
GIntBig OGRFeature::GetFieldAsInteger64 | ( | 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 method is the same as the C function OGR_F_GetFieldAsInteger64().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
References CPLAtoGIntBigEx(), OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), GetGeomFieldCount(), OGRFieldDefn::GetType(), IsFieldSetAndNotNull(), OFTInteger, OFTInteger64, OFTReal, OFTString, and OGR_G_Area().
Referenced by Equal(), and SetFieldsFrom().
|
inline |
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.
pszFName | the name of the field to fetch. |
const GIntBig * OGRFeature::GetFieldAsInteger64List | ( | int | iField, |
int * | pnCount | ||
) |
Fetch field value as a list of 64 bit integers.
Currently this method only works for OFTInteger64List fields.
This method is the same as the C function OGR_F_GetFieldAsInteger64List().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
pnCount | an integer to put the list count (number of integers) into. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSetAndNotNull(), and OFTInteger64List.
Referenced by Equal(), GetFieldAsSerializedJSon(), and SetFieldsFrom().
|
inline |
Fetch field value as a list of 64 bit integers.
Currently this method only works for OFTInteger64List fields.
pszFName | the name of the field to fetch. |
pnCount | an integer to put the list count (number of integers) into. |
const int * OGRFeature::GetFieldAsIntegerList | ( | int | iField, |
int * | pnCount | ||
) |
Fetch field value as a list of integers.
Currently this method only works for OFTIntegerList fields.
This method is the same as the C function OGR_F_GetFieldAsIntegerList().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
pnCount | an integer to put the list count (number of integers) into. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSetAndNotNull(), and OFTIntegerList.
Referenced by Equal(), GetFieldAsSerializedJSon(), and SetFieldsFrom().
|
inline |
Fetch field value as a list of integers.
Currently this method only works for OFTIntegerList fields.
pszFName | the name of the field to fetch. |
pnCount | an integer to put the list count (number of integers) into. |
char * OGRFeature::GetFieldAsSerializedJSon | ( | int | iField | ) |
Fetch field value as a serialized JSon object.
Currently this method only works for OFTStringList, OFTIntegerList, OFTInteger64List and OFTRealList
iField | the field to fetch, from 0 to GetFieldCount()-1. |
References CPLStrdup(), GetFieldAsDoubleList(), GetFieldAsInteger64List(), GetFieldAsIntegerList(), GetFieldAsStringList(), OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSetAndNotNull(), OFTInteger64List, OFTIntegerList, OFTRealList, and OFTStringList.
const char * OGRFeature::GetFieldAsString | ( | 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 method is the same as the C function OGR_F_GetFieldAsString().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
< Success
References CPL_FRMT_GIB, CPLBinaryToHex(), CPLFree, CPLsnprintf(), GetFID(), OGRFeatureDefn::GetFieldCount(), OGRFeatureDefn::GetFieldDefn(), OGRGeometry::getGeometryName(), GetGeomFieldCount(), OGRFieldDefn::GetPrecision(), GetStyleString(), OGRFieldDefn::GetType(), OGRFieldDefn::GetWidth(), IsFieldSetAndNotNull(), OFTBinary, OFTDate, OFTDateTime, OFTInteger, OFTInteger64, OFTInteger64List, OFTIntegerList, OFTReal, OFTRealList, OFTString, OFTStringList, OFTTime, OGR_G_Area(), OGR_GET_MS, OGRERR_NONE, and VSI_STRDUP_VERBOSE.
Referenced by DumpReadable(), Equal(), GetStyleString(), and SetFieldsFrom().
|
inline |
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.
pszFName | the name of the field to fetch. |
char ** OGRFeature::GetFieldAsStringList | ( | 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 method is the same as the C function OGR_F_GetFieldAsStringList().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
References OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSetAndNotNull(), and OFTStringList.
Referenced by Equal(), and GetFieldAsSerializedJSon().
|
inline |
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().
pszFName | the name of the field to fetch. |
|
inline |
Fetch number of fields on this feature. This will always be the same as the field count for the OGRFeatureDefn.
This method is the same as the C function OGR_F_GetFieldCount().
References OGRFeatureDefn::GetFieldCount().
Referenced by DumpReadable(), OGR_F_GetFieldDefnRef(), OGR_F_IsFieldNull(), OGR_F_IsFieldSet(), OGR_F_IsFieldSetAndNotNull(), SetFieldsFrom(), and SetFrom().
|
inline |
Fetch definition for this field.
This method is the same as the C function OGR_F_GetFieldDefnRef().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
References OGRFeatureDefn::GetFieldDefn().
Referenced by SetFieldsFrom(), and SetFrom().
|
inline |
Fetch the field index given field name.
This is a cover for the OGRFeatureDefn::GetFieldIndex() method.
This method is the same as the C function OGR_F_GetFieldIndex().
pszName | the name of the field to search for. |
References OGRFeatureDefn::GetFieldIndex().
Referenced by GetStyleString(), and SetFrom().
OGRGeometry * OGRFeature::GetGeometryRef | ( | ) |
Fetch pointer to feature geometry.
This method is the same as the C function OGR_F_GetGeometryRef().
Starting with GDAL 1.11, this is equivalent to calling OGRFeature::GetGeomFieldRef(0).
References GetGeomFieldCount(), and GetGeomFieldRef().
Referenced by OGR_F_GetGeometryRef().
|
inline |
Fetch number of geometry fields on this feature. This will always be the same as the geometry field count for the OGRFeatureDefn.
This method is the same as the C function OGR_F_GetGeomFieldCount().
References OGRFeatureDefn::GetGeomFieldCount().
Referenced by DumpReadable(), Equal(), GetFieldAsDouble(), GetFieldAsInteger64(), GetFieldAsString(), GetGeometryRef(), GetGeomFieldRef(), IsFieldSet(), SetFrom(), SetGeometry(), SetGeometryDirectly(), SetGeomField(), SetGeomFieldDirectly(), and StealGeometry().
|
inline |
Fetch definition for this geometry field.
This method is the same as the C function OGR_F_GetGeomFieldDefnRef().
iGeomField | the field to fetch, from 0 to GetGeomFieldCount()-1. |
References OGRFeatureDefn::GetGeomFieldDefn().
Referenced by SetFrom().
|
inline |
Fetch the geometry field index given geometry field name.
This is a cover for the OGRFeatureDefn::GetGeomFieldIndex() method.
This method is the same as the C function OGR_F_GetGeomFieldIndex().
pszName | the name of the geometry field to search for. |
References OGRFeatureDefn::GetGeomFieldIndex().
Referenced by GetGeomFieldRef(), and SetFrom().
OGRGeometry * OGRFeature::GetGeomFieldRef | ( | int | iField | ) |
Fetch pointer to feature geometry.
This method is the same as the C function OGR_F_GetGeomFieldRef().
iField | geometry field to get. |
References GetGeomFieldCount().
Referenced by Equal(), GetGeometryRef(), OGR_F_GetGeomFieldRef(), SetFrom(), and Validate().
OGRGeometry * OGRFeature::GetGeomFieldRef | ( | const char * | pszFName | ) |
Fetch pointer to feature geometry.
pszFName | name of geometry field to get. |
References GetGeomFieldIndex().
|
inline |
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 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 function OGR_F_GetNativeData().
Referenced by SetFrom().
|
inline |
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 (see https://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().
Referenced by SetFrom().
|
inline |
Fetch a pointer to the internal field value given the index.
This method is the same as the C function OGR_F_GetRawFieldRef().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
Referenced by SetFieldsFrom().
|
virtual |
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 method is the same as the C function OGR_F_GetStyleString().
References GetFieldAsString(), and GetFieldIndex().
Referenced by DumpReadable(), GetFieldAsString(), OGRStyleMgr::InitFromFeature(), IsFieldSet(), and SetFrom().
|
inlinevirtual |
Return style table.
bool OGRFeature::IsFieldNull | ( | int | iField | ) |
Test if a field is null.
This method is the same as the C function OGR_F_IsFieldNull().
iField | the field to test. |
References OGRFeatureDefn::GetFieldCount().
Referenced by DumpReadable(), Equal(), SetFieldNull(), SetFieldsFrom(), and UnsetField().
int OGRFeature::IsFieldSet | ( | int | iField | ) |
Test if a field has ever been assigned a value or not.
This method is the same as the C function OGR_F_IsFieldSet().
iField | the field to test. |
References GetFID(), OGRFeatureDefn::GetFieldCount(), GetGeomFieldCount(), GetStyleString(), OGR_G_Area(), OGR_RawField_IsUnset(), and OGRNullFID.
Referenced by DumpReadable(), Equal(), FillUnsetWithDefault(), SetFieldNull(), SetFieldsFrom(), and UnsetField().
bool OGRFeature::IsFieldSetAndNotNull | ( | int | iField | ) |
Test if a field is set and not null.
This method is the same as the C function OGR_F_IsFieldSetAndNotNull().
iField | the field to test. |
References OGRFeatureDefn::GetFieldCount().
Referenced by Equal(), GetFieldAsBinary(), GetFieldAsDateTime(), GetFieldAsDouble(), GetFieldAsDoubleList(), GetFieldAsInteger64(), GetFieldAsInteger64List(), GetFieldAsIntegerList(), GetFieldAsSerializedJSon(), GetFieldAsString(), GetFieldAsStringList(), and SetField().
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 method is the same as the C function OGR_F_SetFID().
nFIDIn | the new feature identifier value to assign. |
< Success
References OGRERR_NONE.
void OGRFeature::SetField | ( | int | iField, |
int | nValue | ||
) |
Set field to 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 method is the same as the C function OGR_F_SetFieldInteger().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
nValue | the value to assign. |
References CPLFree, OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSetAndNotNull(), OFTInteger, OFTInteger64, OFTInteger64List, OFTIntegerList, OFTReal, OFTRealList, OFTString, OFTStringList, OGR_RawField_SetUnset(), and VSI_STRDUP_VERBOSE.
Referenced by FillUnsetWithDefault(), SetField(), and SetFieldsFrom().
void OGRFeature::SetField | ( | 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 method is the same as the C function OGR_F_SetFieldInteger64().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
nValue | the value to assign. |
References CPLError(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), and OFTInteger.
void OGRFeature::SetField | ( | int | iField, |
double | dfValue | ||
) |
Set field to double 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 method is the same as the C function OGR_F_SetFieldDouble().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
dfValue | the value to assign. |
References CPLFree, CPLsnprintf(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSetAndNotNull(), OFTInteger, OFTInteger64, OFTInteger64List, OFTIntegerList, OFTReal, OFTRealList, OFTString, OFTStringList, OGR_RawField_SetUnset(), SetField(), and VSI_STRDUP_VERBOSE.
void OGRFeature::SetField | ( | 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 method is the same as the C function OGR_F_SetFieldString().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
pszValue | the value to assign. |
References CPLError(), CPLFree, CPLGetConfigOption(), CPLTestBool(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldSetAndNotNull(), OFTInteger, OFTString, OGR_RawField_SetUnset(), and VSI_STRDUP_VERBOSE.
void OGRFeature::SetField | ( | int | iField, |
int | nCount, | ||
int * | panValues | ||
) |
Set field to list of integers value.
This method currently on has an effect of OFTIntegerList, OFTInteger64List and OFTRealList fields.
This method is the same as the C function OGR_F_SetFieldIntegerList().
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. |
References CPLFree, CPLSPrintf(), CSLDestroy(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetSubType(), OGRFieldDefn::GetType(), OFSTBoolean, OFSTInt16, OFTInteger, OFTInteger64, OFTInteger64List, OFTIntegerList, OFTReal, OFTRealList, OFTStringList, SetField(), VSI_MALLOC_VERBOSE, and VSI_STRDUP_VERBOSE.
void OGRFeature::SetField | ( | int | iField, |
int | nCount, | ||
const GIntBig * | panValues | ||
) |
Set field to list of 64 bit integers value.
This method currently on has an effect of OFTIntegerList, OFTInteger64List and OFTRealList fields.
This method is the same as the C function OGR_F_SetFieldIntege64rList().
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. |
References CPLError(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), and OFTIntegerList.
void OGRFeature::SetField | ( | int | iField, |
int | nCount, | ||
double * | padfValues | ||
) |
Set field to list of doubles value.
This method currently on has an effect of OFTIntegerList, OFTInteger64List, OFTRealList fields.
This method is the same as the C function OGR_F_SetFieldDoubleList().
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. |
References CPLSPrintf(), CSLDestroy(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OFTInteger, OFTInteger64, OFTInteger64List, OFTIntegerList, OFTReal, OFTRealList, OFTStringList, SetField(), VSI_MALLOC_VERBOSE, and VSI_STRDUP_VERBOSE.
void OGRFeature::SetField | ( | int | iField, |
char ** | papszValues | ||
) |
Set field to list of strings value.
This method currently on has an effect of OFTStringList fields.
This method is the same as the C function OGR_F_SetFieldStringList().
iField | the field to set, from 0 to GetFieldCount()-1. |
papszValues | the values to assign. |
References CPLError(), CSLCount(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OFTIntegerList, OFTStringList, SetField(), and VSI_MALLOC_VERBOSE.
void OGRFeature::SetField | ( | int | iField, |
OGRField * | puValue | ||
) |
Set field.
The passed value OGRField must be of exactly the same type as the target field, or an application crash may occur. The passed value is copied, and will not be affected. It remains the responsibility of the caller.
This method is the same as the C function OGR_F_SetFieldRaw().
iField | the field to fetch, from 0 to GetFieldCount()-1. |
puValue | the value to assign. |
void OGRFeature::SetField | ( | int | iField, |
int | nBytes, | ||
GByte * | pabyData | ||
) |
Set field to binary data.
This method currently on has an effect of OFTBinary fields.
This method is the same as the C function OGR_F_SetFieldBinary().
iField | the field to set, from 0 to GetFieldCount()-1. |
nBytes | bytes of data being set. |
pabyData | the raw data being applied. |
References CPLFree, OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OFTBinary, OFTString, OFTStringList, SetField(), and VSI_MALLOC_VERBOSE.
void OGRFeature::SetField | ( | int | iField, |
int | nYear, | ||
int | nMonth, | ||
int | nDay, | ||
int | nHour = 0 , |
||
int | nMinute = 0 , |
||
float | fSecond = 0.f , |
||
int | nTZFlag = 0 |
||
) |
Set field to date.
This method currently only has an effect for OFTDate, OFTTime and OFTDateTime fields.
This method is the same as the C function OGR_F_SetFieldDateTime().
iField | the field to set, from 0 to GetFieldCount()-1. |
nYear | (including century) |
nMonth | (1-12) |
nDay | (1-31) |
nHour | (0-23) |
nMinute | (0-59) |
fSecond | (0-59, with millisecond accuracy) |
nTZFlag | (0=unknown, 1=localtime, 100=GMT, see data model for details) |
References CPLError(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), OFTDate, OFTDateTime, and OFTTime.
|
inline |
Set field to 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.
pszFName | the name of the field to set. |
nValue | the value to assign. |
|
inline |
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.
pszFName | the name of the field to set. |
nValue | the value to assign. |
|
inline |
Set field to double 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.
pszFName | the name of the field to set. |
dfValue | the value to assign. |
|
inline |
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.
pszFName | the name of the field to set. |
pszValue | the value to assign. |
|
inline |
Set field to list of integers value.
This method currently on has an effect of OFTIntegerList, OFTInteger64List and OFTRealList fields.
pszFName | the name of the field to set. |
nCount | the number of values in the list being assigned. |
panValues | the values to assign. |
|
inline |
Set field to list of 64 bit integers value.
This method currently on has an effect of OFTIntegerList, OFTInteger64List and OFTRealList fields.
pszFName | the name of the field to set. |
nCount | the number of values in the list being assigned. |
panValues | the values to assign. |
|
inline |
Set field to list of doubles value.
This method currently on has an effect of OFTIntegerList, OFTInteger64List, OFTRealList fields.
pszFName | the name of the field to set. |
nCount | the number of values in the list being assigned. |
padfValues | the values to assign. |
|
inline |
Set field to list of strings value.
This method currently on has an effect of OFTStringList fields.
pszFName | the name of the field to set. |
papszValues | the values to assign. |
|
inline |
Set field.
The passed value OGRField must be of exactly the same type as the target field, or an application crash may occur. The passed value is copied, and will not be affected. It remains the responsibility of the caller.
pszFName | the name of the field to set. |
puValue | the value to assign. |
|
inline |
Set field to date.
This method currently only has an effect for OFTDate, OFTTime and OFTDateTime fields.
pszFName | the name of the field to set. |
nYear | (including century) |
nMonth | (1-12) |
nDay | (1-31) |
nHour | (0-23) |
nMinute | (0-59) |
fSecond | (0-59, with millisecond accuracy) |
nTZFlag | (0=unknown, 1=localtime, 100=GMT, see data model for details) |
void OGRFeature::SetFieldNull | ( | int | iField | ) |
Clear a field, marking it as null.
This method is the same as the C function OGR_F_SetFieldNull().
iField | the field to set to null. |
References CPLFree, CSLDestroy(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldNull(), IsFieldSet(), OFTBinary, OFTInteger64List, OFTIntegerList, OFTRealList, OFTString, OFTStringList, and OGR_RawField_SetNull().
Referenced by SetFieldsFrom().
OGRErr OGRFeature::SetFieldsFrom | ( | OGRFeature * | poSrcFeature, |
int * | panMap, | ||
int | bForgiving = TRUE |
||
) |
Set fields from another feature.
Overwrite the fields of this feature from the attributes of another. The FID and the style string are not set. The poSrcFeature 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. SetField() method 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.
poSrcFeature | the feature from which geometry, and field values will be copied. |
panMap | Array of the indices of the 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. |
< Failure
< Failure
< Failure
< Success
References GetFieldAsDouble(), GetFieldAsDoubleList(), GetFieldAsInteger(), GetFieldAsInteger64(), GetFieldAsInteger64List(), GetFieldAsIntegerList(), GetFieldAsString(), GetFieldCount(), GetFieldDefnRef(), GetRawFieldRef(), OGRFieldDefn::GetType(), IsFieldNull(), IsFieldSet(), OFTDate, OFTDateTime, OFTInteger, OFTInteger64, OFTInteger64List, OFTIntegerList, OFTReal, OFTRealList, OFTString, OFTStringList, OFTTime, OGRERR_FAILURE, OGRERR_NONE, SetField(), SetFieldNull(), and UnsetField().
Referenced by SetFrom().
OGRErr OGRFeature::SetFrom | ( | OGRFeature * | poSrcFeature, |
int | bForgiving = TRUE |
||
) |
Set one feature from another.
Overwrite the contents of this feature from the geometry and attributes of another. The poSrcFeature does not need to have the same OGRFeatureDefn. Field values are copied by corresponding field names. Field types do not have to exactly match. SetField() method conversion rules will be applied as needed.
This method is the same as the C function OGR_F_SetFrom().
poSrcFeature | 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. |
< Failure
< Failure
References GetFieldCount(), GetFieldDefnRef(), GetFieldIndex(), OGRFieldDefn::GetNameRef(), OGRERR_FAILURE, VSI_MALLOC_VERBOSE, and VSIFree().
OGRErr OGRFeature::SetFrom | ( | OGRFeature * | poSrcFeature, |
int * | panMap, | ||
int | bForgiving = TRUE |
||
) |
Set one feature from another.
Overwrite the contents of this feature from the geometry and attributes of another. The poSrcFeature 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. SetField() method 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 method is the same as the C function OGR_F_SetFromWithMap().
poSrcFeature | the feature from which geometry, and field values will be copied. |
panMap | Array of the indices of the 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. |
< Failure
< Success
< Success
References GetGeomFieldCount(), GetGeomFieldDefnRef(), GetGeomFieldIndex(), GetGeomFieldRef(), OGRGeomFieldDefn::GetNameRef(), GetNativeData(), GetNativeMediaType(), GetStyleString(), OGRERR_FAILURE, OGRERR_NONE, OGRNullFID, SetFID(), SetFieldsFrom(), SetGeomField(), SetNativeData(), SetNativeMediaType(), and SetStyleString().
OGRErr OGRFeature::SetGeometry | ( | const OGRGeometry * | poGeomIn | ) |
Set feature geometry.
This method updates the features geometry, and operate exactly as SetGeometryDirectly(), except that this method does not assume ownership of the passed geometry, but instead makes a copy of it.
This method is the same as the C function OGR_F_SetGeometry().
poGeomIn | new geometry to apply to feature. Passing NULL value here is correct and it will result in deallocation of currently assigned geometry without assigning new one. |
< Failure
References GetGeomFieldCount(), OGRERR_FAILURE, and SetGeomField().
OGRErr OGRFeature::SetGeometryDirectly | ( | OGRGeometry * | poGeomIn | ) |
Set feature geometry.
This method updates the features geometry, and operate exactly as SetGeometry(), except that this method assumes ownership of the passed geometry (even in case of failure of that function).
This method is the same as the C function OGR_F_SetGeometryDirectly().
poGeomIn | new geometry to apply to feature. Passing NULL value here is correct and it will result in deallocation of currently assigned geometry without assigning new one. |
< Failure
References GetGeomFieldCount(), OGRERR_FAILURE, and SetGeomFieldDirectly().
OGRErr OGRFeature::SetGeomField | ( | int | iField, |
const OGRGeometry * | poGeomIn | ||
) |
Set feature geometry of a specified geometry field.
This method updates the features geometry, and operate exactly as SetGeomFieldDirectly(), except that this method does not assume ownership of the passed geometry, but instead makes a copy of it.
This method is the same as the C function OGR_F_SetGeomField().
iField | geometry field to set. |
poGeomIn | new geometry to apply to feature. Passing NULL value here is correct and it will result in deallocation of currently assigned geometry without assigning new one. |
< Failure
< Success
References OGRGeometry::clone(), GetGeomFieldCount(), OGRERR_FAILURE, and OGRERR_NONE.
Referenced by SetFrom(), and SetGeometry().
OGRErr OGRFeature::SetGeomFieldDirectly | ( | int | iField, |
OGRGeometry * | poGeomIn | ||
) |
Set feature geometry of a specified geometry field.
This method updates the features geometry, and operate exactly as SetGeomField(), except that this method assumes ownership of the passed geometry (even in case of failure of that function).
This method is the same as the C function OGR_F_SetGeomFieldDirectly().
iField | geometry field to set. |
poGeomIn | new geometry to apply to feature. Passing NULL value here is correct and it will result in deallocation of currently assigned geometry without assigning new one. |
< Failure
< Success
References GetGeomFieldCount(), OGRERR_FAILURE, and OGRERR_NONE.
Referenced by OGR_F_GetGeometryRef(), OGR_F_GetGeomFieldRef(), and SetGeometryDirectly().
void OGRFeature::SetNativeData | ( | 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 GetNativeMediaType().
This function is the same as the C function OGR_F_SetNativeData().
pszNativeData | a string with the native data, or NULL if there is none. |
References CPLFree, and VSI_STRDUP_VERBOSE.
Referenced by SetFrom().
void OGRFeature::SetNativeMediaType | ( | 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 (see https://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_SetNativeMediaType().
pszNativeMediaType | a string with the native media type, or NULL if there is none. |
References CPLFree, and VSI_STRDUP_VERBOSE.
Referenced by SetFrom().
|
virtual |
Set feature style string.
This method operate exactly as OGRFeature::SetStyleStringDirectly() except that it does not assume ownership of the passed string, but instead makes a copy of it.
This method is the same as the C function OGR_F_SetStyleString().
pszString | the style string to apply to this feature, cannot be NULL. |
References CPLFree, and VSI_STRDUP_VERBOSE.
Referenced by OGRStyleMgr::SetFeatureStyleString(), and SetFrom().
|
virtual |
Set feature style string.
This method operate exactly as OGRFeature::SetStyleString() except that it assumes ownership of the passed string.
This method is the same as the C function OGR_F_SetStyleStringDirectly().
pszString | the style string to apply to this feature, cannot be NULL. |
References CPLFree.
|
virtual |
Set style table.
poStyleTable | new style table (will be cloned) |
References OGRStyleTable::Clone().
|
virtual |
Set style table.
poStyleTable | new style table (ownership transferred to the object) |
OGRGeometry * OGRFeature::StealGeometry | ( | ) |
Take away ownership of geometry.
Fetch the geometry from this feature, and clear the reference to the geometry on the feature. This is a mechanism for the application to take over ownership of the geometry from the feature without copying. Sort of an inverse to SetGeometryDirectly().
After this call the OGRFeature will have a NULL geometry.
References GetGeomFieldCount().
Referenced by OGR_F_GetGeometryRef(), and OGR_F_GetGeomFieldRef().
OGRGeometry * OGRFeature::StealGeometry | ( | int | iGeomField | ) |
Take away ownership of geometry.
Fetch the geometry from this feature, and clear the reference to the geometry on the feature. This is a mechanism for the application to take over ownership of the geometry from the feature without copying. Sort of an inverse to SetGeometryDirectly().
After this call the OGRFeature will have a NULL geometry.
iGeomField | index of the geometry field. |
References GetGeomFieldCount().
void OGRFeature::UnsetField | ( | int | iField | ) |
Clear a field, marking it as unset.
This method is the same as the C function OGR_F_UnsetField().
iField | the field to unset. |
References CPLFree, CSLDestroy(), OGRFeatureDefn::GetFieldDefn(), OGRFieldDefn::GetType(), IsFieldNull(), IsFieldSet(), OFTBinary, OFTInteger64List, OFTIntegerList, OFTRealList, OFTString, OFTStringList, and OGR_RawField_SetUnset().
Referenced by SetFieldsFrom().
int OGRFeature::Validate | ( | 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 method is the same as the C function OGR_F_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, OGR_F_VAL_ALLOW_DIFFERENT_GEOM_DIM with '|' operator |
bEmitError | TRUE if a CPLError() must be emitted when a check fails |
References CPLError(), OGRFeatureDefn::GetGeomFieldCount(), OGRFeatureDefn::GetGeomFieldDefn(), GetGeomFieldRef(), OGRGeomFieldDefn::IsNullable(), and OGR_F_VAL_NULL.