Geo::GDAL  2.3
Geo::OGR::Layer Class Reference

A collection of similar features.
More...

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

Public Member Functions

public method AlterFieldDefn (scalar name, hash params)
 
public list Capabilities ()
 
public method Clip (Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
 
public method CommitTransaction ()
 
public method CreateFeature ()
 
public method CreateField (hash params)
 
public method DataSource ()
 
public method Dataset ()
 
public method DeleteFeature (scalar fid)
 
public method DeleteField (scalar field)
 
public method Erase (Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
 
public Geo::OGR::Feature Feature (scalar f)
 
public scalar FeatureCount (scalar force=1)
 
public method Features ()
 
public method ForFeatures (scalar code, scalar in_place)
 
public method ForGeometries (scalar code, scalar in_place)
 
public method Geometries ()
 
public scalar GeometryType (scalar field)
 
public Geo::OGR::DataSource GetDataSource ()
 
public Geo::OGR::FeatureDefn GetDefn ()
 
public list GetExtent (scalar force=1)
 
public scalar GetFIDColumn ()
 
public Geo::OGR::Feature GetFeature (scalar fid)
 
public method GetFeatureCount ()
 
public scalar GetFeaturesRead ()
 
public scalar GetFieldDefn (scalar name)
 
public list GetFieldNames ()
 
public scalar GetGeomFieldDefn (scalar name)
 
public scalar GetName ()
 
public Geo::OGR::Feature GetNextFeature ()
 
public hash reference GetSchema ()
 Get the schema of this layer.
More...
 
public Geo::OGR::Geometry GetSpatialFilter ()
 
public method GetStyleTable ()
 
public method Identity (Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
 
public method InsertFeature (scalar feature)
 
public method Intersection (Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
 
public method ReorderField ()
 
public method ReorderFields ()
 
public method ResetReading ()
 
public method RollbackTransaction ()
 
public hash reference Row (hash row)
 
public method SetAttributeFilter (scalar filter_string)
 
public method SetFeature (scalar feature)
 
public method SetIgnoredFields (array fields)
 
public method SetNextByIndex (scalar new_index)
 
public method SetSpatialFilter (scalar filter)
 
public method SetSpatialFilterRect (scalar minx, scalar miny, scalar maxx, scalar maxy)
 
public method SetStyleTable ()
 
public Geo::OGR::Geometry SpatialFilter (array filter)
 
public Geo::OSR::SpatialReference SpatialReference (scalar name, Geo::OSR::SpatialReference sr)
 
public method StartTransaction ()
 
public method SymDifference (Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
 
public method SyncToDisk ()
 
public scalar TestCapability (scalar cap)
 
public list Tuple (array tuple)
 
public method Union (Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
 
public method Update (Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
 
- Public Member Functions inherited from Geo::GDAL::MajorObject
public scalar Description (scalar description)
 
public method Domains ()
 
public scalar GetDescription ()
 
public hash reference GetMetadata (scalar domain="")
 
public method GetMetadataDomainList ()
 
public hash reference Metadata (hashref metadata=undef, scalar domain= '')
 
public method SetDescription (scalar NewDesc)
 
public method SetMetadata (hashref metadata, scalar domain="")
 
- Public Member Functions inherited from Geo::GDAL
public method ApplyVerticalShiftGrid ()
 
public method BuildVRT ()
 
public method CPLBinaryToHex ()
 
public method CPLHexToBinary ()
 
public method CreatePansharpenedVRT ()
 
public scalar DataTypeIsComplex (scalar DataType)
 
public list DataTypeValueRange (scalar DataType)
 
public list DataTypes ()
 
public scalar DecToDMS (scalar angle, scalar axis, scalar precision=2)
 
public scalar DecToPackedDMS (scalar dec)
 
public method DontUseExceptions ()
 
public Geo::GDAL::Driver Driver (scalar Name)
 
public list DriverNames ()
 
public list Drivers ()
 
public method EscapeString ()
 
public scalar FindFile (scalar basename)
 
public method FinderClean ()
 
public method GOA2GetAccessToken ()
 
public method GOA2GetAuthorizationURL ()
 
public method GOA2GetRefreshToken ()
 
public method GetActualURL ()
 
public scalar GetCacheMax ()
 
public scalar GetCacheUsed ()
 
public scalar GetConfigOption (scalar key)
 
public scalar GetDataTypeSize (scalar DataType)
 
public method GetErrorCounter ()
 
public method GetFileSystemOptions ()
 
public method GetFileSystemsPrefixes ()
 
public method GetJPEG2000StructureAsString ()
 
public method GetSignedURL ()
 
public Geo::GDAL::Driver IdentifyDriver (scalar path, scalar siblings)
 
public method IdentifyDriverEx ()
 
public method MkdirRecursive ()
 
public Geo::GDAL::Dataset Open (hash params)
 
public Geo::GDAL::Dataset OpenEx (hash params)
 
public list OpenFlags ()
 
public scalar PackCharacter (scalar DataType)
 
public scalar PackedDMSToDec (scalar packed)
 
public method PopFinderLocation ()
 
public method PushFinderLocation (scalar path)
 
public list RIOResamplingTypes ()
 
public list ResamplingTypes ()
 
public method RmdirRecursive ()
 
public method SetCacheMax (scalar Bytes)
 
public method SetConfigOption (scalar key, scalar value)
 
public method UseExceptions ()
 
public method VSICurlClearCache ()
 
public method VSIFEofL ()
 
public method VSIFOpenExL ()
 
public method VSIGetLastErrorMsg ()
 
public method VSIGetLastErrorNo ()
 
public scalar VersionInfo (scalar request= 'VERSION_NUM')
 
public scalar errstr ()
 
- Public Member Functions inherited from Geo::OGR
public list ByteOrders ()
 
public Geo::GDAL::Driver Driver (scalar name)
 
public list DriverNames ()
 
public list Drivers ()
 
public method Flatten ()
 
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 method HasM ()
 
public method HasZ ()
 
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 similar features.

A layer object is typically obtained with a data source object. A
layer has a data model (a schema), which is maintained in a
definition object, and a set of features, which contain data
according to the data model. The schema is typically set when the
layer is created or opened, but it may be altered somewhat with
methods Geo::OGR::Layer::CreateField,
Geo::OGR::Layer::AlterFieldDefn, and
Geo::OGR::Layer::DeleteField. Features and/or their data can be
read, inserted and deleted. Reading can be filtered. Layers can be
compared to each other with methods Clip, Erase, Identity,
Intersection, SymDifference, Union, and Update.
A layer may have metadata OLMD_FID64 => 'YES' if it holds features
with 64 bit FIDs. The metadata of a layer can be obtained with
GetMetadata method.

Definition at line 13355 of file all.dox.

Member Function Documentation

public method Geo::OGR::Layer::AlterFieldDefn ( scalar  name,
hash  params 
)

Object method.

Parameters
fieldthe name of the field to be altered.
paramsas in Geo::OGR::FieldDefn::new. Width and
Precision should be both or neither.
Note
Only non-spatial fields can be altered.
Also the deprecated form AlterFieldDefn($field,
Geo::OGR::FieldDefn $Defn, $Flags) works.

Code:
click to view

public list Geo::OGR::Layer::Capabilities ( )

Object method.
Both a package subroutine and an object method.

Returns
a list of capabilities. The object method returns a list of
the capabilities the layer has. The package subroutine returns a list of
all potential capabilities a layer may have. These are currently:
AlterFieldDefn, CreateField, CreateGeomField, CurveGeometries, DeleteFeature, DeleteField, FastFeatureCount, FastGetExtent, FastSetNextByIndex, FastSpatialFilter, IgnoreFields, MeasuredGeometries, RandomRead, RandomWrite, ReorderFields, SequentialWrite, StringsAsUTF8, and Transactions.

Examples:
<br>@cap = Geo::OGR::Layer::Capabilities(); # the package subroutine
<br>@cap = $layer->Capabilities(); # the object method
<br>


Code:
click to view

public method Geo::OGR::Layer::Clip ( Geo::OGR::Layer  method,
Geo::OGR::Layer  result,
hashref  options,
coderef  callback,
scalar  callback_data 
)

Object method.
Clip off areas that are not covered by the method layer. The schema
of the result layer can be set before calling this method, or is
initialized to to contain all fields from
this and method layer.

Parameters
methodmethod layer.
resultresult layer.
optionsa reference to an options hash.
callback[optional] a reference to a subroutine, which will
be called with parameters (number progress, string msg, callback_data)
callback_data[optional]

Code:
click to view

public method Geo::OGR::Layer::CommitTransaction ( )

Object method.

Code:
click to view

public method Geo::OGR::Layer::CreateFeature ( )


Code:
click to view

public method Geo::OGR::Layer::CreateField ( hash  params)

Object method.
Create a field.

Parameters
paramsas in Geo::OGR::FieldDefn::new or
Geo::OGR::GeomFieldDefn::new, plus ApproxOK (whose default is true).

Code:
click to view

public method Geo::OGR::Layer::Dataset ( )


Code:
click to view

public method Geo::OGR::Layer::DataSource ( )


Code:
click to view

public method Geo::OGR::Layer::DeleteFeature ( scalar  fid)

Object method.

Parameters
fidfeature id

Code:
click to view

public method Geo::OGR::Layer::DeleteField ( scalar  field)

Object method.
Delete an existing field from a layer.

Parameters
fieldname (or index) of the field which is deleted
Note
Only non-spatial fields can be deleted.

Code:
click to view

public method Geo::OGR::Layer::Erase ( Geo::OGR::Layer  method,
Geo::OGR::Layer  result,
hashref  options,
coderef  callback,
scalar  callback_data 
)

Object method.
The result layer contains features whose geometries represent areas
that are in the input layer but not in the method layer. The
features in the result layer have attributes from the input
layer. The schema of the result layer can be set by the user or, if
it is empty, is initialized to contain all fields in the input
layer.

Parameters
methodmethod layer.
resultresult layer.
optionsa reference to an options hash.
callback[optional] a reference to a subroutine, which will
be called with parameters (number progress, string msg, callback_data)
callback_data[optional]

Code:
click to view

Object method.

Parameters
f[optional] feature id, a feature, a row, or a tuple

Note
If the argument feature has a null FID (FID not set) the
feature is inserted into the layer as a new feature. If the FID is
non null, then the feature replaces the feature in the layer with
that FID.

Returns
a new Geo::OGR::Feature object that represents the feature
in the layer.

Code:
click to view

public scalar Geo::OGR::Layer::FeatureCount ( scalar  force = 1)

Object method.
A.k.a GetFeatureCount

Parameters
force
Returns
integer

Code:
click to view

public method Geo::OGR::Layer::Features ( )


Code:
click to view

public method Geo::OGR::Layer::ForFeatures ( scalar  code,
scalar  in_place 
)

Object method.

Note
experimental, the syntax may change

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

Example usage:
<br>$layer->ForFeatures(sub {my $f = shift; $self->DeleteFeature($f->FID)}); # empties the layer
<br>


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

Code:
click to view

public method Geo::OGR::Layer::ForGeometries ( scalar  code,
scalar  in_place 
)

Object method.

Note
experimental, the syntax may change

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

Example usage:
<br>my $area = 0;
<br>$layer->ForGeometries(sub {my $g = shift; $area += $g->Area}); # computes the total area
<br>


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

Code:
click to view

public method Geo::OGR::Layer::Geometries ( )


Code:
click to view

public scalar Geo::OGR::Layer::GeometryType ( scalar  field)

Object method.

Parameters
fieldthe name or index of the spatial field.
Returns
the geometry type of the spatial field.

Code:
click to view

public Geo::OGR::DataSource Geo::OGR::Layer::GetDataSource ( )

Object method.

Returns
the data source object to which this layer object belongs to.

Code:
click to view

public Geo::OGR::FeatureDefn Geo::OGR::Layer::GetDefn ( )

Object method.
A.k.a GetLayerDefn.

Returns
a Geo::OGR::FeatureDefn object.

Code:
click to view

public list Geo::OGR::Layer::GetExtent ( scalar  force = 1)

Object method.

Parameters
forcecompute the extent even if it is expensive
Note
In scalar context returns a reference to an anonymous array
containing the extent.
Returns
the extent ($minx, $maxx, $miny, $maxy)
Parameters
force
Returns
the extent = ($minx, $maxx, $miny, $maxy) as a listref

Code:
click to view

public Geo::OGR::Feature Geo::OGR::Layer::GetFeature ( scalar  fid)

Object method.

Parameters
fidfeature id
Returns
a new Geo::OGR::Feature object that represents the feature in the layer.

Code:
click to view

public method Geo::OGR::Layer::GetFeatureCount ( )


Code:
click to view

public scalar Geo::OGR::Layer::GetFeaturesRead ( )

Object method.

Returns
integer

Code:
click to view

public scalar Geo::OGR::Layer::GetFIDColumn ( )

Object method.

Returns
the name of the underlying database column being used as the
FID column, or "" if not supported.

Code:
click to view

public scalar Geo::OGR::Layer::GetFieldDefn ( scalar  name)

Object method.
Get the definition of a field.

Parameters
namethe name of the field.
Returns
a Geo::OGR::FieldDefn object.

Code:
click to view

public list Geo::OGR::Layer::GetFieldNames ( )

Object method.

Returns
a list of the names of the fields in this layer. The
non-geometry field names are first in the list and then the geometry
fields.

Code:
click to view

public scalar Geo::OGR::Layer::GetGeomFieldDefn ( scalar  name)

Object method.
Get the definition of a spatial field.

Parameters
namethe name of the spatial field.
Returns
a Geo::OGR::GeomFieldDefn object.

Code:
click to view

public scalar Geo::OGR::Layer::GetName ( )

Object method.

Returns
the name of the layer.

Code:
click to view

public Geo::OGR::Feature Geo::OGR::Layer::GetNextFeature ( )

Object method.

Returns
iteratively Geo::OGR::Feature objects from the layer. The
iteration obeys the spatial and the attribute filter.

Code:
click to view

public hash reference Geo::OGR::Layer::GetSchema ( )

Get the schema of this layer.

Object method.

Note
The schema of a layer cannot be set with this method. If you
have a Geo::OGR::FeatureDefn object before creating the layer, use
its schema in the Geo::OGR::CreateLayer method.
Returns
the schema of this layer, as in Geo::OGR::FeatureDefn::Schema.

Code:
click to view

public Geo::OGR::Geometry Geo::OGR::Layer::GetSpatialFilter ( )

Object method.

Returns
a new Geo::OGR::Geometry object

Code:
click to view

public method Geo::OGR::Layer::GetStyleTable ( )


Code:
click to view

public method Geo::OGR::Layer::Identity ( Geo::OGR::Layer  method,
Geo::OGR::Layer  result,
hashref  options,
coderef  callback,
scalar  callback_data 
)

Object method.
The result layer contains features whose geometries represent areas
that are in the input layer. The features in the result layer have
attributes from both input and method layers. The schema of the
result layer can be set by the user or, if it is empty, is
initialized to contain all fields in input and method layers.

Parameters
methodmethod layer.
resultresult layer.
optionsa reference to an options hash.
callback[optional] a reference to a subroutine, which will
be called with parameters (number progress, string msg, callback_data)
callback_data[optional]

Code:
click to view

public method Geo::OGR::Layer::InsertFeature ( scalar  feature)

Object method.
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)
Returns
the new feature.

Code:
click to view

public method Geo::OGR::Layer::Intersection ( Geo::OGR::Layer  method,
Geo::OGR::Layer  result,
hashref  options,
coderef  callback,
scalar  callback_data 
)

Object method.
The result layer contains features whose geometries represent areas
that are common between features in the input layer and in the
method layer. The schema of the result layer can be set before
calling this method, or is initialized to contain all fields from
this and method layer.

Parameters
methodmethod layer.
resultresult layer.
optionsa reference to an options hash.
callback[optional] a reference to a subroutine, which will
be called with parameters (number progress, string msg, callback_data)
callback_data[optional]

Code:
click to view

public method Geo::OGR::Layer::ReorderField ( )


Code:
click to view

public method Geo::OGR::Layer::ReorderFields ( )


Code:
click to view

public method Geo::OGR::Layer::ResetReading ( )

Object method.
Initialize the layer object for iterative reading.

Code:
click to view

public method Geo::OGR::Layer::RollbackTransaction ( )

Object method.

Code:
click to view

public hash reference Geo::OGR::Layer::Row ( hash  row)

Object method.
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

Code:
click to view

public method Geo::OGR::Layer::SetAttributeFilter ( scalar  filter_string)

Object method.
Set or clear the attribute filter.

Parameters
filter_stringa SQL WHERE clause or undef to clear the
filter.

Code:
click to view

public method Geo::OGR::Layer::SetFeature ( scalar  feature)

Object method.

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

Code:
click to view

public method Geo::OGR::Layer::SetIgnoredFields ( array  fields)

Object method.

Parameters
fieldsa list of field names

Code:
click to view

public method Geo::OGR::Layer::SetNextByIndex ( scalar  new_index)

Object method.

Parameters
new_indexthe index to which set the read cursor in the
current iteration

Code:
click to view

public method Geo::OGR::Layer::SetSpatialFilter ( scalar  filter)

Object method.

Parameters
filter[optional] a Geo::OGR::Geometry object. If not given,
removes the filter if there is one.

Code:
click to view

public method Geo::OGR::Layer::SetSpatialFilterRect ( scalar  minx,
scalar  miny,
scalar  maxx,
scalar  maxy 
)

Object method.

Parameters
minx
miny
maxx
maxy

Code:
click to view

public method Geo::OGR::Layer::SetStyleTable ( )


Code:
click to view

public Geo::OGR::Geometry Geo::OGR::Layer::SpatialFilter ( array  filter)

Object method.

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

Code:
click to view

public Geo::OSR::SpatialReference Geo::OGR::Layer::SpatialReference ( scalar  name,
Geo::OSR::SpatialReference  sr 
)

Object method.

Note
A.k.a GetSpatialRef.
Get or set the projection of a spatial field of this layer. Gets or
sets the projection of the first field if no field name is given.
Parameters
name[optional] a name of a spatial field in this layer.
sr[optional] a Geo::OSR::SpatialReference object,
which replaces the existing projection.
Returns
a Geo::OSR::SpatialReference object, which represents the
projection in the given spatial field.

Code:
click to view

public method Geo::OGR::Layer::StartTransaction ( )

Object method.

Code:
click to view

public method Geo::OGR::Layer::SymDifference ( Geo::OGR::Layer  method,
Geo::OGR::Layer  result,
hashref  options,
coderef  callback,
scalar  callback_data 
)

Object method.
The result layer contains features whose geometries represent areas
that are in either in the input layer or in the method layer but not
in both. The features in the result layer have attributes from both
input and method layers. For features which represent areas that are
only in the input or in the method layer the respective attributes
have undefined values. The schema of the result layer can be set by
the user or, if it is empty, is initialized to contain all fields in
the input and method layers.

Parameters
methodmethod layer.
resultresult layer.
optionsa reference to an options hash.
callback[optional] a reference to a subroutine, which will
be called with parameters (number progress, string msg, callback_data)
callback_data[optional]

Code:
click to view

public method Geo::OGR::Layer::SyncToDisk ( )

Object method.

Code:
click to view

public scalar Geo::OGR::Layer::TestCapability ( scalar  cap)

Object method.

Parameters
capA capability string.
Returns
a boolean value indicating whether the layer has the
specified capability.

Code:
click to view

public list Geo::OGR::Layer::Tuple ( array  tuple)

Object method.
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 expected data in the tuple is: ([feature id,]
non-spatial fields, spatial fields). 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

Code:
click to view

public method Geo::OGR::Layer::Union ( Geo::OGR::Layer  method,
Geo::OGR::Layer  result,
hashref  options,
coderef  callback,
scalar  callback_data 
)

Object method.
The result layer contains features whose geometries represent areas
that are in either in the input layer or in the method layer. The
schema of the result layer can be set before calling this method, or
is initialized to contain all fields from this and method layer.

Parameters
methodmethod layer.
resultresult layer.
optionsa reference to an options hash.
callback[optional] a reference to a subroutine, which will
be called with parameters (number progress, string msg, callback_data)
callback_data[optional]

Code:
click to view

public method Geo::OGR::Layer::Update ( Geo::OGR::Layer  method,
Geo::OGR::Layer  result,
hashref  options,
coderef  callback,
scalar  callback_data 
)

Object method.
The result layer contains features whose geometries represent areas
that are either in the input layer or in the method layer. The
features in the result layer have areas of the features of the
method layer or those ares of the features of the input layer that
are not covered by the method layer. The features of the result
layer get their attributes from the input layer. The schema of the
result layer can be set by the user or, if it is empty, is
initialized to contain all fields in the input layer.

Parameters
methodmethod layer.
resultresult layer.
optionsa reference to an options hash.
callback[optional] a reference to a subroutine, which will
be called with parameters (number progress, string msg, callback_data)
callback_data[optional]

Code:
click to view


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