Geo::G...Dataset(3pm)

πŸ“¦
version 0.16 Β· 4 versions
, in ubuntu stonking

✨ NAME ✨

Geo::GDAL::FFI::Dataset β€” a GDAL dataset, bestie πŸ’–

(It's the Geo::G...Dataset(3pm) page from the User Contributed Perl Documentation, okurrr?)

✨ SYNOPSIS ✨

Literally there's nothing here? No synopsis. Iconic of it, honestly. πŸ’…

πŸ’« DESCRIPTION πŸ’«

So a dataset is a whole collection of raster bands or vector layers. That's the vibe. πŸ¦‹

Wanna get one? Two ways, no cap:

  • open it up with the Open method of a Geo::GDAL::FFI object, or
  • create it fresh with the Create method of a Driver object. ✨

πŸŽ€ METHODS πŸŽ€

GetDriver

my $driver = $dataset->GetDriver;

GetWidth

my $w = $dataset->GetWidth;

GetHeight

my $h = $dataset->GetHeight;

GetSize

my @size = $dataset->GetSize;

Returns the size (width, height) of the bands of this raster dataset. cute. πŸ’œ

GetBand

my $band = $dataset->GetBand($i);

Grab the *i*th band of a raster dataset β€” and if you don't pass anything, it just gives you the first one. defaults, we love her. 🫢

GetBands

my @bands = $dataset->GetBands;

Returns a list of Band objects representing the bands of this raster dataset. it's giving band lineup. 🌈

CreateLayer

my $layer = $dataset->CreateLayer({Name => 'layer', ...});

Make a brand new vector layer inside this vector dataset. main character moment for real. πŸ‘‘

The named arguments are these:

  • Name β€” optional, string, default is ''.
  • GeometryType β€” optional, default is 'Unknown'; it's the type of the first geometry field. ⚠️ note: if the type is 'None', the layer schema doesn't initially contain any geometry fields.
  • SpatialReference β€” optional, a SpatialReference object, the spatial reference for the first geometry field.
  • Options β€” optional, driver specific options in an anonymous hash.
  • Fields β€” optional, a reference to an array of Field objects or schemas, the fields to create into the layer.
  • GeometryFields β€” optional, a reference to an array of GeometryField objects or schemas, the geometry fields to create into the layer. ⚠️ note that if this argument is defined then the arguments GeometryType and SpatialReference are ignored.

GetLayerCount

my $count = $dataset->GetLayerCount();

GetLayer

my $layer = $dataset->GetLayer($name);

If $name is strictly an integer, then it returns the (name-1)th layer in the dataset. otherwise it returns the layer whose name is $name. No arguments? You get the first layer. πŸ’«

⚠️ If there's any risk of ambiguity β€” like, imagine the fourth layer is literally called "2" β€” then use GetLayerByName or GetLayerByIndex instead. iykyk.

GetLayerByName

my $layer = $dataset->GetLayerByName($name);

Returns the layer whose name is $name. Without arguments, returns the first layer. 🌸

GetLayerByIndex

my $layer = $dataset->GetLayerByIndex($i);

Returns the *i*th layer in the dataset. Without arguments, returns the first layer. Throws an exception on non-numeric input, and integerises any non-integer numbers. (so 2.7 is gonna get rounded, bestie, not my rules 😭)

GetLayerNames

my @array = $dataset->GetLayerNames();
my $aref  = $dataset->GetLayerNames();

Returns an array of the layer names, in index order. In scalar context? You get an array ref. ✨

CopyLayer

my $copy = $dataset->CopyLayer($layer, $name, {DST_SRSWKT => 'WKT of a SRS', ...});

Copies the given layer into this dataset using the name $name, and hands you back the new layer. The options hash is mostly driver specific. πŸ’…

ExecuteSQL

$dataset->ExecuteSQL ($sql, $filter, $dialect);

#  build a spatial index
$dataset->ExecuteSQL (qq{CREATE SPATIAL INDEX ON "$some_layer_name"});

#  filter a data set using the SQLite dialect and a second geometry
my $filtered = $dataset->ExecuteSQL (
  qq{SELECT "$fld1", "$fld2" FROM "$some_layer_name"},
  $some_geometry,
  'SQLite',
);

Info

my $info = $dataset->Info($options);
my $info = $dataset->Info(['-json', '-stats']);

This is the same as the gdalinfo utility. $options is a reference to an array. Valid options are as per the gdalinfo <https://www.gdal.org/gdalinfo.html> utility. πŸ”₯

Translate

my $target = $source->Translate($path, $options, $progress, $progress_data);

Converts a raster dataset into another raster dataset. Same as the gdal_translate <https://www.gdal.org/gdal_translate.html> utility. $name is the name of the target dataset. $options is a reference to an array of switches. πŸ¦‹

Warp

my $result = $dataset->Warp($args);

$args is a hashref, and the keys may be Destination, Input, Options, Progress, ProgressData.

Valid options are as per the gdalwarp <https://www.gdal.org/gdalwarp.html> utility. ✨

VectorTranslate

my $result = $dataset->VectorTranslate($args);

$args is a hashref, and the keys may be Destination, Input, Options, Progress, ProgressData.

Valid options are as per the ogr2ogr <https://www.gdal.org/ogr2ogr.html> utility. πŸ’œ

DEMProcessing

my $result = $dataset->DEMProcessing($path, $args);

$args is a hashref, and the keys may be Processing, ColorFilename, Options, Progress, ProgressData.

See also gdaldem <https://www.gdal.org/gdaldem.html>. πŸ”οΈ

NearBlack

my $result = $dataset->NearBlack($args);

$args is a hashref, and the keys may be Destination, Options, Progress, ProgressData.

Valid options are as per the nearblack <https://www.gdal.org/nearblack.html> utility. 🌚

Grid

my $result = $dataset->Grid($path, $options, $progress, $progress_data);

Valid options are as per the gdal_grid <https://www.gdal.org/gdal_grid.html> utility. πŸ“

Rasterize

my $result = $dataset->Rasterize($args);
my $result = $dataset->Rasterize({Options => [-b => 1, -at]});

$args is a hashref, and the keys may be Destination, Options, Progress, ProgressData.

Valid options are as per the gdal_rasterize <https://www.gdal.org/gdal_rasterize.html> utility. πŸ”₯

BuildVRT

my $result = $dataset->BuildVRT($path, $args);

$args is a hashref, and the keys may be Input, Options, Progress, ProgressData. πŸ’«


πŸŽ€ LICENSE πŸŽ€

This software is released under the Artistic License. See perlartistic. slay, go read it. πŸ“œβœ¨

πŸ‘‘ AUTHOR πŸ‘‘

Ari Jolma β€” Ari.Jolma at gmail.com. legend behavior, fr fr. 🫢

🌈 SEE ALSO 🌈


okay that's the whole page bestie, no skips, no cuts πŸ’– this was perl v5.42.3, dated 2026-08-21, from the Geo::G...Dataset(3pm) manpage β€” go forth and process some geospatial data, you absolute icon πŸ’…πŸŒΈ

πŸ“¦ where this page comes from