Geo::GDAL  2.0
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, subref callback, scalar callback_data)
 
public method CommitTransaction ()
 
public method CreateFeature (scalar feature)
 
public method CreateField (hash params)
 
public method DataSource ()
 
public method DeleteFeature (scalar fid)
 
public method DeleteField (scalar field)
 
public method Erase (Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, subref callback, scalar callback_data)
 
public method ForFeatures (scalar code, scalar in_place)
 
public method ForGeometries (scalar code, scalar in_place)
 
public method GeometryType ()
 
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 scalar GetFeatureCount (scalar force=1)
 
public scalar GetFeaturesRead ()
 
public hash GetFieldDefn (scalar name)
 
public list GetFieldNames ()
 
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, subref callback, scalar callback_data)
 
public method InsertFeature (scalar feature)
 
public method Intersection (Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, subref 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, subref 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, subref callback, scalar callback_data)
 
public method Update (Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, subref 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 list AccessTypes ()
 
public Geo::GDAL::Dataset AutoCreateWarpedVRT (Geo::GDAL::Dataset src, Geo::OSR::SpatialReference src_srs=undef, Geo::OSR::SpatialReference dst_srs=undef, scalar ResampleAlg='NearestNeighbour', scalar maxerror=0.0)
 
public method CPLBinaryToHex ()
 
public method CPLHexToBinary ()
 
public list Child (scalar node, scalar i)
 
public list Children (scalar node)
 
public method ComputeMedianCutPCT (Geo::GDAL::Band red, Geo::GDAL::Band green, Geo::GDAL::Band blue, scalar num_colors, scalar colors, subref progress, scalar progress_data)
 
public method ComputeProximity (Geo::GDAL::Band src, Geo::GDAL::Band proximity, hashref options, subref progress, scalar progress_data)
 
public scalar DataTypeIsComplex (scalar DataType)
 
public list DataTypeValueRange (scalar DataType)
 
public list DataTypes ()
 
public method Debug ()
 
public scalar DecToDMS (scalar angle, scalar axis, scalar precision=2)
 
public scalar DecToPackedDMS (scalar dec)
 
public method DitherRGB2PCT (scalar red, scalar green, scalar blue, scalar target, scalar colors, subref progress, scalar progress_data)
 
public method EscapeString ()
 
public scalar FindFile (scalar class, scalar basename)
 
public method FinderClean ()
 
public method GOA2GetAccessToken ()
 
public method GOA2GetAuthorizationURL ()
 
public method GOA2GetRefreshToken ()
 
public scalar GetCacheMax ()
 
public scalar GetCacheUsed ()
 
public scalar GetConfigOption (scalar key, scalar default)
 
public scalar GetDataTypeSize (scalar DataType)
 
public Geo::GDAL::Driver GetDriver (scalar name)
 
public list GetDriverNames ()
 
public method GetJPEG2000StructureAsString ()
 
public Geo::GDAL::Driver IdentifyDriver (scalar path, scalar siblings)
 
public list NodeData (scalar node)
 
public scalar NodeType (scalar type)
 
public list NodeTypes ()
 
public Geo::GDAL::Dataset Open (scalar name, scalar access= 'ReadOnly')
 
public Geo::GDAL::Dataset OpenEx (scalar name, scalar open_flags=0, array reference allowed_drivers=undef, array reference open_options=undef, array reference sibling_files=undef)
 
public Geo::GDAL::Dataset OpenShared (scalar name, scalar access= 'ReadOnly')
 
public scalar PackCharacter (scalar DataType)
 
public scalar PackedDMSToDec (scalar packed)
 
public array reference ParseXMLString (scalar XML)
 
public method Polygonize (Geo::GDAL::Band src, Geo::GDAL::Band mask, Geo::OGR::Layer out, scalar PixValField, hashref options, subref progress, scalar progress_data)
 
public method PopFinderLocation ()
 
public method PushFinderLocation (scalar path)
 
public list RIOResamplingTypes ()
 
public method RasterizeLayer (Geo::GDAL::Dataset ds, arrayref bands, Geo::OGR::Layer layer, scalar transformer, scalar arg, arrayref burn_values, hashref options, subref progress, scalar progress_data)
 
public method ReprojectImage (scalar src_ds, scalar dst_ds, scalar src_wkt=undef, scalar dst_wkt=undef, scalar ResampleAlg='NearestNeighbour', scalar WarpMemoryLimit=0, scalar maxerror=0.0, subref progress, scalar progress_data)
 
public list ResamplingTypes ()
 
public scalar SerializeXMLTree (arrayref XMLTree)
 
public method SetCacheMax (scalar Bytes)
 
public method SetConfigOption (scalar key, scalar value)
 
public method SieveFilter (Geo::GDAL::Band src, Geo::GDAL::Band mask, Geo::GDAL::Band dst, scalar threshold, scalar connectedness, hashref options, subref progress, scalar progress_data)
 
public scalar VersionInfo (scalar request= 'VERSION_NUM')
 
- Public Member Functions inherited from Geo::OGR
public list ByteOrders ()
 
public scalar GeometryTypeModify (scalar type, scalar modifier)
 
public scalar GeometryTypeTest (scalar type, scalar test, scalar type2)
 
public list GeometryTypes ()
 
public Geo::OGR::Driver GetDriver (scalar name)
 
public list GetDriverNames ()
 
public method GetNonLinearGeometriesEnabledFlag ()
 
public Geo::OGR::DataSource GetOpenDS (scalar number)
 
public scalar GetOpenDSCount ()
 
public method OLMD_FID64 ()
 
public Geo::OGR::DataSource Open (scalar name, scalar update=0)
 
public Geo::OGR::DataSource 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.

Definition at line 10570 of file all.pm.

Member Function Documentation

public method Geo::OGR::Layer::AlterFieldDefn ( scalar  name,
hash  params 
)
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 ( )

Both a class and an object method.

Returns
a list of capabilities. The object method returns a list of the capabilities the layer has. The class method 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, RandomRead, RandomWrite, ReorderFields, SequentialWrite, StringsAsUTF8, and Transactions.

Examples:

@cap = Geo::OGR::Layer::Capabilities(); # the class method
@cap = $layer->Capabilities(); # the object method
Code:
click to view
public method Geo::OGR::Layer::Clip ( Geo::OGR::Layer  method,
Geo::OGR::Layer  result,
hashref  options,
subref  callback,
scalar  callback_data 
)

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 ( )
Code:
click to view
public method 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
Code:
click to view
public method Geo::OGR::Layer::CreateField ( hash  params)

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::DataSource ( )
Code:
click to view
public method Geo::OGR::Layer::DeleteFeature ( scalar  fid)
Parameters
fidfeature id
Code:
click to view
public method Geo::OGR::Layer::DeleteField ( scalar  field)

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,
subref  callback,
scalar  callback_data 
)

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
public method 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
Code:
click to view
public method 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
Code:
click to view
public method Geo::OGR::Layer::GeometryType ( )
Code:
click to view
public Geo::OGR::DataSource Geo::OGR::Layer::GetDataSource ( )
Returns
the data source object to which this layer object belongs to.
Code:
click to view
public Geo::OGR::FeatureDefn Geo::OGR::Layer::GetDefn ( )

A.k.a GetLayerDefn.

Returns
a Geo::OGR::FeatureDefn object.
Code:
click to view
public 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
force
Returns
the extent = ($minx, $miny, $maxx, $maxy) as a listref
Code:
click to view
public Geo::OGR::Feature Geo::OGR::Layer::GetFeature ( scalar  fid)
Parameters
fidfeature id
Returns
a new Geo::OGR::Feature object that represents the feature in the layer.
Code:
click to view
public scalar Geo::OGR::Layer::GetFeatureCount ( scalar  force = 1)
Parameters
force
Returns
integer
Code:
click to view
public scalar Geo::OGR::Layer::GetFeaturesRead ( )
Returns
integer
Code:
click to view
public scalar Geo::OGR::Layer::GetFIDColumn ( )
Returns
the name of the underlying database column being used as the FID column, or "" if not supported.
Code:
click to view
public hash Geo::OGR::Layer::GetFieldDefn ( scalar  name)

Get the definition of a field.

Parameters
namethe name of the field.
Returns
the field definition object, either Geo::OGR::FieldDefn or Geo::OGR::GeomFieldDefn.
Code:
click to view
public list Geo::OGR::Layer::GetFieldNames ( )
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::GetName ( )
Returns
the name of the layer.
Code:
click to view
public Geo::OGR::Feature Geo::OGR::Layer::GetNextFeature ( )
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.

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 ( )
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,
subref  callback,
scalar  callback_data 
)

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)

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)
Code:
click to view
public method Geo::OGR::Layer::Intersection ( Geo::OGR::Layer  method,
Geo::OGR::Layer  result,
hashref  options,
subref  callback,
scalar  callback_data 
)

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 ( )

Initialize the layer object for iterative reading.

Code:
click to view
public method Geo::OGR::Layer::RollbackTransaction ( )
Code:
click to view
public hash reference 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
Code:
click to view
public method 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.
Code:
click to view
public method 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
Code:
click to view
public method Geo::OGR::Layer::SetIgnoredFields ( array  fields)
Parameters
fieldsa list of field names
Code:
click to view
public method Geo::OGR::Layer::SetNextByIndex ( scalar  new_index)
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)
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 
)
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)
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 
)
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 ( )
Code:
click to view
public method Geo::OGR::Layer::SymDifference ( Geo::OGR::Layer  method,
Geo::OGR::Layer  result,
hashref  options,
subref  callback,
scalar  callback_data 
)

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 ( )
Code:
click to view
public scalar Geo::OGR::Layer::TestCapability ( scalar  cap)
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)

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,
subref  callback,
scalar  callback_data 
)

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,
subref  callback,
scalar  callback_data 
)

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: