NAME

Geo::GDAL::FFI::Geometry - A GDAL geometry

SYNOPSIS

DESCRIPTION

METHODS

new

my $geom = Geo::GDAL::FFI::Geometry->new($geometry_type);

$type must be one of Geo::GDAL::FFI::GeometryTypes().

my $geom = Geo::GDAL::FFI::Geometry->new($format, $arg, $sr);

$format must be one of Geo::GDAL::FFI::GeometryFormats(), e.g., 'WKT'.

$sr should be a SpatialRef object if given.

Clone

my $geom2 = $geom1->Clone;

Clones this geometry and returns the clone.

GetType

my $type = $geom->GetType($mode);

Returns the type of this geometry. If $mode (optional) is 'flatten', returns the type without Z, M, or ZM postfix.

GetPointCount

Returns the point count of this geometry.

SetPoint

$point->SetPoint($x, $y, $z, $m);

Set the coordinates of a point geometry. The usage of $z and $m in the method depend on the actual 3D or measured status of the point.

$point->SetPoint([$x, $y, $z, $m]);

Set the coordinates of a point geometry. The usage of $z and $m in the method depend on the actual 3D or measured status of the geometry.

$geom->SetPoint($i, $x, $y, $z, $m);

Set the coordinates of the ith (zero based index) point in a curve geometry. The usage of $z and $m in the method depend on the actual 3D or measured status of the geometry.

Note that setting the nth point of a curve creates all points 0..n-2 unless they exist.

$geom->SetPoint($i, $coords);

Set the coordinates of the ith (zero based index) point in this curve. $coords must be a reference to an array of the coordinates. The usage of $z and $m in the method depend on the 3D or measured status of the geometry.

Note that setting the nth point of a curve may create all points 0..n-2.

GetPoint

my $coords = $geom->GetPoint($i);

Get the coordinates of the ith (zero based index) point in this curve. This method can also be used to set the coordinates of a point geometry and then the $i must be zero if it is given.

Returns the coordinates either as a list or a reference to an anonymous array depending on the context. The coordinates contain $z and $m depending on the 3D or measured status of the geometry.

GetPoints

my $points = $geom->GetPoints;

Returns the coordinates of the vertices of this geometry in an obvious array based data structure. Note that different geometry types have similar data structures.

SetPoints

$geom->SetPoints($points);

Sets the coordinates of the vertices of this geometry from an obvious array based data structure. Note that different geometry types may have similar data structures. If the geometry contains subgeometries (like polygon contains rings for example), the data structure is assumed to adhere to this structure. Uses SetPoint and may thus add points to curves.

GetGeometryCount

my $num_geometries = $geom->GetGeometryCount;

GetGeometry

my $outer_ring = $polygon->GetGeometry(0);

Returns the ith subgeometry (zero based index) in this geometry. The returned geometry object is only a wrapper to the underlying C++ reference and thus changing that geometry will change the parent.

AddGeometry

$polygon->AddGeometry($ring);

RemoveGeometry

$geom->RemoveGeometry($i);

AsText

Intersects

Equals

Disjoint

Touches

Crosses

Within

Contains

Overlaps

Boundary

ConvexHull

Buffer

Intersection

Union

Difference

SymDifference

Distance

Distance3D

Length

Area

Centroid

Empty

IsEmpty

IsValid

IsSimple

IsRing

LICENSE

This software is released under the Artistic License. See perlartistic.

AUTHOR

Ari Jolma - Ari.Jolma at gmail.com

SEE ALSO

Geo::GDAL::FFI

Alien::gdal, FFI::Platypus, http://www.gdal.org