Geo::GDAL  2.1
Geo::OGR::Feature Class Reference

A collection of non-spatial and spatial attributes. More...

+ Inheritance diagram for Geo::OGR::Feature:
+ Collaboration diagram for Geo::OGR::Feature:

Public Member Functions

public Geo::OGR::Feature Clone ()
 
public method DumpReadable ()
 
public scalar Equal (scalar feature)
 
public scalar FID (scalar id)
 Get or set the id of this feature. More...
 
public method Field (scalar name, scalar value,...)
 Get, set, or unset the field value. More...
 
public method FillUnsetWithDefault ()
 
public method Geometry (scalar name, scalar geometry)
 Get or set the value of a geometry field. More...
 
public Geo::OGR::FeatureDefn GetDefn ()
 
public scalar GetFID ()
 
public list GetField (scalar name)
 
public Geo::OGR::FieldDefn GetFieldDefn (scalar name)
 
public list GetFieldNames ()
 
public method GetGeomFieldDefn ()
 
public method GetNativeData ()
 
public method GetNativeMediaType ()
 
public hash reference GetSchema ()
 Get the schema of this feature. More...
 
public scalar GetStyleString ()
 
public Geo::OGR::Layer Layer ()
 
public hash reference Row (hash row)
 
public method SetFID (scalar id)
 
public method SetField (scalar name, array Value)
 
public method SetFrom (scalar other, scalar forgiving=1, hashref map)
 
public method SetNativeData ()
 
public method SetNativeMediaType ()
 
public method SetStyleString (scalar string)
 
public list Tuple (array tuple)
 
public scalar Validate (list flags)
 
public Geo::OGR::Feature new (hash schema)
 Create a new feature. More...
 
- Public Member Functions inherited from Geo::OGR
public list ByteOrders ()
 
public Geo::GDAL::Driver Driver (scalar name)
 
public list DriverNames ()
 
public list Drivers ()
 
public scalar GeometryTypeModify (scalar type, scalar modifier)
 
public scalar GeometryTypeTest (scalar type, scalar test, scalar type2)
 
public list GeometryTypes ()
 
public method GetNonLinearGeometriesEnabledFlag ()
 
public method GetOpenDSCount ()
 
public Geo::GDAL::Dataset Open (scalar name, scalar update=0)
 
public Geo::GDAL::Dataset OpenShared (scalar name, scalar update=0)
 
public method SetGenerate_DB2_V72_BYTE_ORDER (scalar Generate_DB2_V72_BYTE_ORDER)
 
public method SetNonLinearGeometriesEnabledFlag ()
 

Detailed Description

A collection of non-spatial and spatial attributes.

A feature is a collection of non-spatial and spatial attributes and an id, which is a special attribute, and data records according to this data model. Attributes are called fields and some fields are spatial, i.e., their value is a geometry. Fields have at least a name and a type. Features may exist within a layer or separetely. The data model of a feature is a definition object.

Definition at line 7916 of file all.pm.

Member Function Documentation

public Geo::OGR::Feature Geo::OGR::Feature::Clone ( )

Object method.

Returns
a new Geo::OGR::Feature object
Code:
click to view
public method Geo::OGR::Feature::DumpReadable ( )

Object method. Write the contents of this feature to stdout.

Code:
click to view
public scalar Geo::OGR::Feature::Equal ( scalar  feature)

Object method.

Parameters
featurea Geo::OGR::Feature object for comparison
Returns
boolean
Code:
click to view
public scalar Geo::OGR::Feature::FID ( scalar  id)

Get or set the id of this feature.

Object method.

Parameters
id[optional] the id to set for this feature.
Returns
integer the id of this feature.
Code:
click to view
public method Geo::OGR::Feature::Field ( scalar  name,
scalar  value,
  ... 
)

Get, set, or unset the field value.

Object method.

Parameters
namethe name (or the index) of the field.
valuea scalar, a list of scalars or a reference to a list. If undef, the field is unset. If a scalar or a list of scalars, the field is set from them.
Note
Non-scalar fields (for example Date) can be set either from a scalar, which is then assumed to be a string and parsed, or from a list of values (for example year, month, day for Date).
Returns
in non-void context the value of the field, which may be a scalar or a list, depending on the field type. For unset fields the undef value is returned.
Code:
click to view
public method Geo::OGR::Feature::FillUnsetWithDefault ( )
Code:
click to view
public method Geo::OGR::Feature::Geometry ( scalar  name,
scalar  geometry 
)

Get or set the value of a geometry field.

Object method.

Note
This method delivers the functionality of undocumented methods SetGeometry($geometry), SetGeometryDirectly, SetGeomField, SetGeomFieldDirectly, GetGeometry, GetGeometryRef.

Set or get the geometry in the feature. When setting, does a check against the schema (GeometryType) of the feature. If the parameter is a geometry object, it is cloned.

Parameters
name[optional] the name of the spatial field, whose geometry is to be set. If not given, sets or gets the geometry of the first (or the single) spatial field.
geometry[optional] a Geo::OGR::Geometry object or a reference to a hash from which such can be created (using Geo::OGR::Geometry::new).
Returns
in a non-void context the indicated geometry in the feature as a Geo::OGR::Geometry object. The returned object contains a reference to the actual geometry data in the feature (the geometry is not cloned) and to the feature object, thus keeping the feature object from being destroyed while the geometry object exists.
Code:
click to view
public Geo::OGR::FeatureDefn Geo::OGR::Feature::GetDefn ( )

Object method.

Note
A.k.a GetDefnRef.
Returns
a Geo::OGR::FeatureDefn object, which represents the definition of this feature.
Code:
click to view
public scalar Geo::OGR::Feature::GetFID ( )

Object method.

Returns
the feature id (an integer).
Code:
click to view
public list Geo::OGR::Feature::GetField ( scalar  name)

Object method. See Field().

Code:
click to view
public Geo::OGR::FieldDefn Geo::OGR::Feature::GetFieldDefn ( scalar  name)

Object method.

Note
A.k.a GetFieldDefnRef
Parameters
namethe name of the field.
Returns
a new Geo::OGR::FieldDefn object that represents the field in question.
Code:
click to view
public list Geo::OGR::Feature::GetFieldNames ( )

Object method. Get the names of the fields in this feature.

Code:
click to view
public method Geo::OGR::Feature::GetGeomFieldDefn ( )
Code:
click to view
public method Geo::OGR::Feature::GetNativeData ( )
Code:
click to view
public method Geo::OGR::Feature::GetNativeMediaType ( )
Code:
click to view
public hash reference Geo::OGR::Feature::GetSchema ( )

Get the schema of this feature.

Object method.

Returns
the schema as a hash whose keywords are Name, StyleIgnored and Fields. Fields is an anonymous array of first non-spatial and then spatial field schemas as in Geo::OGR::FieldDefn::Schema() and Geo::OGR::GeomFieldDefn::Schema().
Code:
click to view
public scalar Geo::OGR::Feature::GetStyleString ( )

Object method.

Returns
a string
Code:
click to view

Object method.

Returns
the layer to which this feature belongs to or undef.
Code:
click to view
public Geo::OGR::Feature Geo::OGR::Feature::new ( hash  schema)

Create a new feature.

Class method.

Parameters
AGeo::OGR::FeatureDefn object or named parameters to create one:
  • Name
  • Fields a list of Geo::OGR::FieldDefn or Geo::OGR::GeomFieldDefn objects or anonymous hashes from which such can be created.
  • GeometryType the geometry type if the feature has only one spatial field.
  • StyleIgnored whether the style can be omitted when fetching features. (default is false)
Note
Do not mix GeometryType and geometry fields in Fields list.
Returns
a new Geo::OGR::Feature object.
Code:
click to view
public hash reference Geo::OGR::Feature::Row ( hash  row)

Object method.

Note
This method discards the data the destination feature (or layer) does not support. Changes in data due to differences between field types may also occur.

Get and/or set the data of the feature. The key of the (key,value) pairs of the row is the field name. Special field names FID and Geometry are used for feature id and (single) geometry respectively. The geometry/ies is/are set and get using the Geo::OGR::Feature::Geometry method. Field values are set using the Geo::OGR::Feature::Field method.

Parameters
row[optional] feature data in a hash.
Returns
a reference to feature data in a hash. Spatial fields are returned as Geo::OGR::Geometry objects.
Code:
click to view
public method Geo::OGR::Feature::SetFID ( scalar  id)

Object method.

Parameters
idthe feature id.
Code:
click to view
public method Geo::OGR::Feature::SetField ( scalar  name,
array  Value 
)

Object method. See Field().

Code:
click to view
public method Geo::OGR::Feature::SetFrom ( scalar  other,
scalar  forgiving = 1,
hashref  map 
)

Object method.

Parameters
othera Geo::OGR::Feature object
forgiving[optional] set to false if the operation should not continue if output fields do not match some of the source fields
map[optional] a mapping from output field indexes to source fields, include into the hash all field indexes of this feature which should be set
Code:
click to view
public method Geo::OGR::Feature::SetNativeData ( )
Code:
click to view
public method Geo::OGR::Feature::SetNativeMediaType ( )
Code:
click to view
public method Geo::OGR::Feature::SetStyleString ( scalar  string)

Object method.

Parameters
string
Code:
click to view
public list Geo::OGR::Feature::Tuple ( array  tuple)

Object method.

Note
This method discards the data the destination feature (or layer) does not support. Changes in data due to differences between field types may also occur.
The schema of the tuple needs to be the same as that of the feature.

Get and/set the data of the feature. The expected data in the tuple is ([feature_id,] non-spatial fields, spatial fields). The fields in the tuple are in the order they are in the schema. Field values are set using the Geo::OGR::Feature::Field method. Geometries are set and get using the Geo::OGR::Feature::Geometry method.

Parameters
tuple[optional] feature data in an array
Returns
feature data in an array
Code:
click to view
public scalar Geo::OGR::Feature::Validate ( list  flags)

Object method.

Parameters
flagsone of more of null, geom_type, width, allow_null_when_default, or all.
Exceptions
croakswith an error message if the feature is not valid.
Returns
integer denoting the validity of the feature object.
Code:
click to view

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