Class Feature
- java.lang.Object
-
- org.gdal.ogr.Feature
-
- All Implemented Interfaces:
java.lang.Cloneable
public class Feature extends java.lang.Object implements java.lang.Cloneable
A simple feature, including geometry and attributes.The Feature class is a binding for the C++ OGRFeature class.
-
-
Constructor Summary
Constructors Constructor Description Feature(FeatureDefn feature_def)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Feature
Clone()
Duplicate feature.void
delete()
Delete (in memory) a feature.void
DumpReadable()
Dump this feature in a human readable form.java.lang.String
DumpReadableAsString()
java.lang.String
DumpReadableAsString(java.util.Vector options)
boolean
Equal(Feature feature)
Test if two features are the same.boolean
equals(java.lang.Object obj)
void
FillUnsetWithDefault()
void
FillUnsetWithDefault(int bNotNullableOnly)
void
FillUnsetWithDefault(int bNotNullableOnly, java.util.Vector options)
FeatureDefn
GetDefnRef()
Fetch feature definition.long
GetFID()
Get feature identifier.byte[]
GetFieldAsBinary(int id)
byte[]
GetFieldAsBinary(java.lang.String field_name)
void
GetFieldAsDateTime(int ifield, int[] pnYear, int[] pnMonth, int[] pnDay, int[] pnHour, int[] pnMinute, float[] pfSecond, int[] pnTZFlag)
Fetch field value as date and time.void
GetFieldAsDateTime(java.lang.String field_name, int[] pnYear, int[] pnMonth, int[] pnDay, int[] pnHour, int[] pnMinute, float[] pfSecond, int[] pnTZFlag)
double
GetFieldAsDouble(int ifield)
Fetch field value as a double.double
GetFieldAsDouble(java.lang.String name)
Fetch field value as a double.double[]
GetFieldAsDoubleList(int ifield)
Fetch field value as a list of doubles.int
GetFieldAsInteger(int ifield)
Fetch field value as integer.int
GetFieldAsInteger(java.lang.String name)
Fetch field value as integer.long
GetFieldAsInteger64(int id)
long
GetFieldAsInteger64(java.lang.String field_name)
int[]
GetFieldAsIntegerList(int ifield)
Fetch field value as a list of integers.java.lang.String
GetFieldAsISO8601DateTime(int id)
java.lang.String
GetFieldAsISO8601DateTime(int id, java.util.Vector options)
java.lang.String
GetFieldAsISO8601DateTime(java.lang.String field_name)
java.lang.String
GetFieldAsISO8601DateTime(java.lang.String field_name, java.util.Vector options)
java.lang.String
GetFieldAsString(int ifield)
Fetch field value as a string.java.lang.String
GetFieldAsString(java.lang.String name)
Fetch field value as a string.byte[]
GetFieldAsStringAsByteArray(int ifield)
Fetch field value as a string (when it is not UTF-8 encoded).byte[]
GetFieldAsStringAsByteArray(java.lang.String name)
Fetch field value as a string (when it is not UTF-8 encoded).java.lang.String[]
GetFieldAsStringList(int ifield)
Fetch field value as a list of strings.int
GetFieldCount()
Fetch number of fields on this feature.FieldDefn
GetFieldDefnRef(int ifield)
Fetch definition for this field.FieldDefn
GetFieldDefnRef(java.lang.String name)
Fetch definition for this field.int
GetFieldIndex(java.lang.String name)
Fetch the field index given field name.int
GetFieldType(int ifield)
Fetch the field type.int
GetFieldType(java.lang.String name)
Fetch the field type.Geometry
GetGeometryRef()
Fetch pointer to feature geometry.int
GetGeomFieldCount()
GeomFieldDefn
GetGeomFieldDefnRef(int id)
GeomFieldDefn
GetGeomFieldDefnRef(java.lang.String field_name)
int
GetGeomFieldIndex(java.lang.String field_name)
Geometry
GetGeomFieldRef(int iField)
Geometry
GetGeomFieldRef(java.lang.String field_name)
java.lang.String
GetNativeData()
byte[]
GetNativeDataAsByteArray()
java.lang.String
GetNativeMediaType()
java.lang.String
GetStyleString()
Fetch style string for this feature.byte[]
GetStyleStringAsByteArray()
Fetch style string for this feature (when it is not UTF-8 encoded).int
hashCode()
boolean
IsFieldNull(int id)
boolean
IsFieldNull(java.lang.String field_name)
boolean
IsFieldSet(int ifield)
Test if a field has ever been assigned a value or not.boolean
IsFieldSet(java.lang.String name)
Test if a field has ever been assigned a value or not.boolean
IsFieldSetAndNotNull(int id)
boolean
IsFieldSetAndNotNull(java.lang.String field_name)
int
SetFID(long fid)
Set the feature identifier.void
SetField(int ifield, double val)
Set field to double value.void
SetField(int ifield, int val)
Set field to integer value.void
SetField(int ifield, int year, int month, int day, int hour, int minute, float second, int tzflag)
Set field to date.void
SetField(int ifield, java.lang.String val)
Set field to string value.void
SetField(java.lang.String name, double val)
Set field to double value.void
SetField(java.lang.String name, int val)
Set field to integer value.void
SetField(java.lang.String name, int year, int month, int day, int hour, int minute, float second, int tzflag)
Set field to date.void
SetField(java.lang.String name, java.lang.String val)
Set field to string value.void
SetFieldBinaryFromHexString(int id, java.lang.String pszValue)
void
SetFieldBinaryFromHexString(java.lang.String field_name, java.lang.String pszValue)
void
SetFieldDoubleList(int ifield, double[] values)
Set field to list of doubles value.void
SetFieldInteger64(int id, long value)
void
SetFieldIntegerList(int ifield, int[] values)
Set field to list of integers value.void
SetFieldNull(int id)
void
SetFieldNull(java.lang.String field_name)
void
SetFieldStringList(int ifield, java.util.Vector values)
Set field to list of strings value.int
SetFrom(Feature srcFeature)
Set one feature from another.int
SetFrom(Feature srcFeature, int forgiving)
Set one feature from another.int
SetFromWithMap(Feature srcFeature, int forgiving, int[] map)
Set one feature from another.int
SetGeometry(Geometry geom)
Set feature geometry.int
SetGeometryDirectly(Geometry geom)
Set feature geometry.int
SetGeomField(int iField, Geometry geom)
int
SetGeomField(java.lang.String field_name, Geometry geom)
int
SetGeomFieldDirectly(int iField, Geometry geom)
int
SetGeomFieldDirectly(java.lang.String field_name, Geometry geom)
void
SetNativeData(java.lang.String nativeData)
void
SetNativeMediaType(java.lang.String nativeMediaType)
void
SetStyleString(java.lang.String style_string)
Set feature style string.void
UnsetField(int ifield)
Clear a field, marking it as unset.void
UnsetField(java.lang.String name)
Clear a field, marking it as unset.int
Validate()
int
Validate(int flags)
int
Validate(int flags, int bEmitError)
-
-
-
Constructor Detail
-
Feature
public Feature(FeatureDefn feature_def)
Constructor.Note that the Feature will increment the reference count of its defining FeatureDefn.
- Parameters:
feature_def
- feature class (layer) definition to which the feature will adhere.
-
-
Method Detail
-
delete
public void delete()
Delete (in memory) a feature.Calling this method is not required as normal garbage collection will reclaim associated resources when the object goes out of scope. Otherwise calling delete() explicitly will help release resources sooner. Don't call any method on a deleted object !
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
clone
public java.lang.Object clone()
-
GetDefnRef
public FeatureDefn GetDefnRef()
Fetch feature definition.- Returns:
- a reference to the feature definition object.
-
SetGeometry
public int SetGeometry(Geometry geom)
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.
- Parameters:
geom
- 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.- Returns:
- 0 if successful, or throws a RuntimeException (or an error code if DontUseExceptions() has been called) if the geometry type is illegal for the FeatureDefn (checking not yet implemented).
-
SetGeometryDirectly
public int SetGeometryDirectly(Geometry geom)
Set feature geometry.This method updates the features geometry, and operate exactly as SetGeometry(), except that this method assumes ownership of the passed geometry.
- Parameters:
geom
- 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.- Returns:
- 0 if successful, or throws a RuntimeException (or an error code if DontUseExceptions() has been called) if the geometry type is illegal for the FeatureDefn (checking not yet implemented).
-
GetGeometryRef
public Geometry GetGeometryRef()
Fetch pointer to feature geometry.- Returns:
- internal feature geometry (or null if no geometry). This object should not be modified.
-
SetGeomField
public int SetGeomField(int iField, Geometry geom)
-
SetGeomField
public int SetGeomField(java.lang.String field_name, Geometry geom)
-
SetGeomFieldDirectly
public int SetGeomFieldDirectly(int iField, Geometry geom)
-
SetGeomFieldDirectly
public int SetGeomFieldDirectly(java.lang.String field_name, Geometry geom)
-
GetGeomFieldRef
public Geometry GetGeomFieldRef(int iField)
-
GetGeomFieldRef
public Geometry GetGeomFieldRef(java.lang.String field_name)
-
Clone
public Feature Clone()
Duplicate feature.The newly created feature is owned by the caller, and will have its own reference to the FeatureDefn.
- Returns:
- new feature, exactly matching this feature.
-
Equal
public boolean Equal(Feature feature)
Test if two features are the same.Two features are considered equal if they share the (pointer equality) same FeatureDefn, have the same field values, and the same geometry (as tested by Geometry.Equal()) as well as the same feature id.
- Parameters:
feature
- the other feature to test this one against.- Returns:
- true if they are equal, otherwise false.
-
GetFieldCount
public int GetFieldCount()
Fetch number of fields on this feature. This will always be the same as the field count for the FeatureDefn.- Returns:
- count of fields.
-
GetFieldDefnRef
public FieldDefn GetFieldDefnRef(int ifield)
Fetch definition for this field.- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.- Returns:
- the field definition (from the FeatureDefn).
-
GetFieldDefnRef
public FieldDefn GetFieldDefnRef(java.lang.String name)
Fetch definition for this field.- Parameters:
name
- the name of the field to fetch.- Returns:
- the field definition (from the FeatureDefn).
-
GetGeomFieldCount
public int GetGeomFieldCount()
-
GetGeomFieldDefnRef
public GeomFieldDefn GetGeomFieldDefnRef(int id)
-
GetGeomFieldDefnRef
public GeomFieldDefn GetGeomFieldDefnRef(java.lang.String field_name)
-
GetFieldAsString
public java.lang.String 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.
- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.- Returns:
- the field value.
- See Also:
GetFieldAsStringAsByteArray(int)
-
GetFieldAsString
public java.lang.String GetFieldAsString(java.lang.String name)
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.
- Parameters:
name
- the name of the field to fetch.- Returns:
- the field value.
- See Also:
GetFieldAsStringAsByteArray(String)
-
GetFieldAsStringAsByteArray
public byte[] GetFieldAsStringAsByteArray(int ifield)
Fetch field value as a string (when it is not UTF-8 encoded).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.
- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.- Returns:
- the field value.
- Since:
- 3.10
-
GetFieldAsStringAsByteArray
public byte[] GetFieldAsStringAsByteArray(java.lang.String name)
Fetch field value as a string (when it is not UTF-8 encoded).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.
- Parameters:
name
- the name of the field to fetch.- Returns:
- the field value.
- Since:
- 3.10
-
GetFieldAsISO8601DateTime
public java.lang.String GetFieldAsISO8601DateTime(int id, java.util.Vector options)
-
GetFieldAsISO8601DateTime
public java.lang.String GetFieldAsISO8601DateTime(int id)
-
GetFieldAsISO8601DateTime
public java.lang.String GetFieldAsISO8601DateTime(java.lang.String field_name, java.util.Vector options)
-
GetFieldAsISO8601DateTime
public java.lang.String GetFieldAsISO8601DateTime(java.lang.String field_name)
-
GetFieldAsInteger
public int GetFieldAsInteger(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.
- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.- Returns:
- the field value.
-
GetFieldAsInteger
public int GetFieldAsInteger(java.lang.String name)
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.
- Parameters:
name
- the name of the field to fetch.- Returns:
- the field value.
-
GetFieldAsInteger64
public long GetFieldAsInteger64(int id)
-
GetFieldAsInteger64
public long GetFieldAsInteger64(java.lang.String field_name)
-
GetFieldAsDouble
public double GetFieldAsDouble(int ifield)
Fetch field value as a double.OFTString features will be translated using atof(). OFTInteger fields will be cast to double. Other field types, or errors will result in a return value of zero.
- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.- Returns:
- the field value.
-
GetFieldAsDouble
public double GetFieldAsDouble(java.lang.String name)
Fetch field value as a double.OFTString features will be translated using atof(). OFTInteger fields will be cast to double. Other field types, or errors will result in a return value of zero.
- Parameters:
name
- the name of the field to fetch.- Returns:
- the field value.
-
GetFieldAsDateTime
public void 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.
- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.pnYear
- an allocated array of 1 integer to put the year (including century)pnMonth
- an allocated array of 1 integer to put the month (1-12)pnDay
- an allocated array of 1 integer to put the day (1-31)pnHour
- an allocated array of 1 integer to put the hour (0-23)pnMinute
- an allocated array of 1 integer to put the minute (0-59)pfSecond
- an allocated array of 1 integer to put the second (0-59)pnTZFlag
- an allocated array of 1 integer to put the time zone flag (0=unknown, 1=localtime, 100=GMT, see data model for details)
-
GetFieldAsDateTime
public void GetFieldAsDateTime(java.lang.String field_name, int[] pnYear, int[] pnMonth, int[] pnDay, int[] pnHour, int[] pnMinute, float[] pfSecond, int[] pnTZFlag)
-
GetFieldAsIntegerList
public int[] GetFieldAsIntegerList(int ifield)
Fetch field value as a list of integers.Currently this method only works for OFTIntegerList fields.
- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.- Returns:
- the field value. The returned value may be null.
- Since:
- Java bindings 1.7.0
-
GetFieldAsDoubleList
public double[] GetFieldAsDoubleList(int ifield)
Fetch field value as a list of doubles.Currently this method only works for OFTRealList fields.
- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.- Returns:
- the field value. The returned value may be null.
- Since:
- Java bindings 1.7.0
-
GetFieldAsStringList
public java.lang.String[] GetFieldAsStringList(int ifield)
Fetch field value as a list of strings.Currently this method only works for OFTStringList fields.
- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.- Returns:
- the field value. The returned value may be null.
- Since:
- Java bindings 1.7.0
-
GetFieldAsBinary
public byte[] GetFieldAsBinary(int id)
-
GetFieldAsBinary
public byte[] GetFieldAsBinary(java.lang.String field_name)
-
IsFieldSet
public boolean IsFieldSet(int ifield)
Test if a field has ever been assigned a value or not.- Parameters:
ifield
- the field to test.- Returns:
- true if the field has been set, otherwise false.
-
IsFieldSet
public boolean IsFieldSet(java.lang.String name)
Test if a field has ever been assigned a value or not.- Parameters:
name
- the name of the field to test.- Returns:
- true if the field has been set, otherwise false.
-
IsFieldNull
public boolean IsFieldNull(int id)
-
IsFieldNull
public boolean IsFieldNull(java.lang.String field_name)
-
IsFieldSetAndNotNull
public boolean IsFieldSetAndNotNull(int id)
-
IsFieldSetAndNotNull
public boolean IsFieldSetAndNotNull(java.lang.String field_name)
-
GetFieldIndex
public int GetFieldIndex(java.lang.String name)
Fetch the field index given field name. This is a cover for the FeatureDefn.GetFieldIndex() method.- Parameters:
name
- the name of the field to search for.- Returns:
- the field index, or -1 if no matching field is found.
-
GetGeomFieldIndex
public int GetGeomFieldIndex(java.lang.String field_name)
-
GetFID
public long GetFID()
Get feature identifier.- Returns:
- feature id or OGRNullFID if none has been assigned.
-
SetFID
public int SetFID(long fid)
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.
- Parameters:
fid
- the new feature identifier value to assign.- Returns:
- 0 on success. Otherwise throws a RuntimeException (or an error code if DontUseExceptions() has been called).
-
DumpReadable
public void DumpReadable()
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. The standard output will be used.
-
DumpReadableAsString
public java.lang.String DumpReadableAsString(java.util.Vector options)
-
DumpReadableAsString
public java.lang.String DumpReadableAsString()
-
UnsetField
public void UnsetField(int ifield)
Clear a field, marking it as unset.- Parameters:
ifield
- the field to unset, from 0 to GetFieldCount()-1.
-
UnsetField
public void UnsetField(java.lang.String name)
Clear a field, marking it as unset.- Parameters:
name
- the name of the field to unset.
-
SetFieldNull
public void SetFieldNull(int id)
-
SetFieldNull
public void SetFieldNull(java.lang.String field_name)
-
SetField
public void SetField(int ifield, java.lang.String val)
Set field to string value.OFTInteger fields will be set based on an atoi() conversion of the string. OFTReal fields will be set based on an atof() conversion of the string. Other field types may be unaffected.
- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.val
- the value to assign.
-
SetField
public void SetField(java.lang.String name, java.lang.String val)
Set field to string value.OFTInteger fields will be set based on an atoi() conversion of the string. OFTReal fields will be set based on an atof() conversion of the string. Other field types may be unaffected.
- Parameters:
name
- the name of the field to set.val
- the value to assign.
-
SetFieldInteger64
public void SetFieldInteger64(int id, long value)
-
SetField
public void SetField(int ifield, int val)
Set field to integer value.OFTInteger 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.
- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.val
- the value to assign.
-
SetField
public void SetField(java.lang.String name, int val)
Set field to integer value.OFTInteger 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.
- Parameters:
name
- the name of the field to set.val
- the value to assign.
-
SetField
public void SetField(int ifield, double val)
Set field to double value.OFTInteger 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.
- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.val
- the value to assign.
-
SetField
public void SetField(java.lang.String name, double val)
Set field to double value.OFTInteger 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.
- Parameters:
name
- the name of the field to set.val
- the value to assign.
-
SetField
public void SetField(int ifield, int year, int month, int day, int hour, int minute, float second, int tzflag)
Set field to date.This method currently only has an effect for OFTDate, OFTTime and OFTDateTime fields.
- Parameters:
ifield
- the field to set, from 0 to GetFieldCount()-1.year
- (including century)month
- (1-12)day
- (1-31)hour
- (0-23)minute
- (0-59)second
- (0-59)tzflag
- (0=unknown, 1=localtime, 100=GMT, see data model for details)
-
SetField
public void SetField(java.lang.String name, int year, int month, int day, int hour, int minute, float second, int tzflag)
Set field to date.This method currently only has an effect for OFTDate, OFTTime and OFTDateTime fields.
- Parameters:
name
- the name of the field to set.year
- (including century)month
- (1-12)day
- (1-31)hour
- (0-23)minute
- (0-59)second
- (0-59)tzflag
- (0=unknown, 1=localtime, 100=GMT, see data model for details)
-
SetFieldIntegerList
public void SetFieldIntegerList(int ifield, int[] values)
Set field to list of integers value.This method currently on has an effect of OFTIntegerList fields.
- Parameters:
ifield
- the field to set, from 0 to GetFieldCount()-1.values
- the values to assign.
-
SetFieldDoubleList
public void SetFieldDoubleList(int ifield, double[] values)
Set field to list of doubles value.This method currently on has an effect of OFTRealList fields.
- Parameters:
ifield
- the field to set, from 0 to GetFieldCount()-1.values
- the values to assign.
-
SetFieldStringList
public void SetFieldStringList(int ifield, java.util.Vector values)
Set field to list of strings value.This method currently on has an effect of OFTStringList fields.
- Parameters:
ifield
- the field to set, from 0 to GetFieldCount()-1.values
- the values to assign (vector of strings).- Since:
- Java bindings 1.7.0
-
SetFieldBinaryFromHexString
public void SetFieldBinaryFromHexString(int id, java.lang.String pszValue)
-
SetFieldBinaryFromHexString
public void SetFieldBinaryFromHexString(java.lang.String field_name, java.lang.String pszValue)
-
SetFrom
public int SetFrom(Feature srcFeature, int forgiving)
Set one feature from another.Overwrite the contents of this feature from the geometry and attributes of another. The srcFeature does not need to have the same FeatureDefn. 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.
- Parameters:
srcFeature
- the feature from which geometry, and field values will be copied.forgiving
- 1 if the operation should continue despite lacking output fields matching some of the source fields.- Returns:
- 0 if the operation succeeds, even if some values are not transferred, otherwise throws a RuntimeException (or an error code if DontUseExceptions() has been called).
- See Also:
SetFromWithMap(org.gdal.ogr.Feature srcFeature, int forgiving, int[] map)
-
SetFrom
public int SetFrom(Feature srcFeature)
Set one feature from another.Same as below with forgiving == 1
- Since:
- Java bindings 1.7.0
- See Also:
SetFrom(Feature srcFeature, int forgiving)
-
SetFromWithMap
public int SetFromWithMap(Feature srcFeature, int forgiving, int[] map)
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. SetField() function conversion rules will be applied as needed. This is more efficient than SetFrom(Feature, int) in that this doesn't lookup the fields by their names. Particularly useful when the field names don't match.
- Parameters:
srcFeature
- the feature from which geometry, and field values will be copied.forgiving
- 1 if the operation should continue despite lacking output fields matching some of the source fields.map
- 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.- Returns:
- 0 if the operation succeeds, even if some values are not transferred, otherwise throws a RuntimeException (or an error code if DontUseExceptions() has been called).
- Since:
- OGR 1.8.0
- See Also:
SetFrom(org.gdal.ogr.Feature srcFeature, int forgiving)
-
GetStyleString
public java.lang.String GetStyleString()
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.
- Returns:
- a reference to a representation in string format, or null if there isn't one.
- See Also:
GetStyleStringAsByteArray()
-
GetStyleStringAsByteArray
public byte[] GetStyleStringAsByteArray()
Fetch style string for this feature (when it is not UTF-8 encoded).Set the OGR Feature Style Specification for details on the format of this string, and ogr_featurestyle.h for services available to parse it.
- Returns:
- a reference to a representation in string format, or null if there isn't one.
- Since:
- 3.10
-
SetStyleString
public void SetStyleString(java.lang.String style_string)
Set feature style string.- Parameters:
style_string
- the style string to apply to this feature, cannot be null.
-
GetFieldType
public int GetFieldType(int ifield)
Fetch the field type.This is a cover for the FeatureDefn.GetFieldType() method.
- Parameters:
ifield
- the field to fetch, from 0 to GetFieldCount()-1.- Returns:
- the field type (like ogr.OFTInteger, etc.)
-
GetFieldType
public int GetFieldType(java.lang.String name)
Fetch the field type.This is a cover for the FeatureDefn.GetFieldType() method.
- Parameters:
name
- the name of the field to fetch.- Returns:
- the field type (like ogr.OFTInteger, etc.)
-
Validate
public int Validate(int flags, int bEmitError)
-
Validate
public int Validate(int flags)
-
Validate
public int Validate()
-
FillUnsetWithDefault
public void FillUnsetWithDefault(int bNotNullableOnly, java.util.Vector options)
-
FillUnsetWithDefault
public void FillUnsetWithDefault(int bNotNullableOnly)
-
FillUnsetWithDefault
public void FillUnsetWithDefault()
-
GetNativeData
public java.lang.String GetNativeData()
-
GetNativeDataAsByteArray
public byte[] GetNativeDataAsByteArray()
-
GetNativeMediaType
public java.lang.String GetNativeMediaType()
-
SetNativeData
public void SetNativeData(java.lang.String nativeData)
-
SetNativeMediaType
public void SetNativeMediaType(java.lang.String nativeMediaType)
-
-