.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Geo::GDAL::FFI::Geometry 3pm" .TH Geo::GDAL::FFI::Geometry 3pm 2024-05-24 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Geo::GDAL::FFI::Geometry \- A GDAL geometry .SH SYNOPSIS .IX Header "SYNOPSIS" .SH DESCRIPTION .IX Header "DESCRIPTION" .SH METHODS .IX Header "METHODS" .SS new .IX Subsection "new" .Vb 1 \& my $geom = Geo::GDAL::FFI::Geometry\->new($geometry_type); .Ve .PP \&\f(CW$type\fR must be one of \fBGeo::GDAL::FFI::GeometryTypes()\fR. .PP .Vb 1 \& my $geom = Geo::GDAL::FFI::Geometry\->new($format, $arg, $sr); .Ve .PP \&\f(CW$format\fR must be one of \fBGeo::GDAL::FFI::GeometryFormats()\fR, e.g., 'WKT'. .PP \&\f(CW$sr\fR should be a SpatialRef object if given. .SS Clone .IX Subsection "Clone" .Vb 1 \& my $geom2 = $geom1\->Clone; .Ve .PP Clones this geometry and returns the clone. .SS GetType .IX Subsection "GetType" .Vb 1 \& my $type = $geom\->GetType($mode); .Ve .PP Returns the type of this geometry. If \f(CW$mode\fR (optional) is 'flatten', returns the type without Z, M, or ZM postfix. .SS GetPointCount .IX Subsection "GetPointCount" Returns the point count of this geometry. .SS SetPoint .IX Subsection "SetPoint" .Vb 1 \& $point\->SetPoint($x, $y, $z, $m); .Ve .PP Set the coordinates of a point geometry. The usage of \f(CW$z\fR and \f(CW$m\fR in the method depend on the actual 3D or measured status of the point. .PP .Vb 1 \& $point\->SetPoint([$x, $y, $z, $m]); .Ve .PP Set the coordinates of a point geometry. The usage of \f(CW$z\fR and \f(CW$m\fR in the method depend on the actual 3D or measured status of the geometry. .PP .Vb 1 \& $geom\->SetPoint($i, $x, $y, $z, $m); .Ve .PP Set the coordinates of the ith (zero based index) point in a curve geometry. The usage of \f(CW$z\fR and \f(CW$m\fR in the method depend on the actual 3D or measured status of the geometry. .PP Note that setting the nth point of a curve creates all points 0..n\-2 unless they exist. .PP .Vb 1 \& $geom\->SetPoint($i, $coords); .Ve .PP Set the coordinates of the ith (zero based index) point in this curve. \f(CW$coords\fR must be a reference to an array of the coordinates. The usage of \f(CW$z\fR and \f(CW$m\fR in the method depend on the 3D or measured status of the geometry. .PP Note that setting the nth point of a curve may create all points 0..n\-2. .SS GetPoint .IX Subsection "GetPoint" .Vb 1 \& my $coords = $geom\->GetPoint($i); .Ve .PP 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 \f(CW$i\fR must be zero if it is given. .PP Returns the coordinates either as a list or a reference to an anonymous array depending on the context. The coordinates contain \f(CW$z\fR and \f(CW$m\fR depending on the 3D or measured status of the geometry. .SS GetPoints .IX Subsection "GetPoints" .Vb 1 \& my $points = $geom\->GetPoints; .Ve .PP 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. .SS SetPoints .IX Subsection "SetPoints" .Vb 1 \& $geom\->SetPoints($points); .Ve .PP 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. .SS GetGeometryCount .IX Subsection "GetGeometryCount" .Vb 1 \& my $num_geometries = $geom\->GetGeometryCount; .Ve .SS GetGeometry .IX Subsection "GetGeometry" .Vb 1 \& my $outer_ring = $polygon\->GetGeometry(0); .Ve .PP 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. .SS AddGeometry .IX Subsection "AddGeometry" .Vb 1 \& $polygon\->AddGeometry($ring); .Ve .SS RemoveGeometry .IX Subsection "RemoveGeometry" .Vb 1 \& $geom\->RemoveGeometry($i); .Ve .SS ExportToWKT($variant) .IX Subsection "ExportToWKT($variant)" .Vb 1 \& my $wkt = $geom\->ExportToWKT($variant); .Ve .PP Returns the geometry as WKT. \f(CW$variant\fR is optional (default is 'ISO'). .SS AsText .IX Subsection "AsText" Alias to ExportToWKT. .SS ExportToGML(%options) .IX Subsection "ExportToGML(%options)" .Vb 1 \& my $gml = $geom\->ExportToGML(%options); .Ve .PP Returns the geometry as GML string. \f(CW%options\fR may contain options as described in GDAL documentation. .SS ExportToJSON(%options) .IX Subsection "ExportToJSON(%options)" .Vb 1 \& my $json = $geom\->ExportToJSON(%options); .Ve .PP Returns the geometry as JSON string. \f(CW%options\fR may contain options as described in GDAL documentation. .SS Intersects .IX Subsection "Intersects" .SS Equals .IX Subsection "Equals" .SS Disjoint .IX Subsection "Disjoint" .SS Touches .IX Subsection "Touches" .SS Crosses .IX Subsection "Crosses" .SS Within .IX Subsection "Within" .SS Contains .IX Subsection "Contains" .SS Overlaps .IX Subsection "Overlaps" .SS Boundary .IX Subsection "Boundary" .SS ConvexHull .IX Subsection "ConvexHull" .SS Buffer .IX Subsection "Buffer" .SS Intersection .IX Subsection "Intersection" .SS Union .IX Subsection "Union" .SS Difference .IX Subsection "Difference" .SS SymDifference .IX Subsection "SymDifference" .SS Distance .IX Subsection "Distance" .SS Distance3D .IX Subsection "Distance3D" .SS Length .IX Subsection "Length" .SS Area .IX Subsection "Area" .SS Centroid .IX Subsection "Centroid" .SS Empty .IX Subsection "Empty" .SS IsEmpty .IX Subsection "IsEmpty" .SS IsValid .IX Subsection "IsValid" .SS IsSimple .IX Subsection "IsSimple" .SS IsRing .IX Subsection "IsRing" .SS GetEnvelope .IX Subsection "GetEnvelope" Returns a four element array reference containing [Xmin, Xmax, Ymin, Ymax]. .SS GetEnvelope3D .IX Subsection "GetEnvelope3D" Returns a six element array reference containing [Xmin, Xmax, Ymin, Ymax, Zmin, Zmax]. .SS MakeValid(%options) .IX Subsection "MakeValid(%options)" .Vb 1 \& my $valid_geom = $geom\->MakeValid(%options); .Ve .PP Attempts to make an invalid geometry valid and returns that. \f(CW%options\fR may contain options as described in GDAL documentation. .PP Requires GDAL version >= 3.0 .SS \fBNormalize()\fP .IX Subsection "Normalize()" .Vb 1 \& my $normalized_geom = $geom\->Normalize(); .Ve .PP Attempts to bring geometry into normalized/canonical form. .PP Requires GDAL version >= 3.3 .SH LICENSE .IX Header "LICENSE" This software is released under the Artistic License. See perlartistic. .SH AUTHOR .IX Header "AUTHOR" Ari Jolma \- Ari.Jolma at gmail.com .SH "SEE ALSO" .IX Header "SEE ALSO" Geo::GDAL::FFI .PP Alien::gdal, FFI::Platypus,