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

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

πŸ’– 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:

  • Intersects
  • Equals
  • Disjoint
  • Touches
  • Crosses
  • Within
  • Contains
  • Overlaps
  • Boundary
  • ConvexHull

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:

  • Buffer
  • Intersection
  • Union
  • UnaryUnion
  • Difference
  • SymDifference
  • Distance
  • Distance3D
  • Length
  • Area
  • Centroid
  • Empty
  • IsEmpty
  • IsValid
  • IsSimple
  • IsRing

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 πŸ‘€


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