Geo::G...ometry(3pm)
π Geo::GDAL::FFI::Geometry β a GDAL geometry π
okay so bestie, this page drops straight out of the User Contributed Perl Documentation corner of the 3pm manual, and it is all about Geo::GDAL::FFI::Geometry. That's the whole title. "A GDAL geometry." Ten out of ten name, no notes π
β¨ NAME β¨
Geo::GDAL::FFI::Geometry β a GDAL geometry. that's it. that's the name. short, sweet, iconic π
β¨ SYNOPSIS β¨
not me finding this section absolutely empty π the original had nothing in here and I am respectfully not inventing anything to put in it. moving on π¦
β¨ DESCRIPTION β¨
also empty, fr fr. zero words. the DESCRIPTION is a void and honestly? valid. all the actual tea is down in METHODS π«Ά
π METHODS π
okay this is the main character section, grab a snack π
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 hands you the clone back. a whole copy, just for you π
GetType
my $type = $geom->GetType($mode);
Returns the type of this geometry. If $mode (optional, babes) is 'flatten', it returns the type without the Z, M, or ZM postfix. flattening, but make it geometry β¨
GetPointCount
Returns the point count of this geometry. that's the whole vibe π―
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.
β οΈ heads up bestie: setting the nth point of a curve creates all points 0..n-2 unless they exist. surprise points!! π
$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.
β οΈ and again, no cap: 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. context-sensitive queen π
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. "obvious" is doing a lot of work here but okay π
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 a 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.
π real talk: it's not a copy, it's a link. edit the child, you edit the parent. main character energy with consequences.
AddGeometry
$polygon->AddGeometry($ring);
RemoveGeometry
$geom->RemoveGeometry($i);
ExportToWKT($variant)
my $wkt = $geom->ExportToWKT($variant);
Returns the geometry as WKT. $variant is optional (default is 'ISO').
AsText
Alias to ExportToWKT. same energy, different name π«
ExportToGML(%options)
my $gml = $geom->ExportToGML(%options);
Returns the geometry as a GML string. %options may contain options as described in GDAL documentation.
ExportToJSON(%options)
my $json = $geom->ExportToJSON(%options);
Returns the geometry as a JSON string. %options may contain options as described in GDAL documentation.
π«§ the geometry-relationship girlies π«§
so these next ones show up in the original with absolutely no description whatsoever. not even a one-liner. I am not making up behaviour for them because that would be lying to you, and we don't do that here π so here they are in all their unexplained glory:
IntersectsEqualsDisjointTouchesCrossesWithinContainsOverlapsBoundaryConvexHull
ConcaveHull($ratio, $allow_holes)
Generates a concave hull of the input geometry.
If $ratio is undefined then it defaults to 0.001 as a value of 0 can result in unusual segments. π unusual segments. noted.
π«§ more mystery methods π«§
again, no descriptions given in the original, so I'm just handing you the names, exactly as they came:
BufferIntersectionUnionUnaryUnionDifferenceSymDifferenceDistanceDistance3DLengthAreaCentroidEmptyIsEmptyIsValidIsSimpleIsRing
Segmentize
$geom->Segmentize($max_length)
Requires GEOS 3.10. yes bestie, version-gated, respect the requirements π§
GetEnvelope
Returns a four element array reference containing [Xmin, Xmax, Ymin, Ymax]. (note the order. it's giving X, X, Y, Y. it is not the other order. write that down π)
GetEnvelope3D
Returns a six element array reference containing [Xmin, Xmax, Ymin, Ymax, Zmin, Zmax].
GetExtent
Returns a four element array reference containing [Xmin, Ymin, Xmax, Ymax].
This and GetExtent3D are convenience methods given many systems need data in the order x1,y1,x2,y2. The order is also consistent with the Geo::GDAL::FFI::Layer GetExtent method. consistency is so underrated β¨
GetExtent3D
Returns a six element array reference containing [Xmin, Ymin, Zmin, Xmax, Ymax, Zmax].
MakeValid(%options)
my $valid_geom = $geom->MakeValid(%options);
Attempts to make an invalid geometry valid and returns that. %options may contain options as described in GDAL documentation.
Requires GDAL version >= 3.0.
π glow-up service for broken geometries. love that for them.
Normalize()
my $normalized_geom = $geom->Normalize();
Attempts to bring geometry into normalized/canonical form.
Requires GDAL version >= 3.3.
π LICENSE π
This software is released under the Artistic License. See perlartistic. go read it, it's your legal bestie π
π AUTHOR π
Ari Jolma - Ari.Jolma at gmail.com
π SEE ALSO π
Geo::GDAL::FFIAlien::gdal,FFI::Platypus,<http://www.gdal.org>
and that's the whole page bestie!! π¦ this little gem was written by perl v5.42.3 and dated 2026-08-21, and that's the last line of the original so that's where we're leaving it. periodt. π β¨
π¦ where this page comes from
- ubuntu stonking: libgeo-gdal-ffi-perl 0.16-1build2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms