Geo::GDAL  1.11
Geo::OGR::Layer Class Reference
Inheritance diagram for Geo::OGR::Layer:
Inheritance graph
[legend]

List of all members.

Public Class Methods

list Capabilities ()

Public Object Methods

scalar TestCapability (scalar cap)
Geo::OGR::DataSource DataSource ()
hash GetField (scalar field_name)
 CreateField (hash parameters)
 CreateField (scalar field_definition, scalar approximation_ok)
 AlterField (scalar field_name, hash new_definition)
 AlterFieldDefn (scalar field, scalar definition, scalar flags)
 DeleteField (scalar field)
hashref Schema (hash schema)
hashref Row (hash row)
list Tuple (list tuple)
Geo::OGR::Geometry SpatialFilter (scalar filter)
Geo::OGR::Geometry SpatialFilter (list filter)
 SetSpatialFilter (scalar filter)
 SetSpatialFilterRect (scalar minx, scalar miny, scalar maxx, scalar maxy)
Geo::OGR::Geometry GetSpatialFilter ()
 SetAttributeFilter (scalar filter_string)
 ResetReading ()
Geo::OGR::Feature GetNextFeature ()
 SetNextByIndex (scalar new_index)
scalar GetFeaturesRead ()
 ForFeatures (scalar code, scalar in_place)
 ForGeometries (scalar code, scalar in_place)
scalar GetName ()
Geo::OGR::Feature GetFeature (scalar fid)
 SetFeature (scalar feature)
 CreateFeature (scalar feature)
 InsertFeature (scalar feature)
 DeleteFeature (scalar fid)
 SyncToDisk ()
Geo::OGR::FeatureDefn GetLayerDefn ()
scalar GetFeatureCount (scalar force=1)
list GetExtent (scalar force=1)
 StartTransaction ()
 CommitTransaction ()
 RollbackTransaction ()
Geo::OSR::SpatialReference GetSpatialRef ()
scalar GetFIDColumn ()
scalar GetGeometryColumn ()
scalar GeometryType ()
 SetIgnoredFields (list fields)

Public Attributes

list CAPABILITIES

Member Function Documentation

Geo::OGR::Layer::AlterField ( scalar  field_name,
hash  new_definition 
)
Parameters:
field_namethe name (or index) of the field to be altered
new_definitionone or more of Name, Type, and Width
Geo::OGR::Layer::AlterFieldDefn ( scalar  field,
scalar  definition,
scalar  flags 
)
Deprecated:
use AlterField(scalar name, hash parameters) Alter the definition of an existing field on a layer.
Parameters:
fieldindex of the field whose definition is altered
definitiona Geo::OGR::FieldDefn object
flags1 to alter the name, 2 to alter the type, 4 to alter the width, use combinations 3, 5, 6 or 7 to alter two or more properties

Examples:

@cap = Geo::OGR::Layer::Capabilities(); # the class method
@cap = $layer->Capabilities(); # the object method
Returns:
a list of capabilities. The class method returns a list of all potential capabilities a layer may have. The object method returns a list of all capabilities the layer has.
Geo::OGR::Layer::CreateFeature ( scalar  feature)
Deprecated:
use Geo::OGR::Layer::InsertFeature which accepts Perl data and checks for geometry type and attribute data
Note:
The feature should have the same schema as the layer.

Inserts a feature into the layer. The given feature's id may change.

Parameters:
featurea Geo::OGR::Feature object
Geo::OGR::Layer::CreateField ( hash  parameters)
Parameters:
parametersnamed parameters: Name, Type, Justify, Width, Precision
Geo::OGR::Layer::CreateField ( scalar  field_definition,
scalar  approximation_ok 
)
Deprecated:
use CreateField(hash parameters)
Parameters:
field_definitiona Geo::OGR::FieldDefn object
approximation_okmay the field be created in a slightly different form depending on the limitations of the format driver.
Returns:
the data source object to which this layer object belongs to.
Parameters:
fidfeature id
Geo::OGR::Layer::DeleteField ( scalar  field)

Delete an existing field from a layer.

Parameters:
fieldname (or index) of the field which is deleted
Geo::OGR::Layer::ForFeatures ( scalar  code,
scalar  in_place 
)
Note:
experimental, the syntax may change

Call code for all features. This is a simple wrapper for ResetReading and while(GetNextFeature).

Example usage:

$layer->ForFeatures(sub {my $f = shift; $self->DeleteFeature($f->FID)}); # empties the layer
Parameters:
codea reference to a subroutine, which is called with each feature as an argument
in_placeif set to true, the feature is stored back to the layer
Geo::OGR::Layer::ForGeometries ( scalar  code,
scalar  in_place 
)
Note:
experimental, the syntax may change

Call code for all geometries. This is a simple wrapper for ResetReading and while(GetNextFeature).

Example usage:

my $area = 0;
$layer->ForGeometries(sub {my $g = shift; $area += $g->Area}); # computes the total area
Parameters:
codea reference to a subroutine, which is called with each geometry as an argument
in_placeif set to true, the geometry is stored back to the layer
Returns:
the geometry type of the layer, one of @Geo::OGR::Geometry::GEOMETRY_TYPES
list Geo::OGR::Layer::GetExtent ( scalar  force = 1)
Parameters:
forcecompute the extent even if it is expensive
Note:
In scalar context returns a reference to an anonymous array containing the extent.
The order of values is different from those returned by Geo::OGR::Geometry::GetEnvelope.
Returns:
the extent ($minx, $miny, $maxx, $maxy)
Parameters:
fidfeature id
Returns:
a new Geo::OGR::Feature object
scalar Geo::OGR::Layer::GetFeatureCount ( scalar  force = 1)
Parameters:
force
Returns:
integer
Returns:
integer
Returns:
the name of the underlying database column being used as the FID column, or "" if not supported.
hash Geo::OGR::Layer::GetField ( scalar  field_name)
Parameters:
field_namethe name (or index) of the field
Returns:
the schema of the field in a hash (in list context) or in an anonymous hash
Returns:
the name of the underlying database column being used as the geometry column, or "" if not supported
Deprecated:
use Geo::OGR::Layer::Schema, which returns a Perl structure
Returns:
a new Geo::OGR::FeatureDefn object
Returns:
Returns:
iteratively Geo::OGR::Feature objects from the layer. The iteration obeys the spatial and the attribute filter.
Returns:
a new Geo::OGR::Geometry object
Returns:
a new Geo::OSR::SpatialReference object
Geo::OGR::Layer::InsertFeature ( scalar  feature)

Creates a new feature which has the schema of the layer and initializes it with data from the argument. Then inserts the feature into the layer (using CreateFeature). Uses Geo::OGR::Feature::Row or Geo::OGR::Feature::Tuple.

Parameters:
featurea Geo::OGR::Feature object or reference to feature data in a hash (as in Geo::OGR::Feature::Row) or in an array (as in Geo::OGR::Feature::Tuple)

Initialize the layer object for iterative reading.

hashref Geo::OGR::Layer::Row ( hash  row)

Get and/or set the data of a feature that has the supplied feature id (the next feature obtained with GetNextFeature is used if feature id is not given). Calls Geo::OGR::Feature::Row.

Parameters:
row[optional] feature data
Returns:
a reference to feature data in a hash
hashref Geo::OGR::Layer::Schema ( hash  schema)

Get and/or set the schema of the layer.

Parameters:
schemaThe schema hash may contain the keys:
  • Fields A reference to a list of field definitions (either Geo::OGR::FieldDefn objects or hashrefs from which they can be created).
  • ApproxOK (optional) A flag specifying whether it is ok to change the requested field definition to accommodate limitations of the layer.
Returns:
a reference to a schema hash, which has keys:
  • Name The name of this layer.
  • GeometryType The type of the geometries in this layer (a string).
  • Fields An array of references to hashes of field definitions.
Geo::OGR::Layer::SetAttributeFilter ( scalar  filter_string)

Set or clear the attribute filter.

Parameters:
filter_stringa SQL WHERE clause or undef to clear the filter.
Geo::OGR::Layer::SetFeature ( scalar  feature)
Note:
The feature should have the same schema as the layer.

Replaces a feature in the layer based on the given feature's id. Requires RandomWrite capability.

Parameters:
featurea Geo::OGR::Feature object
Parameters:
fieldsa list of field names
Geo::OGR::Layer::SetNextByIndex ( scalar  new_index)
Parameters:
new_indexthe index to which set the read cursor in the current iteration
Parameters:
filter[optional] a Geo::OGR::Geometry object. If not given, removes the filter if there is one.
Geo::OGR::Layer::SetSpatialFilterRect ( scalar  minx,
scalar  miny,
scalar  maxx,
scalar  maxy 
)
Parameters:
minx
miny
maxx
maxy
Parameters:
filter[optional] a Geo::OGR::Geometry object or a string. An undefined value removes the filter if there is one.
Returns:
a new Geo::OGR::Geometry object
Parameters:
filter[optional] a rectangle ($minx, $miny, $maxx, $maxy).
Returns:
a new Geo::OGR::Geometry object
scalar Geo::OGR::Layer::TestCapability ( scalar  cap)
Parameters:
capA capability string.
Returns:
a boolean value indicating whether the layer has the specified capability.
list Geo::OGR::Layer::Tuple ( list  tuple)

Get and/set the data of a feature that has the supplied feature id (the next feature obtained with GetNextFeature is used if feature id is not given). The order of the data in the tuple is: feature id, Geometry, fields in their order. Calls Geo::OGR::Feature::Tuple.

Parameters:
tuple[optional] feature data
Note:
The schema of the tuple needs to be the same as that of the layer.
Returns:
a reference to feature data in an array

Member Data Documentation

Layer capabilities known to GDAL


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