Geo::GDAL  2.4
all.pm
Go to the documentation of this file.
1 #** @class Geo::GDAL
2 # @brief GDAL utility functions and a root class for raster classes.
3 # @details Geo::GDAL wraps many GDAL utility functions and is as a root class
4 # for all GDAL raster classes. A "raster" is an object, whose core is
5 # a rectagular grid of cells, called a "band" in GDAL. Each cell
6 # contains a numeric value of a specific data type.
7 #*
8 package Geo::GDAL;
9 
10 #** @method ApplyVerticalShiftGrid()
11 #*
12 sub ApplyVerticalShiftGrid {
13 }
14 
15 #** @method BuildVRT()
16 #*
17 sub BuildVRT {
18  for (keys %Geo::GDAL::Const::) {
19  next if /TypeCount/;
20  push(@DATA_TYPES, $1), next if /^GDT_(\w+)/;
21  push(@OPEN_FLAGS, $1), next if /^OF_(\w+)/;
22  push(@RESAMPLING_TYPES, $1), next if /^GRA_(\w+)/;
23  push(@RIO_RESAMPLING_TYPES, $1), next if /^GRIORA_(\w+)/;
24  push(@NODE_TYPES, $1), next if /^CXT_(\w+)/;
25  }
26  for my $string (@DATA_TYPES) {
27  my $int = eval "\$Geo::GDAL::Const::GDT_$string";
28  $S2I{data_type}{$string} = $int;
29  $I2S{data_type}{$int} = $string;
30  }
31  for my $string (@OPEN_FLAGS) {
32  my $int = eval "\$Geo::GDAL::Const::OF_$string";
33  $S2I{open_flag}{$string} = $int;
34  }
35  for my $string (@RESAMPLING_TYPES) {
36  my $int = eval "\$Geo::GDAL::Const::GRA_$string";
37  $S2I{resampling}{$string} = $int;
38  $I2S{resampling}{$int} = $string;
39  }
40  for my $string (@RIO_RESAMPLING_TYPES) {
41  my $int = eval "\$Geo::GDAL::Const::GRIORA_$string";
42  $S2I{rio_resampling}{$string} = $int;
43  $I2S{rio_resampling}{$int} = $string;
44  }
45  for my $string (@NODE_TYPES) {
46  my $int = eval "\$Geo::GDAL::Const::CXT_$string";
47  $S2I{node_type}{$string} = $int;
48  $I2S{node_type}{$int} = $string;
49  }
50  our $HAVE_PDL;
51  eval 'require PDL';
52  $HAVE_PDL = 1 unless $@;
53 }
54 
55 #** @method CPLBinaryToHex()
56 #*
57 sub CPLBinaryToHex {
58 }
59 
60 #** @method CPLHexToBinary()
61 #*
62 sub CPLHexToBinary {
63 }
64 
65 #** @method ContourGenerateEx()
66 #*
67 sub ContourGenerateEx {
68 }
69 
70 #** @method CreatePansharpenedVRT()
71 #*
72 sub CreatePansharpenedVRT {
73 }
74 
75 #** @method scalar DataTypeIsComplex($DataType)
76 # Package subroutine.
77 # @param DataType A GDAL raster cell data type (one of those listed by Geo::GDAL::DataTypes).
78 # @return true if the data type is a complex number.
79 #*
80 sub DataTypeIsComplex {
81  return _DataTypeIsComplex(s2i(data_type => shift));
82 }
83 
84 #** @method list DataTypeValueRange($DataType)
85 # Package subroutine.
86 # @param DataType Data type (one of those listed by Geo::GDAL::DataTypes).
87 # @note Some returned values are inaccurate.
88 #
89 # @return the minimum, maximum range of the data type.
90 #*
91 sub DataTypeValueRange {
92  my $t = shift;
93  s2i(data_type => $t);
94  # these values are from gdalrasterband.cpp
95  return (0,255) if $t =~ /Byte/;
96  return (0,65535) if $t =~/UInt16/;
97  return (-32768,32767) if $t =~/Int16/;
98  return (0,4294967295) if $t =~/UInt32/;
99  return (-2147483648,2147483647) if $t =~/Int32/;
100  return (-4294967295.0,4294967295.0) if $t =~/Float32/;
101  return (-4294967295.0,4294967295.0) if $t =~/Float64/;
102 }
103 
104 #** @method list DataTypes()
105 # Package subroutine.
106 # @return a list of GDAL raster cell data types. These are currently:
107 # Byte, CFloat32, CFloat64, CInt16, CInt32, Float32, Float64, Int16, Int32, UInt16, UInt32, and Unknown.
108 #*
109 sub DataTypes {
110  return @DATA_TYPES;
111 }
112 
113 #** @method scalar DecToDMS($angle, $axis, $precision=2)
114 # Package subroutine.
115 # Convert decimal degrees to degrees, minutes, and seconds string
116 # @param angle A number
117 # @param axis A string specifying latitude or longitude ('Long').
118 # @param precision
119 # @return a string nndnn'nn.nn'"L where n is a number and L is either
120 # N or E
121 #*
122 sub DecToDMS {
123 }
124 
125 #** @method scalar DecToPackedDMS($dec)
126 # Package subroutine.
127 # @param dec Decimal degrees
128 # @return packed DMS, i.e., a number DDDMMMSSS.SS
129 #*
130 sub DecToPackedDMS {
131 }
132 
133 #** @method DontUseExceptions()
134 # Package subroutine.
135 # Do not use the Perl exception mechanism for GDAL messages. Instead
136 # the messages are printed to standard error.
137 #*
138 sub DontUseExceptions {
139 }
140 
141 #** @method Geo::GDAL::Driver Driver($Name)
142 # Package subroutine.
143 # Access a format driver.
144 # @param Name The short name of the driver. One of
145 # Geo::GDAL::DriverNames or Geo::OGR::DriverNames.
146 # @note This subroutine is imported into the main namespace if Geo::GDAL
147 # is used with qw/:all/.
148 # @return a Geo::GDAL::Driver object.
149 #*
150 sub Driver {
151  return 'Geo::GDAL::Driver' unless @_;
152  my $name = shift;
153  my $driver = GetDriver($name);
154  error("Driver \"$name\" not found. Is it built in? Check with Geo::GDAL::Drivers or Geo::OGR::Drivers.")
155  unless $driver;
156  return $driver;
157 }
158 
159 #** @method list DriverNames()
160 # Package subroutine.
161 # Available raster format drivers.
162 # \code
163 # perl -MGeo::GDAL -e '@d=Geo::GDAL::DriverNames;print "@d\n"'
164 # \endcode
165 # @note Use Geo::OGR::DriverNames for vector drivers.
166 # @return a list of the short names of all available GDAL raster drivers.
167 #*
168 sub DriverNames {
169 }
170 
171 #** @method list Drivers()
172 # Package subroutine.
173 # @note Use Geo::OGR::Drivers for vector drivers.
174 # @return a list of all available GDAL raster drivers.
175 #*
176 sub Drivers {
177  my @drivers;
178  for my $i (0..GetDriverCount()-1) {
179  my $driver = GetDriver($i);
180  push @drivers, $driver if $driver->TestCapability('RASTER');
181  }
182  return @drivers;
183 }
184 
185 #** @method EscapeString()
186 #*
187 sub EscapeString {
188 }
189 
190 #** @method scalar FindFile($basename)
191 # Package subroutine.
192 # Search for GDAL support files.
193 #
194 # An example:
195 # \code
196 # use Geo::GDAL;
197 # $a = Geo::GDAL::FindFile('pcs.csv');
198 # print STDERR "$a\n";
199 # \endcode
200 # Prints (for example):
201 # \code
202 # c:\msys\1.0\local\share\gdal\pcs.csv
203 # \endcode
204 #
205 # @param basename The name of the file to search for. For example
206 # 'pcs.csv'.
207 # @return the path to the searched file or undef.
208 #*
209 sub FindFile {
210  if (@_ == 1) {
211  _FindFile('', @_);
212  } else {
213  _FindFile(@_);
214  }
215 }
216 
217 #** @method FinderClean()
218 # Package subroutine.
219 # Clear the set of support file search paths.
220 #*
221 sub FinderClean {
222 }
223 
224 #** @method GOA2GetAccessToken()
225 #*
226 sub GOA2GetAccessToken {
227 }
228 
229 #** @method GOA2GetAuthorizationURL()
230 #*
231 sub GOA2GetAuthorizationURL {
232 }
233 
234 #** @method GOA2GetRefreshToken()
235 #*
236 sub GOA2GetRefreshToken {
237 }
238 
239 #** @method GetActualURL()
240 #*
241 sub GetActualURL {
242 }
243 
244 #** @method scalar GetCacheMax()
245 # Package subroutine.
246 # @return maximum amount of memory (as bytes) for caching within GDAL.
247 #*
248 sub GetCacheMax {
249 }
250 
251 #** @method scalar GetCacheUsed()
252 # Package subroutine.
253 # @return the amount of memory currently used for caching within GDAL.
254 #*
255 sub GetCacheUsed {
256 }
257 
258 #** @method scalar GetConfigOption($key)
259 # Package subroutine.
260 # @param key A GDAL config option. Consult <a
261 # href="https://trac.osgeo.org/gdal/wiki/ConfigOptions">the GDAL
262 # documentation</a> for available options and their use.
263 # @return the value of the GDAL config option.
264 #*
265 sub GetConfigOption {
266 }
267 
268 #** @method scalar GetDataTypeSize($DataType)
269 # Package subroutine.
270 # @param DataType A GDAL raster cell data type (one of those listed by Geo::GDAL::DataTypes).
271 # @return the size as the number of bits.
272 #*
273 sub GetDataTypeSize {
274  return _GetDataTypeSize(s2i(data_type => shift, 1));
275 }
276 
277 #** @method GetErrorCounter()
278 #*
279 sub GetErrorCounter {
280 }
281 
282 #** @method GetFileSystemOptions()
283 #*
284 sub GetFileSystemOptions {
285 }
286 
287 #** @method GetFileSystemsPrefixes()
288 #*
289 sub GetFileSystemsPrefixes {
290 }
291 
292 #** @method GetJPEG2000StructureAsString()
293 #*
294 sub GetJPEG2000StructureAsString {
295 }
296 
297 #** @method GetSignedURL()
298 #*
299 sub GetSignedURL {
300 }
301 
302 #** @method Geo::GDAL::Driver IdentifyDriver($path, $siblings)
303 # Package subroutine.
304 # @param path a dataset path.
305 # @param siblings [optional] A list of names of files that belong to the data format.
306 # @return a Geo::GDAL::Driver.
307 #*
308 sub IdentifyDriver {
309 }
310 
311 #** @method IdentifyDriverEx()
312 #*
313 sub IdentifyDriverEx {
314 }
315 
316 #** @method MkdirRecursive()
317 #*
318 sub MkdirRecursive {
319 }
320 
321 #** @method Geo::GDAL::Dataset Open(%params)
322 # Package subroutine.
323 # Open a dataset.
324 # An example, which opens an existing raster dataset for editing:
325 # \code
326 # use Geo::GDAL qw/:all/;
327 # $ds = Open(Name => 'existing.tiff', Access => 'Update');
328 # \endcode
329 # @param params Named parameters:
330 # - \a Name Dataset string (typically a filename). Default is '.'.
331 # - \a Access Access type, either 'ReadOnly' or 'Update'. Default is 'ReadOnly'.
332 # - \a Type Dataset type, either 'Raster', 'Vector', or 'Any'. Default is 'Any'.
333 # - \a Options A hash of GDAL open options passed to candidate drivers. Default is {}.
334 # - \a Files A list of names of files that are auxiliary to the main file. Default is [].
335 #
336 # @note This subroutine is imported into the main namespace if Geo::GDAL
337 # is use'd with qw/:all/.
338 #
339 # @note Some datasets / dataset strings do not explicitly imply the
340 # dataset type (for example a PostGIS database). If the type is not
341 # specified in such a case the returned dataset may be of either type.
342 #
343 # @return a new Geo::GDAL::Dataset object if success.
344 #*
345 sub Open {
346  my $p = named_parameters(\@_, Name => '.', Access => 'ReadOnly', Type => 'Any', Options => {}, Files => []);
347  my @flags;
348  my %o = (READONLY => 1, UPDATE => 1);
349  error(1, $p->{access}, \%o) unless $o{uc($p->{access})};
350  push @flags, uc($p->{access});
351  %o = (RASTER => 1, VECTOR => 1, ANY => 1);
352  error(1, $p->{type}, \%o) unless $o{uc($p->{type})};
353  push @flags, uc($p->{type}) unless uc($p->{type}) eq 'ANY';
354  my $dataset = OpenEx(Name => $p->{name}, Flags => \@flags, Options => $p->{options}, Files => $p->{files});
355  unless ($dataset) {
356  my $t = "Failed to open $p->{name}.";
357  $t .= " Is it a ".lc($p->{type})." dataset?" unless uc($p->{type}) eq 'ANY';
358  error($t);
359  }
360  return $dataset;
361 }
362 
363 #** @method Geo::GDAL::Dataset OpenEx(%params)
364 # Package subroutine.
365 # The generic dataset open method, used internally by all Open and OpenShared methods.
366 # @param params Named parameters:
367 # - \a Name The name of the data set or source to open. (Default is '.')
368 # - \a Flags A list of access mode flags. Available flags are listed by Geo::GDAL::OpenFlags(). (Default is [])
369 # - \a Drivers A list of short names of drivers that may be used. Empty list means all. (Default is [])
370 # - \a Options A hash of GDAL open options passed to candidate drivers. (Default is {})
371 # - \a Files A list of names of files that are auxiliary to the main file. (Default is [])
372 #
373 # An example
374 # \code
375 # $ds = Geo::GDAL::OpenEx(Name => 'existing.tiff', Flags => [qw/RASTER UPDATE/]);
376 # \endcode
377 # @return a new Geo::GDAL::Dataset object.
378 #*
379 sub OpenEx {
380  my $p = named_parameters(\@_, Name => '.', Flags => [], Drivers => [], Options => {}, Files => []);
381  unless ($p) {
382  my $name = shift // '';
383  my @flags = @_;
384  $p = {name => $name, flags => \@flags, drivers => [], options => {}, files => []};
385  }
386  if ($p->{flags}) {
387  my $f = 0;
388  for my $flag (@{$p->{flags}}) {
389  $f |= s2i(open_flag => $flag);
390  }
391  $p->{flags} = $f;
392  }
393  return _OpenEx($p->{name}, $p->{flags}, $p->{drivers}, $p->{options}, $p->{files});
394 }
395 
396 #** @method list OpenFlags()
397 # Package subroutine.
398 # @return a list of GDAL data set open modes. These are currently:
399 # ALL, GNM, RASTER, READONLY, SHARED, UPDATE, VECTOR, and VERBOSE_ERROR.
400 #*
401 sub OpenFlags {
402  return @DATA_TYPES;
403 }
404 
405 #** @method scalar PackCharacter($DataType)
406 # Package subroutine.
407 # Get the character that is needed for Perl's pack and unpack when
408 # they are used with Geo::GDAL::Band::ReadRaster and
409 # Geo::GDAL::Band::WriteRaster. Note that Geo::GDAL::Band::ReadTile
410 # and Geo::GDAL::Band::WriteTile have simpler interfaces that do not
411 # require pack and unpack.
412 # @param DataType A GDAL raster cell data type, typically from $band->DataType.
413 # @return a character which can be used in Perl's pack and unpack.
414 #*
415 sub PackCharacter {
416  my $t = shift;
417  $t = i2s(data_type => $t);
418  s2i(data_type => $t); # test
419  my $is_big_endian = unpack("h*", pack("s", 1)) =~ /01/; # from Programming Perl
420  return 'C' if $t =~ /^Byte$/;
421  return ($is_big_endian ? 'n': 'v') if $t =~ /^UInt16$/;
422  return 's' if $t =~ /^Int16$/;
423  return ($is_big_endian ? 'N' : 'V') if $t =~ /^UInt32$/;
424  return 'l' if $t =~ /^Int32$/;
425  return 'f' if $t =~ /^Float32$/;
426  return 'd' if $t =~ /^Float64$/;
427 }
428 
429 #** @method scalar PackedDMSToDec($packed)
430 # Package subroutine.
431 # @param packed DMS as a number DDDMMMSSS.SS
432 # @return decimal degrees
433 #*
434 sub PackedDMSToDec {
435 }
436 
437 #** @method PopFinderLocation()
438 # Package subroutine.
439 # Remove the latest addition from the set of support file search
440 # paths. Note that calling this subroutine may remove paths GDAL put
441 # into the finder.
442 #*
443 sub PopFinderLocation {
444 }
445 
446 #** @method PushFinderLocation($path)
447 # Package subroutine.
448 # Add a path to the set of paths from where GDAL support files are
449 # sought. Note that GDAL puts initially into the finder the current
450 # directory and value of GDAL_DATA environment variable (if it
451 # exists), installation directory (prepended with '/share/gdal' or
452 # '/Resources/gdal'), or '/usr/local/share/gdal'. It is usually only
453 # needed to add paths to the finder if using an alternate set of data
454 # files or a non-installed GDAL is used (as in testing).
455 #*
456 sub PushFinderLocation {
457 }
458 
459 #** @method list RIOResamplingTypes()
460 # Package subroutine.
461 # @return a list of GDAL raster IO resampling methods. These are currently:
462 # Average, Bilinear, Cubic, CubicSpline, Gauss, Lanczos, Mode, and NearestNeighbour.
463 #*
464 sub RIOResamplingTypes {
465  return @RIO_RESAMPLING_TYPES;
466 }
467 
468 #** @method list ResamplingTypes()
469 # Package subroutine.
470 # @return a list of GDAL resampling methods. These are currently:
471 # Average, Bilinear, Cubic, CubicSpline, Lanczos, Max, Med, Min, Mode, NearestNeighbour, Q1, and Q3.
472 #*
473 sub ResamplingTypes {
474  return @RESAMPLING_TYPES;
475 }
476 
477 #** @method RmdirRecursive()
478 #*
479 sub RmdirRecursive {
480 }
481 
482 #** @method SetCacheMax($Bytes)
483 # Package subroutine.
484 # @param Bytes New maximum amount of memory for caching within GDAL.
485 #*
486 sub SetCacheMax {
487 }
488 
489 #** @method SetConfigOption($key, $value)
490 # Package subroutine.
491 # @param key A GDAL config option. Consult <a
492 # href="https://trac.osgeo.org/gdal/wiki/ConfigOptions">the GDAL
493 # documentation</a> for available options and their use.
494 # @param value A value for the option, typically 'YES', 'NO',
495 # undef, path, numeric value, or a filename.
496 #*
497 sub SetConfigOption {
498 }
499 
500 #** @method UseExceptions()
501 # Package subroutine.
502 # Use the Perl exception mechanism for GDAL messages (failures are
503 # confessed and warnings are warned) and collect the messages
504 # into \@Geo::GDAL::error. This is the default.
505 #*
506 sub UseExceptions {
507 }
508 
509 #** @method VSICurlClearCache()
510 #*
511 sub VSICurlClearCache {
512 }
513 
514 #** @method VSICurlPartialClearCache()
515 #*
516 sub VSICurlPartialClearCache {
517 }
518 
519 #** @method VSIErrorReset()
520 #*
521 sub VSIErrorReset {
522 }
523 
524 #** @method VSIFEofL()
525 #*
526 sub VSIFEofL {
527 }
528 
529 #** @method VSIFFlushL()
530 #*
531 sub VSIFFlushL {
532 }
533 
534 #** @method VSIFOpenExL()
535 #*
536 sub VSIFOpenExL {
537 }
538 
539 #** @method VSIGetLastErrorMsg()
540 #*
541 sub VSIGetLastErrorMsg {
542 }
543 
544 #** @method VSIGetLastErrorNo()
545 #*
546 sub VSIGetLastErrorNo {
547 }
548 
549 #** @method scalar VersionInfo($request = 'VERSION_NUM')
550 # Package subroutine.
551 # @param request A string specifying the request. Currently either
552 # "VERSION_NUM", "RELEASE_DATE", "RELEASE_NAME", or
553 # "--version". Default is "VERSION_NUM".
554 # @return Requested information.
555 #*
556 sub VersionInfo {
557 }
558 
559 #** @method scalar errstr()
560 # Package subroutine.
561 # Clear the error stack and return all generated GDAL error messages in one (possibly multiline) string.
562 # @return the chomped error stack joined with newlines.
563 #*
564 sub errstr {
565  my @stack = @error;
566  chomp(@stack);
567  @error = ();
568  return join("\n", @stack);
569 }
570 # usage: named_parameters(\@_, key value list of default parameters);
571 # returns parameters in a hash with low-case-without-_ keys
572 }
573 
574 #** @class Geo::GDAL::AsyncReader
575 # @brief Enable asynchronous requests.
576 # @details This class is not yet documented nor tested in the GDAL Perl wrappers
577 # @todo Test and document.
578 #*
579 package Geo::GDAL::AsyncReader;
580 
581 use base qw(Geo::GDAL)
582 
583 #** @method GetNextUpdatedRegion()
584 #*
585 sub GetNextUpdatedRegion {
586 }
587 
588 #** @method LockBuffer()
589 #*
590 sub LockBuffer {
591 }
592 
593 #** @method UnlockBuffer()
594 #*
595 sub UnlockBuffer {
596 }
597 
598 #** @class Geo::GDAL::Band
599 # @brief A raster band.
600 # @details
601 #*
602 package Geo::GDAL::Band;
603 
605 
606 #** @attr $XSize
607 # Object attribute.
608 # scalar (access as $band->{XSize})
609 #*
610 
611 #** @attr $YSize
612 # Object attribute.
613 # scalar (access as $band->{YSize})
614 #*
615 
616 #** @method AdviseRead()
617 #*
618 sub AdviseRead {
619 }
620 
621 #** @method Geo::GDAL::RasterAttributeTable AttributeTable($AttributeTable)
622 # Object method.
623 # @param AttributeTable [optional] A Geo::GDAL::RasterAttributeTable object.
624 # @return a new Geo::GDAL::RasterAttributeTable object, whose data is
625 # contained within the band.
626 #*
627 sub AttributeTable {
628  my $self = shift;
629  SetDefaultRAT($self, $_[0]) if @_ and defined $_[0];
630  return unless defined wantarray;
631  my $r = GetDefaultRAT($self);
632  keep($r, $self) if $r;
633 }
634 
635 #** @method list BlockSize()
636 # Object method.
637 # A.k.a GetBlockSize
638 # @return The size of a preferred i/o raster block size as a list
639 # (width, height).
640 #*
641 sub BlockSize {
642 }
643 
644 #** @method list CategoryNames(@names)
645 # Object method.
646 # @param names [optional]
647 # @return
648 #*
649 sub CategoryNames {
650  my $self = shift;
651  SetRasterCategoryNames($self, \@_) if @_;
652  return unless defined wantarray;
653  my $n = GetRasterCategoryNames($self);
654  return @$n;
655 }
656 
657 #** @method scalar Checksum($xoff = 0, $yoff = 0, $xsize = undef, $ysize = undef)
658 # Object method.
659 # Computes a checksum from the raster or a part of it.
660 # @param xoff
661 # @param yoff
662 # @param xsize
663 # @param ysize
664 # @return the checksum.
665 #*
666 sub Checksum {
667 }
668 
669 #** @method hashref ClassCounts($classifier, $progress = undef, $progress_data = undef)
670 # Object method.
671 # Compute the counts of cell values or number of cell values in ranges.
672 # @note Classifier is required only for float bands.
673 # @note NoData values are counted similar to other values when
674 # classifier is not defined for integer rasters.
675 #
676 # @param classifier Anonymous array of format [ $comparison,
677 # $classifier ], where $comparison is a string '<', '<=', '>', or '>='
678 # and $classifier is an anonymous array of format [ $value,
679 # $value|$classifier, $value|$classifier ], where $value is a numeric
680 # value against which the reclassified value is compared to. If the
681 # comparison returns true, then the second $value or $classifier is
682 # applied, and if not then the third $value or $classifier.
683 #
684 # In the example below, the line is divided into ranges
685 # [-inf..3), [3..5), and [5..inf], i.e., three ranges with class
686 # indexes 0, 1, and 2. Note that the indexes are used as keys for
687 # class counts and not the class values (here 1.0, 2.0, and 3.0),
688 # which are used in Geo::GDAL::Band::Reclassify.
689 # \code
690 # $classifier = [ '<', [5.0, [3.0, 1.0, 2.0], 3.0] ];
691 # # Howto create this $classifier from @class_boundaries:
692 # my $classifier = ['<='];
693 # my $tree = [$class_boundaries[0], 0, 1];
694 # for my $i (1 .. $#class_boundaries) {
695 # $tree = [$class_boundaries[$i], [@$tree], $i+1];
696 # }
697 # push @$classifier, $tree;
698 # \endcode
699 # @return a reference to an anonymous hash, which contains the class
700 # values (indexes) as keys and the number of cells with that value or
701 # in that range as values. If the subroutine is user terminated an
702 # error is raised.
703 #*
704 sub ClassCounts {
705 }
706 
707 #** @method scalar ColorInterpretation($color_interpretation)
708 # Object method.
709 # @note a.k.a. GetRasterColorInterpretation and GetColorInterpretation
710 # (get only and returns an integer), SetRasterColorInterpretation and
711 # SetColorInterpretation (set only and requires an integer)
712 # @param color_interpretation [optional] new color interpretation, one
713 # of Geo::GDAL::Band::ColorInterpretations.
714 # @return The color interpretation of this band. One of Geo::GDAL::Band::ColorInterpretations.
715 #*
716 sub ColorInterpretation {
717  my($self, $ci) = @_;
718  if (defined $ci) {
719  $ci = s2i(color_interpretation => $ci);
720  SetRasterColorInterpretation($self, $ci);
721  }
722  return unless defined wantarray;
723  i2s(color_interpretation => GetRasterColorInterpretation($self));
724 }
725 
726 #** @method ColorInterpretations()
727 # Package subroutine.
728 # @return a list of types of color interpretation for raster
729 # bands. These are currently:
730 # AlphaBand, BlackBand, BlueBand, CyanBand, GrayIndex, GreenBand, HueBand, LightnessBand, MagentaBand, PaletteIndex, RedBand, SaturationBand, Undefined, YCbCr_CbBand, YCbCr_CrBand, YCbCr_YBand, and YellowBand.
731 #*
732 sub ColorInterpretations {
733  return @COLOR_INTERPRETATIONS;
734 }
735 
736 #** @method Geo::GDAL::ColorTable ColorTable($ColorTable)
737 # Object method.
738 # Get or set the color table of this band.
739 # @param ColorTable [optional] a Geo::GDAL::ColorTable object
740 # @return A new Geo::GDAL::ColorTable object which represents the
741 # internal color table associated with this band. Returns undef this
742 # band does not have an associated color table.
743 #*
744 sub ColorTable {
745  my $self = shift;
746  SetRasterColorTable($self, $_[0]) if @_ and defined $_[0];
747  return unless defined wantarray;
748  GetRasterColorTable($self);
749 }
750 
751 #** @method ComputeBandStats($samplestep = 1)
752 # Object method.
753 # @param samplestep the row increment in computing the statistics.
754 # @note Returns uncorrected sample standard deviation.
755 #
756 # See also Geo::GDAL::Band::ComputeStatistics.
757 # @return a list (mean, stddev).
758 #*
759 sub ComputeBandStats {
760 }
761 
762 #** @method ComputeRasterMinMax($approx_ok = 0)
763 # Object method.
764 # @return arrayref MinMax = [min, max]
765 #*
766 sub ComputeRasterMinMax {
767 }
768 
769 #** @method list ComputeStatistics($approx_ok, $progress = undef, $progress_data = undef)
770 # Object method.
771 # @param approx_ok Whether it is allowed to compute the statistics
772 # based on overviews or similar.
773 # @note Returns uncorrected sample standard deviation.
774 #
775 # See also Geo::GDAL::Band::ComputeBandStats.
776 # @return a list ($min, $max, $mean, $stddev).
777 #*
778 sub ComputeStatistics {
779 }
780 
781 #** @method Geo::OGR::Layer Contours($DataSource, hashref LayerConstructor, $ContourInterval, $ContourBase, arrayref FixedLevels, $NoDataValue, $IDField, $ElevField, coderef Progress, $ProgressData)
782 # Object method.
783 # Generate contours for this raster band. This method can also be used with named parameters.
784 # @note This method is a wrapper for ContourGenerate.
785 #
786 # An example:
787 # \code
788 # use Geo::GDAL;
789 # $dem = Geo::GDAL::Open('dem.gtiff');
790 # $contours = $dem->Band->Contours(ContourInterval => 10, ElevField => 'z');
791 # $n = $contours->GetFeatureCount;
792 # \endcode
793 #
794 # @param DataSource a Geo::OGR::DataSource object, default is a Memory data source
795 # @param LayerConstructor data for Geo::OGR::DataSource::CreateLayer, default is {Name => 'contours'}
796 # @param ContourInterval default is 100
797 # @param ContourBase default is 0
798 # @param FixedLevels a reference to a list of fixed contour levels, default is []
799 # @param NoDataValue default is undef
800 # @param IDField default is '', i.e., no field (the field is created if this is given)
801 # @param ElevField default is '', i.e., no field (the field is created if this is given)
802 # @param progress [optional] a reference to a subroutine, which will
803 # be called with parameters (number progress, string msg, progress_data)
804 # @param progress_data [optional]
805 # @return
806 #*
807 sub Contours {
808  my $self = shift;
809  my $p = named_parameters(\@_,
810  DataSource => undef,
811  LayerConstructor => {Name => 'contours'},
812  ContourInterval => 100,
813  ContourBase => 0,
814  FixedLevels => [],
815  NoDataValue => undef,
816  IDField => -1,
817  ElevField => -1,
818  Progress => undef,
819  ProgressData => undef);
820  $p->{datasource} //= Geo::OGR::GetDriver('Memory')->CreateDataSource('ds');
821  $p->{layerconstructor}->{Schema} //= {};
822  $p->{layerconstructor}->{Schema}{Fields} //= [];
823  my %fields;
824  unless ($p->{idfield} =~ /^[+-]?\d+$/ or $fields{$p->{idfield}}) {
825  push @{$p->{layerconstructor}->{Schema}{Fields}}, {Name => $p->{idfield}, Type => 'Integer'};
826  }
827  unless ($p->{elevfield} =~ /^[+-]?\d+$/ or $fields{$p->{elevfield}}) {
828  my $type = $self->DataType() =~ /Float/ ? 'Real' : 'Integer';
829  push @{$p->{layerconstructor}->{Schema}{Fields}}, {Name => $p->{elevfield}, Type => $type};
830  }
831  my $layer = $p->{datasource}->CreateLayer($p->{layerconstructor});
832  my $schema = $layer->GetLayerDefn;
833  for ('idfield', 'elevfield') {
834  $p->{$_} = $schema->GetFieldIndex($p->{$_}) unless $p->{$_} =~ /^[+-]?\d+$/;
835  }
836  $p->{progressdata} = 1 if $p->{progress} and not defined $p->{progressdata};
837  ContourGenerate($self, $p->{contourinterval}, $p->{contourbase}, $p->{fixedlevels},
838  $p->{nodatavalue}, $layer, $p->{idfield}, $p->{elevfield},
839  $p->{progress}, $p->{progressdata});
840  return $layer;
841 }
842 
843 #** @method CreateMaskBand(@flags)
844 # Object method.
845 # @note May invalidate any previous mask band obtained with Geo::GDAL::Band::GetMaskBand.
846 #
847 # @param flags one or more mask flags. The flags are Geo::GDAL::Band::MaskFlags.
848 #*
849 sub CreateMaskBand {
850  my $self = shift;
851  my $f = 0;
852  if (@_ and $_[0] =~ /^\d$/) {
853  $f = shift;
854  } else {
855  for my $flag (@_) {
856  carp "Unknown mask flag: '$flag'." unless $MASK_FLAGS{$flag};
857  $f |= $MASK_FLAGS{$flag};
858  }
859  }
860  $self->_CreateMaskBand($f);
861 }
862 
863 #** @method scalar DataType()
864 # Object method.
865 # @return The data type of this band. One of Geo::GDAL::DataTypes.
866 #*
867 sub DataType {
868  my $self = shift;
869  return i2s(data_type => $self->{DataType});
870 }
871 
872 #** @method Geo::GDAL::Dataset Dataset()
873 # Object method.
874 # @return The dataset which this band belongs to.
875 #*
876 sub Dataset {
877  my $self = shift;
878  parent($self);
879 }
880 
881 #** @method scalar DeleteNoDataValue()
882 # Object method.
883 #*
884 sub DeleteNoDataValue {
885 }
886 
887 #** @method Geo::GDAL::Band Distance(%params)
888 # Object method.
889 # Compute distances to specific cells of this raster.
890 # @param params Named parameters:
891 # - \a Distance A raster band, into which the distances are computed. If not given, a not given, a new in-memory raster band is created and returned. The data type of the raster can be given in the options.
892 # - \a Options Hash of options. Options are:
893 # - \a Values A list of cell values in this band to measure the distance from. If this option is not provided, the distance will be computed to non-zero pixel values. Currently pixel values are internally processed as integers.
894 # - \a DistUnits=PIXEL|GEO Indicates whether distances will be computed in cells or in georeferenced units. The default is pixel units. This also determines the interpretation of MaxDist.
895 # - \a MaxDist=n The maximum distance to search. Distances greater than this value will not be computed. Instead output cells will be set to a NoData value.
896 # - \a NoData=n The NoData value to use on the distance band for cells that are beyond MaxDist. If not provided, the distance band will be queried for a NoData value. If one is not found, 65535 will be used (255 if the type is Byte).
897 # - \a Use_Input_NoData=YES|NO If this option is set, the NoData value of this band will be respected. Leaving NoData cells in the input as NoData pixels in the distance raster.
898 # - \a Fixed_Buf_Val=n If this option is set, all cells within the MaxDist threshold are set to this value instead of the distance value.
899 # - \a DataType The data type for the result if it is not given.
900 # - \a Progress Progress function.
901 # - \a ProgressData Additional parameter for the progress function.
902 #
903 # @note This GDAL function behind this API is called GDALComputeProximity.
904 #
905 # @return The distance raster.
906 #*
907 sub Distance {
908  my $self = shift;
909  my $p = named_parameters(\@_, Distance => undef, Options => undef, Progress => undef, ProgressData => undef);
910  for my $key (keys %{$p->{options}}) {
911  $p->{options}{uc($key)} = $p->{options}{$key};
912  }
913  $p->{options}{TYPE} //= $p->{options}{DATATYPE} //= 'Float32';
914  unless ($p->{distance}) {
915  my ($w, $h) = $self->Size;
916  $p->{distance} = Geo::GDAL::Driver('MEM')->Create(Name => 'distance', Width => $w, Height => $h, Type => $p->{options}{TYPE})->Band;
917  }
918  Geo::GDAL::ComputeProximity($self, $p->{distance}, $p->{options}, $p->{progress}, $p->{progressdata});
919  return $p->{distance};
920 }
921 
922 #** @method Domains()
923 #*
924 sub Domains {
925  return @DOMAINS;
926 }
927 
928 #** @method Fill($real_part, $imag_part = 0.0)
929 # Object method.
930 # Fill the band with a constant value.
931 # @param real_part Real component of fill value.
932 # @param imag_part Imaginary component of fill value.
933 #
934 #*
935 sub Fill {
936 }
937 
938 #** @method FillNoData($mask, $max_search_dist, $smoothing_iterations, $options, coderef progress, $progress_data)
939 # Object method.
940 # Interpolate values for cells in this raster. The cells to fill
941 # should be marked in the mask band with zero.
942 #
943 # @param mask [optional] a mask band indicating cells to be interpolated (zero valued) (default is to get it with Geo::GDAL::Band::GetMaskBand).
944 # @param max_search_dist [optional] the maximum number of cells to
945 # search in all directions to find values to interpolate from (default is 10).
946 # @param smoothing_iterations [optional] the number of 3x3 smoothing filter passes to run (0 or more) (default is 0).
947 # @param options [optional] A reference to a hash. No options have been defined so far for this algorithm (default is {}).
948 # @param progress [optional] a reference to a subroutine, which will
949 # be called with parameters (number progress, string msg, progress_data) (default is undef).
950 # @param progress_data [optional] (default is undef).
951 #
952 # <a href="http://www.gdal.org/gdal__alg_8h.html">Documentation for GDAL algorithms</a>
953 #*
954 sub FillNoData {
955 }
956 
957 #** @method FlushCache()
958 # Object method.
959 # Write cached data to disk. There is usually no need to call this
960 # method.
961 #*
962 sub FlushCache {
963 }
964 
965 #** @method scalar GetBandNumber()
966 # Object method.
967 # @return The index of this band in the parent dataset list of bands.
968 #*
969 sub GetBandNumber {
970 }
971 
972 #** @method GetBlockSize()
973 #*
974 sub GetBlockSize {
975 }
976 
977 #** @method list GetDefaultHistogram($force = 1, coderef progress = undef, $progress_data = undef)
978 # Object method.
979 # @param force true to force the computation
980 # @param progress [optional] a reference to a subroutine, which will
981 # be called with parameters (number progress, string msg, progress_data)
982 # @param progress_data [optional]
983 # @note See Note in Geo::GDAL::Band::GetHistogram.
984 # @return a list: ($min, $max, arrayref histogram).
985 #*
986 sub GetDefaultHistogram {
987 }
988 
989 #** @method list GetHistogram(%parameters)
990 # Object method.
991 # Compute histogram from the raster.
992 # @param parameters Named parameters:
993 # - \a Min the lower bound, default is -0.5
994 # - \a Max the upper bound, default is 255.5
995 # - \a Buckets the number of buckets in the histogram, default is 256
996 # - \a IncludeOutOfRange whether to use the first and last values in the returned list
997 # for out of range values, default is false;
998 # the bucket size is (Max-Min) / Buckets if this is false and
999 # (Max-Min) / (Buckets-2) if this is true
1000 # - \a ApproxOK if histogram can be computed from overviews, default is false
1001 # - \a Progress an optional progress function, the default is undef
1002 # - \a ProgressData data for the progress function, the default is undef
1003 # @note Histogram counts are treated as strings in the bindings to be
1004 # able to use large integers (if GUIntBig is larger than Perl IV). In
1005 # practice this is only important if you have a 32 bit machine and
1006 # very large bucket counts. In those cases it may also be necessary to
1007 # use Math::BigInt.
1008 # @return a list which contains the count of values in each bucket
1009 #*
1010 sub GetHistogram {
1011  my $self = shift;
1012  my $p = named_parameters(\@_,
1013  Min => -0.5,
1014  Max => 255.5,
1015  Buckets => 256,
1016  IncludeOutOfRange => 0,
1017  ApproxOK => 0,
1018  Progress => undef,
1019  ProgressData => undef);
1020  $p->{progressdata} = 1 if $p->{progress} and not defined $p->{progressdata};
1021  _GetHistogram($self, $p->{min}, $p->{max}, $p->{buckets},
1022  $p->{includeoutofrange}, $p->{approxok},
1023  $p->{progress}, $p->{progressdata});
1024 }
1025 
1026 #** @method Geo::GDAL::Band GetMaskBand()
1027 # Object method.
1028 # @return the mask band associated with this
1029 # band.
1030 #*
1031 sub GetMaskBand {
1032  my $self = shift;
1033  my $band = _GetMaskBand($self);
1034  keep($band, $self);
1035 }
1036 
1037 #** @method list GetMaskFlags()
1038 # Object method.
1039 # @return the mask flags of the mask band associated with this
1040 # band. The flags are one or more of Geo::GDAL::Band::MaskFlags.
1041 #*
1042 sub GetMaskFlags {
1043  my $self = shift;
1044  my $f = $self->_GetMaskFlags;
1045  my @f;
1046  for my $flag (keys %MASK_FLAGS) {
1047  push @f, $flag if $f & $MASK_FLAGS{$flag};
1048  }
1049  return wantarray ? @f : $f;
1050 }
1051 
1052 #** @method scalar GetMaximum()
1053 # Object method.
1054 # @note Call Geo::GDAL::Band::ComputeStatistics before calling
1055 # GetMaximum to make sure the value is computed.
1056 #
1057 # @return statistical minimum of the band or undef if statistics are
1058 # not kept or computed in scalar context. In list context returns the
1059 # maximum value or a (kind of) maximum value supported by the data
1060 # type and a boolean value, which indicates which is the case (true is
1061 # first, false is second).
1062 #*
1063 sub GetMaximum {
1064 }
1065 
1066 #** @method scalar GetMinimum()
1067 # Object method.
1068 # @note Call Geo::GDAL::Band::ComputeStatistics before calling
1069 # GetMinimum to make sure the value is computed.
1070 #
1071 # @return statistical minimum of the band or undef if statistics are
1072 # not kept or computed in scalar context. In list context returns the
1073 # minimum value or a (kind of) minimum value supported by the data
1074 # type and a boolean value, which indicates which is the case (true is
1075 # first, false is second).
1076 #*
1077 sub GetMinimum {
1078 }
1079 
1080 #** @method Geo::GDAL::Band GetOverview($index)
1081 # Object method.
1082 # @param index 0..GetOverviewCount-1
1083 # @return a Geo::GDAL::Band object, which represents the internal
1084 # overview band, or undef. if the index is out of bounds.
1085 #*
1086 sub GetOverview {
1087  my ($self, $index) = @_;
1088  my $band = _GetOverview($self, $index);
1089  keep($band, $self);
1090 }
1091 
1092 #** @method scalar GetOverviewCount()
1093 # Object method.
1094 # @return the number of overviews available of the band.
1095 #*
1096 sub GetOverviewCount {
1097 }
1098 
1099 #** @method list GetStatistics($approx_ok, $force)
1100 # Object method.
1101 # @param approx_ok Whether it is allowed to compute the statistics
1102 # based on overviews or similar.
1103 # @param force Whether to force scanning of the whole raster.
1104 # @note Uses Geo::GDAL::Band::ComputeStatistics internally.
1105 #
1106 # @return a list ($min, $max, $mean, $stddev).
1107 #*
1108 sub GetStatistics {
1109 }
1110 
1111 #** @method HasArbitraryOverviews()
1112 # Object method.
1113 # @return true or false.
1114 #*
1115 sub HasArbitraryOverviews {
1116 }
1117 
1118 #** @method list MaskFlags()
1119 # Package subroutine.
1120 # @return the list of mask flags. These are
1121 # - \a AllValid: There are no invalid cell, all mask values will be 255.
1122 # When used this will normally be the only flag set.
1123 # - \a PerDataset: The mask band is shared between all bands on the dataset.
1124 # - \a Alpha: The mask band is actually an alpha band and may have values
1125 # other than 0 and 255.
1126 # - \a NoData: Indicates the mask is actually being generated from NoData values.
1127 # (mutually exclusive of Alpha).
1128 #*
1129 sub MaskFlags {
1130  my @f = sort {$MASK_FLAGS{$a} <=> $MASK_FLAGS{$b}} keys %MASK_FLAGS;
1131  return @f;
1132 }
1133 
1134 #** @method scalar NoDataValue($NoDataValue)
1135 # Object method.
1136 # Get or set the "no data" value.
1137 # @param NoDataValue [optional]
1138 # @note $band->NoDataValue(undef) sets the NoData value to the
1139 # Posix floating point maximum. Use Geo::GDAL::Band::DeleteNoDataValue
1140 # to stop this band using a NoData value.
1141 # @return The NoData value or undef in scalar context. An undef
1142 # value indicates that there is no NoData value associated with this
1143 # band.
1144 #*
1145 sub NoDataValue {
1146  my $self = shift;
1147  if (@_ > 0) {
1148  if (defined $_[0]) {
1149  SetNoDataValue($self, $_[0]);
1150  } else {
1151  SetNoDataValue($self, POSIX::FLT_MAX); # hopefully an "out of range" value
1152  }
1153  }
1154  GetNoDataValue($self);
1155 }
1156 
1157 #** @method scalar PackCharacter()
1158 # Object method.
1159 # @return The character to use in Perl pack and unpack for the data of this band.
1160 #*
1161 sub PackCharacter {
1162  my $self = shift;
1163  return Geo::GDAL::PackCharacter($self->DataType);
1164 }
1165 
1166 #** @method Piddle($piddle, $xoff = 0, $yoff = 0, $xsize = <width>, $ysize = <height>, $xdim, $ydim)
1167 # Object method.
1168 # Read or write band data from/into a piddle.
1169 #
1170 # \note The PDL module must be available for this method to work. Also, you
1171 # should 'use PDL' in the code that you use this method.
1172 #
1173 # @param piddle [only when writing] The piddle from which to read the data to be written into the band.
1174 # @param xoff, yoff The offset for data in the band, default is top left (0, 0).
1175 # @param xsize, ysize [optional] The size of the window in the band.
1176 # @param xdim, ydim [optional, only when reading from a band] The size of the piddle to create.
1177 # @return A new piddle when reading from a band (no not use when writing into a band).
1178 #*
1179 sub Piddle {
1180  # TODO: add Piddle sub to dataset too to make Width x Height x Bands piddles
1181  error("PDL is not available.") unless $Geo::GDAL::HAVE_PDL;
1182  my $self = shift;
1183  my $t = $self->{DataType};
1184  unless (defined wantarray) {
1185  my $pdl = shift;
1186  error("The datatype of the Piddle and the band do not match.")
1187  unless $PDL2DATATYPE{$pdl->get_datatype} == $t;
1188  my ($xoff, $yoff, $xsize, $ysize) = @_;
1189  $xoff //= 0;
1190  $yoff //= 0;
1191  my $data = $pdl->get_dataref();
1192  my ($xdim, $ydim) = $pdl->dims();
1193  if ($xdim > $self->{XSize} - $xoff) {
1194  warn "Piddle XSize too large ($xdim) for this raster band (width = $self->{XSize}, offset = $xoff).";
1195  $xdim = $self->{XSize} - $xoff;
1196  }
1197  if ($ydim > $self->{YSize} - $yoff) {
1198  $ydim = $self->{YSize} - $yoff;
1199  warn "Piddle YSize too large ($ydim) for this raster band (height = $self->{YSize}, offset = $yoff).";
1200  }
1201  $xsize //= $xdim;
1202  $ysize //= $ydim;
1203  $self->_WriteRaster($xoff, $yoff, $xsize, $ysize, $data, $xdim, $ydim, $t, 0, 0);
1204  return;
1205  }
1206  my ($xoff, $yoff, $xsize, $ysize, $xdim, $ydim, $alg) = @_;
1207  $xoff //= 0;
1208  $yoff //= 0;
1209  $xsize //= $self->{XSize} - $xoff;
1210  $ysize //= $self->{YSize} - $yoff;
1211  $xdim //= $xsize;
1212  $ydim //= $ysize;
1213  $alg //= 'NearestNeighbour';
1214  $alg = s2i(rio_resampling => $alg);
1215  my $buf = $self->_ReadRaster($xoff, $yoff, $xsize, $ysize, $xdim, $ydim, $t, 0, 0, $alg);
1216  my $pdl = PDL->new;
1217  my $datatype = $DATATYPE2PDL{$t};
1218  error("The band datatype is not supported by PDL.") if $datatype < 0;
1219  $pdl->set_datatype($datatype);
1220  $pdl->setdims([$xdim, $ydim]);
1221  my $data = $pdl->get_dataref();
1222  $$data = $buf;
1223  $pdl->upd_data;
1224  # FIXME: we want approximate equality since no data value can be very large floating point value
1225  my $bad = GetNoDataValue($self);
1226  return $pdl->setbadif($pdl == $bad) if defined $bad;
1227  return $pdl;
1228 }
1229 
1230 #** @method Geo::OGR::Layer Polygonize(%params)
1231 # Object method.
1232 # Polygonize this raster band.
1233 #
1234 # @param params Named parameters:
1235 # - \a Mask A raster band, which is used as a mask to select polygonized areas. Default is undef.
1236 # - \a OutLayer A vector layer into which the polygons are written. If not given, an in-memory layer 'polygonized' is created and returned.
1237 # - \a PixValField The name of the field in the output layer into which the cell value of the polygon area is stored. Default is 'val'.
1238 # - \a Options Hash or list of options. Connectedness can be set to 8
1239 # to use 8-connectedness, otherwise 4-connectedness is
1240 # used. ForceIntPixel can be set to 1 to force using a 32 bit int buffer
1241 # for cell values in the process. If this is not set and the data type
1242 # of this raster does not fit into a 32 bit int buffer, a 32 bit float
1243 # buffer is used.
1244 # - \a Progress Progress function.
1245 # - \a ProgressData Additional parameter for the progress function.
1246 #
1247 # @return Output vector layer.
1248 #*
1249 sub Polygonize {
1250  my $self = shift;
1251  my $p = named_parameters(\@_, Mask => undef, OutLayer => undef, PixValField => 'val', Options => undef, Progress => undef, ProgressData => undef);
1252  my %known_options = (Connectedness => 1, ForceIntPixel => 1, DATASET_FOR_GEOREF => 1, '8CONNECTED' => 1);
1253  for my $option (keys %{$p->{options}}) {
1254  error(1, $option, \%known_options) unless exists $known_options{$option};
1255  }
1256  my $dt = $self->DataType;
1257  my %leInt32 = (Byte => 1, Int16 => 1, Int32 => 1, UInt16 => 1);
1258  my $leInt32 = $leInt32{$dt};
1259  $dt = $dt =~ /Float/ ? 'Real' : 'Integer';
1260  $p->{outlayer} //= Geo::OGR::Driver('Memory')->Create()->
1261  CreateLayer(Name => 'polygonized',
1262  Fields => [{Name => 'val', Type => $dt},
1263  {Name => 'geom', Type => 'Polygon'}]);
1264  $p->{pixvalfield} = $p->{outlayer}->GetLayerDefn->GetFieldIndex($p->{pixvalfield});
1265  $p->{options}{'8CONNECTED'} = 1 if $p->{options}{Connectedness} && $p->{options}{Connectedness} == 8;
1266  if ($leInt32 || $p->{options}{ForceIntPixel}) {
1267  Geo::GDAL::_Polygonize($self, $p->{mask}, $p->{outlayer}, $p->{pixvalfield}, $p->{options}, $p->{progress}, $p->{progressdata});
1268  } else {
1269  Geo::GDAL::FPolygonize($self, $p->{mask}, $p->{outlayer}, $p->{pixvalfield}, $p->{options}, $p->{progress}, $p->{progressdata});
1270  }
1271  set the srs of the outlayer if it was created here
1272  return $p->{outlayer};
1273 }
1274 
1275 #** @method RasterAttributeTable()
1276 #*
1277 sub RasterAttributeTable {
1278 }
1279 
1280 #** @method scalar ReadRaster(%params)
1281 # Object method.
1282 # Read data from the band.
1283 #
1284 # @param params Named parameters:
1285 # - \a XOff x offset (cell coordinates) (default is 0)
1286 # - \a YOff y offset (cell coordinates) (default is 0)
1287 # - \a XSize width of the area to read (default is the width of the band)
1288 # - \a YSize height of the area to read (default is the height of the band)
1289 # - \a BufXSize (default is undef, i.e., the same as XSize)
1290 # - \a BufYSize (default is undef, i.e., the same as YSize)
1291 # - \a BufType data type of the buffer (default is the data type of the band)
1292 # - \a BufPixelSpace (default is 0)
1293 # - \a BufLineSpace (default is 0)
1294 # - \a ResampleAlg one of Geo::GDAL::RIOResamplingTypes (default is 'NearestNeighbour'),
1295 # - \a Progress reference to a progress function (default is undef)
1296 # - \a ProgressData (default is undef)
1297 #
1298 # <a href="http://www.gdal.org/classGDALDataset.html">Entry in GDAL docs (method RasterIO)</a>
1299 # @return a buffer, open the buffer with \a unpack function of Perl. See Geo::GDAL::Band::PackCharacter.
1300 #*
1301 sub ReadRaster {
1302  my $self = shift;
1303  my ($width, $height) = $self->Size;
1304  my ($type) = $self->DataType;
1305  my $p = named_parameters(\@_,
1306  XOff => 0,
1307  YOff => 0,
1308  XSize => $width,
1309  YSize => $height,
1310  BufXSize => undef,
1311  BufYSize => undef,
1312  BufType => $type,
1313  BufPixelSpace => 0,
1314  BufLineSpace => 0,
1315  ResampleAlg => 'NearestNeighbour',
1316  Progress => undef,
1317  ProgressData => undef
1318  );
1319  $p->{resamplealg} = s2i(rio_resampling => $p->{resamplealg});
1320  $p->{buftype} = s2i(data_type => $p->{buftype}, 1);
1321  $self->_ReadRaster($p->{xoff},$p->{yoff},$p->{xsize},$p->{ysize},$p->{bufxsize},$p->{bufysize},$p->{buftype},$p->{bufpixelspace},$p->{buflinespace},$p->{resamplealg},$p->{progress},$p->{progressdata});
1322 }
1323 
1324 #** @method array reference ReadTile($xoff = 0, $yoff = 0, $xsize = <width>, $ysize = <height>)
1325 # Object method.
1326 # Read band data into a Perl array.
1327 #
1328 # \note Accessing band data in this way is slow. Consider using PDL and Geo::GDAL::Band::Piddle.
1329 #
1330 # Usage example (print the data from a band):
1331 # \code
1332 # print "@$_\n" for ( @{ $band->ReadTile() } );
1333 # \endcode
1334 # Another usage example (process the data of a large dataset that has one band):
1335 # \code
1336 # my($W,$H) = $dataset->Band()->Size();
1337 # my($xoff,$yoff,$w,$h) = (0,0,200,200);
1338 # while (1) {
1339 # if ($xoff >= $W) {
1340 # $xoff = 0;
1341 # $yoff += $h;
1342 # last if $yoff >= $H;
1343 # }
1344 # my $data = $dataset->Band(1)->ReadTile($xoff,$yoff,min($W-$xoff,$w),min($H-$yoff,$h));
1345 # # add your data processing code here
1346 # $dataset->Band(1)->WriteTile($data,$xoff,$yoff);
1347 # $xoff += $w;
1348 # }
1349 #
1350 # sub min {
1351 # return $_[0] < $_[1] ? $_[0] : $_[1];
1352 # }
1353 # \endcode
1354 # @param xoff Number of cell to skip before starting to read from a row. Pixels are read from left to right.
1355 # @param yoff Number of cells to skip before starting to read from a column. Pixels are read from top to bottom.
1356 # @param xsize Number of cells to read from each row.
1357 # @param ysize Number of cells to read from each column.
1358 # @return a two-dimensional Perl array, organizes as data->[y][x], y =
1359 # 0..height-1, x = 0..width-1. I.e., y is row and x is column.
1360 #*
1361 sub ReadTile {
1362  my($self, $xoff, $yoff, $xsize, $ysize, $w_tile, $h_tile, $alg) = @_;
1363  $xoff //= 0;
1364  $yoff //= 0;
1365  $xsize //= $self->{XSize} - $xoff;
1366  $ysize //= $self->{YSize} - $yoff;
1367  $w_tile //= $xsize;
1368  $h_tile //= $ysize;
1369  $alg //= 'NearestNeighbour';
1370  $alg = s2i(rio_resampling => $alg);
1371  my $t = $self->{DataType};
1372  my $buf = $self->_ReadRaster($xoff, $yoff, $xsize, $ysize, $w_tile, $h_tile, $t, 0, 0, $alg);
1373  my $pc = Geo::GDAL::PackCharacter($t);
1374  my $w = $w_tile * Geo::GDAL::GetDataTypeSize($t)/8;
1375  my $offset = 0;
1376  my @data;
1377  for my $y (0..$h_tile-1) {
1378  my @d = unpack($pc."[$w_tile]", substr($buf, $offset, $w));
1379  push @data, \@d;
1380  $offset += $w;
1381  }
1382  return \@data;
1383 }
1384 
1385 #** @method Reclassify($classifier, $progress = undef, $progress_data = undef)
1386 # Object method.
1387 # Reclassify the cells in the band.
1388 # @note NoData values in integer rasters are reclassified if
1389 # explicitly specified in the hash classifier. However, they are not
1390 # reclassified to the default value, if one is specified. In real
1391 # valued rasters nodata cells are not reclassified.
1392 # @note If the subroutine is user terminated or the classifier is
1393 # incorrect, already reclassified cells will stay reclassified but an
1394 # error is raised.
1395 # @param classifier For integer rasters an anonymous hash, which
1396 # contains old class values as keys and new class values as values, or
1397 # an array classifier as in Geo::GDAL::Band::ClassCounts. In a hash
1398 # classifier a special key '*' (star) can be used as default, to act
1399 # as a fallback new class value. For real valued rasters the
1400 # classifier is as in Geo::GDAL::Band::ClassCounts.
1401 #*
1402 sub Reclassify {
1403 }
1404 
1405 #** @method RegenerateOverview(Geo::GDAL::Band overview, $resampling, coderef progress, $progress_data)
1406 # Object method.
1407 # @param overview a Geo::GDAL::Band object for the overview.
1408 # @param resampling [optional] the resampling method (one of Geo::GDAL::RIOResamplingTypes) (default is Average).
1409 # @param progress [optional] a reference to a subroutine, which will
1410 # be called with parameters (number progress, string msg, progress_data)
1411 # @param progress_data [optional]
1412 #*
1413 sub RegenerateOverview {
1414  my $self = shift;
1415  #Geo::GDAL::Band overview, scalar resampling, subref callback, scalar callback_data
1416  my @p = @_;
1417  Geo::GDAL::RegenerateOverview($self, @p);
1418 }
1419 
1420 #** @method RegenerateOverviews(arrayref overviews, $resampling, coderef progress, $progress_data)
1421 # Object method.
1422 # @todo This is not yet available
1423 #
1424 # @param overviews a list of Geo::GDAL::Band objects for the overviews.
1425 # @param resampling [optional] the resampling method (one of Geo::GDAL::RIOResamplingTypes) (default is Average).
1426 # @param progress [optional] a reference to a subroutine, which will
1427 # be called with parameters (number progress, string msg, progress_data)
1428 # @param progress_data [optional]
1429 #*
1430 sub RegenerateOverviews {
1431  my $self = shift;
1432  #arrayref overviews, scalar resampling, subref callback, scalar callback_data
1433  my @p = @_;
1434  Geo::GDAL::RegenerateOverviews($self, @p);
1435 }
1436 
1437 #** @method ScaleAndOffset($scale, $offset)
1438 # Object method.
1439 # Scale and offset are used to transform raw cell values into the
1440 # units returned by GetUnits(). The conversion function is:
1441 # \code
1442 # Units value = (raw value * scale) + offset
1443 # \endcode
1444 # @return a list ($scale, $offset), the values are undefined if they
1445 # are not set.
1446 # @since version 1.9 of the bindings.
1447 #*
1448 sub ScaleAndOffset {
1449  my $self = shift;
1450  SetScale($self, $_[0]) if @_ > 0 and defined $_[0];
1451  SetOffset($self, $_[1]) if @_ > 1 and defined $_[1];
1452  return unless defined wantarray;
1453  my $scale = GetScale($self);
1454  my $offset = GetOffset($self);
1455  return ($scale, $offset);
1456 }
1457 
1458 #** @method list SetDefaultHistogram($min, $max, $histogram)
1459 # Object method.
1460 # @param min
1461 # @param max
1462 # @note See Note in Geo::GDAL::Band::GetHistogram.
1463 # @param histogram reference to an array containing the histogram
1464 #*
1465 sub SetDefaultHistogram {
1467 
1468 #** @method SetStatistics($min, $max, $mean, $stddev)
1469 # Object method.
1470 # Save the statistics of the band if possible (the format can save
1471 # arbitrary metadata).
1472 # @param min
1473 # @param max
1474 # @param mean
1475 # @param stddev
1476 #*
1477 sub SetStatistics {
1478 }
1479 
1480 #** @method Geo::GDAL::Band Sieve(%params)
1481 # Object method.
1482 # Remove small areas by merging them into the largest neighbour area.
1483 # @param params Named parameters:
1484 # - \a Mask A raster band, which is used as a mask to select sieved areas. Default is undef.
1485 # - \a Dest A raster band into which the result is written. If not given, an new in-memory raster band is created and returned.
1486 # - \a Threshold The smallest area size (in number of cells) which are not sieved away.
1487 # - \a Options Hash or list of options. {Connectedness => 4} can be specified to use 4-connectedness, otherwise 8-connectedness is used.
1488 # - \a Progress Progress function.
1489 # - \a ProgressData Additional parameter for the progress function.
1490 #
1491 # @return The filtered raster band.
1492 #*
1493 sub Sieve {
1494  my $self = shift;
1495  my $p = named_parameters(\@_, Mask => undef, Dest => undef, Threshold => 10, Options => undef, Progress => undef, ProgressData => undef);
1496  unless ($p->{dest}) {
1497  my ($w, $h) = $self->Size;
1498  $p->{dest} = Geo::GDAL::Driver('MEM')->Create(Name => 'sieved', Width => $w, Height => $h, Type => $self->DataType)->Band;
1499  }
1500  my $c = 8;
1501  if ($p->{options}{Connectedness}) {
1502  $c = $p->{options}{Connectedness};
1503  delete $p->{options}{Connectedness};
1504  }
1505  Geo::GDAL::SieveFilter($self, $p->{mask}, $p->{dest}, $p->{threshold}, $c, $p->{options}, $p->{progress}, $p->{progressdata});
1506  return $p->{dest};
1507 }
1508 
1509 #** @method list Size()
1510 # Object method.
1511 # @return The size of the band as a list (width, height).
1512 #*
1513 sub Size {
1514  my $self = shift;
1515  return ($self->{XSize}, $self->{YSize});
1516 }
1517 
1518 #** @method Unit($type)
1519 # Object method.
1520 # @param type [optional] the unit (a string).
1521 # @note $band->Unit(undef) sets the unit value to an empty string.
1522 # @return the unit (a string).
1523 # @since version 1.9 of the bindings.
1524 #*
1525 sub Unit {
1526  my $self = shift;
1527  if (@_ > 0) {
1528  my $unit = shift;
1529  $unit //= '';
1530  SetUnitType($self, $unit);
1531  }
1532  return unless defined wantarray;
1533  GetUnitType($self);
1534 }
1535 
1536 #** @method WriteRaster(%params)
1537 # Object method.
1538 # Write data into the band.
1539 #
1540 # @param params Named parameters:
1541 # - \a XOff x offset (cell coordinates) (default is 0)
1542 # - \a YOff y offset (cell coordinates) (default is 0)
1543 # - \a XSize width of the area to write (default is the width of the band)
1544 # - \a YSize height of the area to write (default is the height of the band)
1545 # - \a Buf a buffer (or a reference to a buffer) containing the data. Create the buffer with \a pack function of Perl. See Geo::GDAL::Band::PackCharacter.
1546 # - \a BufXSize (default is undef, i.e., the same as XSize)
1547 # - \a BufYSize (default is undef, i.e., the same as YSize)
1548 # - \a BufType data type of the buffer (default is the data type of the band)
1549 # - \a BufPixelSpace (default is 0)
1550 # - \a BufLineSpace (default is 0)
1551 #
1552 # <a href="http://www.gdal.org/classGDALDataset.html">Entry in GDAL docs (method RasterIO)</a>
1553 #*
1554 sub WriteRaster {
1555  my $self = shift;
1556  my ($width, $height) = $self->Size;
1557  my ($type) = $self->DataType;
1558  my $p = named_parameters(\@_,
1559  XOff => 0,
1560  YOff => 0,
1561  XSize => $width,
1562  YSize => $height,
1563  Buf => undef,
1564  BufXSize => undef,
1565  BufYSize => undef,
1566  BufType => $type,
1567  BufPixelSpace => 0,
1568  BufLineSpace => 0
1569  );
1570  confess "Usage: \$band->WriteRaster( Buf => \$data, ... )" unless defined $p->{buf};
1571  $p->{buftype} = s2i(data_type => $p->{buftype}, 1);
1572  $self->_WriteRaster($p->{xoff},$p->{yoff},$p->{xsize},$p->{ysize},$p->{buf},$p->{bufxsize},$p->{bufysize},$p->{buftype},$p->{bufpixelspace},$p->{buflinespace});
1573 }
1574 
1575 #** @method WriteTile($data, $xoff = 0, $yoff = 0)
1576 # Object method.
1577 # Write band data from a Perl array.
1578 #
1579 # \note Accessing band data in this way is slow. Consider using PDL and Geo::GDAL::Band::Piddle.
1580 #
1581 # @param data A two-dimensional Perl array, organizes as data->[y][x], y =
1582 # 0..height-1, x = 0..width-1.
1583 # @param xoff
1584 # @param yoff
1585 #
1586 #*
1587 sub WriteTile {
1588  my($self, $data, $xoff, $yoff) = @_;
1589  $xoff //= 0;
1590  $yoff //= 0;
1591  error('The data must be in a two-dimensional array') unless ref $data eq 'ARRAY' && ref $data->[0] eq 'ARRAY';
1592  my $xsize = @{$data->[0]};
1593  if ($xsize > $self->{XSize} - $xoff) {
1594  warn "Buffer XSize too large ($xsize) for this raster band (width = $self->{XSize}, offset = $xoff).";
1595  $xsize = $self->{XSize} - $xoff;
1596  }
1597  my $ysize = @{$data};
1598  if ($ysize > $self->{YSize} - $yoff) {
1599  $ysize = $self->{YSize} - $yoff;
1600  warn "Buffer YSize too large ($ysize) for this raster band (height = $self->{YSize}, offset = $yoff).";
1601  }
1602  my $pc = Geo::GDAL::PackCharacter($self->{DataType});
1603  for my $i (0..$ysize-1) {
1604  my $scanline = pack($pc."[$xsize]", @{$data->[$i]});
1605  $self->WriteRaster( $xoff, $yoff+$i, $xsize, 1, $scanline );
1606  }
1607 }
1608 
1609 #** @class Geo::GDAL::ColorTable
1610 # @brief A color table from a raster band or a color table, which can be used for a band.
1611 # @details
1612 #*
1613 package Geo::GDAL::ColorTable;
1614 
1615 use base qw(Geo::GDAL)
1616 
1617 #** @method Geo::GDAL::ColorTable Clone()
1618 # Object method.
1619 # Clone an existing color table.
1620 # @return a new Geo::GDAL::ColorTable object
1621 #*
1622 sub Clone {
1623 }
1624 
1625 #** @method list Color($index, @color)
1626 # Object method.
1627 # Get or set a color in this color table.
1628 # @param index The index of the color in the table. Note that the
1629 # color table may expand if the index is larger than the current max
1630 # index of this table and a color is given. An attempt to retrieve a
1631 # color out of the current size of the table causes an error.
1632 # @param color [optional] The color, either a list or a reference to a
1633 # list. If the list is too short or has undef values, the undef values
1634 # are taken as 0 except for alpha, which is taken as 255.
1635 # @note A color is an array of four integers having a value between 0
1636 # and 255: (gray, red, cyan or hue; green, magenta, or lightness;
1637 # blue, yellow, or saturation; alpha or blackband)
1638 # @return A color, in list context a list and in scalar context a reference to an anonymous array.
1639 #*
1640 sub Color {
1641 }
1642 
1643 #** @method list Colors(@colors)
1644 # Object method.
1645 # Get or set the colors in this color table.
1646 # @note The color table will expand to the size of the input list but
1647 # it will not shrink.
1648 # @param colors [optional] A list of all colors (a list of lists) for this color table.
1649 # @return A list of colors (a list of lists).
1650 #*
1651 sub Colors {
1652 }
1653 
1654 #** @method CreateColorRamp($start_index, arrayref start_color, $end_index, arrayref end_color)
1655 # Object method.
1656 # @param start_index
1657 # @param start_color
1658 # @param end_index
1659 # @param end_color
1660 #*
1661 sub CreateColorRamp {
1662 }
1663 
1664 #** @method scalar GetCount()
1665 # Object method.
1666 # @return The number of colors in this color table.
1667 #*
1668 sub GetCount {
1669 }
1670 
1671 #** @method scalar GetPaletteInterpretation()
1672 # Object method.
1673 # @return palette interpretation (string)
1674 #*
1675 sub GetPaletteInterpretation {
1676  my $self = shift;
1677  return i2s(palette_interpretation => GetPaletteInterpretation($self));
1678 }
1679 
1680 #** @method Geo::GDAL::ColorTable new($GDALPaletteInterp = 'RGB')
1681 # Class method.
1682 # Create a new empty color table.
1683 # @return a new Geo::GDAL::ColorTable object
1684 #*
1685 sub new {
1686  my($pkg, $pi) = @_;
1687  $pi //= 'RGB';
1688  $pi = s2i(palette_interpretation => $pi);
1689  my $self = Geo::GDALc::new_ColorTable($pi);
1690  bless $self, $pkg if defined($self);
1691 }
1692 
1693 #** @class Geo::GDAL::Dataset
1694 # @brief A set of associated raster bands or vector layer source.
1695 # @details
1696 #*
1697 package Geo::GDAL::Dataset;
1698 
1699 use base qw(Geo::GDAL::MajorObject Geo::GDAL)
1700 
1701 #** @attr $RasterCount
1702 # scalar (access as $dataset->{RasterCount})
1703 #*
1704 
1705 #** @attr $RasterXSize
1706 # scalar (access as $dataset->{RasterXSize})
1707 #*
1708 
1709 #** @attr $RasterYSize
1710 # scalar (access as $dataset->{RasterYSize})
1711 #*
1712 
1713 #** @method AddBand($datatype = 'Byte', hashref options = {})
1714 # Object method.
1715 # Add a new band to the dataset. The driver must support the action.
1716 # @param datatype GDAL raster cell data type (one of those listed by Geo::GDAL::DataTypes).
1717 # @param options reference to a hash of format specific options.
1718 # @return The added band.
1719 #*
1720 sub AddBand {
1721  my ($self, $type, $options) = @_;
1722  $type //= 'Byte';
1723  $type = s2i(data_type => $type);
1724  $self->_AddBand($type, $options);
1725  return unless defined wantarray;
1726  return $self->GetRasterBand($self->{RasterCount});
1727 }
1728 
1729 #** @method AdviseRead()
1730 #*
1731 sub AdviseRead {
1732 }
1733 
1734 #** @method Geo::GDAL::Band Band($index)
1735 # Object method.
1736 # Create a band object for the band within the dataset.
1737 # @note a.k.a. GetRasterBand
1738 # @param index 1...RasterCount, default is 1.
1739 # @return a new Geo::GDAL::Band object
1740 #*
1741 sub Band {
1742 }
1743 
1744 #** @method list Bands()
1745 # Object method.
1746 # @return a list of new Geo::GDAL::Band objects
1747 #*
1748 sub Bands {
1749  my $self = shift;
1750  my @bands;
1751  for my $i (1..$self->{RasterCount}) {
1752  push @bands, GetRasterBand($self, $i);
1753  }
1754  return @bands;
1755 }
1756 
1757 #** @method BuildOverviews($resampling, arrayref overviews, coderef progress, $progress_data)
1758 # Object method.
1759 # @param resampling the resampling method, one of Geo::GDAL::RIOResamplingTypes.
1760 # @param overviews The list of overview decimation factors to
1761 # build. For example [2,4,8].
1762 # @param progress [optional] a reference to a subroutine, which will
1763 # be called with parameters (number progress, string msg, progress_data)
1764 # @param progress_data [optional]
1765 #*
1766 sub BuildOverviews {
1767  my $self = shift;
1768  my @p = @_;
1769  $p[0] = uc($p[0]) if $p[0];
1770  eval {
1771  $self->_BuildOverviews(@p);
1772  };
1773  confess(last_error()) if $@;
1774 }
1775 
1776 #** @method Geo::GDAL::Dataset BuildVRT($Dest, arrayref Sources, hashref Options, coderef progress, $progress_data)
1777 # Object method.
1778 # Build a virtual dataset from a set of datasets.
1779 # @param Dest Destination raster dataset definition string (typically
1780 # filename), or an object, which implements write and close.
1781 # @param Sources A list of filenames of input datasets or a list of
1782 # dataset objects.
1783 # @param Options See section \ref index_processing_options.
1784 # @return Dataset object
1785 #
1786 # @note This subroutine is imported into the main namespace if Geo::GDAL
1787 # is use'd with qw/:all/.
1788 #*
1789 sub BuildVRT {
1790  my ($dest, $sources, $options, $progress, $progress_data) = @_;
1791  $options = Geo::GDAL::GDALBuildVRTOptions->new(make_processing_options($options));
1792  error("Usage: Geo::GDAL::DataSet::BuildVRT(\$vrt_file_name, \\\@sources)")
1793  unless ref $sources eq 'ARRAY' && defined $sources->[0];
1794  unless (blessed($dest)) {
1795  if (blessed($sources->[0])) {
1796  return Geo::GDAL::wrapper_GDALBuildVRT_objects($dest, $sources, $options, $progress, $progress_data);
1797  } else {
1798  return Geo::GDAL::wrapper_GDALBuildVRT_names($dest, $sources, $options, $progress, $progress_data);
1799  }
1800  } else {
1801  if (blessed($sources->[0])) {
1802  return stdout_redirection_wrapper(
1803  $sources, $dest,
1804  \&Geo::GDAL::wrapper_GDALBuildVRT_objects,
1805  $options, $progress, $progress_data);
1806  } else {
1807  return stdout_redirection_wrapper(
1808  $sources, $dest,
1809  \&Geo::GDAL::wrapper_GDALBuildVRT_names,
1810  $options, $progress, $progress_data);
1811  }
1812  }
1813 }
1814 
1815 #** @method CommitTransaction()
1816 #*
1817 sub CommitTransaction {
1818 }
1819 
1820 #** @method Geo::GDAL::ColorTable ComputeColorTable(%params)
1821 # Object method.
1822 # Compute a color table from an RGB image
1823 # @param params Named parameters:
1824 # - \a Red The red band, the default is to use the red band of this dataset.
1825 # - \a Green The green band, the default is to use the green band of this dataset.
1826 # - \a Blue The blue band, the default is to use the blue band of this dataset.
1827 # - \a NumColors The number of colors in the computed color table. Default is 256.
1828 # - \a Progress reference to a progress function (default is undef)
1829 # - \a ProgressData (default is undef)
1830 # - \a Method The computation method. The default and currently only option is the median cut algorithm.
1831 #
1832 # @return a new color table object.
1833 #*
1834 sub ComputeColorTable {
1835  my $self = shift;
1836  my $p = named_parameters(\@_,
1837  Red => undef,
1838  Green => undef,
1839  Blue => undef,
1840  NumColors => 256,
1841  Progress => undef,
1842  ProgressData => undef,
1843  Method => 'MedianCut');
1844  for my $b ($self->Bands) {
1845  for my $cion ($b->ColorInterpretation) {
1846  if ($cion eq 'RedBand') { $p->{red} //= $b; last; }
1847  if ($cion eq 'GreenBand') { $p->{green} //= $b; last; }
1848  if ($cion eq 'BlueBand') { $p->{blue} //= $b; last; }
1849  }
1850  }
1851  my $ct = Geo::GDAL::ColorTable->new;
1852  Geo::GDAL::ComputeMedianCutPCT($p->{red},
1853  $p->{green},
1854  $p->{blue},
1855  $p->{numcolors},
1856  $ct, $p->{progress},
1857  $p->{progressdata});
1858  return $ct;
1859 }
1860 
1861 #** @method Geo::OGR::Layer CopyLayer($layer, $name, hashref options = undef)
1862 # Object method.
1863 # @param layer A Geo::OGR::Layer object to be copied.
1864 # @param name A name for the new layer.
1865 # @param options A ref to a hash of format specific options.
1866 # @return a new Geo::OGR::Layer object.
1867 #*
1868 sub CopyLayer {
1869 }
1870 
1871 #** @method Geo::OGR::Layer CreateLayer(%params)
1872 # Object method.
1873 # @brief Create a new vector layer into this dataset.
1874 #
1875 # @param %params Named parameters:
1876 # - \a Name (scalar) name for the new layer.
1877 # - \a Fields (array reference) a list of (scalar and geometry) field definitions as in
1878 # Geo::OGR::Layer::CreateField.
1879 # - \a ApproxOK (boolean value, default is true) a flag, which is forwarded to Geo::OGR::Layer::CreateField.
1880 # - \a Options (hash reference) driver specific hash of layer creation options.
1881 # - \a Schema (hash reference, deprecated, use \a Fields and \a Name) may contain keys Name, Fields, GeomFields, GeometryType.
1882 # - \a SRS (scalar) the spatial reference for the default geometry field.
1883 # - \a GeometryType (scalar) the type of the default geometry field
1884 # (if only one geometry field). Default is 'Unknown'.
1885 #
1886 # @note If Fields or Schema|Fields is not given, a default geometry
1887 # field (Name => '', GeometryType => 'Unknown') is created. If it is
1888 # given and it contains spatial fields, both GeometryType and SRS are
1889 # ignored. The type can be also set with the named parameter.
1890 #
1891 # Example:
1892 # \code
1893 # my $roads = Geo::OGR::Driver('Memory')->Create('road')->
1894 # CreateLayer(
1895 # Fields => [ { Name => 'class',
1896 # Type => 'Integer' },
1897 # { Name => 'geom',
1898 # Type => 'LineString25D' } ] );
1899 # \endcode
1900 #
1901 # @note Many formats allow only one spatial field, which currently
1902 # requires the use of GeometryType.
1903 #
1904 # @return a new Geo::OGR::Layer object.
1905 #*
1906 sub CreateLayer {
1907  my $self = shift;
1908  my $p = named_parameters(\@_,
1909  Name => 'unnamed',
1910  SRS => undef,
1911  GeometryType => 'Unknown',
1912  Options => {},
1913  Schema => undef,
1914  Fields => undef,
1915  ApproxOK => 1);
1916  error("The 'Fields' argument must be an array reference.") if $p->{fields} && ref($p->{fields}) ne 'ARRAY';
1917  if (defined $p->{schema}) {
1918  my $s = $p->{schema};
1919  $p->{geometrytype} = $s->{GeometryType} if exists $s->{GeometryType};
1920  $p->{fields} = $s->{Fields} if exists $s->{Fields};
1921  $p->{name} = $s->{Name} if exists $s->{Name};
1922  }
1923  $p->{fields} = [] unless ref($p->{fields}) eq 'ARRAY';
1924  # if fields contains spatial fields, then do not create default one
1925  for my $f (@{$p->{fields}}) {
1926  error("Field definitions must be hash references.") unless ref $f eq 'HASH';
1927  if ($f->{GeometryType} || ($f->{Type} && s_exists(geometry_type => $f->{Type}))) {
1928  $p->{geometrytype} = 'None';
1929  last;
1930  }
1931  }
1932  my $gt = s2i(geometry_type => $p->{geometrytype});
1933  my $layer = _CreateLayer($self, $p->{name}, $p->{srs}, $gt, $p->{options});
1934  for my $f (@{$p->{fields}}) {
1935  $layer->CreateField($f);
1936  }
1937  keep($layer, $self);
1938 }
1939 
1940 #** @method CreateMaskBand()
1941 # Object method.
1942 # Add a mask band to the dataset.
1943 #*
1944 sub CreateMaskBand {
1945  return _CreateMaskBand(@_);
1946 }
1947 
1948 #** @method Geo::GDAL::Dataset DEMProcessing($Dest, $Processing, $ColorFilename, hashref Options, coderef progress, $progress_data)
1949 # Object method.
1950 # Apply a DEM processing to this dataset.
1951 # @param Dest Destination raster dataset definition string (typically filename) or an object, which implements write and close.
1952 # @param Processing Processing to apply, one of "hillshade", "slope", "aspect", "color-relief", "TRI", "TPI", or "Roughness".
1953 # @param ColorFilename The color palette for color-relief.
1954 # @param Options See section \ref index_processing_options.
1955 # @param progress [optional] A reference to a subroutine, which will
1956 # be called with parameters (number progress, string msg, progress_data).
1957 # @param progress_data [optional]
1958 #
1959 #*
1960 sub DEMProcessing {
1961  my ($self, $dest, $Processing, $ColorFilename, $options, $progress, $progress_data) = @_;
1962  $options = Geo::GDAL::GDALDEMProcessingOptions->new(make_processing_options($options));
1963  return $self->stdout_redirection_wrapper(
1964  $dest,
1965  \&Geo::GDAL::wrapper_GDALDEMProcessing,
1966  $Processing, $ColorFilename, $options, $progress, $progress_data
1967  );
1968 }
1969 
1970 #** @method Dataset()
1971 #*
1972 sub Dataset {
1973  my $self = shift;
1974  parent($self);
1975 }
1976 
1977 #** @method DeleteLayer($name)
1978 # Object method.
1979 # Deletes a layer from the data source. Note that if there is a layer
1980 # object for the deleted layer, it becomes unusable.
1981 # @param name name of the layer to delete.
1982 #*
1983 sub DeleteLayer {
1984  my ($self, $name) = @_;
1985  my $index;
1986  for my $i (0..$self->GetLayerCount-1) {
1987  my $layer = GetLayerByIndex($self, $i);
1988  $index = $i, last if $layer->GetName eq $name;
1989  }
1990  error(2, $name, 'Layer') unless defined $index;
1991  _DeleteLayer($self, $index);
1992 }
1993 
1994 #** @method Geo::GDAL::Band Dither(%params)
1995 # Object method.
1996 # Compute one band with color table image from an RGB image
1997 # @params params Named parameters:
1998 # - \a Red The red band, the default is to use the red band of this dataset.
1999 # - \a Green The green band, the default is to use the green band of this dataset.
2000 # - \a Blue The blue band, the default is to use the blue band of this dataset.
2001 # - \a Dest The destination band. If this is not defined, a new in-memory band (and a dataset) will be created.
2002 # - \a ColorTable The color table for the result. If this is not defined, and the destination band does not contain one, it will be computed with the ComputeColorTable method.
2003 # - \a Progress Reference to a progress function (default is undef). Note that if ColorTable is computed using ComputeColorTable method, the progress will run twice from 0 to 1.
2004 # - \a ProgressData (default is undef)
2005 #
2006 # @return the destination band.
2007 #
2008 # Usage example. This code converts an RGB JPEG image into a one band PNG image with a color table.
2009 # \code
2010 # my $d = Geo::GDAL::Open('pic.jpg');
2011 # Geo::GDAL::Driver('PNG')->Copy(Name => 'test.png', Src => $d->Dither->Dataset);
2012 # \endcode
2013 #*
2014 sub Dither {
2015  my $self = shift;
2016  my $p = named_parameters(\@_,
2017  Red => undef,
2018  Green => undef,
2019  Blue => undef,
2020  Dest => undef,
2021  ColorTable => undef,
2022  Progress => undef,
2023  ProgressData => undef);
2024  for my $b ($self->Bands) {
2025  for my $cion ($b->ColorInterpretation) {
2026  if ($cion eq 'RedBand') { $p->{red} //= $b; last; }
2027  if ($cion eq 'GreenBand') { $p->{green} //= $b; last; }
2028  if ($cion eq 'BlueBand') { $p->{blue} //= $b; last; }
2029  }
2030  }
2031  my ($w, $h) = $self->Size;
2032  $p->{dest} //= Geo::GDAL::Driver('MEM')->Create(Name => 'dithered',
2033  Width => $w,
2034  Height => $h,
2035  Type => 'Byte')->Band;
2036  $p->{colortable}
2037  //= $p->{dest}->ColorTable
2038  // $self->ComputeColorTable(Red => $p->{red},
2039  Green => $p->{green},
2040  Blue => $p->{blue},
2041  Progress => $p->{progress},
2042  ProgressData => $p->{progressdata});
2043  Geo::GDAL::DitherRGB2PCT($p->{red},
2044  $p->{green},
2045  $p->{blue},
2046  $p->{dest},
2047  $p->{colortable},
2048  $p->{progress},
2049  $p->{progressdata});
2050  $p->{dest}->ColorTable($p->{colortable});
2051  return $p->{dest};
2052 }
2053 
2054 #** @method Domains()
2055 #*
2056 sub Domains {
2057  return @DOMAINS;
2058 }
2059 
2060 #** @method Geo::GDAL::Driver Driver()
2061 # Object method.
2062 # @note a.k.a. GetDriver
2063 # @return a Geo::GDAL::Driver object that was used to open or create this dataset.
2064 #*
2065 sub Driver {
2066 }
2067 
2068 #** @method Geo::OGR::Layer ExecuteSQL($statement, $geom = undef, $dialect = "")
2069 # Object method.
2070 # @param statement A SQL statement.
2071 # @param geom A Geo::OGR::Geometry object.
2072 # @param dialect
2073 # @return a new Geo::OGR::Layer object. The data source object will
2074 # exist as long as the layer object exists.
2075 #*
2076 sub ExecuteSQL {
2077  my $self = shift;
2078  my $layer = $self->_ExecuteSQL(@_);
2079  note($layer, "is result set");
2080  keep($layer, $self);
2081 }
2082 
2083 #** @method Geo::GDAL::Extent Extent(@params)
2084 # Object method.
2085 # @param params nothing, or a list ($xoff, $yoff, $w, $h)
2086 # @return A new Geo::GDAL::Extent object that represents the area that
2087 # this raster or the specified tile covers.
2088 #*
2089 sub Extent {
2090  my $self = shift;
2091  my $t = $self->GeoTransform;
2092  my $extent = $t->Extent($self->Size);
2093  if (@_) {
2094  my ($xoff, $yoff, $w, $h) = @_;
2095  my ($x, $y) = $t->Apply([$xoff, $xoff+$w, $xoff+$w, $xoff], [$yoff, $yoff, $yoff+$h, $yoff+$h]);
2096  my $xmin = shift @$x;
2097  my $xmax = $xmin;
2098  for my $x (@$x) {
2099  $xmin = $x if $x < $xmin;
2100  $xmax = $x if $x > $xmax;
2101  }
2102  my $ymin = shift @$y;
2103  my $ymax = $ymin;
2104  for my $y (@$y) {
2105  $ymin = $y if $y < $ymin;
2106  $ymax = $y if $y > $ymax;
2107  }
2108  $extent = Geo::GDAL::Extent->new($xmin, $ymin, $xmax, $ymax);
2109  }
2110  return $extent;
2111 }
2112 
2113 #** @method list GCPs(@GCPs, Geo::OSR::SpatialReference sr)
2114 # Object method.
2115 # Get or set the GCPs and their projection.
2116 # @param GCPs [optional] a list of Geo::GDAL::GCP objects
2117 # @param sr [optional] the projection of the GCPs.
2118 # @return a list of Geo::GDAL::GCP objects followed by a Geo::OSR::SpatialReference object.
2119 #*
2120 sub GCPs {
2121  my $self = shift;
2122  if (@_ > 0) {
2123  my $proj = pop @_;
2124  $proj = $proj->Export('WKT') if $proj and ref($proj);
2125  SetGCPs($self, \@_, $proj);
2126  }
2127  return unless defined wantarray;
2128  my $proj = Geo::OSR::SpatialReference->new(GetGCPProjection($self));
2129  my $GCPs = GetGCPs($self);
2130  return (@$GCPs, $proj);
2131 }
2132 
2133 #** @method Geo::GDAL::GeoTransform GeoTransform(Geo::GDAL::GeoTransform $geo_transform)
2134 # Object method.
2135 # Transformation from cell coordinates (column,row) to projection
2136 # coordinates (x,y)
2137 # \code
2138 # x = geo_transform[0] + column*geo_transform[1] + row*geo_transform[2]
2139 # y = geo_transform[3] + column*geo_transform[4] + row*geo_transform[5]
2140 # \endcode
2141 # @param geo_transform [optional]
2142 # @return the geo transform in a non-void context.
2143 #*
2144 sub GeoTransform {
2145  my $self = shift;
2146  eval {
2147  if (@_ == 1) {
2148  SetGeoTransform($self, $_[0]);
2149  } elsif (@_ > 1) {
2150  SetGeoTransform($self, \@_);
2151  }
2152  };
2153  confess(last_error()) if $@;
2154  return unless defined wantarray;
2155  my $t = GetGeoTransform($self);
2156  if (wantarray) {
2157  return @$t;
2158  } else {
2159  return Geo::GDAL::GeoTransform->new($t);
2160  }
2161 }
2162 
2163 #** @method GetDriver()
2164 #*
2165 sub GetDriver {
2166 }
2167 
2168 #** @method list GetFileList()
2169 # Object method.
2170 # @return list of files GDAL believes to be part of this dataset.
2171 #*
2172 sub GetFileList {
2173 }
2174 
2175 #** @method scalar GetGCPProjection()
2176 # Object method.
2177 # @return projection string.
2178 #*
2179 sub GetGCPProjection {
2180 }
2181 
2182 #** @method GetGCPSpatialRef()
2183 #*
2184 sub GetGCPSpatialRef {
2185 }
2186 
2187 #** @method Geo::OGR::Layer GetLayer($name)
2188 # Object method.
2189 # @param name the name of the requested layer. If not given, then
2190 # returns the first layer in the data source.
2191 # @return a new Geo::OGR::Layer object that represents the layer
2192 # in the data source.
2193 #*
2194 sub GetLayer {
2195  my($self, $name) = @_;
2196  my $layer = defined $name ? GetLayerByName($self, "$name") : GetLayerByIndex($self, 0);
2197  $name //= '';
2198  error(2, $name, 'Layer') unless $layer;
2199  keep($layer, $self);
2200 }
2201 
2202 #** @method list GetLayerNames()
2203 # Object method.
2204 # @note Delivers the functionality of undocumented method GetLayerCount.
2205 # @return a list of the names of the layers this data source provides.
2206 #*
2207 sub GetLayerNames {
2208  my $self = shift;
2209  my @names;
2210  for my $i (0..$self->GetLayerCount-1) {
2211  my $layer = GetLayerByIndex($self, $i);
2212  push @names, $layer->GetName;
2213  }
2214  return @names;
2215 }
2216 
2217 #** @method GetNextFeature()
2218 #*
2219 sub GetNextFeature {
2220 }
2221 
2222 #** @method GetSpatialRef()
2223 #*
2224 sub GetSpatialRef {
2225 }
2226 
2227 #** @method GetStyleTable()
2228 #*
2229 sub GetStyleTable {
2230 }
2231 
2232 #** @method Geo::GDAL::Dataset Grid($Dest, hashref Options)
2233 # Object method.
2234 # Creates a regular raster grid from this data source.
2235 # This is equivalent to the gdal_grid utility.
2236 # @param Dest Destination raster dataset definition string (typically
2237 # filename) or an object, which implements write and close.
2238 # @param Options See section \ref index_processing_options.
2239 #*
2240 sub Grid {
2241  my ($self, $dest, $options, $progress, $progress_data) = @_;
2242  $options = Geo::GDAL::GDALGridOptions->new(make_processing_options($options));
2243  return $self->stdout_redirection_wrapper(
2244  $dest,
2245  \&Geo::GDAL::wrapper_GDALGrid,
2246  $options, $progress, $progress_data
2247  );
2248 }
2249 
2250 #** @method scalar Info(hashref Options)
2251 # Object method.
2252 # Information about this dataset.
2253 # @param Options See section \ref index_processing_options.
2254 #*
2255 sub Info {
2256  my ($self, $o) = @_;
2257  $o = Geo::GDAL::GDALInfoOptions->new(make_processing_options($o));
2258  return GDALInfo($self, $o);
2259 }
2260 
2261 #** @method Geo::GDAL::Dataset Nearblack($Dest, hashref Options, coderef progress, $progress_data)
2262 # Object method.
2263 # Convert nearly black/white pixels to black/white.
2264 # @param Dest Destination raster dataset definition string (typically
2265 # filename), destination dataset to which to add an alpha or mask
2266 # band, or an object, which implements write and close.
2267 # @param Options See section \ref index_processing_options.
2268 # @return Dataset if destination dataset definition string was given,
2269 # otherwise a boolean for success/fail but the method croaks if there
2270 # was an error.
2271 #*
2272 sub Nearblack {
2273  my ($self, $dest, $options, $progress, $progress_data) = @_;
2274  $options = Geo::GDAL::GDALNearblackOptions->new(make_processing_options($options));
2275  my $b = blessed($dest);
2276  if ($b && $b eq 'Geo::GDAL::Dataset') {
2277  Geo::GDAL::wrapper_GDALNearblackDestDS($dest, $self, $options, $progress, $progress_data);
2278  } else {
2279  return $self->stdout_redirection_wrapper(
2280  $dest,
2281  \&Geo::GDAL::wrapper_GDALNearblackDestName,
2282  $options, $progress, $progress_data
2283  );
2284  }
2285 }
2286 
2287 #** @method Geo::GDAL::Dataset Open()
2288 # Package subroutine.
2289 # The same as Geo::GDAL::Open
2290 #*
2291 sub Open {
2292 }
2293 
2294 #** @method Geo::GDAL::Dataset OpenShared()
2295 # Package subroutine.
2296 # The same as Geo::GDAL::OpenShared
2297 #*
2298 sub OpenShared {
2299 }
2300 
2301 #** @method Geo::GDAL::Dataset Rasterize($Dest, hashref Options, coderef progress, $progress_data)
2302 # Object method.
2303 # Render data from this data source into a raster.
2304 # @param Dest Destination raster dataset definition string (typically
2305 # filename), destination dataset, or an object, which implements write and close.
2306 # @param Options See section \ref index_processing_options.
2307 # @return Dataset if destination dataset definition string was given,
2308 # otherwise a boolean for success/fail but the method croaks if there
2309 # was an error.
2310 #
2311 #*
2312 sub Rasterize {
2313  my ($self, $dest, $options, $progress, $progress_data) = @_;
2314  $options = Geo::GDAL::GDALRasterizeOptions->new(make_processing_options($options));
2315  my $b = blessed($dest);
2316  if ($b && $b eq 'Geo::GDAL::Dataset') {
2317  Geo::GDAL::wrapper_GDALRasterizeDestDS($dest, $self, $options, $progress, $progress_data);
2318  } else {
2319  # TODO: options need to force a new raster be made, otherwise segfault
2320  return $self->stdout_redirection_wrapper(
2321  $dest,
2322  \&Geo::GDAL::wrapper_GDALRasterizeDestName,
2323  $options, $progress, $progress_data
2324  );
2325  }
2326 }
2327 
2328 #** @method scalar ReadRaster(%params)
2329 # Object method.
2330 # Read data from the dataset.
2331 #
2332 # @param params Named parameters:
2333 # - \a XOff x offset (cell coordinates) (default is 0)
2334 # - \a YOff y offset (cell coordinates) (default is 0)
2335 # - \a XSize width of the area to read (default is the width of the dataset)
2336 # - \a YSize height of the area to read (default is the height of the dataset)
2337 # - \a BufXSize (default is undef, i.e., the same as XSize)
2338 # - \a BufYSize (default is undef, i.e., the same as YSize)
2339 # - \a BufType data type of the buffer (default is the data type of the first band)
2340 # - \a BandList a reference to an array of band indices (default is [1])
2341 # - \a BufPixelSpace (default is 0)
2342 # - \a BufLineSpace (default is 0)
2343 # - \a BufBandSpace (default is 0)
2344 # - \a ResampleAlg one of Geo::GDAL::RIOResamplingTypes (default is 'NearestNeighbour'),
2345 # - \a Progress reference to a progress function (default is undef)
2346 # - \a ProgressData (default is undef)
2347 #
2348 # <a href="http://www.gdal.org/classGDALDataset.html">Entry in GDAL docs (method RasterIO)</a>
2349 # @return a buffer, open the buffer with \a unpack function of Perl. See Geo::GDAL::Band::PackCharacter.
2350 #*
2351 sub ReadRaster {
2352  my $self = shift;
2353  my ($width, $height) = $self->Size;
2354  my ($type) = $self->Band->DataType;
2355  my $p = named_parameters(\@_,
2356  XOff => 0,
2357  YOff => 0,
2358  XSize => $width,
2359  YSize => $height,
2360  BufXSize => undef,
2361  BufYSize => undef,
2362  BufType => $type,
2363  BandList => [1],
2364  BufPixelSpace => 0,
2365  BufLineSpace => 0,
2366  BufBandSpace => 0,
2367  ResampleAlg => 'NearestNeighbour',
2368  Progress => undef,
2369  ProgressData => undef
2370  );
2371  $p->{resamplealg} = s2i(rio_resampling => $p->{resamplealg});
2372  $p->{buftype} = s2i(data_type => $p->{buftype}, 1);
2373  $self->_ReadRaster($p->{xoff},$p->{yoff},$p->{xsize},$p->{ysize},$p->{bufxsize},$p->{bufysize},$p->{buftype},$p->{bandlist},$p->{bufpixelspace},$p->{buflinespace},$p->{bufbandspace},$p->{resamplealg},$p->{progress},$p->{progressdata});
2374 }
2375 
2376 #** @method ReadTile()
2377 #*
2378 sub ReadTile {
2379  my ($self, $xoff, $yoff, $xsize, $ysize, $w_tile, $h_tile, $alg) = @_;
2380  my @data;
2381  for my $i (0..$self->Bands-1) {
2382  $data[$i] = $self->Band($i+1)->ReadTile($xoff, $yoff, $xsize, $ysize, $w_tile, $h_tile, $alg);
2383  }
2384  return \@data;
2385 }
2386 
2387 #** @method ReleaseResultSet($layer)
2388 # Object method.
2389 # @param layer A layer the has been created with ExecuteSQL.
2390 # @note There is no need to call this method. The result set layer is
2391 # released in the destructor of the layer that was created with SQL.
2392 #*
2393 sub ReleaseResultSet {
2394  # a no-op, _ReleaseResultSet is called from Layer::DESTROY
2395 }
2396 
2397 #** @method ResetReading()
2398 #*
2399 sub ResetReading {
2400 }
2401 
2402 #** @method RollbackTransaction()
2403 #*
2404 sub RollbackTransaction {
2405 }
2406 
2407 #** @method SetGCPs2()
2408 #*
2409 sub SetGCPs2 {
2410 }
2411 
2412 #** @method SetSpatialRef()
2413 #*
2414 sub SetSpatialRef {
2415 }
2416 
2417 #** @method SetStyleTable()
2418 #*
2419 sub SetStyleTable {
2420 }
2421 
2422 #** @method list Size()
2423 # Object method.
2424 # @return (width, height)
2425 #*
2426 sub Size {
2427  my $self = shift;
2428  return ($self->{RasterXSize}, $self->{RasterYSize});
2429 }
2430 
2431 #** @method Geo::OSR::SpatialReference SpatialReference(Geo::OSR::SpatialReference sr)
2432 # Object method.
2433 # Get or set the projection of this dataset.
2434 # @param sr [optional] a Geo::OSR::SpatialReference object,
2435 # which replaces the existing projection definition of this dataset.
2436 # @return a Geo::OSR::SpatialReference object, which represents the
2437 # projection of this dataset.
2438 # @note Methods GetProjection, SetProjection, and Projection return WKT strings.
2439 #*
2440 sub SpatialReference {
2441  my($self, $sr) = @_;
2442  SetProjection($self, $sr->As('WKT')) if defined $sr;
2443  if (defined wantarray) {
2444  my $p = GetProjection($self);
2445  return unless $p;
2446  return Geo::OSR::SpatialReference->new(WKT => $p);
2447  }
2448 }
2449 
2450 #** @method StartTransaction()
2451 #*
2452 sub StartTransaction {
2453 }
2454 
2455 #** @method TestCapability()
2456 #*
2457 sub TestCapability {
2458  return _TestCapability(@_);
2459 }
2460 
2461 #** @method Tile(Geo::GDAL::Extent e)
2462 # Object method.
2463 # Compute the top left cell coordinates and width and height of the
2464 # tile that covers the given extent.
2465 # @param e The extent whose tile is needed.
2466 # @note Requires that the raster is a strictly north up one.
2467 # @return A list ($xoff, $yoff, $xsize, $ysize).
2468 #*
2469 sub Tile {
2470  my ($self, $e) = @_;
2471  my ($w, $h) = $self->Size;
2472  my $t = $self->GeoTransform;
2473  confess "GeoTransform is not \"north up\"." unless $t->NorthUp;
2474  my $xoff = floor(($e->[0] - $t->[0])/$t->[1]);
2475  $xoff = 0 if $xoff < 0;
2476  my $yoff = floor(($e->[1] - $t->[3])/$t->[5]);
2477  $yoff = 0 if $yoff < 0;
2478  my $xsize = ceil(($e->[2] - $t->[0])/$t->[1]) - $xoff;
2479  $xsize = $w - $xoff if $xsize > $w - $xoff;
2480  my $ysize = ceil(($e->[3] - $t->[3])/$t->[5]) - $yoff;
2481  $ysize = $h - $yoff if $ysize > $h - $yoff;
2482  return ($xoff, $yoff, $xsize, $ysize);
2483 }
2484 
2485 #** @method Geo::GDAL::Dataset Translate($Dest, hashref Options, coderef progress, $progress_data)
2486 # Object method.
2487 # Convert this dataset into another format.
2488 # @param Dest Destination dataset definition string (typically
2489 # filename) or an object, which implements write and close.
2490 # @param Options See section \ref index_processing_options.
2491 # @return New dataset object if destination dataset definition
2492 # string was given, otherwise a boolean for success/fail but the
2493 # method croaks if there was an error.
2494 #*
2495 sub Translate {
2496  my ($self, $dest, $options, $progress, $progress_data) = @_;
2497  return $self->stdout_redirection_wrapper(
2498  $dest,
2499 }
2500 
2501 #** @method Geo::GDAL::Dataset Warp($Dest, hashref Options, coderef progress, $progress_data)
2502 # Object method.
2503 # Reproject this dataset.
2504 # @param Dest Destination raster dataset definition string (typically
2505 # filename) or an object, which implements write and close.
2506 # @param Options See section \ref index_processing_options.
2507 # @note This method can be run as a package subroutine with a list of
2508 # datasets as the first argument to mosaic several datasets.
2509 #*
2510 sub Warp {
2511  my ($self, $dest, $options, $progress, $progress_data) = @_;
2512  # can be run as object method (one dataset) and as package sub (a list of datasets)
2513  $options = Geo::GDAL::GDALWarpAppOptions->new(make_processing_options($options));
2514  my $b = blessed($dest);
2515  $self = [$self] unless ref $self eq 'ARRAY';
2516  if ($b && $b eq 'Geo::GDAL::Dataset') {
2517  Geo::GDAL::wrapper_GDALWarpDestDS($dest, $self, $options, $progress, $progress_data);
2518  } else {
2519  return stdout_redirection_wrapper(
2520  $self,
2521  $dest,
2522  \&Geo::GDAL::wrapper_GDALWarpDestName,
2523  $options, $progress, $progress_data
2524  );
2525  }
2526 }
2527 
2528 #** @method Geo::GDAL::Dataset Warped(%params)
2529 # Object method.
2530 # Create a virtual warped dataset from this dataset.
2531 #
2532 # @param params Named parameters:
2533 # - \a SrcSRS Override the spatial reference system of this dataset if there is one (default is undef).
2534 # - \a DstSRS The target spatial reference system of the result (default is undef).
2535 # - \a ResampleAlg The resampling algorithm (default is 'NearestNeighbour').
2536 # - \a MaxError Maximum error measured in input cellsize that is allowed in approximating the transformation (default is 0 for exact calculations).
2537 #
2538 # # <a href="http://www.gdal.org/gdalwarper_8h.html">Documentation for GDAL warper.</a>
2539 #
2540 # @return a new Geo::GDAL::Dataset object
2541 #*
2542 sub Warped {
2543  my $self = shift;
2544  my $p = named_parameters(\@_, SrcSRS => undef, DstSRS => undef, ResampleAlg => 'NearestNeighbour', MaxError => 0);
2545  for my $srs (qw/srcsrs dstsrs/) {
2546  $p->{$srs} = $p->{$srs}->ExportToWkt if $p->{$srs} && blessed $p->{$srs};
2547  }
2548  $p->{resamplealg} = s2i(resampling => $p->{resamplealg});
2549  my $warped = Geo::GDAL::_AutoCreateWarpedVRT($self, $p->{srcsrs}, $p->{dstsrs}, $p->{resamplealg}, $p->{maxerror});
2550  keep($warped, $self) if $warped; # self must live as long as warped
2551 }
2552 
2553 #** @method WriteRaster(%params)
2554 # Object method.
2555 # Write data into the dataset.
2556 #
2557 # @param params Named parameters:
2558 # - \a XOff x offset (cell coordinates) (default is 0)
2559 # - \a YOff y offset (cell coordinates) (default is 0)
2560 # - \a XSize width of the area to write (default is the width of the dataset)
2561 # - \a YSize height of the area to write (default is the height of the dataset)
2562 # - \a Buf a buffer (or a reference to a buffer) containing the data. Create the buffer with \a pack function of Perl. See Geo::GDAL::Band::PackCharacter.
2563 # - \a BufXSize (default is undef, i.e., the same as XSize)
2564 # - \a BufYSize (default is undef, i.e., the same as YSize)
2565 # - \a BufType data type of the buffer (default is the data type of the first band)
2566 # - \a BandList a reference to an array of band indices (default is [1])
2567 # - \a BufPixelSpace (default is 0)
2568 # - \a BufLineSpace (default is 0)
2569 # - \a BufBandSpace (default is 0)
2570 #
2571 # <a href="http://www.gdal.org/classGDALDataset.html">Entry in GDAL docs (method RasterIO)</a>
2572 #*
2573 sub WriteRaster {
2574  my $self = shift;
2575  my ($width, $height) = $self->Size;
2576  my ($type) = $self->Band->DataType;
2577  my $p = named_parameters(\@_,
2578  XOff => 0,
2579  YOff => 0,
2580  XSize => $width,
2581  YSize => $height,
2582  Buf => undef,
2583  BufXSize => undef,
2584  BufYSize => undef,
2585  BufType => $type,
2586  BandList => [1],
2587  BufPixelSpace => 0,
2588  BufLineSpace => 0,
2589  BufBandSpace => 0
2590  );
2591  $p->{buftype} = s2i(data_type => $p->{buftype}, 1);
2592  $self->_WriteRaster($p->{xoff},$p->{yoff},$p->{xsize},$p->{ysize},$p->{buf},$p->{bufxsize},$p->{bufysize},$p->{buftype},$p->{bandlist},$p->{bufpixelspace},$p->{buflinespace},$p->{bufbandspace});
2593 }
2594 
2595 #** @method WriteTile()
2596 #*
2597 sub WriteTile {
2598  my ($self, $data, $xoff, $yoff) = @_;
2599  $xoff //= 0;
2600  $yoff //= 0;
2601  for my $i (0..$self->Bands-1) {
2602  $self->Band($i+1)->WriteTile($data->[$i], $xoff, $yoff);
2603  }
2604 }
2605 
2606 #** @class Geo::GDAL::Driver
2607 # @brief A driver for a specific dataset format.
2608 # @details
2609 #*
2610 package Geo::GDAL::Driver;
2611 
2612 use base qw(Geo::GDAL::MajorObject Geo::GDAL)
2613 
2614 #** @attr $HelpTopic
2615 # $driver->{HelpTopic}
2616 #*
2617 
2618 #** @attr $LongName
2619 # $driver->{LongName}
2620 #*
2621 
2622 #** @attr $ShortName
2623 # $driver->{ShortName}
2624 #*
2625 
2626 #** @method list Capabilities()
2627 # Object method.
2628 # @return A list of capabilities. When executed as a package subroutine
2629 # returns a list of all potential capabilities a driver may have. When
2630 # executed as an object method returns a list of all capabilities the
2631 # driver has.
2632 #
2633 # Currently capabilities are:
2634 # CREATE, CREATECOPY, DEFAULT_FIELDS, NOTNULL_FIELDS, NOTNULL_GEOMFIELDS, OPEN, RASTER, VECTOR, and VIRTUALIO.
2635 #
2636 # Examples.
2637 # \code
2638 # @all_capabilities = Geo::GDAL::Driver::Capabilities;
2639 # @capabilities_of_the_geotiff_driver = Geo::GDAL::Driver('GTiff')->Capabilities;
2640 # \endcode
2641 #*
2642 sub Capabilities {
2643  my $self = shift;
2644  return @CAPABILITIES unless $self;
2645  my $h = $self->GetMetadata;
2646  my @cap;
2647  for my $cap (@CAPABILITIES) {
2648  my $test = $h->{'DCAP_'.uc($cap)};
2649  push @cap, $cap if defined($test) and $test eq 'YES';
2650  }
2651  return @cap;
2652 }
2653 
2654 #** @method Geo::GDAL::Dataset Copy(%params)
2655 # Object method.
2656 # Create a new raster Geo::GDAL::Dataset as a copy of an existing dataset.
2657 # @note a.k.a. CreateCopy
2658 #
2659 # @param params Named parameters:
2660 # - \a Name name for the new raster dataset.
2661 # - \a Src the source Geo::GDAL::Dataset object.
2662 # - \a Strict 1 (default) if the copy must be strictly equivalent, or 0 if the copy may adapt.
2663 # - \a Options an anonymous hash of driver specific options.
2664 # - \a Progress [optional] a reference to a subroutine, which will
2665 # be called with parameters (number progress, string msg, progress_data).
2666 # - \a ProgressData [optional]
2667 # @return a new Geo::GDAL::Dataset object.
2668 #*
2669 sub Copy {
2670  my $self = shift;
2671  my $p = named_parameters(\@_, Name => 'unnamed', Src => undef, Strict => 1, Options => {}, Progress => undef, ProgressData => undef);
2672  return $self->stdout_redirection_wrapper(
2673  $p->{name},
2674  $self->can('_CreateCopy'),
2675  $p->{src}, $p->{strict}, $p->{options}, $p->{progress}, $p->{progressdata});
2676 }
2677 
2678 #** @method CopyFiles($NewName, $OldName)
2679 # Object method.
2680 # Copy the files of a dataset.
2681 # @param NewName String.
2682 # @param OldName String.
2683 #*
2684 sub CopyFiles {
2685 }
2686 
2687 #** @method Geo::GDAL::Dataset Create(%params)
2688 # Object method.
2689 # Create a raster dataset using this driver.
2690 # @note a.k.a. CreateDataset
2691 #
2692 # @param params Named parameters:
2693 # - \a Name The name for the dataset (default is 'unnamed') or an object, which implements write and close.
2694 # - \a Width The width for the raster dataset (default is 256).
2695 # - \a Height The height for the raster dataset (default is 256).
2696 # - \a Bands The number of bands to create into the raster dataset (default is 1).
2697 # - \a Type The data type for the raster cells (default is 'Byte'). One of Geo::GDAL::Driver::CreationDataTypes.
2698 # - \a Options Driver creation options as a reference to a hash (default is {}).
2699 #
2700 # @return A new Geo::GDAL::Dataset object.
2701 #*
2702 sub Create {
2703  my $self = shift;
2704  my $p = named_parameters(\@_, Name => 'unnamed', Width => 256, Height => 256, Bands => 1, Type => 'Byte', Options => {});
2705  my $type = s2i(data_type => $p->{type});
2706  return $self->stdout_redirection_wrapper(
2707  $p->{name},
2708  $self->can('_Create'),
2709  $p->{width}, $p->{height}, $p->{bands}, $type, $p->{options}
2710  );
2711 }
2712 
2713 #** @method list CreationDataTypes()
2714 # Object method.
2715 # @return a list of data types that can be used for new datasets of this format. A subset of Geo::GDAL::DataTypes
2716 #*
2717 sub CreationDataTypes {
2718  my $self = shift;
2719  my $h = $self->GetMetadata;
2720  return split /\s+/, $h->{DMD_CREATIONDATATYPES} if $h->{DMD_CREATIONDATATYPES};
2721 }
2722 
2723 #** @method list CreationOptionList()
2724 # Object method.
2725 # @return a list of options, each option is a hashref, the keys are
2726 # name, type and description or Value. Value is a listref.
2727 #*
2728 sub CreationOptionList {
2729  my $self = shift;
2730  my @options;
2731  my $h = $self->GetMetadata->{DMD_CREATIONOPTIONLIST};
2732  if ($h) {
2733  $h = ParseXMLString($h);
2734  my($type, $value) = NodeData($h);
2735  if ($value eq 'CreationOptionList') {
2736  for my $o (Children($h)) {
2737  my %option;
2738  for my $a (Children($o)) {
2739  my(undef, $key) = NodeData($a);
2740  my(undef, $value) = NodeData(Child($a, 0));
2741  if ($key eq 'Value') {
2742  push @{$option{$key}}, $value;
2743  } else {
2744  $option{$key} = $value;
2745  }
2746  }
2747  push @options, \%option;
2748  }
2749  }
2750  }
2751  return @options;
2752 }
2753 
2754 #** @method Delete($name)
2755 # Object method.
2756 # @param name
2757 #*
2758 sub Delete {
2759 }
2760 
2761 #** @method Domains()
2762 #*
2763 sub Domains {
2764  return @DOMAINS;
2765 }
2766 
2767 #** @method scalar Extension()
2768 # Object method.
2769 # @note The returned extension does not contain a '.' prefix.
2770 # @return a suggested single extension or a list of extensions (in
2771 # list context) for datasets.
2772 #*
2773 sub Extension {
2774  my $self = shift;
2775  my $h = $self->GetMetadata;
2776  if (wantarray) {
2777  my $e = $h->{DMD_EXTENSIONS};
2778  my @e = split / /, $e;
2779  @e = split /\//, $e if $e =~ /\//; # ILWIS returns mpr/mpl
2780  for my $i (0..$#e) {
2781  $e[$i] =~ s/^\.//; # CALS returns extensions with a dot prefix
2782  }
2783  return @e;
2784  } else {
2785  my $e = $h->{DMD_EXTENSION};
2786  return '' if $e =~ /\//; # ILWIS returns mpr/mpl
2787  $e =~ s/^\.//;
2788  return $e;
2789  }
2790 }
2791 
2792 #** @method scalar MIMEType()
2793 # Object method.
2794 # @return a suggested MIME type for datasets.
2795 #*
2796 sub MIMEType {
2797  my $self = shift;
2798  my $h = $self->GetMetadata;
2799  return $h->{DMD_MIMETYPE};
2800 }
2801 
2802 #** @method scalar Name()
2803 # Object method.
2804 # @return The short name of the driver.
2805 #*
2806 sub Name {
2807  my $self = shift;
2808  return $self->{ShortName};
2809 }
2810 
2811 #** @method Open()
2812 # Object method.
2813 # The same as Geo::GDAL::Open except that only this driver is allowed.
2814 #*
2815 sub Open {
2816  my $self = shift;
2817  my @p = @_; # name, update
2818  my @flags = qw/RASTER/;
2819  push @flags, qw/READONLY/ if $p[1] eq 'ReadOnly';
2820  push @flags, qw/UPDATE/ if $p[1] eq 'Update';
2821  my $dataset = OpenEx($p[0], \@flags, [$self->Name()]);
2822  error("Failed to open $p[0]. Is it a raster dataset?") unless $dataset;
2823  return $dataset;
2824 }
2825 
2826 #** @method Rename($NewName, $OldName)
2827 # Object method.
2828 # Rename (move) a GDAL dataset.
2829 # @param NewName String.
2830 # @param OldName String.
2831 #*
2832 sub Rename {
2833 }
2834 
2835 #** @method scalar TestCapability($cap)
2836 # Object method.
2837 # Test whether the driver has the specified capability.
2838 # @param cap A capability string (one of those returned by Capabilities).
2839 # @return a boolean value.
2840 #*
2841 sub TestCapability {
2842  my($self, $cap) = @_;
2843  my $h = $self->GetMetadata->{'DCAP_'.uc($cap)};
2844  return (defined($h) and $h eq 'YES') ? 1 : undef;
2845 }
2846 
2847 #** @method stdout_redirection_wrapper()
2848 #*
2849 sub stdout_redirection_wrapper {
2850  my ($self, $name, $sub, @params) = @_;
2851  my $object = 0;
2852  if ($name && blessed $name) {
2853  $object = $name;
2854  my $ref = $object->can('write');
2855  VSIStdoutSetRedirection($ref);
2856  $name = '/vsistdout/';
2857  }
2858  my $ds;
2859  eval {
2860  $ds = $sub->($self, $name, @params);
2861  };
2862  if ($object) {
2863  if ($ds) {
2864  $Geo::GDAL::stdout_redirection{tied(%$ds)} = $object;
2865  } else {
2866  VSIStdoutUnsetRedirection();
2867  $object->close;
2868  }
2869  }
2870  confess(last_error()) if $@;
2871  confess("Failed. Use Geo::OGR::Driver for vector drivers.") unless $ds;
2872  return $ds;
2873 }
2874 
2875 #** @class Geo::GDAL::Extent
2876 # @brief A rectangular area in projection coordinates: xmin, ymin, xmax, ymax.
2877 #*
2878 package Geo::GDAL::Extent;
2879 
2880 #** @method ExpandToInclude($extent)
2881 # Package subroutine.
2882 # Extends this extent to include the other extent.
2883 # @param extent Another Geo::GDAL::Extent object.
2884 #*
2885 sub ExpandToInclude {
2886  my ($self, $e) = @_;
2887  return if $e->IsEmpty;
2888  if ($self->IsEmpty) {
2889  @$self = @$e;
2890  } else {
2891  $self->[0] = $e->[0] if $e->[0] < $self->[0];
2892  $self->[1] = $e->[1] if $e->[1] < $self->[1];
2893  $self->[2] = $e->[2] if $e->[2] > $self->[2];
2894  $self->[3] = $e->[3] if $e->[3] > $self->[3];
2895  }
2896 }
2897 
2898 #** @method IsEmpty()
2899 #*
2900 sub IsEmpty {
2901  my $self = shift;
2902  return $self->[2] < $self->[0];
2903 }
2904 
2905 #** @method scalar Overlap($extent)
2906 # Package subroutine.
2907 # @param extent Another Geo::GDAL::Extent object.
2908 # @return A new, possibly empty, Geo::GDAL::Extent object, which
2909 # represents the joint area of the two extents.
2910 #*
2911 sub Overlap {
2912  my ($self, $e) = @_;
2913  return Geo::GDAL::Extent->new() unless $self->Overlaps($e);
2914  my $ret = Geo::GDAL::Extent->new($self);
2915  $ret->[0] = $e->[0] if $self->[0] < $e->[0];
2916  $ret->[1] = $e->[1] if $self->[1] < $e->[1];
2917  $ret->[2] = $e->[2] if $self->[2] > $e->[2];
2918  $ret->[3] = $e->[3] if $self->[3] > $e->[3];
2919  return $ret;
2920 }
2921 
2922 #** @method scalar Overlaps($extent)
2923 # Package subroutine.
2924 # @param extent Another Geo::GDAL::Extent object.
2925 # @return True if this extent overlaps the other extent, false otherwise.
2926 #*
2927 sub Overlaps {
2928  my ($self, $e) = @_;
2929  return $self->[0] < $e->[2] && $self->[2] > $e->[0] && $self->[1] < $e->[3] && $self->[3] > $e->[1];
2930 }
2931 
2932 #** @method list Size()
2933 # Package subroutine.
2934 # @return A list ($width, $height).
2935 #*
2936 sub Size {
2937  my $self = shift;
2938  return (0,0) if $self->IsEmpty;
2939  return ($self->[2] - $self->[0], $self->[3] - $self->[1]);
2940 }
2941 
2942 #** @method Geo::GDAL::Extent new(@params)
2943 # Package subroutine.
2944 # @param params nothing, a list ($xmin, $ymin, $xmax, $ymax), or an Extent object
2945 # @return A new Extent object (empty if no parameters, a copy of the parameter if it is an Extent object).
2946 #*
2947 sub new {
2948  my $class = shift;
2949  my $self;
2950  if (@_ == 0) {
2951  $self = [0,0,-1,0];
2952  } elsif (ref $_[0]) {
2953  @$self = @{$_[0]};
2954  } else {
2955  @$self = @_;
2956  }
2957  bless $self, $class;
2958  return $self;
2959 }
2960 
2961 #** @class Geo::GDAL::GCP
2962 # @brief A ground control point for georeferencing rasters.
2963 # @details
2964 #*
2965 package Geo::GDAL::GCP;
2966 
2967 use base qw(Geo::GDAL)
2968 
2969 #** @attr $Column
2970 # cell x coordinate (access as $gcp->{Column})
2971 #*
2972 
2973 #** @attr $Id
2974 # unique identifier (string) (access as $gcp->{Id})
2975 #*
2976 
2977 #** @attr $Info
2978 # informational message (access as $gcp->{Info})
2979 #*
2980 
2981 #** @attr $Row
2982 # cell y coordinate (access as $gcp->{Row})
2983 #*
2984 
2985 #** @attr $X
2986 # projection coordinate (access as $gcp->{X})
2987 #*
2988 
2989 #** @attr $Y
2990 # projection coordinate (access as $gcp->{Y})
2991 #*
2992 
2993 #** @attr $Z
2994 # projection coordinate (access as $gcp->{Z})
2995 #*
2996 
2997 #** @method scalar new($x = 0.0, $y = 0.0, $z = 0.0, $column = 0.0, $row = 0.0, $info = "", $id = "")
2998 # Class method.
2999 # @param x projection coordinate
3000 # @param y projection coordinate
3001 # @param z projection coordinate
3002 # @param column cell x coordinate
3003 # @param row cell y coordinate
3004 # @param info informational message
3005 # @param id unique identifier (string)
3006 # @return a new Geo::GDAL::GCP object
3007 #*
3008 sub new {
3009  my $pkg = shift;
3010  my $self = Geo::GDALc::new_GCP(@_);
3011  bless $self, $pkg if defined($self);
3012 }
3013 
3014 #** @class Geo::GDAL::GeoTransform
3015 # @brief An array of affine transformation coefficients.
3016 # @details The geo transformation has the form
3017 # \code
3018 # x = a + column * b + row * c
3019 # y = d + column * e + row * f
3020 # \endcode
3021 # where
3022 # (column,row) is the location in cell coordinates, and
3023 # (x,y) is the location in projection coordinates, or vice versa.
3024 # A Geo::GDAL::GeoTransform object is a reference to an anonymous array [a,b,c,d,e,f].
3025 #*
3026 package Geo::GDAL::GeoTransform;
3027 
3028 #** @method Apply($x, $y)
3029 # Object method.
3030 # @param x Column or x, or a reference to an array of columns or x's
3031 # @param y Row or y, or a reference to an array of rows or y's
3032 # @return a list (x, y), where x and y are the transformed coordinates
3033 # or references to arrays of transformed coordinates.
3034 #*
3035 sub Apply {
3036  my ($self, $columns, $rows) = @_;
3037  return Geo::GDAL::ApplyGeoTransform($self, $columns, $rows) unless ref($columns) eq 'ARRAY';
3038  my (@x, @y);
3039  for my $i (0..$#$columns) {
3040  ($x[$i], $y[$i]) =
3041  Geo::GDAL::ApplyGeoTransform($self, $columns->[$i], $rows->[$i]);
3042  }
3043  return (\@x, \@y);
3044 }
3045 
3046 #** @method Inv()
3047 # Object method.
3048 # @return a new Geo::GDAL::GeoTransform object, which is the inverse
3049 # of this one (in void context changes this object).
3050 #*
3051 sub Inv {
3052  my $self = shift;
3053  my @inv = Geo::GDAL::InvGeoTransform($self);
3054  return Geo::GDAL::GeoTransform->new(@inv) if defined wantarray;
3055  @$self = @inv;
3056 }
3057 
3058 #** @method NorthUp()
3059 #*
3060 sub NorthUp {
3061  my $self = shift;
3062  return $self->[2] == 0 && $self->[4] == 0;
3063 }
3064 
3065 #** @method new(@params)
3066 # Class method.
3067 # @param params nothing, a reference to an array [a,b,c,d,e,f], a list
3068 # (a,b,c,d,e,f), or named parameters
3069 # - \a GCPs A reference to an array of Geo::GDAL::GCP objects.
3070 # - \a ApproxOK Minimize the error in the coefficients (integer, default is 1 (true), used with GCPs).
3071 # - \a Extent A Geo::GDAL::Extent object used to obtain the coordinates of the up left corner position.
3072 # - \a CellSize The cell size (width and height) (default is 1, used with Extent).
3073 #
3074 # @note When Extent is specifid, the created geo transform will be
3075 # north up, have square cells, and coefficient f will be -1 times the
3076 # cell size (image y - row - will increase downwards and projection y
3077 # will increase upwards).
3078 # @return a new Geo::GDAL::GeoTransform object.
3079 #*
3080 sub new {
3081  my $class = shift;
3082  my $self;
3083  if (@_ == 0) {
3084  $self = [0,1,0,0,0,1];
3085  } elsif (ref $_[0]) {
3086  @$self = @{$_[0]};
3087  } elsif ($_[0] =~ /^[a-zA-Z]/i) {
3088  my $p = named_parameters(\@_, GCPs => undef, ApproxOK => 1, Extent => undef, CellSize => 1);
3089  if ($p->{gcps}) {
3090  $self = Geo::GDAL::GCPsToGeoTransform($p->{gcps}, $p->{approxok});
3091  } elsif ($p->{extent}) {
3092  $self = Geo::GDAL::GeoTransform->new($p->{extent}[0], $p->{cellsize}, 0, $p->{extent}[2], 0, -$p->{cellsize});
3093  } else {
3094  error("Missing GCPs or Extent");
3095  }
3096  } else {
3097  my @a = @_;
3098  $self = \@a;
3099  }
3100  bless $self, $class;
3101 }
3102 
3103 #** @class Geo::GDAL::MajorObject
3104 # @brief An object, which holds meta data.
3105 # @details
3106 #*
3107 package Geo::GDAL::MajorObject;
3108 
3109 use base qw(Geo::GDAL)
3110 
3111 #** @method scalar Description($description)
3112 # Object method.
3113 # @param description [optional]
3114 # @return the description in a non-void context.
3115 #*
3116 sub Description {
3117  my($self, $desc) = @_;
3118  SetDescription($self, $desc) if defined $desc;
3119  GetDescription($self) if defined wantarray;
3120 }
3121 
3122 #** @method Domains()
3123 # Package subroutine.
3124 # @return the class specific DOMAINS list
3125 #*
3126 sub Domains {
3127  return @DOMAINS;
3128 }
3129 
3130 #** @method scalar GetDescription()
3131 # Object method.
3132 # @return
3133 #*
3134 sub GetDescription {
3135 }
3136 
3137 #** @method hash reference GetMetadata($domain = "")
3138 # Object method.
3139 # @note see Metadata
3140 # @param domain
3141 # @return
3142 #*
3143 sub GetMetadata {
3144 }
3145 
3146 #** @method GetMetadataDomainList()
3147 #*
3148 sub GetMetadataDomainList {
3149 }
3150 
3151 #** @method hash reference Metadata(hashref metadata = undef, $domain = '')
3152 # Object method.
3153 # @param metadata
3154 # @param domain
3155 # @return the metadata in a non-void context.
3156 #*
3157 sub Metadata {
3158  my $self = shift,
3159  my $metadata = ref $_[0] ? shift : undef;
3160  my $domain = shift // '';
3161  SetMetadata($self, $metadata, $domain) if defined $metadata;
3162  GetMetadata($self, $domain) if defined wantarray;
3163 }
3164 
3165 #** @method SetDescription($NewDesc)
3166 # Object method.
3167 # @param NewDesc
3168 #
3169 #*
3170 sub SetDescription {
3171 }
3172 
3173 #** @method SetMetadata(hashref metadata, $domain = "")
3174 # Object method.
3175 # @note see Metadata
3176 # @param metadata
3177 # @param domain
3178 #
3179 #*
3180 sub SetMetadata {
3181 }
3182 
3183 #** @class Geo::GDAL::RasterAttributeTable
3184 # @brief An attribute table in a raster band.
3185 # @details
3186 #*
3187 package Geo::GDAL::RasterAttributeTable;
3188 
3189 use base qw(Geo::GDAL)
3190 
3191 #** @method Band()
3192 #*
3193 sub Band {
3194  my $self = shift;
3195  parent($self);
3196 }
3197 
3198 #** @method ChangesAreWrittenToFile()
3199 #*
3200 sub ChangesAreWrittenToFile {
3201 }
3202 
3203 #** @method Geo::GDAL::RasterAttributeTable Clone()
3204 # Object method.
3205 # @return a new Geo::GDAL::RasterAttributeTable object
3206 #*
3207 sub Clone {
3208 }
3209 
3210 #** @method hash Columns(%columns)
3211 # Object method.
3212 # A get/set method for the columns of the RAT
3213 # @param columns optional, a the keys are column names and the values are anonymous
3214 # hashes with keys Type and Usage
3215 # @return a hash similar to the optional input parameter
3216 #*
3217 sub Columns {
3218  my $self = shift;
3219  my %columns;
3220  if (@_) { # create columns
3221  %columns = @_;
3222  for my $name (keys %columns) {
3223  $self->CreateColumn($name, $columns{$name}{Type}, $columns{$name}{Usage});
3224  }
3225  }
3226  %columns = ();
3227  for my $c (0..$self->GetColumnCount-1) {
3228  my $name = $self->GetNameOfCol($c);
3229  $columns{$name}{Type} = $self->GetTypeOfCol($c);
3230  $columns{$name}{Usage} = $self->GetUsageOfCol($c);
3231  }
3232  return %columns;
3233 }
3234 
3235 #** @method CreateColumn($name, $type, $usage)
3236 # Object method.
3237 # @param name
3238 # @param type one of FieldTypes
3239 # @param usage one of FieldUsages
3240 #*
3241 sub CreateColumn {
3242  my($self, $name, $type, $usage) = @_;
3243  for my $color (qw/Red Green Blue Alpha/) {
3244  carp "RAT column type will be 'Integer' for usage '$color'." if $usage eq $color and $type ne 'Integer';
3245  }
3246  $type = s2i(rat_field_type => $type);
3247  $usage = s2i(rat_field_usage => $usage);
3248  _CreateColumn($self, $name, $type, $usage);
3249 }
3250 
3251 #** @method DumpReadable()
3252 #*
3253 sub DumpReadable {
3254 }
3255 
3256 #** @method list FieldTypes()
3257 # Package subroutine.
3258 # @return
3259 #*
3260 sub FieldTypes {
3261  return @FIELD_TYPES;
3262 }
3263 
3264 #** @method list FieldUsages()
3265 # Package subroutine.
3266 # @return
3267 #*
3268 sub FieldUsages {
3269  return @FIELD_USAGES;
3270 }
3271 
3272 #** @method scalar GetColOfUsage($usage)
3273 # Object method.
3274 # @param usage
3275 # @return
3276 #*
3277 sub GetColOfUsage {
3278  my($self, $usage) = @_;
3279  _GetColOfUsage($self, s2i(rat_field_usage => $usage));
3280 }
3281 
3282 #** @method scalar GetColumnCount()
3283 # Object method.
3284 # @return
3285 #*
3286 sub GetColumnCount {
3287 }
3288 
3289 #** @method scalar GetNameOfCol($column)
3290 # Object method.
3291 # @param column
3292 # @return
3293 #*
3294 sub GetNameOfCol {
3295 }
3296 
3297 #** @method scalar GetRowCount()
3298 # Object method.
3299 #*
3300 sub GetRowCount {
3301 }
3302 
3303 #** @method scalar GetRowOfValue($value)
3304 # Object method.
3305 # @param value a cell value
3306 # @return row index or -1
3307 #*
3308 sub GetRowOfValue {
3309 }
3310 
3311 #** @method GetTableType()
3312 #*
3313 sub GetTableType {
3314 }
3315 
3316 #** @method scalar GetTypeOfCol($column)
3317 # Object method.
3318 # @param column
3319 # @return
3320 #*
3321 sub GetTypeOfCol {
3322  my($self, $col) = @_;
3323  i2s(rat_field_type => _GetTypeOfCol($self, $col));
3324 }
3325 
3326 #** @method scalar GetUsageOfCol($column)
3327 # Object method.
3328 # @param column
3329 # @return
3330 #*
3331 sub GetUsageOfCol {
3332  my($self, $col) = @_;
3333  i2s(rat_field_usage => _GetUsageOfCol($self, $col));
3334 }
3335 
3336 #** @method scalar GetValueAsDouble($row, $column)
3337 # Object method.
3338 # @param row
3339 # @param column
3340 # @return
3341 #*
3342 sub GetValueAsDouble {
3343 }
3344 
3345 #** @method scalar GetValueAsInt($row, $column)
3346 # Object method.
3347 # @param row
3348 # @param column
3349 # @return
3350 #*
3351 sub GetValueAsInt {
3352 }
3353 
3354 #** @method scalar GetValueAsString($row, $column)
3355 # Object method.
3356 # @param row
3357 # @param column
3358 # @return
3359 #*
3360 sub GetValueAsString {
3361 }
3362 
3363 #** @method LinearBinning($Row0MinIn, $BinSizeIn)
3364 # Object method.
3365 # @param Row0MinIn [optional] the lower bound (cell value) of the first category.
3366 # @param BinSizeIn [optional] the width of each category (in cell value units).
3367 # @return ($Row0MinIn, $BinSizeIn) or an empty list if LinearBinning is not set.
3368 #*
3369 sub LinearBinning {
3370  my $self = shift;
3371  SetLinearBinning($self, @_) if @_ > 0;
3372  return unless defined wantarray;
3373  my @a = GetLinearBinning($self);
3374  return $a[0] ? ($a[1], $a[2]) : ();
3375 }
3376 
3377 #** @method SetRowCount($count)
3378 # Object method.
3379 # @param count
3380 #
3381 #*
3382 sub SetRowCount {
3383 }
3384 
3385 #** @method SetTableType()
3386 #*
3387 sub SetTableType {
3388 }
3389 
3390 #** @method SetValueAsDouble($row, $column, $value)
3391 # Object method.
3392 # @param row
3393 # @param column
3394 # @param value
3395 #
3396 #*
3397 sub SetValueAsDouble {
3398 }
3399 
3400 #** @method SetValueAsInt($row, $column, $value)
3401 # Object method.
3402 # @param row
3403 # @param column
3404 # @param value
3405 #
3406 #*
3407 sub SetValueAsInt {
3409 
3410 #** @method SetValueAsString($row, $column, $value)
3411 # Object method.
3412 # @param row
3413 # @param column
3414 # @param value
3415 #
3416 #*
3417 sub SetValueAsString {
3419 
3420 #** @method scalar Value($row, $column, $value)
3421 # Object method.
3422 # @param row
3423 # @param column
3424 # @param value [optional]
3425 # @return
3426 #*
3427 sub Value {
3428  my($self, $row, $column) = @_;
3429  SetValueAsString($self, $row, $column, $_[3]) if defined $_[3];
3430  return unless defined wantarray;
3431  GetValueAsString($self, $row, $column);
3432 }
3433 
3434 #** @method Geo::GDAL::RasterAttributeTable new()
3435 # Class method.
3436 # @return a new Geo::GDAL::RasterAttributeTable object
3437 #*
3438 sub new {
3439  my $pkg = shift;
3440  my $self = Geo::GDALc::new_RasterAttributeTable(@_);
3441  bless $self, $pkg if defined($self);
3442 }
3443 
3444 #** @class Geo::GDAL::Transformer
3445 # @brief
3446 # @details This class is not yet documented for the GDAL Perl bindings.
3447 # @todo Test and document.
3448 #*
3449 package Geo::GDAL::Transformer;
3450 
3451 use base qw(Geo::GDAL)
3452 
3453 #** @method TransformGeolocations()
3454 #*
3455 sub TransformGeolocations {
3456 }
3457 
3458 #** @method TransformPoint()
3459 #*
3460 sub TransformPoint {
3461 }
3462 
3463 #** @method new()
3464 #*
3465 sub new {
3466  my $pkg = shift;
3467  my $self = Geo::GDALc::new_Transformer(@_);
3468  bless $self, $pkg if defined($self);
3469 }
3470 
3471 #** @class Geo::GDAL::VSIF
3472 # @brief A GDAL virtual file system.
3473 # @details
3474 #*
3475 package Geo::GDAL::VSIF;
3476 
3477 use base qw(Exporter)
3478 
3479 #** @method Close()
3480 # Object method.
3481 #*
3482 sub Close {
3483  my ($self) = @_;
3484  Geo::GDAL::VSIFCloseL($self);
3485 }
3486 
3487 #** @method Flush()
3488 #*
3489 sub Flush {
3490  my ($self) = @_;
3491  Geo::GDAL::VSIFFlushL($self);
3492 }
3493 
3494 #** @method MkDir($path)
3495 # Package subroutine.
3496 # Make a directory.
3497 # @param path The directory to make.
3498 # @note The name of this method is VSIMkdir in GDAL.
3499 #*
3500 sub MkDir {
3501  my ($path) = @_;
3502  # mode unused in CPL
3503  Geo::GDAL::Mkdir($path, 0);
3504 }
3505 
3506 #** @method Geo::GDAL::VSIF Open($filename, $mode)
3507 # Package subroutine.
3508 # @param filename Name of the file to open. For example "/vsimem/x".
3509 # @param mode Access mode. 'r', 'r+', 'w', etc.
3510 # @return A file handle on success.
3511 #*
3512 sub Open {
3513  my ($path, $mode) = @_;
3514  my $self = Geo::GDAL::VSIFOpenL($path, $mode);
3515  bless $self, 'Geo::GDAL::VSIF';
3516 }
3517 
3518 #** @method scalar Read($count)
3519 # Object method.
3520 # @param count The number of bytes to read from the file.
3521 # @return A byte string.
3522 #*
3523 sub Read {
3524  my ($self, $count) = @_;
3525  Geo::GDAL::VSIFReadL($count, $self);
3526 }
3527 
3528 #** @method list ReadDir($dir)
3529 # Package subroutine.
3530 # @return Contents of a directory in an anonymous array or as a list.
3531 #*
3532 sub ReadDir {
3533  my ($path) = @_;
3534  Geo::GDAL::ReadDir($path);
3535 }
3536 
3537 #** @method scalar ReadDirRecursive($dir)
3538 # Package subroutine.
3539 # @note Give the directory in the form '/vsimem', i.e., without trailing '/'.
3540 # @return Contents of a directory tree in an anonymous array.
3541 #*
3542 sub ReadDirRecursive {
3543  my ($path) = @_;
3544  Geo::GDAL::ReadDirRecursive($path);
3545 }
3546 
3547 #** @method Rename($old, $new)
3548 # Package subroutine.
3549 # Rename a file.
3550 # @note The name of this method is VSIRename in GDAL.
3551 #*
3552 sub Rename {
3553  my ($old, $new) = @_;
3554  Geo::GDAL::Rename($old, $new);
3555 }
3556 
3557 #** @method RmDir($path)
3558 # Package subroutine.
3559 # Remove a directory.
3560 # @note The name of this method is VSIRmdir in GDAL.
3561 #*
3562 sub RmDir {
3563  my ($dirname, $recursive) = @_;
3564  eval {
3565  if (!$recursive) {
3566  Geo::GDAL::Rmdir($dirname);
3567  } else {
3568  for my $f (ReadDir($dirname)) {
3569  next if $f eq '..' or $f eq '.';
3570  my @s = Stat($dirname.'/'.$f);
3571  if ($s[0] eq 'f') {
3572  Unlink($dirname.'/'.$f);
3573  } elsif ($s[0] eq 'd') {
3574  Rmdir($dirname.'/'.$f, 1);
3575  Rmdir($dirname.'/'.$f);
3576  }
3577  }
3578  RmDir($dirname);
3579  }
3580  };
3581  if ($@) {
3582  my $r = $recursive ? ' recursively' : '';
3583  error("Cannot remove directory \"$dirname\"$r.");
3584  }
3585 }
3586 
3587 #** @method Seek($offset, $whence)
3588 # Object method.
3589 #*
3590 sub Seek {
3591  my ($self, $offset, $whence) = @_;
3592  Geo::GDAL::VSIFSeekL($self, $offset, $whence);
3593 }
3594 
3595 #** @method list Stat($filename)
3596 # Package subroutine.
3597 # @return ($filemode, $filesize). filemode is f for a plain file, d
3598 # for a directory, l for a symbolic link, p for a named pipe (FIFO), S
3599 # for a socket, b for a block special file, and c for a character
3600 # special file.
3601 #*
3602 sub Stat {
3603  my ($path) = @_;
3604  Geo::GDAL::Stat($path);
3605 }
3606 
3607 #** @method scalar Tell()
3608 # Object method.
3609 #*
3610 sub Tell {
3611  my ($self) = @_;
3612  Geo::GDAL::VSIFTellL($self);
3613 }
3614 
3615 #** @method Truncate($new_size)
3616 # Object method.
3617 #*
3618 sub Truncate {
3619  my ($self, $new_size) = @_;
3620  Geo::GDAL::VSIFTruncateL($self, $new_size);
3621 }
3622 
3623 #** @method Unlink($filename)
3624 # Package subroutine.
3625 # @param filename The file to delete.
3626 # @return 0 on success and -1 on an error.
3627 #*
3628 sub Unlink {
3629  my ($filename) = @_;
3630  Geo::GDAL::Unlink($filename);
3631 }
3632 
3633 #** @method Write($scalar)
3634 # Object method.
3635 # @param scalar The byte string to write to the file.
3636 # @return Number of bytes written into the file.
3637 #*
3638 sub Write {
3639  my ($self, $data) = @_;
3640  Geo::GDAL::VSIFWriteL($data, $self);
3641 }
3642 
3643 #** @class Geo::GDAL::VSILFILE
3644 #*
3645 package Geo::GDAL::VSILFILE;
3646 
3647 use base qw(Geo::GDAL)
3648 
3649 #** @class Geo::GDAL::XML
3650 # @brief A simple XML parser
3651 # @details
3652 #*
3653 package Geo::GDAL::XML;
3654 
3655 #** @method new($string)
3656 # Object method.
3657 # @param string String containing XML.
3658 # @return A new Geo::GDAL::XML object, which is a reference to an anonymous array.
3659 #*
3660 sub new {
3661  my $class = shift;
3662  my $xml = shift // '';
3663  my $self = ParseXMLString($xml);
3664  bless $self, $class;
3665  $self->traverse(sub {my $node = shift; bless $node, $class});
3666  return $self;
3667 }
3668 
3669 #** @method serialize()
3670 # Object method.
3671 # @return The XML serialized into a string.
3672 #*
3673 sub serialize {
3674  my $self = shift;
3675  return SerializeXMLTree($self);
3676 }
3677 1;
3678 # This file was automatically generated by SWIG (http://www.swig.org).
3679 # Version 2.0.12
3680 #
3681 # Do not make changes to this file unless you know what you are doing--modify
3682 # the SWIG interface file instead.
3683 }
3684 
3685 #** @method traverse(coderef subroutine)
3686 # Object method.
3687 # @param subroutine Code reference, which will be called for each node in the XML with parameters: node, node_type, node_value. Node type is either Attribute, Comment, Element, Literal, or Text.
3688 #*
3689 sub traverse {
3690  my ($self, $sub) = @_;
3691  my $type = $self->[0];
3692  my $data = $self->[1];
3693  $type = NodeType($type);
3694  $sub->($self, $type, $data);
3695  for my $child (@{$self}[2..$#$self]) {
3696  traverse($child, $sub);
3697  }
3698 }
3699 
3700 #** @class Geo::GNM
3701 # @brief Base class for geographical networks in GDAL.
3702 # @details
3703 #*
3704 package Geo::GNM;
3705 
3706 #** @method CastToGenericNetwork()
3707 #*
3708 sub CastToGenericNetwork {
3709 }
3710 
3711 #** @method CastToNetwork()
3712 #*
3713 sub CastToNetwork {
3714 }
3715 
3716 #** @method GATConnectedComponents()
3717 #*
3718 sub GATConnectedComponents {
3719 }
3720 
3721 #** @method GATDijkstraShortestPath()
3722 #*
3723 sub GATDijkstraShortestPath {
3724 }
3725 
3726 #** @method GATKShortestPath()
3727 #*
3728 sub GATKShortestPath {
3729 }
3730 
3731 #** @method GNM_EDGE_DIR_BOTH()
3732 #*
3733 sub GNM_EDGE_DIR_BOTH {
3734 }
3735 
3736 #** @method GNM_EDGE_DIR_SRCTOTGT()
3737 #*
3738 sub GNM_EDGE_DIR_SRCTOTGT {
3739 }
3740 
3741 #** @method GNM_EDGE_DIR_TGTTOSRC()
3742 #*
3743 sub GNM_EDGE_DIR_TGTTOSRC {
3744  1;
3745 }
3746 
3747 #** @class Geo::GNM::GenericNetwork
3748 # @details
3749 #*
3750 package Geo::GNM::GenericNetwork;
3751 
3752 use base qw(Geo::GNM::Network Geo::GNM)
3753 
3754 #** @method ChangeAllBlockState()
3755 #*
3756 sub ChangeAllBlockState {
3757 }
3758 
3759 #** @method ChangeBlockState()
3760 #*
3761 sub ChangeBlockState {
3762 }
3763 
3764 #** @method ConnectFeatures()
3765 #*
3766 sub ConnectFeatures {
3767 }
3768 
3769 #** @method ConnectPointsByLines()
3770 #*
3771 sub ConnectPointsByLines {
3772 }
3773 
3774 #** @method CreateRule()
3775 #*
3776 sub CreateRule {
3777 }
3778 
3779 #** @method DeleteAllRules()
3780 #*
3781 sub DeleteAllRules {
3782 }
3783 
3784 #** @method DeleteRule()
3785 #*
3786 sub DeleteRule {
3787 }
3788 
3789 #** @method DisconnectFeatures()
3790 #*
3791 sub DisconnectFeatures {
3792 }
3793 
3794 #** @method DisconnectFeaturesWithId()
3795 #*
3796 sub DisconnectFeaturesWithId {
3797 }
3798 
3799 #** @method GetRules()
3800 #*
3801 sub GetRules {
3802 }
3803 
3804 #** @method ReconnectFeatures()
3805 #*
3806 sub ReconnectFeatures {
3807 }
3808 
3809 #** @class Geo::GNM::MajorObject
3810 # @details
3811 #*
3812 package Geo::GNM::MajorObject;
3813 
3814 #** @class Geo::GNM::Network
3815 # @details
3816 #*
3817 package Geo::GNM::Network;
3818 
3819 use base qw(Geo::GDAL::MajorObject Geo::GNM)
3820 
3821 #** @method CommitTransaction()
3822 #*
3823 sub CommitTransaction {
3824 }
3825 
3826 #** @method CopyLayer()
3827 #*
3828 sub CopyLayer {
3829 }
3830 
3831 #** @method DisconnectAll()
3832 #*
3833 sub DisconnectAll {
3834 }
3835 
3836 #** @method GetFeatureByGlobalFID()
3837 #*
3838 sub GetFeatureByGlobalFID {
3839 }
3840 
3841 #** @method GetFileList()
3842 #*
3843 sub GetFileList {
3844 }
3845 
3846 #** @method GetLayerByIndex()
3847 #*
3848 sub GetLayerByIndex {
3849 }
3850 
3851 #** @method GetLayerByName()
3852 #*
3853 sub GetLayerByName {
3854 }
3855 
3856 #** @method GetLayerCount()
3857 #*
3858 sub GetLayerCount {
3859 }
3860 
3861 #** @method GetName()
3862 #*
3863 sub GetName {
3864 }
3865 
3866 #** @method GetPath()
3867 #*
3868 sub GetPath {
3869 }
3870 
3871 #** @method GetProjection()
3872 #*
3873 sub GetProjection {
3874 }
3875 
3876 #** @method GetProjectionRef()
3877 #*
3878 sub GetProjectionRef {
3879 }
3880 
3881 #** @method GetVersion()
3882 #*
3883 sub GetVersion {
3884 }
3885 
3886 #** @method RollbackTransaction()
3887 #*
3888 sub RollbackTransaction {
3889 }
3890 
3891 #** @method StartTransaction()
3892 #*
3893 sub StartTransaction {
3894 }
3895 
3896 #** @class Geo::OGR
3897 # @brief OGR utility functions.
3898 # @details A wrapper for many OGR utility functions and a root class for all
3899 # OGR classes.
3900 #*
3901 package Geo::OGR;
3902 
3903 #** @method list ByteOrders()
3904 # Package subroutine.
3905 # @return a list of byte order types, XDR and NDR. XDR denotes
3906 # big-endian and NDR denotes little-endian.
3907 #*
3908 sub ByteOrders {
3909 }
3910 
3911 #** @method Geo::GDAL::Driver Driver($name)
3912 # Package subroutine.
3913 # A.k.a GetDriver.
3914 # @param name the short name of the driver.
3915 # @note No check is made that the driver is actually a vector driver.
3916 # @return a Geo::GDAL::Driver object.
3917 #*
3918 sub Driver {
3919  return 'Geo::GDAL::Driver' unless @_;
3920  bless Geo::GDAL::Driver(@_), 'Geo::OGR::Driver';
3921 }
3922 
3923 #** @method list DriverNames()
3924 # Package subroutine.
3925 # A.k.a GetDriverNames
3926 # \code
3927 # perl -MGeo::GDAL -e '@d=Geo::OGR::DriverNames;print "@d\n"'
3928 # \endcode
3929 # @note Use Geo::GDAL::DriverNames for raster drivers.
3930 # @return a list of the short names of all available GDAL vector drivers.
3931 #*
3932 sub DriverNames {
3933 }
3934 
3935 #** @method list Drivers()
3936 # Package subroutine.
3937 # @note Use Geo::GDAL::Drivers for raster drivers.
3938 # @return a list of all available GDAL vector drivers.
3939 #*
3940 sub Drivers {
3941  my @drivers;
3942  for my $i (0..GetDriverCount()-1) {
3943  my $driver = Geo::GDAL::GetDriver($i);
3944  push @drivers, $driver if $driver->TestCapability('VECTOR');
3945  }
3946  return @drivers;
3947 }
3948 
3949 #** @method Flatten()
3950 #*
3951 sub Flatten {
3952 }
3953 
3954 #** @method scalar GeometryTypeModify($type, $modifier)
3955 # Object method.
3956 # @param type a geometry type (one of Geo::OGR::GeometryTypes).
3957 # @param modifier one of 'flatten', 'set_Z', 'make_collection', 'make_curve', or 'make_linear'.
3958 # @return modified geometry type.
3959 #*
3960 sub GeometryTypeModify {
3961  my($type, $modifier) = @_;
3962  $type = s2i(geometry_type => $type);
3963  return i2s(geometry_type => GT_Flatten($type)) if $modifier =~ /flat/i;
3964  return i2s(geometry_type => GT_SetZ($type)) if $modifier =~ /z/i;
3965  return i2s(geometry_type => GT_GetCollection($type)) if $modifier =~ /collection/i;
3966  return i2s(geometry_type => GT_GetCurve($type)) if $modifier =~ /curve/i;
3967  return i2s(geometry_type => GT_GetLinear($type)) if $modifier =~ /linear/i;
3968  error(1, $modifier, {Flatten => 1, SetZ => 1, GetCollection => 1, GetCurve => 1, GetLinear => 1});
3969 }
3970 
3971 #** @method scalar GeometryTypeTest($type, $test, $type2)
3972 # Object method.
3973 # @param type a geometry type (one of Geo::OGR::GeometryTypes).
3974 # @param test one of 'has_z', 'is_subclass_of', 'is_curve', 'is_surface', or 'is_non_linear'.
3975 # @param type2 a geometry type (one of Geo::OGR::GeometryTypes). Required for 'is_subclass_of' test.
3976 # @return result of the test.
3977 #*
3978 sub GeometryTypeTest {
3979  my($type, $test, $type2) = @_;
3980  $type = s2i(geometry_type => $type);
3981  if (defined $type2) {
3982  $type = s2i(geometry_type => $type);
3983  } else {
3984  error("Usage: GeometryTypeTest(type1, 'is_subclass_of', type2).") if $test =~ /subclass/i;
3985  }
3986  return GT_HasZ($type) if $test =~ /z/i;
3987  return GT_IsSubClassOf($type, $type2) if $test =~ /subclass/i;
3988  return GT_IsCurve($type) if $test =~ /curve/i;
3989  return GT_IsSurface($type) if $test =~ /surface/i;
3990  return GT_IsNonLinear($type) if $test =~ /linear/i;
3991  error(1, $test, {HasZ => 1, IsSubClassOf => 1, IsCurve => 1, IsSurface => 1, IsNonLinear => 1});
3992 }
3993 
3994 #** @method list GeometryTypes()
3995 # Package subroutine.
3996 # @return a list of all geometry types, currently:
3997 # CircularString, CircularStringM, CircularStringZ, CircularStringZM, CompoundCurve, CompoundCurveM, CompoundCurveZ, CompoundCurveZM, Curve, CurveM, CurvePolygon, CurvePolygonM, CurvePolygonZ, CurvePolygonZM, CurveZ, CurveZM, GeometryCollection, GeometryCollection25D, GeometryCollectionM, GeometryCollectionZM, LineString, LineString25D, LineStringM, LineStringZM, LinearRing, MultiCurve, MultiCurveM, MultiCurveZ, MultiCurveZM, MultiLineString, MultiLineString25D, MultiLineStringM, MultiLineStringZM, MultiPoint, MultiPoint25D, MultiPointM, MultiPointZM, MultiPolygon, MultiPolygon25D, MultiPolygonM, MultiPolygonZM, MultiSurface, MultiSurfaceM, MultiSurfaceZ, MultiSurfaceZM, None, Point, Point25D, PointM, PointZM, Polygon, Polygon25D, PolygonM, PolygonZM, PolyhedralSurface, PolyhedralSurfaceM, PolyhedralSurfaceZ, PolyhedralSurfaceZM, Surface, SurfaceM, SurfaceZ, SurfaceZM, TIN, TINM, TINZ, TINZM, Triangle, TriangleM, TriangleZ, TriangleZM, and Unknown.
3998 #*
3999 sub GeometryTypes {
4000  1;
4001  # This file was automatically generated by SWIG (http://www.swig.org).
4002  # Version 2.0.12
4003  #
4004  # Do not make changes to this file unless you know what you are doing--modify
4005  # the SWIG interface file instead.
4006 }
4007 
4008 #** @method GetNonLinearGeometriesEnabledFlag()
4009 #*
4010 sub GetNonLinearGeometriesEnabledFlag {
4011 }
4012 
4013 #** @method GetOpenDSCount()
4014 #*
4015 sub GetOpenDSCount {
4016 }
4017 
4018 #** @method HasM()
4019 #*
4020 sub HasM {
4021 }
4022 
4023 #** @method HasZ()
4024 #*
4025 sub HasZ {
4026 }
4027 
4028 #** @method Geo::GDAL::Dataset Open($name, $update = 0)
4029 # Object method.
4030 # Open a vector data source.
4031 # @param name The data source string (directory, filename, etc.).
4032 # @param update Whether to open the data source in update mode (default is not).
4033 # @return a new Geo::GDAL::Dataset object.
4034 #*
4035 sub Open {
4036  my @p = @_; # name, update
4037  my @flags = qw/VECTOR/;
4038  push @flags, qw/UPDATE/ if $p[1];
4039  my $dataset = Geo::GDAL::OpenEx($p[0], \@flags);
4040  error("Failed to open $p[0]. Is it a vector dataset?") unless $dataset;
4041  return $dataset;
4042 }
4043 
4044 #** @method Geo::GDAL::Dataset OpenShared($name, $update = 0)
4045 # Object method.
4046 # Open a vector data source in shared mode.
4047 # @param name The data source string (directory, filename, etc.).
4048 # @param update Whether to open the data source in update mode.
4049 # @return a new Geo::GDAL::Dataset object.
4050 #*
4051 sub OpenShared {
4052  my @p = @_; # name, update
4053  my @flags = qw/VECTOR SHARED/;
4054  push @flags, qw/UPDATE/ if $p[1];
4055  my $dataset = Geo::GDAL::OpenEx($p[0], \@flags);
4056  error("Failed to open $p[0]. Is it a vector dataset?") unless $dataset;
4057  return $dataset;
4058 }
4059 
4060 #** @method SetGenerate_DB2_V72_BYTE_ORDER($Generate_DB2_V72_BYTE_ORDER)
4061 # Object method.
4062 # Needed only on IBM DB2.
4063 #*
4064 sub SetGenerate_DB2_V72_BYTE_ORDER {
4065 }
4066 
4067 #** @method SetNonLinearGeometriesEnabledFlag()
4068 #*
4069 sub SetNonLinearGeometriesEnabledFlag {
4070 }
4071 
4072 #** @class Geo::OGR::DataSource
4073 # @brief A vector dataset.
4074 # @details This is a legacy class which should not be
4075 # used in new code. Use Geo::GDAL::Dataset.
4076 #*
4077 package Geo::OGR::DataSource;
4078 
4079 #** @method Geo::GDAL::Dataset Open()
4080 # Package subroutine.
4081 # The same as Geo::OGR::Open
4082 #*
4083 sub Open {
4084 }
4085 
4086 #** @method Geo::GDAL::Dataset OpenShared()
4087 # Package subroutine.
4088 # The same as Geo::OGR::OpenShared
4089 #*
4090 sub OpenShared {
4091 }
4092 
4093 #** @class Geo::OGR::Driver
4094 # @brief A vector format driver.
4095 # @details This is a legacy class which
4096 # should not be used in new code. Use Geo::GDAL::Driver.
4097 #*
4098 package Geo::OGR::Driver;
4099 
4100 use base qw(Geo::GDAL::Driver)
4101 
4102 #** @method Geo::GDAL::Dataset Copy(Geo::GDAL::Dataset source, $name, arrayref options = undef)
4103 # Object method.
4104 # Copy a vector data source into a new data source with this driver.
4105 # @param source The Geo::GDAL::Dataset object to be copied.
4106 # @param name The name for the new data source.
4107 # @param options Driver specific options. In addition to options
4108 # specified in GDAL documentation the option STRICT can be set to 'NO'
4109 # for a more relaxed copy. Otherwise the STRICT is 'YES'.
4110 # @note The order of the first two parameters is different from that in Geo::GDAL::Driver::Copy.
4111 # @return a new Geo::GDAL::Dataset object.
4112 #*
4113 sub Copy {
4114  my ($self, @p) = @_; # src, name, options
4115  my $strict = 1; # the default in bindings
4116  $strict = 0 if $p[2] && $p[2]->{STRICT} eq 'NO';
4117  $self->SUPER::Copy($p[1], $p[0], $strict, @{$p[2..4]}); # path, src, strict, options, cb, cb_data
4118 }
4119 
4120 #** @method Geo::GDAL::Dataset Create($name, hashref options = undef )
4121 # Object method.
4122 # Create a new vector data source using this driver.
4123 # @param name The data source name.
4124 # @param options Driver specific dataset creation options.
4125 #*
4126 sub Create {
4127  my ($self, $name, $options) = @_; # name, options
4128  $options //= {};
4129  $self->SUPER::Create(Name => $name, Width => 0, Height => 0, Bands => 0, Type => 'Byte', Options => $options);
4130 }
4131 
4132 #** @method Open()
4133 # Object method.
4134 # The same as Geo::OGR::Open except that only this driver is allowed.
4135 #*
4136 sub Open {
4137  my $self = shift;
4138  my @p = @_; # name, update
4139  my @flags = qw/VECTOR/;
4140  push @flags, qw/UPDATE/ if $p[1];
4141  my $dataset = Geo::GDAL::OpenEx($p[0], \@flags, [$self->Name()]);
4142  error("Failed to open $p[0]. Is it a vector dataset?") unless $dataset;
4143  return $dataset;
4144 }
4145 
4146 #** @class Geo::OGR::Feature
4147 # @brief A collection of non-spatial and spatial attributes.
4148 # @details A feature is a collection of non-spatial and spatial attributes and
4149 # an id, which is a special attribute, and data records according to
4150 # this data model. Attributes are called fields and some fields are
4151 # spatial, i.e., their value is a geometry. Fields have at least a
4152 # name and a type. Features may exist within a layer or
4153 # separetely. The data model of a feature is a definition object.
4154 #*
4155 package Geo::OGR::Feature;
4156 
4157 use base qw(Geo::OGR)
4158 
4159 #** @method Geo::OGR::Feature Clone()
4160 # Object method.
4161 # @return a new Geo::OGR::Feature object
4162 #*
4163 sub Clone {
4164 }
4165 
4166 #** @method DumpReadable()
4167 # Object method.
4168 # Write the contents of this feature to stdout.
4169 #*
4170 sub DumpReadable {
4171 }
4172 
4173 #** @method scalar Equal($feature)
4174 # Object method.
4175 # @param feature a Geo::OGR::Feature object for comparison
4176 # @return boolean
4177 #*
4178 sub Equal {
4179 }
4180 
4181 #** @method scalar FID($id)
4182 # Object method.
4183 # @brief Get or set the id of this feature.
4184 # @param id [optional] the id to set for this feature.
4185 # @return integer the id of this feature.
4186 #*
4187 sub FID {
4188  my $self = shift;
4189  $self->SetFID($_[0]) if @_;
4190  return unless defined wantarray;
4191  $self->GetFID;
4192 }
4193 
4194 #** @method Field($name, $value, ...)
4195 # Object method.
4196 # @brief Get, set, or unset the field value.
4197 # @param name the name (or the index) of the field.
4198 # @param value a scalar, a list of scalars or a reference to a
4199 # list. If undef, the field is unset. If a scalar or a list of
4200 # scalars, the field is set from them.
4201 # @note Non-scalar fields (for example Date) can be set either from a
4202 # scalar, which is then assumed to be a string and parsed, or from a
4203 # list of values (for example year, month, day for Date).
4204 # @note Setting and getting Integer64 fields requires 'use bigint' if
4205 # \$Config{ivsize} is smaller than 8, i.e., in a 32 bit machine.
4206 # @return in non-void context the value of the field, which may be a
4207 # scalar or a list, depending on the field type. For unset fields the
4208 # undef value is returned.
4209 #*
4210 sub Field {
4211  my $self = shift;
4212  my $field = $self->GetFieldIndex(shift // 0);
4213  $self->SetField($field, @_) if @_;
4214  $self->GetField($field) if defined wantarray;
4215 }
4216 
4217 #** @method FillUnsetWithDefault()
4218 #*
4219 sub FillUnsetWithDefault {
4220 }
4221 
4222 #** @method Geometry($name, $geometry)
4223 # Object method.
4224 # @brief Get or set the value of a geometry field.
4225 # @note This method delivers the functionality of undocumented methods
4226 # SetGeometry($geometry), SetGeometryDirectly, SetGeomField,
4227 # SetGeomFieldDirectly, GetGeometry, GetGeometryRef.
4228 #
4229 # Set or get the geometry in the feature. When setting, does a check
4230 # against the schema (GeometryType) of the feature. If the parameter
4231 # is a geometry object, it is cloned.
4232 # @param name [optional] the name of the spatial field,
4233 # whose geometry is to be set. If not given, sets or gets the geometry
4234 # of the first (or the single) spatial field.
4235 # @param geometry [optional] a Geo::OGR::Geometry object or a
4236 # reference to a hash from which such can be created (using
4237 # Geo::OGR::Geometry::new).
4238 # @return in a non-void context the indicated geometry in the feature
4239 # as a Geo::OGR::Geometry object. The returned object contains a
4240 # reference to the actual geometry data in the feature (the geometry
4241 # is not cloned) and to the feature object, thus keeping the feature
4242 # object from being destroyed while the geometry object exists.
4243 #*
4244 sub Geometry {
4245  my $self = shift;
4246  my $field = ((@_ > 0 and ref($_[0]) eq '') or (@_ > 2 and @_ % 2 == 1)) ? shift : 0;
4247  $field = $self->GetGeomFieldIndex($field);
4248  my $geometry;
4249  if (@_ and @_ % 2 == 0) {
4250  %$geometry = @_;
4251  } else {
4252  $geometry = shift;
4253  }
4254  if ($geometry) {
4255  my $type = $self->GetDefn->GetGeomFieldDefn($field)->Type;
4256  if (blessed($geometry) and $geometry->isa('Geo::OGR::Geometry')) {
4257  my $gtype = $geometry->GeometryType;
4258  error("The type of the inserted geometry ('$gtype') is not the same as the type of the field ('$type').")
4259  if $type ne 'Unknown' and $type ne $gtype;
4260  eval {
4261  $self->SetGeomFieldDirectly($field, $geometry->Clone);
4262  };
4263  confess last_error() if $@;
4264  } elsif (ref($geometry) eq 'HASH') {
4265  $geometry->{GeometryType} //= $type;
4266  eval {
4267  $geometry = Geo::OGR::Geometry->new($geometry);
4268  };
4269  confess last_error() if $@;
4270  my $gtype = $geometry->GeometryType;
4271  error("The type of the inserted geometry ('$gtype') is not the same as the type of the field ('$type').")
4272  if $type ne 'Unknown' and $type ne $gtype;
4273  eval {
4274  $self->SetGeomFieldDirectly($field, $geometry);
4275  };
4276  confess last_error() if $@;
4277  } else {
4278  error("Usage: \$feature->Geometry([field],[geometry])");
4279  }
4280  }
4281  return unless defined wantarray;
4282  $geometry = $self->GetGeomFieldRef($field);
4283  return unless $geometry;
4284  keep($geometry, $self);
4285 }
4286 
4287 #** @method Geo::OGR::FeatureDefn GetDefn()
4288 # Object method.
4289 # @note A.k.a GetDefnRef.
4290 # @return a Geo::OGR::FeatureDefn object, which represents the definition of this feature.
4291 #*
4292 sub GetDefn {
4293  my $self = shift;
4294  my $defn = $self->GetDefnRef;
4295  keep($defn, $self);
4296 }
4297 
4298 #** @method scalar GetFID()
4299 # Object method.
4300 # @return the feature id (an integer).
4301 #*
4302 sub GetFID {
4303 }
4304 
4305 #** @method list GetField($name)
4306 # Object method.
4307 # See Field().
4308 #*
4309 sub GetField {
4310  my ($self, $field) = @_;
4311  $field = $self->GetFieldIndex($field);
4312  return unless IsFieldSet($self, $field);
4313  my $type = GetFieldType($self, $field);
4314  return GetFieldAsInteger($self, $field) if $type == $Geo::OGR::OFTInteger;
4315  return GetFieldAsInteger64($self, $field) if $type == $Geo::OGR::OFTInteger64;
4316  return GetFieldAsDouble($self, $field) if $type == $Geo::OGR::OFTReal;
4317  return GetFieldAsString($self, $field) if $type == $Geo::OGR::OFTString;
4318  if ($type == $Geo::OGR::OFTIntegerList) {
4319  my $ret = GetFieldAsIntegerList($self, $field);
4320  return wantarray ? @$ret : $ret;
4321  }
4322  if ($type == $Geo::OGR::OFTInteger64List) {
4323  my $ret = GetFieldAsInteger64List($self, $field);
4324  return wantarray ? @$ret : $ret;
4325  }
4326  if ($type == $Geo::OGR::OFTRealList) {
4327  my $ret = GetFieldAsDoubleList($self, $field);
4328  return wantarray ? @$ret : $ret;
4329  }
4330  if ($type == $Geo::OGR::OFTStringList) {
4331  my $ret = GetFieldAsStringList($self, $field);
4332  return wantarray ? @$ret : $ret;
4333  }
4334  if ($type == $Geo::OGR::OFTBinary) {
4335  return GetFieldAsBinary($self, $field);
4336  }
4337  if ($type == $Geo::OGR::OFTDate) {
4338  my @ret = GetFieldAsDateTime($self, $field);
4339  # year, month, day, hour, minute, second, timezone
4340  return wantarray ? @ret[0..2] : [@ret[0..2]];
4341  }
4342  if ($type == $Geo::OGR::OFTTime) {
4343  my @ret = GetFieldAsDateTime($self, $field);
4344  return wantarray ? @ret[3..6] : [@ret[3..6]];
4345  }
4346  if ($type == $Geo::OGR::OFTDateTime) {
4347  my @ret = GetFieldAsDateTime($self, $field);
4348  return wantarray ? @ret : [@ret];
4349  }
4350  error("Perl bindings do not support the field type '".i2s(field_type => $type)."'.");
4351 }
4352 
4353 #** @method scalar GetFieldDefn($name)
4354 # Object method.
4355 # Get the definition of a field.
4356 # @param name the name of the field.
4357 # @return a Geo::OGR::FieldDefn object.
4358 #*
4359 sub GetFieldDefn {
4360  my $self = shift;
4361  my $field = $self->GetFieldIndex(shift);
4362  return $self->GetFieldDefnRef($field);
4363 }
4364 
4365 #** @method list GetFieldNames()
4366 # Object method.
4367 # Get the names of the fields in this feature.
4368 #*
4369 sub GetFieldNames {
4370 }
4371 
4372 #** @method scalar GetGeomFieldDefn($name)
4373 # Object method.
4374 # Get the definition of a spatial field.
4375 # @param name the name of the spatial field.
4376 # @return a Geo::OGR::GeomFieldDefn object.
4377 #*
4378 sub GetGeomFieldDefn {
4379  my $self = shift;
4380  my $field = $self->GetGeomFieldIndex(shift);
4381  return $self->GetGeomFieldDefnRef($field);
4382 }
4383 
4384 #** @method GetNativeData()
4385 #*
4386 sub GetNativeData {
4387 }
4388 
4389 #** @method GetNativeMediaType()
4390 #*
4391 sub GetNativeMediaType {
4392 }
4393 
4394 #** @method hash reference GetSchema()
4395 # Object method.
4396 # @brief Get the schema of this feature.
4397 #
4398 # @return the schema as a hash whose keywords are Name, StyleIgnored
4399 # and Fields. Fields is an anonymous array of first non-spatial and
4400 # then spatial field schemas as in Geo::OGR::FieldDefn::Schema() and
4401 # Geo::OGR::GeomFieldDefn::Schema().
4402 #*
4403 sub GetSchema {
4404  my $self = shift;
4405  error("Schema of a feature cannot be set directly.") if @_;
4406  return $self->GetDefnRef->Schema;
4407 }
4408 
4409 #** @method scalar GetStyleString()
4410 # Object method.
4411 # @return a string
4412 #*
4413 sub GetStyleString {
4414 }
4415 
4416 #** @method IsFieldNull()
4417 #*
4418 sub IsFieldNull {
4419 }
4420 
4421 #** @method IsFieldSetAndNotNull()
4422 #*
4423 sub IsFieldSetAndNotNull {
4424 }
4425 
4426 #** @method Geo::OGR::Layer Layer()
4427 # Object method.
4428 # @return the layer to which this feature belongs to or undef.
4429 #*
4430 sub Layer {
4431  my $self = shift;
4432  parent($self);
4433 }
4434 
4435 #** @method hash reference Row(%row)
4436 # Object method.
4437 # @note This method discards the data the destination feature (or
4438 # layer) does not support. Changes in data due to differences between
4439 # field types may also occur.
4440 #
4441 # Get and/or set the data of the feature. The key of the (key,value)
4442 # pairs of the row is the field name. Special field names FID and
4443 # Geometry are used for feature id and (single) geometry
4444 # respectively. The geometry/ies is/are set and get using the
4445 # Geo::OGR::Feature::Geometry method. Field values are set using the
4446 # Geo::OGR::Feature::Field method.
4447 # @param row [optional] feature data in a hash.
4448 # @return a reference to feature data in a hash. Spatial fields are
4449 # returned as Geo::OGR::Geometry objects.
4450 #*
4451 sub Row {
4452  my $self = shift;
4453  my $nf = $self->GetFieldCount;
4454  my $ngf = $self->GetGeomFieldCount;
4455  if (@_) { # update
4456  my %row;
4457  if (@_ == 1 and ref($_[0]) eq 'HASH') {
4458  %row = %{$_[0]};
4459  } elsif (@_ and @_ % 2 == 0) {
4460  %row = @_;
4461  } else {
4462  error('Usage: $feature->Row(%FeatureData).');
4463  }
4464  $self->SetFID($row{FID}) if defined $row{FID};
4465  #$self->Geometry($schema, $row{Geometry}) if $row{Geometry};
4466  for my $name (keys %row) {
4467  next if $name eq 'FID';
4468  if ($name eq 'Geometry') {
4469  $self->Geometry(0, $row{$name});
4470  next;
4471  }
4472  my $f = 0;
4473  for my $i (0..$nf-1) {
4474  if ($self->GetFieldDefnRef($i)->Name eq $name) {
4475  $self->SetField($i, $row{$name});
4476  $f = 1;
4477  last;
4478  }
4479  }
4480  next if $f;
4481  for my $i (0..$ngf-1) {
4482  if ($self->GetGeomFieldDefnRef($i)->Name eq $name) {
4483  $self->Geometry($i, $row{$name});
4484  $f = 1;
4485  last;
4486  }
4487  }
4488  next if $f;
4489  carp "Unknown field: '$name'.";
4490  }
4491  }
4492  return unless defined wantarray;
4493  my %row = ();
4494  for my $i (0..$nf-1) {
4495  my $name = $self->GetFieldDefnRef($i)->Name;
4496  $row{$name} = $self->GetField($i);
4497  }
4498  for my $i (0..$ngf-1) {
4499  my $name = $self->GetGeomFieldDefnRef($i)->Name || 'Geometry';
4500  $row{$name} = $self->GetGeometry($i);
4501  }
4502  $row{FID} = $self->GetFID;
4503  return \%row;
4504 }
4505 
4506 #** @method SetFID($id)
4507 # Object method.
4508 # @param id the feature id.
4509 #*
4510 sub SetFID {
4511 }
4512 
4513 #** @method SetField($name, @Value)
4514 # Object method.
4515 # See Field().
4516 #*
4517 sub SetField {
4518  my $self = shift;
4519  my $field = $self->GetFieldIndex(shift);
4520  my $arg = $_[0];
4521  if (@_ == 0 or !defined($arg)) {
4522  _UnsetField($self, $field);
4523  return;
4524  }
4525  $arg = [@_] if @_ > 1;
4526  my $type = $self->GetFieldType($field);
4527  if (ref($arg)) {
4528  if ($type == $Geo::OGR::OFTIntegerList) {
4529  SetFieldIntegerList($self, $field, $arg);
4530  }
4531  elsif ($type == $Geo::OGR::OFTInteger64List) {
4532  SetFieldInteger64List($self, $field, $arg);
4533  }
4534  elsif ($type == $Geo::OGR::OFTRealList) {
4535  SetFieldDoubleList($self, $field, $arg);
4536  }
4537  elsif ($type == $Geo::OGR::OFTStringList) {
4538  SetFieldStringList($self, $field, $arg);
4539  }
4540  elsif ($type == $Geo::OGR::OFTDate) {
4541  _SetField($self, $field, @$arg[0..2], 0, 0, 0, 0);
4542  }
4543  elsif ($type == $Geo::OGR::OFTTime) {
4544  $arg->[3] //= 0;
4545  _SetField($self, $field, 0, 0, 0, @$arg[0..3]);
4546  }
4547  elsif ($type == $Geo::OGR::OFTDateTime) {
4548  $arg->[6] //= 0;
4549  _SetField($self, $field, @$arg[0..6]);
4550  }
4551  elsif ($type == $Geo::OGR::OFTInteger64)
4552  {
4553  SetFieldInteger64($self, $field, $arg);
4554  }
4555  else {
4556  $type = i2s(field_type => $type);
4557  my $name = $self->GetFieldDefnRef($field)->Name;
4558  error("'$arg' is not a suitable value for field $name($type).");
4559  }
4560  } else {
4561  if ($type == $Geo::OGR::OFTBinary) {
4562  #$arg = unpack('H*', $arg); # remove when SetFieldBinary is available
4563  $self->SetFieldBinary($field, $arg);
4564  }
4565  elsif ($type == $Geo::OGR::OFTInteger64)
4566  {
4567  SetFieldInteger64($self, $field, $arg);
4568  }
4569  elsif ($type == $Geo::OGR::OFTInteger or $type == $Geo::OGR::OFTReal or $type == $Geo::OGR::OFTString)
4570  {
4571  _SetField($self, $field, $arg);
4572  }
4573  else {
4574  $type = i2s(field_type => $type);
4575  my $name = $self->GetFieldDefnRef($field)->Name;
4576  error("'$arg' is not a suitable value for field $name($type).");
4577  }
4578  }
4579 }
4580 
4581 #** @method SetFieldNull()
4582 #*
4583 sub SetFieldNull {
4584 }
4585 
4586 #** @method SetFrom($other, $forgiving = 1, hashref map)
4587 # Object method.
4588 # @param other a Geo::OGR::Feature object
4589 # @param forgiving [optional] set to false if the operation should not
4590 # continue if output fields do not match some of the source fields
4591 # @param map [optional] a mapping from output field indexes to source
4592 # fields, include into the hash all field indexes of this feature
4593 # which should be set
4594 #*
4595 sub SetFrom {
4596  my($self, $other) = @_;
4597  _SetFrom($self, $other), return if @_ <= 2;
4598  my $forgiving = $_[2];
4599  _SetFrom($self, $other, $forgiving), return if @_ <= 3;
4600  my $map = $_[3];
4601  my @list;
4602  for my $i (1..GetFieldCount($self)) {
4603  push @list, ($map->{$i} || -1);
4604  }
4605  SetFromWithMap($self, $other, 1, \@list);
4606 }
4607 
4608 #** @method SetNativeData()
4609 #*
4610 sub SetNativeData {
4611 }
4612 
4613 #** @method SetNativeMediaType()
4614 #*
4615 sub SetNativeMediaType {
4616 }
4617 
4618 #** @method SetStyleString($string)
4619 # Object method.
4620 # @param string
4621 #*
4622 sub SetStyleString {
4623 }
4624 
4625 #** @method list Tuple(@tuple)
4626 # Object method.
4627 # @note This method discards the data the destination feature (or
4628 # layer) does not support. Changes in data due to differences between
4629 # field types may also occur.
4630 #
4631 # @note The schema of the tuple needs to be the same as that of the
4632 # feature.
4633 #
4634 # Get and/set the data of the feature. The expected data in the tuple
4635 # is ([feature_id,] non-spatial fields, spatial fields). The fields in
4636 # the tuple are in the order they are in the schema. Field values are
4637 # set using the Geo::OGR::Feature::Field method. Geometries are set
4638 # and get using the Geo::OGR::Feature::Geometry method.
4639 # @param tuple [optional] feature data in an array
4640 # @return feature data in an array
4641 #*
4642 sub Tuple {
4643  my $self = shift;
4644  my $nf = $self->GetFieldCount;
4645  my $ngf = $self->GetGeomFieldCount;
4646  if (@_) {
4647  my $values = ref $_[0] ? $_[0] : \@_;
4648  my $FID;
4649  $FID = shift @$values if @$values == $nf + $ngf + 1;
4650  $self->SetFID($FID) if defined $FID;
4651  if (@$values != $nf + $ngf) {
4652  my $n = $nf + $ngf;
4653  error("Too many or too few attribute values for a feature (need $n).");
4654  }
4655  my $index = 0; # index to non-geometry and geometry fields
4656  for my $i (0..$nf-1) {
4657  $self->SetField($i, $values->[$i]);
4658  }
4659  for my $i (0..$ngf-1) {
4660  $self->Geometry($i, $values->[$nf+$i]);
4661  }
4662  }
4663  return unless defined wantarray;
4664  my @ret = ($self->GetFID);
4665  for my $i (0..$nf-1) {
4666  my $v = $self->GetField($i);
4667  push @ret, $v;
4668  }
4669  for my $i (0..$ngf-1) {
4670  my $v = $self->GetGeometry($i);
4671  push @ret, $v;
4672  }
4673  return @ret;
4674 }
4675 
4676 #** @method scalar Validate(list flags)
4677 # Object method.
4678 # @param flags one of more of null, geom_type, width,
4679 # allow_null_when_default, or all.
4680 # @exception croaks with an error message if the feature is not valid.
4681 # @return integer denoting the validity of the feature object.
4682 #*
4683 sub Validate {
4684  my $self = shift;
4685  my $flags = 0;
4686  for my $flag (@_) {
4687  my $f = eval '$Geo::OGR::'.uc($flag);
4688  $flags |= $f;
4689  }
4690  _Validate($self, $flags);
4691 }
4692 
4693 #** @method Geo::OGR::Feature new(%schema)
4694 # Class method.
4695 # @brief Create a new feature.
4696 # @param Named parameters:
4697 # - \a Schema a reference to a schema hash, or a Geo::OGR::Layer,
4698 # Geo::OGR::Feature, or Geo::OGR::FeatureDefn object.
4699 # - \a Values values for the feature attributes.
4700 # - \a StyleIgnored whether the style can be omitted when fetching
4701 # features. (default is false)
4702 #
4703 # Schema is a hash with the following keys:
4704 # - \a Name name of the schema (not used).
4705 # - \a Fields a list of Geo::OGR::FieldDefn or Geo::OGR::GeomFieldDefn
4706 # objects or references to hashes from which fields can be created.
4707 # - \a GeometryType the geometry type if the feature has only one spatial field.
4708 #
4709 # @note Do not mix GeometryType and geometry fields in Fields list.
4710 # @note Old syntax where the argument is a Geo::OGR::FeatureDefn
4711 # object or Schema hash is supported.
4712 #
4713 # @return a new Geo::OGR::Feature object.
4714 #*
4715 sub new {
4716  my $pkg = shift;
4717  my $arg;
4718  if (ref $_[0]) {
4719  if (ref $_[0] eq 'HASH' && $_[0]->{Schema}) {
4720  $arg = $_[0];
4721  } else {
4722  $arg = {Schema => $_[0]};
4723  }
4724  } elsif (@_ and @_ % 2 == 0) {
4725  %$arg = @_;
4726  unless ($arg->{Schema}) {
4727  my %tmp = @_;
4728  $arg->{Schema} = \%tmp;
4729  }
4730  } else {
4731  error("The argument must be either a schema or a hash.");
4732  }
4733  error("Missing schema.") unless $arg->{Schema};
4734  my $defn;
4735  for (ref $arg->{Schema}) {
4736  (/Geo::OGR::Layer$/ || /Geo::OGR::Feature$/) && do {
4737  $defn = $arg->{Schema}->GetDefn;
4738  last;
4739  };
4740  /Geo::OGR::FeatureDefn$/ && do {
4741  $defn = $arg->{Schema};
4742  last;
4743  };
4744  $defn = Geo::OGR::FeatureDefn->new($arg->{Schema});
4745  }
4746  my $self = Geo::OGRc::new_Feature($defn);
4747  error("Feature creation failed.") unless $self;
4748  bless $self, $pkg;
4749  for (ref $arg->{Values}) {
4750  /ARRAY/ && do {
4751  $self->Tuple($arg->{Values});
4752  last;
4753  };
4754  /HASH/ && do {
4755  $self->Row($arg->{Values});
4756  last;
4757  };
4758  /Geo::OGR::Feature$/ && do {
4759  $self->Tuple($arg->{Values}->Tuple);
4760  last;
4761  };
4762  /^$/ && do {
4763  last;
4764  };
4765  error("Value parameter must be an array, hash, or another feature. Not $_.");
4766  }
4767  return $self;
4768 }
4769 
4770 #** @class Geo::OGR::FeatureDefn
4771 # @brief The schema of a feature or a layer.
4772 # @details A FeatureDefn object is a collection of field definition objects. A
4773 # read-only FeatureDefn object can be obtained from a layer
4774 # (Geo::OGR::Layer::GetDefn()) or a feature
4775 # (Geo::OGR::Feature::GetDefn()).
4776 #*
4777 package Geo::OGR::FeatureDefn;
4778 
4779 use base qw(Geo::OGR)
4780 
4781 #** @method AddField(%params)
4782 # Object method.
4783 # @param params Named parameters to create a new Geo::OGR::FieldDefn
4784 # or Geo::OGR::GeomFieldDefn object.
4785 #*
4786 sub AddField {
4787  my $self = shift;
4788  error("Read-only definition.") if parent($self);
4789  my %params;
4790  if (@_ == 0) {
4791  } elsif (ref($_[0]) eq 'HASH') {
4792  %params = %{$_[0]};
4793  } elsif (@_ % 2 == 0) {
4794  %params = @_;
4795  }
4796  $params{Type} //= '';
4797  if (s_exists(field_type => $params{Type})) {
4798  my $fd = Geo::OGR::FieldDefn->new(%params);
4799  $self->AddFieldDefn($fd);
4800  } else {
4801  my $fd = Geo::OGR::GeomFieldDefn->new(%params);
4802  $self->AddGeomFieldDefn($fd);
4803  }
4804 }
4805 
4806 #** @method DeleteField($name)
4807 # Object method.
4808 # @note Currently only geometry fields can be deleted.
4809 # @param index the index of the geometry field to be deleted.
4810 #*
4811 sub DeleteField {
4812  my ($self, $name) = @_;
4813  error("Read-only definition.") if parent($self);
4814  for my $i (0..$self->GetFieldCount-1) {
4815  error("Non-spatial fields cannot be deleted.") if $self->_GetFieldDefn($i)->Name eq $name;
4816  }
4817  for my $i (0..$self->GetGeomFieldCount-1) {
4818  $self->DeleteGeomFieldDefn($i) if $self->_GetGeomFieldDefn($i)->Name eq $name;
4819  }
4820  error(2, $name, 'Field');
4821 }
4822 
4823 #** @method Feature()
4824 #*
4825 sub Feature {
4826  my $self = shift;
4827  return parent($self);
4828 }
4829 
4830 #** @method scalar GetFieldDefn($name)
4831 # Object method.
4832 # Get the definition of a field.
4833 # @param name the name of the field.
4834 # @return a Geo::OGR::FieldDefn object.
4835 #*
4836 sub GetFieldDefn {
4837  my $self = shift;
4838  my $field = $self->GetFieldIndex(shift);
4839  return $self->_GetFieldDefn($field);
4840 }
4841 
4842 #** @method list GetFieldNames()
4843 # Object method.
4844 # The names of the fields in this layer or feature definition.
4845 # @return the list of field names.
4846 #*
4847 sub GetFieldNames {
4848  my $self = shift;
4849  my @names = ();
4850  for my $i (0..$self->GetFieldCount-1) {
4851  push @names, $self->_GetFieldDefn($i)->Name;
4852  }
4853  for my $i (0..$self->GetGeomFieldCount-1) {
4854  push @names, $self->_GetGeomFieldDefn($i)->Name;
4855  }
4856  return @names;
4857 }
4858 
4859 #** @method scalar GetGeomFieldDefn($name)
4860 # Object method.
4861 # Get the definition of a spatial field.
4862 # @param name the name of the spatial field.
4863 # @return a Geo::OGR::GeomFieldDefn object.
4864 #*
4865 sub GetGeomFieldDefn {
4866  my $self = shift;
4867  my $field = $self->GetGeomFieldIndex(shift);
4868  return $self->_GetGeomFieldDefn($field);
4869 }
4870 
4871 #** @method scalar GetName()
4872 # Object method.
4873 # @return the name of this layer or feature definition.
4874 #*
4875 sub GetName {
4876 }
4877 
4878 #** @method hash reference GetSchema()
4879 # Object method.
4880 # @brief Get the schema of this feature or layer definition.
4881 #
4882 # @return the schema as a hash whose keywords are Name, StyleIgnored
4883 # and Fields. Fields is an anonymous array of first non-spatial and
4884 # then spatial field schemas as in Geo::OGR::FieldDefn::Schema() and
4885 # Geo::OGR::GeomFieldDefn::Schema().
4886 #*
4887 sub GetSchema {
4888  my $self = shift;
4889  carp "Schema of a feature definition should not be set directly." if @_;
4890  if (@_ and @_ % 2 == 0) {
4891  my %schema = @_;
4892  if ($schema{Fields}) {
4893  for my $field (@{$schema{Fields}}) {
4894  $self->AddField($field);
4895  }
4896  }
4897  }
4898  my %schema;
4899  $schema{Name} = $self->Name();
4900  $schema{StyleIgnored} = $self->StyleIgnored();
4901  $schema{Fields} = [];
4902  for my $i (0..$self->GetFieldCount-1) {
4903  my $s = $self->_GetFieldDefn($i)->Schema;
4904  push @{$schema{Fields}}, $s;
4905  }
4906  for my $i (0..$self->GetGeomFieldCount-1) {
4907  my $s = $self->_GetGeomFieldDefn($i)->Schema;
4908  push @{$schema{Fields}}, $s;
4909  }
4910  return wantarray ? %schema : \%schema;
4911 }
4912 
4913 #** @method IsSame(Geo::OGR::FeatureDefn defn)
4914 # Object method.
4915 # @return true if this definition is similar to the other definition,
4916 # false otherwise.
4917 #*
4918 sub IsSame {
4919 }
4920 
4921 #** @method scalar IsStyleIgnored()
4922 # Object method.
4923 # Get the ignore status of style information when fetching features.
4924 # @return the ignore status of style information
4925 # @since 1.9.0
4926 #*
4927 sub IsStyleIgnored {
4928 }
4929 
4930 #** @method SetStyleIgnored($IgnoreState)
4931 # Object method.
4932 # Set the ignore status of style information when fetching features.
4933 # @since 1.9.0
4934 #*
4935 sub SetStyleIgnored {
4936 }
4937 
4938 #** @method Geo::OGR::FeatureDefn new(%schema)
4939 # Class method.
4940 # Creates a new layer or feature definition. The new definition is
4941 # either initialized to the given schema or it will contain no
4942 # non-spatial fields and one spatial field, whose Name is '' and
4943 # GeometryType is 'Unknown' or the value of the named parameter
4944 # GeometryType.
4945 # @param schema [optional] The schema for the new feature definition,
4946 # as in Geo::OGR::FeatureDefn::Schema().
4947 # @return a Geo::OGR::FeatureDefn object
4948 #
4949 # Example usage:
4950 # \code
4951 # $fd = Geo::OGR::FeatureDefn->new(
4952 # Name => "name",
4953 # Fields => [{ Name => 'field1', Type => 'String' },
4954 # { Name => 'geom', GeometryType => 'Point' }] );
4955 # \endcode
4956 #*
4957 sub new {
4958  my $pkg = shift;
4959  my %schema;
4960  if (@_ == 1 and ref($_[0]) eq 'HASH') {
4961  %schema = %{$_[0]};
4962  } elsif (@_ and @_ % 2 == 0) {
4963  %schema = @_;
4964  }
4965  my $fields = $schema{Fields};
4966  error("The 'Fields' argument must be an array reference.") if $fields and ref($fields) ne 'ARRAY';
4967  $schema{Name} //= '';
4968  my $self = Geo::OGRc::new_FeatureDefn($schema{Name});
4969  bless $self, $pkg;
4970  my $gt = $schema{GeometryType};
4971  if ($gt) {
4972  $self->GeometryType($gt);
4973  } elsif ($fields) {
4974  $self->DeleteGeomFieldDefn(0);
4975  }
4976  $self->StyleIgnored($schema{StyleIgnored}) if exists $schema{StyleIgnored};
4977  for my $fd (@{$fields}) {
4978  my $d = $fd;
4979  if (ref($fd) eq 'HASH') {
4980  # if Name and Type are missing, assume Name => Type
4981  if (!(exists $fd->{Name} && exists $fd->{Type})) {
4982  for my $key (sort keys %$fd) {
4983  if (s_exists(field_type => $fd->{$key}) ||
4984  s_exists(geometry_type => $fd->{$key}))
4985  {
4986  $fd->{Name} = $key;
4987  $fd->{Type} = $fd->{$key};
4988  delete $fd->{$key};
4989  last;
4990  }
4991  }
4992  }
4993  if ($fd->{GeometryType} or ($fd->{Type} && s_exists(geometry_type => $fd->{Type}))) {
4994  $d = Geo::OGR::GeomFieldDefn->new(%$fd);
4995  } else {
4996  $d = Geo::OGR::FieldDefn->new(%$fd);
4997  }
4998  }
4999  if (blessed($d) and $d->isa('Geo::OGR::FieldDefn')) {
5000  AddFieldDefn($self, $d);
5001  } elsif (blessed($d) and $d->isa('Geo::OGR::GeomFieldDefn')) {
5002  error("Do not mix GeometryType and geometry fields in Fields.") if $gt;
5003  AddGeomFieldDefn($self, $d);
5004  } else {
5005  error("Item in field list does not define a field.");
5006  }
5007  }
5008  return $self;
5009 }
5010 
5011 #** @class Geo::OGR::FieldDefn
5012 # @brief A definition of a non-spatial attribute.
5013 # @details
5014 #*
5015 package Geo::OGR::FieldDefn;
5016 
5017 use base qw(Geo::OGR)
5018 
5019 #** @method scalar Default($value)
5020 # Object method.
5021 # Get or set the default value for this field.
5022 # @note a.k.a. GetDefault and SetDefault
5023 # @param value [optional]
5024 # @return the default value of this field in non-void context.
5025 #*
5026 sub Default {
5027  my $self = shift;
5028  SetDefault($self, $_[0]) if @_;
5029  GetDefault($self) if defined wantarray;
5030 }
5031 
5032 #** @method GetSchema()
5033 #*
5034 sub GetSchema {
5035 }
5036 
5037 #** @method scalar Ignored($ignore)
5038 # Object method.
5039 # Get and/or set the ignore status (whether this field should be
5040 # omitted when fetching features) of this field.
5041 # @note a.k.a. IsIgnored, SetIgnored
5042 # @param ignore [optional]
5043 # @return the ignore status of this field in non-void context.
5044 # @since 1.9.0
5045 #*
5046 sub Ignored {
5047  my $self = shift;
5048  SetIgnored($self, $_[0]) if @_;
5049  IsIgnored($self) if defined wantarray;
5050 }
5051 
5052 #** @method IsDefaultDriverSpecific()
5053 #*
5054 sub IsDefaultDriverSpecific {
5055 }
5056 
5057 #** @method scalar Justify($justify)
5058 # Object method.
5059 # Get and/or set the justification of this field.
5060 # @note a.k.a. GetJustify, SetJustify
5061 # @param justify [optional] One of field justify types (Geo::OGR::FieldDefn::JustifyValues).
5062 # @return the justify value of this field in non-void context.
5063 #*
5064 sub Justify {
5065  my($self, $justify) = @_;
5066  if (defined $justify) {
5067  $justify = s2i(justify => $justify);
5068  SetJustify($self, $justify);
5069  }
5070  return i2s(justify => GetJustify($self)) if defined wantarray;
5071 }
5072 
5073 #** @method list JustifyValues()
5074 # Package subroutine.
5075 # Justify values supported by GDAL. Current list is
5076 # Left, Right, and Undefined.
5077 #*
5078 sub JustifyValues {
5079  return @JUSTIFY;
5080 }
5081 
5082 #** @method scalar Name($name)
5083 # Object method.
5084 # Get and/or set the name of the field.
5085 # @note a.k.a. GetName, GetNameRef, SetName
5086 # @param name [optional]
5087 # @return the name in non-void context
5088 #*
5089 sub Name {
5090  my $self = shift;
5091  SetName($self, $_[0]) if @_;
5092  GetName($self) if defined wantarray;
5093 }
5094 
5095 #** @method scalar Nullable($nullable)
5096 # Object method.
5097 # Get or set the nullable constraint for this field.
5098 # @note a.k.a. IsNullable and SetNullable
5099 # @param nullable [optional]
5100 # @return the nullable value of this field in non-void context.
5101 #*
5102 sub Nullable {
5103  my $self = shift;
5104  SetNullable($self, $_[0]) if @_;
5105  IsNullable($self) if defined wantarray;
5107 
5108 #** @method scalar Precision($precision)
5109 # Object method.
5110 # Get and/or set the precision of this field.
5111 # @note a.k.a. GetPrecision, SetPrecision
5112 # @param precision [optional]
5113 # @return the precision of this field in non-void context.
5114 #*
5115 sub Precision {
5116  my $self = shift;
5117  SetPrecision($self, $_[0]) if @_;
5118  GetPrecision($self) if defined wantarray;
5119 }
5120 
5121 #** @method hash reference Schema(%params)
5122 # Object method.
5123 # Get the schema or set parts of the schema
5124 # @param params [optional] as those in Geo::OGR::FieldDefn::new.
5125 # @return a reference to a hash whose keys are as those in Geo::OGR::FieldDefn::new.
5126 #*
5127 sub Schema {
5128  my $self = shift;
5129  if (@_) {
5130  my $params = @_ % 2 == 0 ? {@_} : shift;
5131  for my $key (keys %SCHEMA_KEYS) {
5132  next unless exists $params->{$key};
5133  eval "\$self->$key(\$params->{$key})";
5134  confess(last_error()) if $@;
5135  }
5136  }
5137  return unless defined wantarray;
5138  my %schema = ();
5139  for my $key (keys %SCHEMA_KEYS) {
5140  $schema{$key} = eval '$self->'.$key;
5141  }
5142  return wantarray ? %schema : \%schema;
5143 }
5144 
5145 #** @method SetSchema()
5146 #*
5147 sub SetSchema {
5148 }
5149 
5150 #** @method scalar SubType($SubType)
5151 # Object method.
5152 # @note a.k.a. GetSubType, SetSubType
5153 # @param SubType [optional] One of field sub types (Geo::OGR::FieldDefn::SubTypes).
5154 # @return the sub type of this field in non-void context.
5155 #*
5156 sub SubType {
5157  my($self, $subtype) = @_;
5158  if (defined $subtype) {
5159  $subtype = s2i(field_subtype => $subtype);
5160  SetSubType($self, $subtype);
5161  }
5162  return i2s(field_subtype => GetSubType($self)) if defined wantarray;
5163 }
5164 
5165 #** @method SubTypes()
5166 #*
5167 sub SubTypes {
5168  return @SUBTYPES;
5169 }
5170 
5171 #** @method scalar Type($type)
5172 # Object method.
5173 # Get and/or set the type of the field.
5174 # @note a.k.a. GetFieldTypeName, GetTypeName, GetType, SetType
5175 # @param type [optional] One of field types (Geo::OGR::FieldDefn::Types).
5176 # @return one of field types in non-void context.
5177 #*
5178 sub Type {
5179  my($self, $type) = @_;
5180  if (defined $type) {
5181  $type = s2i(field_type => $type);
5182  SetType($self, $type);
5183  }
5184  return i2s(field_type => GetType($self)) if defined wantarray;
5185 }
5186 
5187 #** @method list Types()
5188 # Package subroutine.
5189 # Field types supported by GDAL. Current list is
5190 # Binary, Date, DateTime, Integer, Integer64, Integer64List, IntegerList, Real, RealList, String, StringList, Time, WideString, and WideStringList.
5191 # (However, WideString is not supported.)
5192 #*
5193 sub Types {
5194  return @TYPES;
5195 }
5196 
5197 #** @method scalar Width($width)
5198 # Object method.
5199 # Get and/or set the field width.
5200 # @note a.k.a. GetWidth, SetWidth
5201 # @param width [optional]
5202 # @return the width of this field in non-void context.
5203 #*
5204 sub Width {
5205  my $self = shift;
5206  SetWidth($self, $_[0]) if @_;
5207  GetWidth($self) if defined wantarray;
5208 }
5209 
5210 #** @method Geo::OGR::FieldDefn new(%params)
5211 # Class method.
5212 # @brief Create a new field definition.
5213 #
5214 # @param Named parameters:
5215 # - \a Name Field name (default is 'unnamed').
5216 # - \a Type Field type, one of Geo::OGR::FieldDefn::Types (default is 'String').
5217 # - \a SubType Field sub type, one of Geo::OGR::FieldDefn::SubTypes.
5218 # - \a Justify Justify value, one of Geo::OGR::FieldDefn::JustifyValues
5219 # - \a Width
5220 # - \a Precision
5221 # - \a Nullable (default is true)
5222 # - \a Default
5223 # - \a Ignored (default is false)
5224 #
5225 # @note Simplified parameters Name => 'Type' are also supported.
5226 #
5227 # @return a new Geo::OGR::FieldDefn object
5228 #*
5229 sub new {
5230  my $pkg = shift;
5231  my $params = {Name => 'unnamed', Type => 'String'};
5232  if (@_ == 0) {
5233  } elsif (@_ == 1 and not ref $_[0]) {
5234  $params->{Name} = shift;
5235  } elsif (@_ == 2 and not $Geo::OGR::FieldDefn::SCHEMA_KEYS{$_[0]}) {
5236  $params->{Name} = shift;
5237  $params->{Type} = shift;
5238  } else {
5239  my $tmp = @_ % 2 == 0 ? {@_} : shift;
5240  for my $key (keys %$tmp) {
5241  if ($Geo::OGR::FieldDefn::SCHEMA_KEYS{$key}) {
5242  $params->{$key} = $tmp->{$key};
5243  } else {
5244  carp "Unknown parameter: '$key'." if $key ne 'Index';
5245  }
5246  }
5247  }
5248  $params->{Type} = s2i(field_type => $params->{Type});
5249  my $self = Geo::OGRc::new_FieldDefn($params->{Name}, $params->{Type});
5250  bless $self, $pkg;
5251  delete $params->{Name};
5252  delete $params->{Type};
5253  $self->Schema($params);
5254  return $self;
5255 }
5256 
5257 #** @class Geo::OGR::GeomFieldDefn
5258 # @brief A definition of a spatial attribute.
5259 # @details
5260 #*
5261 package Geo::OGR::GeomFieldDefn;
5262 
5263 use base qw(Geo::OGR)
5264 
5265 #** @method scalar GeometryType($type)
5266 # Object method.
5267 # @note a.k.a. GetType, SetType
5268 # @return the geometry type of the field.
5269 #*
5270 sub GeometryType {
5271 }
5272 
5273 #** @method GetSchema()
5274 #*
5275 sub GetSchema {
5276 }
5277 
5278 #** @method scalar Ignored($ignore)
5279 # Object method.
5280 # @note a.k.a. IsIgnored, SetIgnored
5281 # @return the ignore status of the field.
5282 #*
5283 sub Ignored {
5284  my $self = shift;
5285  SetIgnored($self, $_[0]) if @_;
5286  IsIgnored($self) if defined wantarray;
5287 }
5288 
5289 #** @method scalar Name($name)
5290 # Object method.
5291 # @note a.k.a. GetName, GetNameRef, SetName
5292 # @return the name of the field.
5293 #*
5294 sub Name {
5295  my $self = shift;
5296  SetName($self, $_[0]) if @_;
5297  GetName($self) if defined wantarray;
5298 }
5299 
5300 #** @method scalar Nullable($nullable)
5301 # Object method.
5302 # @note a.k.a. IsNullable, SetNullable
5303 # @return the nullable status of the field.
5304 #*
5305 sub Nullable {
5306  my $self = shift;
5307  SetNullable($self, $_[0]) if @_;
5308  IsNullable($self) if defined wantarray;
5309 }
5310 
5311 #** @method hash reference Schema(%params)
5312 # Object method.
5313 # Get the schema or set parts of the schema.
5314 # @param params [optional] as those in Geo::OGR::GeomFieldDefn::new.
5315 # @return a reference to a hash whose keys are as those in Geo::OGR::GeomFieldDefn::new.
5316 #*
5317 sub Schema {
5318  my $self = shift;
5319  if (@_) {
5320  my $params = @_ % 2 == 0 ? {@_} : shift;
5321  for my $key (keys %SCHEMA_KEYS) {
5322  next unless exists $params->{$key};
5323  eval "\$self->$key(\$params->{$key})";
5324  confess last_error() if $@;
5325  }
5326  }
5327  return unless defined wantarray;
5328  my %schema = ();
5329  for my $key (keys %SCHEMA_KEYS) {
5330  $schema{$key} = eval '$self->'.$key;
5331  }
5332  return wantarray ? %schema : \%schema;
5333 }
5334 
5335 #** @method SetSchema()
5336 #*
5337 sub SetSchema {
5338 }
5339 
5340 #** @method scalar SpatialReference($sr)
5341 # Object method.
5342 # @note a.k.a. GetSpatialRef, SetSpatialRef
5343 # @return the spatial reference of the field as a Geo::OSR::SpatialReference object.
5344 #*
5345 sub SpatialReference {
5346  my $self = shift;
5347  SetSpatialRef($self, $_[0]) if @_;
5348  GetSpatialRef($self) if defined wantarray;
5349 }
5350 
5351 #** @method Type()
5352 # Object method.
5353 # @return the type of this geometry field. One of Geo::OGR::GeomFieldDefn::Types
5354 #*
5355 sub Type {
5356  my($self, $type) = @_;
5357  if (defined $type) {
5358  $type = s2i(geometry_type => $type);
5359  SetType($self, $type);
5360  }
5361  i2s(geometry_type => GetType($self)) if defined wantarray;
5362 }
5363 
5364 #** @method Types()
5365 # Package subroutine.
5366 # @return a list of all geometry types, currently:
5367 # CircularString, CircularStringM, CircularStringZ, CircularStringZM, CompoundCurve, CompoundCurveM, CompoundCurveZ, CompoundCurveZM, Curve, CurveM, CurvePolygon, CurvePolygonM, CurvePolygonZ, CurvePolygonZM, CurveZ, CurveZM, GeometryCollection, GeometryCollection25D, GeometryCollectionM, GeometryCollectionZM, LineString, LineString25D, LineStringM, LineStringZM, LinearRing, MultiCurve, MultiCurveM, MultiCurveZ, MultiCurveZM, MultiLineString, MultiLineString25D, MultiLineStringM, MultiLineStringZM, MultiPoint, MultiPoint25D, MultiPointM, MultiPointZM, MultiPolygon, MultiPolygon25D, MultiPolygonM, MultiPolygonZM, MultiSurface, MultiSurfaceM, MultiSurfaceZ, MultiSurfaceZM, None, Point, Point25D, PointM, PointZM, Polygon, Polygon25D, PolygonM, PolygonZM, PolyhedralSurface, PolyhedralSurfaceM, PolyhedralSurfaceZ, PolyhedralSurfaceZM, Surface, SurfaceM, SurfaceZ, SurfaceZM, TIN, TINM, TINZ, TINZM, Triangle, TriangleM, TriangleZ, TriangleZM, and Unknown.
5368 #*
5369 sub Types {
5371 }
5372 
5373 #** @method Geo::OGR::GeomFieldDefn new(%params)
5374 # Class method.
5375 # @brief Create a new spatial field definition.
5376 #
5377 # @param params one or more of:
5378 # - \a Name name for the field (default is 'geom').
5379 # - \a GeometryType type for the field type, one of Geo::OGR::GeomFieldDefn::Types (default is 'Unknown').
5380 # - \a SpatialReference a Geo::OSR::SpatialReference object.
5381 # - \a Nullable (default is true)
5382 # - \a Ignored (default is false)
5383 #
5384 # @note Simplified parameters <name> => <type> is also supported.
5385 #
5386 # @return a new Geo::OGR::GeomFieldDefn object
5387 #*
5388 sub new {
5389  my $pkg = shift;
5390  my $params = {Name => 'geom', Type => 'Unknown'};
5391  if (@_ == 0) {
5392  } elsif (@_ == 1) {
5393  $params->{Name} = shift;
5394  } elsif (@_ == 2 and not $Geo::OGR::GeomFieldDefn::SCHEMA_KEYS{$_[0]}) {
5395  $params->{Name} = shift;
5396  $params->{Type} = shift;
5397  } else {
5398  my $tmp = @_ % 2 == 0 ? {@_} : shift;
5399  for my $key (keys %$tmp) {
5400  if ($Geo::OGR::GeomFieldDefn::SCHEMA_KEYS{$key}) {
5401  $params->{$key} = $tmp->{$key};
5402  } else {
5403  carp "Unknown parameter: '$key'." if $key ne 'Index' && $key ne 'GeometryType';
5404  }
5405  }
5406  $params->{Type} //= $tmp->{GeometryType};
5407  }
5408  $params->{Type} = s2i(geometry_type => $params->{Type});
5409  my $self = Geo::OGRc::new_GeomFieldDefn($params->{Name}, $params->{Type});
5410  bless $self, $pkg;
5411  delete $params->{Name};
5412  delete $params->{Type};
5413  $self->Schema($params);
5414  return $self;
5415 }
5416 
5417 #** @class Geo::OGR::Geometry
5418 # @brief Spatial data.
5419 # @details A geometry is spatial data (coordinate values, and a reference to a
5420 # spatial reference system) organized into one of the geometry
5421 # types. Geometries can be created from several type of data including
5422 # a Perl data structure. There are several methods, which modify,
5423 # compare, test, or compute values from geometries.
5424 # @note Most spatial analysis methods require <a
5425 # href="http://geos.osgeo.org/doxygen/">GEOS</a> to work rigorously.
5426 #*
5427 package Geo::OGR::Geometry;
5428 
5429 use base qw(Geo::OGR)
5430 
5431 #** @method AddGeometry($other)
5432 # Object method.
5433 # Add a copy of another geometry to a geometry collection
5434 # @param other a Geo::OGR::Geometry object
5435 #*
5436 sub AddGeometry {
5437 }
5438 
5439 #** @method AddGeometryDirectly($other)
5440 # Object method.
5441 # @param other a Geo::OGR::Geometry object
5442 #*
5443 sub AddGeometryDirectly {
5444 }
5445 
5446 #** @method AddPoint($x, $y, $z)
5447 # Object method.
5448 # Set the data of a point or add a point to a line string. Consider
5449 # using Geo::OGR::Geometry::Points. Note that the coordinate
5450 # dimension is automatically upgraded to 25D (3) if z is given.
5451 # @param x
5452 # @param y
5453 # @param z [optional]
5454 # Calls internally the 2D or 3D version depending on the number of parameters.
5455 #*
5456 sub AddPoint {
5457  my $self = shift;
5458  my $t = $self->GetGeometryType;
5459  my $has_z = HasZ($t);
5460  my $has_m = HasM($t);
5461  if (!$has_z && !$has_m) {
5462  $self->AddPoint_2D(@_[0..1]);
5463  } elsif ($has_z && !$has_m) {
5464  $self->AddPoint_3D(@_[0..2]);
5465  } elsif (!$has_z && $has_m) {
5466  $self->AddPointM(@_[0..2]);
5467  } else {
5468  $self->AddPointZM(@_[0..3]);
5469  }
5470 }
5471 
5472 #** @method AddPointM()
5473 #*
5474 sub AddPointM {
5475 }
5476 
5477 #** @method AddPointZM()
5478 #*
5479 sub AddPointZM {
5480 }
5481 
5482 #** @method AddPoint_2D($x, $y)
5483 # Object method.
5484 # Set the data of a point or add a point to a line string. Consider
5485 # using Geo::OGR::Geometry::Points.
5486 # @param x
5487 # @param y
5488 #*
5489 sub AddPoint_2D {
5490 }
5491 
5492 #** @method AddPoint_3D($x, $y, $z)
5493 # Object method.
5494 # Set the data of a point or add a point to a line string. Note that
5495 # the coordinate dimension is automatically upgraded to 25D (3). Consider
5496 # using Geo::OGR::Geometry::Points.
5497 # @param x
5498 # @param y
5499 # @param z
5500 #*
5501 sub AddPoint_3D {
5502 }
5503 
5504 #** @method Geo::OGR::Geometry ApproximateArcAngles(%params)
5505 # Package subroutine.
5506 # Create a line string, which approximates an arc.
5507 # @note All angles are in degrees.
5508 #
5509 # @param %params Named parameters:
5510 # - \a Center center point (default is [0, 0, 0])
5511 # - \a PrimaryRadius default is 1.
5512 # - \a SecondaryAxis default is 1.
5513 # - \a Rotation default is 0.
5514 # - \a StartAngle default is 0.
5515 # - \a EndAngle default is 360.
5516 # - \a MaxAngleStepSizeDegrees default is 4.
5517 # @return a new Geo::OGR::Geometry object.
5518 #*
5519 sub ApproximateArcAngles {
5520  my %p = @_;
5521  my %default = ( Center => [0,0,0],
5522  PrimaryRadius => 1,
5523  SecondaryAxis => 1,
5524  Rotation => 0,
5525  StartAngle => 0,
5526  EndAngle => 360,
5527  MaxAngleStepSizeDegrees => 4
5528  );
5529  for my $p (keys %p) {
5530  if (exists $default{$p}) {
5531  $p{$p} //= $default{$p};
5532  } else {
5533  carp "Unknown parameter: '$p'.";
5534  }
5535  }
5536  for my $p (keys %default) {
5537  $p{$p} //= $default{$p};
5538  }
5539  error("Usage: Center => [x,y,z].") unless ref($p{Center}) eq 'ARRAY';
5540  for my $i (0..2) {
5541  $p{Center}->[$i] //= 0;
5542  }
5543  return Geo::OGR::ApproximateArcAngles($p{Center}->[0], $p{Center}->[1], $p{Center}->[2], $p{PrimaryRadius}, $p{SecondaryAxis}, $p{Rotation}, $p{StartAngle}, $p{EndAngle}, $p{MaxAngleStepSizeDegrees});
5544 }
5545 
5546 #** @method scalar Area()
5547 # Object method.
5548 # @note a.k.a. GetArea
5549 # @return the area of the polygon or multipolygon
5550 #*
5551 sub Area {
5552 }
5553 
5554 #** @method scalar As(%params)
5555 # Object method.
5556 # Export the geometry into a known format.
5557 #
5558 # @param params Named parameters:
5559 # - \a Format One of
5560 # - \a WKT Well Known Text.
5561 # - <em>ISO WKT</em>
5562 # - \a Text Same as WKT.
5563 # - \a WKB Well Known Binary.
5564 # - <em>ISO WKB</em>
5565 # - \a Binary Same as WKB.
5566 # - \a HEXWKB
5567 # - \a HEXEWKB
5568 # - \a GML
5569 # - \a GeoJSON
5570 # - \a ByteOrder Byte order for binary formats. Default is 'XDR'.
5571 # - \a SRID Spatial reference id for HEXEWKB.
5572 # - \a Options GML generation options.
5573 # - \a AltitudeMode For KML.
5574 #
5575 # @return the geometry in a given format.
5576 #*
5577 sub As {
5578  my $self = shift;
5579  my $p = named_parameters(\@_, Format => undef, ByteOrder => 'XDR', SRID => undef, Options => undef, AltitudeMode => undef);
5580  my $f = $p->{format};
5581  if ($f =~ /text/i) {
5582  return $self->AsText;
5583  } elsif ($f =~ /wkt/i) {
5584  if ($f =~ /iso/i) {
5585  return $self->ExportToIsoWkt;
5586  } else {
5587  return $self->AsText;
5588  }
5589  } elsif ($f =~ /binary/i) {
5590  return $self->ExportToWkb($p->{byteorder});
5591  } elsif ($f =~ /wkb/i) {
5592  if ($f =~ /iso/i) {
5593  $p->{byteorder} = s2i(byte_order => $p->{byteorder});
5594  return $self->ExportToIsoWkb($p->{byteorder});
5595  } elsif ($f =~ /ewkb/i) {
5596  return $self->AsHEXEWKB($p->{srid});
5597  } elsif ($f =~ /hex/i) {
5598  return $self->AsHEXWKB;
5599  } else {
5600  return $self->ExportToWkb($p->{byteorder});
5601  }
5602  } elsif ($f =~ /gml/i) {
5603  return $self->ExportToGML($p->{options});
5604  } elsif ($f =~ /kml/i) {
5605  return $self->ExportToKML($p->{altitudemode});
5606  } elsif ($f =~ /json/i) {
5607  return $self->AsJSON;
5608  } else {
5609  error(1, $f, map {$_=>1} qw/Text WKT ISO_WKT ISO_WKB HEX_WKB HEX_EWKB Binary GML KML JSON/);
5610  }
5611 }
5612 
5613 #** @method scalar AsBinary()
5614 # Object method.
5615 # Export the geometry into WKB.
5616 # @sa Geo::OGR::Geometry::As
5617 # @return the geometry as WKB.
5618 #*
5619 sub AsBinary {
5620 }
5621 
5622 #** @method scalar AsText()
5623 # Object method.
5624 # Export the geometry into WKT.
5625 # @sa Geo::OGR::Geometry::As
5626 # @return the geometry as WKT.
5627 #*
5628 sub AsText {
5629 }
5630 
5631 #** @method AssignSpatialReference($srs)
5632 # Object method.
5633 # @param srs a Geo::OSR::SpatialReference object
5634 #*
5635 sub AssignSpatialReference {
5636 }
5637 
5638 #** @method Geo::OGR::Geometry Boundary()
5639 # Object method.
5640 # @note a.k.a. GetBoundary
5641 # @return the boundary of this geometry as a geometry
5642 # @since 1.8.0
5643 #*
5644 sub Boundary {
5645 }
5646 
5647 #** @method Geo::OGR::Geometry Buffer($distance, $quadsecs = 30)
5648 # Object method.
5649 # @param distance
5650 # @param quadsecs
5651 # @return a new Geo::OGR::Geometry object
5652 #*
5653 sub Buffer {
5654 }
5655 
5656 #** @method Geo::OGR::Geometry BuildPolygonFromEdges($BestEffort = 0, $AutoClose = 0, $Tolerance = 0)
5657 # Object method.
5658 # Attempt to create a polygon from a collection of lines or from a multilinestring.
5659 # @param BestEffort For future
5660 # @param AutoClose Assure the first and last points of rings are same.
5661 # @param Tolerance Snap distance.
5662 # @exception Several possibilities, some are reported, some are general errors.
5663 # @return a new Geo::OGR::Geometry object (Polygon)
5664 #*
5665 sub BuildPolygonFromEdges {
5666 }
5667 
5668 #** @method list ByteOrders()
5669 # Package subroutine.
5670 # Same as Geo::OGR::ByteOrders
5671 #*
5672 sub ByteOrders {
5673  return @BYTE_ORDER_TYPES;
5674 }
5675 
5676 #** @method Geo::OGR::Geometry Centroid()
5677 # Object method.
5678 # @return a new Geo::OGR::Geometry object
5679 # @since 1.8.0
5680 #*
5681 sub Centroid {
5682 }
5683 
5684 #** @method Geo::OGR::Geometry Clone()
5685 # Object method.
5686 # @return a new Geo::OGR::Geometry object
5687 #*
5688 sub Clone {
5689 }
5690 
5691 #** @method CloseRings()
5692 # Object method.
5693 #*
5694 sub CloseRings {
5695 }
5696 
5697 #** @method Geo::OGR::Geometry Collect(@geometries)
5698 # Object method.
5699 # Create a geometrycollection from this and possibly other geometries.
5700 # @param geometries [optional] More geometries to add to the collection.
5701 # @return a new Geo::OGR::Geometry object of type geometrycollection.
5702 #*
5703 sub Collect {
5704 }
5705 
5706 #** @method scalar Contains($other)
5707 # Object method.
5708 # @param other a Geo::OGR::Geometry object
5709 # @return true if this geometry contains the other geometry, false otherwise
5710 #*
5711 sub Contains {
5712 }
5713 
5714 #** @method Geo::OGR::Geometry ConvexHull()
5715 # Object method.
5716 # @return a new Geo::OGR::Geometry object
5717 #*
5718 sub ConvexHull {
5719 }
5720 
5721 #** @method scalar CoordinateDimension($dimension)
5722 # Object method.
5723 # @param dimension [optional]
5724 # @return 2 or 3
5725 #*
5726 sub CoordinateDimension {
5727  my $self = shift;
5728  SetCoordinateDimension($self, $_[0]) if @_;
5729  GetCoordinateDimension($self) if defined wantarray;
5730 }
5731 
5732 #** @method scalar Crosses($other)
5733 # Object method.
5734 # @param other a Geo::OGR::Geometry object
5735 # @return true if this geometry crosses the other geometry, false otherwise
5736 #*
5737 sub Crosses {
5738 }
5739 
5740 #** @method DelaunayTriangulation()
5741 #*
5742 sub DelaunayTriangulation {
5743 }
5744 
5745 #** @method Geo::OGR::Geometry Difference($other)
5746 # Object method.
5747 # @param other a Geo::OGR::Geometry object
5748 # @return a new Geo::OGR::Geometry object
5749 #*
5750 sub Difference {
5751 }
5752 
5753 #** @method scalar Disjoint($other)
5754 # Object method.
5755 # @param other a Geo::OGR::Geometry object
5756 # @return true if this geometry is disjoint from the other geometry, false otherwise
5757 #*
5758 sub Disjoint {
5759 }
5760 
5761 #** @method list Dissolve()
5762 # Object method.
5763 # Dissolve a geometrycollection into separate geometries.
5764 # @return a list of new Geo::OGR::Geometry objects cloned from the collection.
5765 #*
5766 sub Dissolve {
5767  my $self = shift;
5768  my @c;
5769  my $n = $self->GetGeometryCount;
5770  if ($n > 0) {
5771  for my $i (0..$n-1) {
5772  push @c, $self->GetGeometryRef($i)->Clone;
5773  }
5774  } else {
5775  push @c, $self;
5776  }
5777  return @c;
5778 }
5779 
5780 #** @method scalar Distance($other)
5781 # Object method.
5782 # @param other a Geo::OGR::Geometry object
5783 # @return the distance to the other geometry
5784 #*
5785 sub Distance {
5786 }
5787 
5788 #** @method Distance3D()
5789 #*
5790 sub Distance3D {
5791 }
5792 
5793 #** @method Empty()
5794 # Object method.
5795 # Clear geometry data, i.e., remove all points, or, for a point, set
5796 # the coordinate dimension as zero.
5797 #*
5798 sub Empty {
5799 }
5800 
5801 #** @method scalar Equals($other)
5802 # Object method.
5803 # @note a.k.a. Equal (deprecated)
5804 # @param other a Geo::OGR::Geometry object
5805 # @return true if this geometry is equivalent to the other geometry, false otherwise
5806 #*
5807 sub Equals {
5808 }
5809 
5810 #** @method Extent()
5811 #*
5812 sub Extent {
5813  my $self = shift;
5814  return Geo::GDAL::Extent->new($self->GetEnvelope);
5815 }
5817 #** @method Feature()
5818 #*
5819 sub Feature {
5820  my $self = shift;
5821  parent($self);
5822 }
5823 
5824 #** @method FlattenTo2D()
5825 # Object method.
5826 #*
5827 sub FlattenTo2D {
5828 }
5829 
5830 #** @method Geo::OGR::Geometry ForceTo($type, ref options)
5831 # Object method.
5832 # Attempt to make a geometry of type 'type' out of this geometry.
5833 # @param type target geometry type. One of Geo::OGR::GeometryTypes.
5834 # @param options not used currently.
5835 # @return a new Geo::OGR::Geometry object.
5836 #*
5837 sub ForceTo {
5838  my $self = shift;
5839  my $type = shift;
5840  $type = s2i(geometry_type => $type);
5841  eval {
5842  $self = Geo::OGR::ForceTo($self, $type, @_);
5843  };
5844  confess last_error() if $@;
5845  return $self;
5846 }
5847 
5848 #** @method Geo::OGR::Geometry ForceToCollection(@geometries)
5849 # Object method.
5850 # Create a geometrycollection from the geometry.
5851 # @param geometries [optional] More geometries to add to the collection.
5852 # @return a new Geo::OGR::Geometry object of type geometrycollection.
5853 #*
5854 sub ForceToCollection {
5855  my $self = Geo::OGR::Geometry->new(GeometryType => 'GeometryCollection');
5856  for my $g (@_) {
5857  $self->AddGeometry($g);
5858  }
5859  return $self;
5860 }
5861 
5862 #** @method Geo::OGR::Geometry ForceToLineString()
5863 # Object method.
5864 # Attempt to create a line string from this geometry.
5865 # @return a new Geo::OGR::Geometry object.
5866 #*
5867 sub ForceToLineString {
5868  my $self = shift;
5869  return Geo::OGR::ForceToLineString($self);
5870 }
5871 
5872 #** @method Geo::OGR::Geometry ForceToMultiLineString(@linestrings)
5873 # Object method.
5874 # Attempt to create a multilinestring from the geometry, which must be a linestring.
5875 # @param linestrings [optional] More linestrings to add to the collection.
5876 # @return a new Geo::OGR::Geometry object of type multilinestring.
5877 #*
5878 sub ForceToMultiLineString {
5879  my $self = shift;
5880  $self = Geo::OGR::ForceToMultiLineString($self);
5881  for my $g (@_) {
5882  $self->AddGeometry($g);
5883  }
5884  return $self;
5885 }
5886 
5887 #** @method Geo::OGR::Geometry ForceToMultiPoint(@points)
5888 # Object method.
5889 # Attempt to create a multipoint from the geometry, which must be a point.
5890 # @param points [optional] More points to add to the collection.
5891 # @return a new Geo::OGR::Geometry object of type multipoint.
5892 #*
5893 sub ForceToMultiPoint {
5894  my $self = shift;
5895  $self = Geo::OGR::ForceToMultiPoint($self);
5896  for my $g (@_) {
5897  $self->AddGeometry($g);
5898  }
5899  return $self;
5900 }
5901 
5902 #** @method Geo::OGR::Geometry ForceToMultiPolygon(@polygons)
5903 # Object method.
5904 # Attempt to create a multipolygon from the geometry, which must be a polygon.
5905 # @param polygons [optional] More polygons to add to the collection.
5906 # @return a new Geo::OGR::Geometry object of type multipolygon.
5907 #*
5908 sub ForceToMultiPolygon {
5909  my $self = shift;
5910  $self = Geo::OGR::ForceToMultiPolygon($self);
5911  for my $g (@_) {
5912  $self->AddGeometry($g);
5913  }
5914  return $self;
5915 }
5916 
5917 #** @method Geo::OGR::Geometry ForceToPolygon()
5918 # Object method.
5919 # Attempt to create a polygon from this geometry.
5920 # @exception None reported. If this method fails, just a copy is returned.
5921 # @return a new Geo::OGR::Geometry object.
5922 #*
5923 sub ForceToPolygon {
5924 }
5925 
5926 #** @method scalar Geometry($n)
5927 # Object method.
5928 # Return the n:th (note zero-based index) element in this geometry or
5929 # geometry in this collection.
5930 # @note a.k.a. GetGeometryRef
5931 # @param n index to the geometry, which is a part of this geometry
5932 # @return a new Geo::OGR::Geometry object whose data is a part of the
5933 # parent geometry (this geometry is kept alive while the returned
5934 # geometry exists)
5935 #*
5936 sub Geometry {
5937 }
5938 
5939 #** @method scalar GeometryCount()
5940 # Object method.
5941 # Return the number of elements in this geometry or geometries in this collection.
5942 # @note a.k.a. GetGeometryCount
5943 # @return an integer
5944 #*
5945 sub GeometryCount {
5946 }
5947 
5948 #** @method scalar GeometryType()
5949 # Object method.
5950 #
5951 # @note The deprecated method GetGeometryType returns the
5952 # type as an integer
5953 #
5954 # @return the geometry type of this geometry (one of Geo::OGR::GeometryTypes).
5955 #*
5956 sub GeometryType {
5957  my $self = shift;
5958  return i2s(geometry_type => $self->GetGeometryType);
5959 }
5960 
5961 #** @method list GeometryTypes()
5962 # Package subroutine.
5963 # Same as Geo::OGR::GeometryTypes
5964 #*
5965 sub GeometryTypes {
5966  return @GEOMETRY_TYPES;
5967 }
5968 
5969 #** @method scalar GetCoordinateDimension()
5970 # Object method.
5971 # @return an integer
5972 #*
5973 sub GetCoordinateDimension {
5974 }
5975 
5976 #** @method GetCurveGeometry()
5977 #*
5978 sub GetCurveGeometry {
5979 }
5980 
5981 #** @method scalar GetDimension()
5982 # Object method.
5983 # @return 0, 1, or 2
5984 #*
5985 sub GetDimension {
5986 }
5987 
5988 #** @method list GetEnvelope()
5989 # Object method.
5990 # @note In scalar context returns a reference to an anonymous array
5991 # containing the envelope.
5992 # @return the envelope ($minx, $maxx, $miny, $maxy)
5993 #*
5994 sub GetEnvelope {
5995 }
5996 
5997 #** @method list GetEnvelope3D()
5998 # Object method.
5999 # @note In scalar context returns a reference to an anonymous array
6000 # containing the envelope.
6001 # @return the 3-D envelope ($minx, $maxx, $miny, $maxy, $minz, $maxz)
6002 # @since 1.9.0
6003 #*
6004 sub GetEnvelope3D {
6005 }
6006 
6007 #** @method scalar GetGeometryRef($index)
6008 # Object method.
6009 # @deprecated Use Geo::OGR::Geometry
6010 #*
6011 sub GetGeometryRef {
6012  my ($self, $i) = @_;
6013  my $ref = $self->_GetGeometryRef($i);
6014  keep($ref, $self);
6015  return $ref;
6016 }
6017 
6018 #** @method GetLinearGeometry()
6019 #*
6020 sub GetLinearGeometry {
6021 }
6022 
6023 #** @method GetM()
6024 #*
6025 sub GetM {
6026 }
6028 #** @method list GetPoint($index = 0)
6029 # Object method.
6030 # @param index
6031 # @return (x,y) or a list with more coordinates
6032 #*
6033 sub GetPoint {
6034  my($self, $i) = @_;
6035  $i //= 0;
6036  my $t = $self->GetGeometryType;
6037  my $has_z = HasZ($t);
6038  my $has_m = HasM($t);
6039  my $point;
6040  if (!$has_z && !$has_m) {
6041  $point = $self->GetPoint_2D($i);
6042  } elsif ($has_z && !$has_m) {
6043  $point = $self->GetPoint_3D($i);
6044  } elsif (!$has_z && $has_m) {
6045  $point = $self->GetPointZM($i);
6046  @$point = ($point->[0], $point->[1], $point->[3]);
6047  } else {
6048  $point = $self->GetPointZM($i);
6049  }
6050  return wantarray ? @$point : $point;
6051 }
6052 
6053 #** @method scalar GetPointCount()
6054 # Object method.
6055 # @return an integer
6056 #*
6057 sub GetPointCount {
6058 }
6059 
6060 #** @method GetPointZM()
6061 #*
6062 sub GetPointZM {
6063 }
6064 
6065 #** @method scalar GetPoint_2D($index = 0)
6066 # Object method.
6067 # @param index
6068 # @return (x,y) or a list with more coordinates
6069 #*
6070 sub GetPoint_2D {
6071 }
6072 
6073 #** @method scalar GetPoint_3D($index = 0)
6074 # Object method.
6075 # @param index
6076 # @return (x,y) or a list with more coordinates
6077 #*
6078 sub GetPoint_3D {
6079 }
6080 
6081 #** @method Geo::OSR::SpatialReference GetSpatialReference()
6082 # Object method.
6083 # @return a new Geo::OSR::SpatialReference object
6084 #*
6085 sub GetSpatialReference {
6086 }
6087 
6088 #** @method scalar GetX($index = 0)
6089 # Object method.
6090 # @param index
6091 # @return a number
6092 #*
6093 sub GetX {
6094 }
6095 
6096 #** @method scalar GetY($index = 0)
6097 # Object method.
6098 # @param index
6099 # @return a number
6100 #*
6101 sub GetY {
6102 }
6103 
6104 #** @method scalar GetZ($index = 0)
6105 # Object method.
6106 # @param index
6107 # @return a number
6108 #*
6109 sub GetZ {
6110 }
6111 
6112 #** @method HasCurveGeometry()
6113 #*
6114 sub HasCurveGeometry {
6115 }
6116 
6117 #** @method Geo::OGR::Geometry Intersection($other)
6118 # Object method.
6119 # @param other a Geo::OGR::Geometry object
6120 # @return a new Geo::OGR::Geometry object
6121 #*
6122 sub Intersection {
6123 }
6124 
6125 #** @method scalar Intersects($other)
6126 # Object method.
6127 # @note a.k.a. Intersect (deprecated)
6128 # @param other a Geo::OGR::Geometry object
6129 # @return true if this geometry intersects with the other geometry, false otherwise
6130 #*
6131 sub Intersects {
6132 }
6133 
6134 #** @method Is3D()
6135 #*
6136 sub Is3D {
6137 }
6138 
6139 #** @method scalar IsEmpty()
6140 # Object method.
6141 # Test whether the geometry is empty (has no points, or, for a point,
6142 # has coordinate dimension of zero).
6143 # @return boolean
6144 #*
6145 sub IsEmpty {
6146 }
6147 
6148 #** @method IsMeasured()
6149 #*
6150 sub IsMeasured {
6151 }
6152 
6153 #** @method scalar IsRing()
6154 # Object method.
6155 # Test if the geometry is a ring. Requires GEOS in GDAL.
6156 # @return boolean
6157 #*
6158 sub IsRing {
6159 }
6160 
6161 #** @method scalar IsSimple()
6162 # Object method.
6163 # Test the simplicity of the geometry (OGC sense). Requires GEOS in GDAL.
6164 # @return boolean
6165 #*
6166 sub IsSimple {
6167 }
6168 
6169 #** @method scalar IsValid()
6170 # Object method.
6171 # Test the validity of the geometry (OGC sense). Requires GEOS in GDAL.
6172 # @return boolean
6173 #*
6174 sub IsValid {
6175 }
6176 
6177 #** @method scalar Length()
6178 # Object method.
6179 # @return the length of the linestring
6180 #*
6181 sub Length {
6182 }
6183 
6184 #** @method MakeValid()
6185 #*
6186 sub MakeValid {
6187 }
6188 
6189 #** @method Move($dx, $dy, $dz)
6190 # Object method.
6191 # Move every point of the object as defined by the parameters.
6192 # @param dx
6193 # @param dy
6194 # @param dz [optional]
6195 #*
6196 sub Move {
6197 }
6198 
6199 #** @method scalar Overlaps($other)
6200 # Object method.
6201 # @param other a Geo::OGR::Geometry object
6202 # @return true if this geometry overlaps the other geometry, false otherwise
6203 #*
6204 sub Overlaps {
6205 }
6206 
6207 #** @method list Point($index, $x, $y, $z)
6208 # Object method.
6209 # Get or set the point
6210 # @param index The index of the point. Optional (ignored if given) for
6211 # Point and Point25D geometries.
6212 # @param x [optional]
6213 # @param y [optional]
6214 # @param z [optional]
6215 # @return
6216 #*
6217 sub Point {
6218  my $self = shift;
6219  my $i;
6220  if (@_) {
6221  my $t = $self->GetGeometryType;
6222  my $i;
6223  if (Flatten($t) == $Geo::OGR::wkbPoint) {
6224  my $has_z = HasZ($t);
6225  my $has_m = HasM($t);
6226  if (!$has_z && !$has_m) {
6227  shift if @_ > 2;
6228  $i = 0;
6229  } elsif ($has_z || $has_m) {
6230  shift if @_ > 3;
6231  $i = 0;
6232  } else {
6233  shift if @_ > 4;
6234  $i = 0;
6235  }
6236  }
6237  $i = shift unless defined $i;
6238  $self->SetPoint($i, @_);
6239  }
6240  return unless defined wantarray;
6241  my $point = $self->GetPoint;
6242  return wantarray ? @$point : $point;
6243 }
6244 
6245 #** @method PointOnSurface()
6246 #*
6247 sub PointOnSurface {
6248 }
6249 
6250 #** @method array reference Points(arrayref points)
6251 # Object method.
6252 # Get or set the points of the geometry. The points (vertices) are
6253 # stored in obvious lists of lists. When setting, the geometry is
6254 # first emptied. The method uses internally either AddPoint_2D or
6255 # AddPoint_3D depending on the coordinate dimension of the input data.
6256 #
6257 # @note The same structure may represent different geometries
6258 # depending on the actual geometry type of the object.
6259 #
6260 # @param points [optional] A reference to an array. A point is a reference to an
6261 # array of numbers, a linestring or a ring is a reference to an array of points,
6262 # a polygon is a reference to an array of rings, etc.
6263 #
6264 # @return A reference to an array.
6265 #*
6266 sub Points {
6267  my $self = shift;
6268  my $t = $self->GetGeometryType;
6269  my $has_z = HasZ($t);
6270  my $has_m = HasM($t);
6271  my $postfix = '';
6272  $postfix .= 'Z' if HasZ($t);
6273  $postfix .= 'M' if HasM($t);
6274  $t = i2s(geometry_type => Flatten($t));
6275  my $points = shift;
6276  if ($points) {
6277  Empty($self);
6278  if ($t eq 'Unknown' or $t eq 'None' or $t eq 'GeometryCollection') {
6279  error("Can't set points of a geometry of type '$t'.");
6280  } elsif ($t eq 'Point') {
6281  # support both "Point" as a list of one point and one point
6282  if (ref($points->[0])) {
6283  $self->AddPoint(@{$points->[0]});
6284  } else {
6285  $self->AddPoint(@$points);
6286  }
6287  } elsif ($t eq 'LineString' or $t eq 'LinearRing' or $t eq 'CircularString') {
6288  for my $p (@$points) {
6289  $self->AddPoint(@$p);
6290  }
6291  } elsif ($t eq 'Polygon') {
6292  for my $r (@$points) {
6293  my $ring = Geo::OGR::Geometry->new('LinearRing');
6294  $ring->Set3D(1) if $has_z;
6295  $ring->SetMeasured(1) if $has_m;
6296  $ring->Points($r);
6297  $self->AddGeometryDirectly($ring);
6298  }
6299  } elsif ($t eq 'MultiPoint') {
6300  for my $p (@$points) {
6301  my $point = Geo::OGR::Geometry->new('Point'.$postfix);
6302  $point->Points($p);
6303  $self->AddGeometryDirectly($point);
6304  }
6305  } elsif ($t eq 'MultiLineString') {
6306  for my $l (@$points) {
6307  my $linestring = Geo::OGR::Geometry->new('LineString'.$postfix);
6308  $linestring->Points($l);
6309  $self->AddGeometryDirectly($linestring);
6310  }
6311  } elsif ($t eq 'MultiPolygon') {
6312  for my $p (@$points) {
6313  my $polygon = Geo::OGR::Geometry->new('Polygon'.$postfix);
6314  $polygon->Points($p);
6315  $self->AddGeometryDirectly($polygon);
6316  }
6317  }
6318  }
6319  return unless defined wantarray;
6320  $self->_GetPoints();
6321 }
6322 
6323 #** @method Polygonize()
6324 #*
6325 sub Polygonize {
6326 }
6327 
6328 #** @method RemoveGeometry()
6329 #*
6330 sub RemoveGeometry {
6331 }
6332 
6333 #** @method Segmentize($MaxLength)
6334 # Object method.
6335 # Modify the geometry such it has no segment longer than the given length.
6336 # @param MaxLength the given length
6337 #*
6338 sub Segmentize {
6339 }
6340 
6341 #** @method Set3D()
6342 #*
6343 sub Set3D {
6344 }
6345 
6346 #** @method SetCoordinateDimension($dimension)
6347 # Object method.
6348 # @param dimension
6349 #*
6350 sub SetCoordinateDimension {
6351 }
6352 
6353 #** @method SetMeasured()
6354 #*
6355 sub SetMeasured {
6356 }
6357 
6358 #** @method SetPoint($index, $x, $y, $z)
6359 # Object method.
6360 # Set the data of a point or a line string. Note that the coordinate
6361 # dimension is automatically upgraded to 25D (3) if z is given.
6362 # @param index
6363 # @param x
6364 # @param y
6365 # @param z [optional]
6366 #*
6367 sub SetPoint {
6368  my $self = shift;
6369  my $t = $self->GetGeometryType;
6370  my $has_z = HasZ($t);
6371  my $has_m = HasM($t);
6372  if (!$has_z && !$has_m) {
6373  $self->SetPoint_2D(@_[0..2]);
6374  } elsif ($has_z && !$has_m) {
6375  $self->SetPoint_3D(@_[0..3]);
6376  } elsif (!$has_z && $has_m) {
6377  $self->SetPointM(@_[0..3]);
6378  } else {
6379  $self->SetPointZM(@_[0..4]);
6380  }
6381 }
6382 
6383 #** @method SetPointM()
6384 #*
6385 sub SetPointM {
6386 }
6387 
6388 #** @method SetPointZM()
6389 #*
6390 sub SetPointZM {
6391 }
6392 
6393 #** @method SetPoint_2D($index, $x, $y)
6394 # Object method.
6395 # @param index
6396 # @param x
6397 # @param y
6398 #*
6399 sub SetPoint_2D {
6400 }
6401 
6402 #** @method SetPoint_3D($index, $x, $y, $z)
6403 # Object method.
6404 # Set the data of a point or a line string. Note that the coordinate
6405 # dimension is automatically upgraded to 25D (3).
6406 # @param index
6407 # @param x
6408 # @param y
6409 # @param z
6410 #*
6411 sub SetPoint_3D {
6412 }
6413 
6414 #** @method Geo::OGR::Geometry Simplify($Tolerance)
6415 # Object method.
6416 # Simplify the geometry.
6417 # @param Tolerance the length tolerance for the simplification
6418 # @since 1.8.0
6419 # @return a new Geo::OSR::Geometry object
6420 #*
6421 sub Simplify {
6422 }
6423 
6424 #** @method SimplifyPreserveTopology()
6425 #*
6426 sub SimplifyPreserveTopology {
6427 }
6428 
6429 #** @method SwapXY()
6430 #*
6431 sub SwapXY {
6432 }
6433 
6434 #** @method Geo::OGR::Geometry SymDifference($other)
6435 # Object method.
6436 # Compute symmetric difference.
6437 # @note a.k.a. SymmetricDifference
6438 # @param other a Geo::OGR::Geometry object
6439 # @return a new Geo::OGR::Geometry object
6440 # @since 1.8.0
6441 #*
6442 sub SymDifference {
6443 }
6444 
6445 #** @method scalar Touches($other)
6446 # Object method.
6447 # @param other a Geo::OGR::Geometry object
6448 # @return true if this geometry touches the other geometry, false otherwise
6449 #*
6450 sub Touches {
6451 }
6452 
6453 #** @method Transform($trans)
6454 # Object method.
6455 # @param trans a Geo::OSR::CoordinateTransformation object
6456 #*
6457 sub Transform {
6458 }
6459 
6460 #** @method TransformTo($srs)
6461 # Object method.
6462 # @param srs a Geo::OSR::SpatialReference object
6463 #*
6464 sub TransformTo {
6465 }
6466 
6467 #** @method Geo::OGR::Geometry Union($other)
6468 # Object method.
6469 # @param other a Geo::OGR::Geometry object
6470 # @return a new Geo::OGR::Geometry object
6471 #*
6472 sub Union {
6473 }
6474 
6475 #** @method Geo::OGR::Geometry UnionCascaded()
6476 # Object method.
6477 # @return a new Geo::OGR::Geometry object
6478 # @since 1.8.0
6479 #*
6480 sub UnionCascaded {
6481 }
6482 
6483 #** @method Value()
6484 #*
6485 sub Value {
6486 }
6487 
6488 #** @method scalar Within($other)
6489 # Object method.
6490 # @param other a Geo::OGR::Geometry object
6491 # @return true if this geometry is within the other geometry, false otherwise
6492 #*
6493 sub Within {
6494 }
6495 
6496 #** @method scalar WkbSize()
6497 # Object method.
6498 # @return an integer
6499 #*
6500 sub WkbSize {
6501 }
6502 
6503 #** @method Geo::OGR::Geometry new(%params)
6504 # Class method.
6505 # @param %params A named parameter, one of:
6506 # - \a GeometryType one the supported geometry types, see Geo::OGR::GeometryTypes.
6507 # - \a WKT a well known text string, which defines a geometry.
6508 # - \a WKB a well known binary string, which defines a geometry.
6509 # - \a HEXWKB WKB in hexadecimal.
6510 # - \a HEXEWKB PostGIS extended WKB.
6511 # - \a GML geometry written in Geographic Markup Language.
6512 # - \a GeoJSON geometry written in GeoJSON (JavaScript Object Notation for Geographic data).
6513 # - \a arc a reference to a list of values defining an arc: [CenterX,
6514 # CenterY, CenterZ, PrimaryRadius, SecondaryRadius, Rotation,
6515 # StartAngle, EndAngle, MaxAngleStepSizeDegrees] (see also Geo::OGR::Geometry::ApproximateArcAngles)
6516 # - \a Points An anonymous array as in method
6517 # Geo::OGR::Geometry::Points; Note: requires also GeometryType
6518 # parameter
6519 #
6520 # @return a new Geo::OGR::Geometry object.
6521 #*
6522 sub new {
6523  my $pkg = shift;
6524  my %param;
6525  if (@_ == 1 and ref($_[0]) eq 'HASH') {
6526  %param = %{$_[0]};
6527  } elsif (@_ % 2 == 0) {
6528  %param = @_;
6529  } else {
6530  ($param{GeometryType}) = @_;
6531  }
6532  my $type = $param{GeometryType} // $param{Type} // $param{type};
6533  my $srs = $param{SRS} // $param{srs};
6534  my $wkt = $param{WKT} // $param{wkt};
6535  my $wkb = $param{WKB} // $param{wkb};
6536  my $hex = $param{HEXEWKB} // $param{HEX_EWKB} // $param{hexewkb} // $param{hex_ewkb};
6537  my $srid;
6538  if ($hex) {
6539  # EWKB contains SRID
6540  $srid = substr($hex, 10, 8);
6541  substr($hex, 10, 8) = '';
6542  } else {
6543  $hex = $param{HEXWKB} // $param{HEX_WKB} // $param{hexwkb} // $param{hex_wkb};
6544  }
6545  if ($hex) {
6546  $wkb = '';
6547  for (my $i = 0; $i < length($hex); $i+=2) {
6548  $wkb .= chr(hex(substr($hex,$i,2)));
6549  }
6550  }
6551  my $gml = $param{GML} // $param{gml};
6552  my $json = $param{GeoJSON} // $param{geojson} // $param{JSON} // $param{json};
6553  my $points = $param{Points} // $param{points};
6554  my $arc = $param{Arc} // $param{arc};
6555  my $self;
6556  if (defined $wkt) {
6557  $self = Geo::OGRc::CreateGeometryFromWkt($wkt, $srs);
6558  } elsif (defined $wkb) {
6559  $self = Geo::OGRc::CreateGeometryFromWkb($wkb, $srs);
6560  } elsif (defined $gml) {
6561  $self = Geo::OGRc::CreateGeometryFromGML($gml);
6562  } elsif (defined $json) {
6563  $self = Geo::OGRc::CreateGeometryFromJson($json);
6564  } elsif (defined $type) {
6565  $type = s2i(geometry_type => $type);
6566  $self = Geo::OGRc::new_Geometry($type); # flattens the type
6567  $self->Set3D(1) if HasZ($type);
6568  $self->SetMeasured(1) if HasM($type);
6569  } elsif (defined $arc) {
6570  $self = Geo::OGRc::ApproximateArcAngles(@$arc);
6571  } else {
6572  error(1, undef, map {$_=>1} qw/GeometryType WKT WKB HEXEWKB HEXWKB GML GeoJSON Arc/);
6573  }
6574  bless $self, $pkg if defined $self;
6575  $self->Points($points) if $points;
6576  return $self;
6577 }
6578 
6579 #** @class Geo::OGR::Layer
6580 # @brief A collection of similar features.
6581 # @details A layer object is typically obtained with a data source object. A
6582 # layer has a data model (a schema), which is maintained in a
6583 # definition object, and a set of features, which contain data
6584 # according to the data model. The schema is typically set when the
6585 # layer is created or opened, but it may be altered somewhat with
6586 # methods Geo::OGR::Layer::CreateField,
6587 # Geo::OGR::Layer::AlterFieldDefn, and
6588 # Geo::OGR::Layer::DeleteField. Features and/or their data can be
6589 # read, inserted and deleted. Reading can be filtered. Layers can be
6590 # compared to each other with methods Clip, Erase, Identity,
6591 # Intersection, SymDifference, Union, and Update.
6592 # A layer may have metadata OLMD_FID64 => 'YES' if it holds features
6593 # with 64 bit FIDs. The metadata of a layer can be obtained with
6594 # GetMetadata method.
6595 #*
6596 package Geo::OGR::Layer;
6597 
6598 use base qw(Geo::GDAL::MajorObject Geo::OGR)
6599 
6600 #** @method AlterFieldDefn($name, %params)
6601 # Object method.
6602 # @param field the name of the field to be altered.
6603 # @param params as in Geo::OGR::FieldDefn::new. Width and
6604 # Precision should be both or neither.
6605 # @note Only non-spatial fields can be altered.
6606 # @note Also the deprecated form AlterFieldDefn($field,
6607 # Geo::OGR::FieldDefn $Defn, $Flags) works.
6608 #*
6609 sub AlterFieldDefn {
6610  my $self = shift;
6611  my $index = $self->GetLayerDefn->GetFieldIndex(shift // 0);
6612  my $param = @_ % 2 == 0 ? {@_} : shift;
6613  if (blessed($param) and $param->isa('Geo::OGR::FieldDefn')) {
6614  _AlterFieldDefn($self, $index, @_);
6615  } else {
6616  my $definition = Geo::OGR::FieldDefn->new($param);
6617  my $flags = 0;
6618  $flags |= 1 if exists $param->{Name};
6619  $flags |= 2 if exists $param->{Type};
6620  $flags |= 4 if exists $param->{Width} or exists $param->{Precision};
6621  $flags |= 8 if exists $param->{Nullable};
6622  $flags |= 16 if exists $param->{Default};
6623  _AlterFieldDefn($self, $index, $definition, $flags);
6624  }
6625 }
6626 
6627 #** @method list Capabilities()
6628 # Object method.
6629 # Both a package subroutine and an object method.
6630 # @return a list of capabilities. The object method returns a list of
6631 # the capabilities the layer has. The package subroutine returns a list of
6632 # all potential capabilities a layer may have. These are currently:
6633 # AlterFieldDefn, CreateField, CreateGeomField, CurveGeometries, DeleteFeature, DeleteField, FastFeatureCount, FastGetExtent, FastSetNextByIndex, FastSpatialFilter, IgnoreFields, MeasuredGeometries, RandomRead, RandomWrite, ReorderFields, SequentialWrite, StringsAsUTF8, and Transactions.
6634 #
6635 # Examples:
6636 # \code
6637 # @cap = Geo::OGR::Layer::Capabilities(); # the package subroutine
6638 # @cap = $layer->Capabilities(); # the object method
6639 # \endcode
6640 #*
6641 sub Capabilities {
6642  return @CAPABILITIES if @_ == 0;
6643  my $self = shift;
6644  my @cap;
6645  for my $cap (@CAPABILITIES) {
6646  push @cap, $cap if _TestCapability($self, $CAPABILITIES{$cap});
6647  }
6648  return @cap;
6649 }
6650 
6651 #** @method Clip(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, $callback_data)
6652 # Object method.
6653 # Clip off areas that are not covered by the method layer. The schema
6654 # of the result layer can be set before calling this method, or is
6655 # initialized to to contain all fields from
6656 # this and method layer.
6657 # @param method method layer.
6658 # @param result result layer.
6659 # @param options a reference to an options hash.
6660 # @param callback [optional] a reference to a subroutine, which will
6661 # be called with parameters (number progress, string msg, callback_data)
6662 # @param callback_data [optional]
6663 #*
6664 sub Clip {
6665 }
6666 
6667 #** @method CommitTransaction()
6668 # Object method.
6669 #*
6670 sub CommitTransaction {
6671 }
6672 
6673 #** @method CreateFeature()
6674 #*
6675 sub CreateFeature {
6676 }
6677 
6678 #** @method CreateField(%params)
6679 # Object method.
6680 # Create a field.
6681 # @param params as in Geo::OGR::FieldDefn::new or
6682 # Geo::OGR::GeomFieldDefn::new, plus ApproxOK (whose default is true).
6683 #*
6684 sub CreateField {
6685  my $self = shift;
6686  my %defaults = ( ApproxOK => 1,
6687  Type => '' );
6688  my %params;
6689  if (@_ == 0) {
6690  } elsif (ref($_[0]) eq 'HASH') {
6691  %params = %{$_[0]};
6692  } elsif (@_ % 2 == 0) {
6693  %params = @_;
6694  } else {
6695  ($params{Defn}) = @_;
6696  }
6697  for my $k (keys %defaults) {
6698  $params{$k} //= $defaults{$k};
6699  }
6700  if (blessed($params{Defn}) and $params{Defn}->isa('Geo::OGR::FieldDefn')) {
6701  $self->_CreateField($params{Defn}, $params{ApproxOK});
6702  } elsif (blessed($_[0]) and $params{Defn}->isa('Geo::OGR::GeomFieldDefn')) {
6703  $self->CreateGeomField($params{Defn}, $params{ApproxOK});
6704  } else {
6705  # if Name and Type are missing, assume Name => Type
6706  if (!(exists $params{Name} && exists $params{Type})) {
6707  for my $key (sort keys %params) {
6708  if (s_exists(field_type => $params{$key}) ||
6709  s_exists(geometry_type => $params{$key}))
6710  {
6711  $params{Name} = $key;
6712  $params{Type} = $params{$key};
6713  delete $params{$key};
6714  last;
6715  }
6716  }
6717  }
6718  my $a = $params{ApproxOK};
6719  delete $params{ApproxOK};
6720  if (exists $params{GeometryType}) {
6721  $params{Type} = $params{GeometryType};
6722  delete $params{GeometryType};
6723  }
6724  if (s_exists(field_type => $params{Type})) {
6725  my $fd = Geo::OGR::FieldDefn->new(%params);
6726  _CreateField($self, $fd, $a);
6727  } elsif (s_exists(geometry_type => $params{Type})) {
6728  my $fd = Geo::OGR::GeomFieldDefn->new(%params);
6729  CreateGeomField($self, $fd, $a);
6730  } elsif ($params{Type} ) {
6731  error("Invalid field type: $params{Type}.")
6732  } elsif ($params{Name} ) {
6733  error("Missing type for field: $params{Name}.")
6734  } else {
6735  error("Missing name and type for a field.")
6736  }
6737  }
6738 }
6739 
6740 #** @method DataSource()
6741 #*
6742 sub DataSource {
6743 }
6744 
6745 #** @method Dataset()
6746 #*
6747 sub Dataset {
6748  my $self = shift;
6749  parent($self);
6750 }
6751 
6752 #** @method DeleteFeature($fid)
6753 # Object method.
6754 # @param fid feature id
6755 #*
6756 sub DeleteFeature {
6757 }
6758 
6759 #** @method DeleteField($field)
6760 # Object method.
6761 # Delete an existing field from a layer.
6762 # @param field name (or index) of the field which is deleted
6763 # @note Only non-spatial fields can be deleted.
6764 #*
6765 sub DeleteField {
6766  my ($self, $field) = @_;
6767  my $index = $self->GetLayerDefn->GetFieldIndex($field // 0);
6768  _DeleteField($self, $index);
6769 }
6770 
6771 #** @method Erase(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, $callback_data)
6772 # Object method.
6773 # The result layer contains features whose geometries represent areas
6774 # that are in the input layer but not in the method layer. The
6775 # features in the result layer have attributes from the input
6776 # layer. The schema of the result layer can be set by the user or, if
6777 # it is empty, is initialized to contain all fields in the input
6778 # layer.
6779 # @param method method layer.
6780 # @param result result layer.
6781 # @param options a reference to an options hash.
6782 # @param callback [optional] a reference to a subroutine, which will
6783 # be called with parameters (number progress, string msg, callback_data)
6784 # @param callback_data [optional]
6785 #*
6786 sub Erase {
6787 }
6788 
6789 #** @method Geo::OGR::Feature Feature($f)
6790 # Object method.
6791 #
6792 # @param f [optional] feature id, a feature, a row, or a tuple
6793 #
6794 # @note If the argument feature has a null FID (FID not set) the
6795 # feature is inserted into the layer as a new feature. If the FID is
6796 # non null, then the feature replaces the feature in the layer with
6797 # that FID.
6798 #
6799 # @return a new Geo::OGR::Feature object that represents the feature
6800 # in the layer.
6801 #*
6802 sub Feature {
6803  my $self = shift;
6804  my $x = shift;
6805  return $self->GetFeature($x) unless $x && ref $x;
6806  # Insert or Set depending on the FID
6807  my $fid;
6808  if (ref $x eq 'ARRAY') {
6809  # FID is the first item in the array
6810  $fid = $x->[0];
6811  } elsif (ref $x eq 'HASH') {
6812  # FID is FID
6813  $fid = $x->{FID};
6814  } else {
6815  $fid = $x->FID;
6816  }
6817  # OGRNullFID is -1
6818  if (!defined $fid || $fid < 0) {
6819  $self->InsertFeature($x);
6820  } else {
6821  $self->SetFeature($x);
6822  }
6823 }
6824 
6825 #** @method scalar FeatureCount($force = 1)
6826 # Object method.
6827 # A.k.a GetFeatureCount
6828 # @param force
6829 # @return integer
6830 #*
6831 sub FeatureCount {
6832 }
6833 
6834 #** @method Features()
6835 #*
6836 sub Features {
6837  my $self = shift;
6838  $self->ResetReading;
6839  return sub {
6840  return $self->GetNextFeature;
6841  }
6842 }
6843 
6844 #** @method ForFeatures($code, $in_place)
6845 # Object method.
6846 # @note experimental, the syntax may change
6847 #
6848 # Call code for all features. This is a simple wrapper for
6849 # ResetReading and while(GetNextFeature).
6850 #
6851 # Example usage:
6852 # \code
6853 # $layer->ForFeatures(sub {my $f = shift; $self->DeleteFeature($f->FID)}); # empties the layer
6854 # \endcode
6855 #
6856 # @param code a reference to a subroutine, which is called with each
6857 # feature as an argument
6858 # @param in_place if set to true, the feature is stored back to the
6859 # layer
6860 #*
6861 sub ForFeatures {
6862  my $self = shift;
6863  my $code = shift;
6864  my $in_place = shift;
6865  $self->ResetReading;
6866  while (my $f = $self->GetNextFeature) {
6867  keep($f, $self);
6868  $code->($f);
6869  $self->SetFeature($f) if $in_place;
6870  };
6871 }
6872 
6873 #** @method ForGeometries($code, $in_place)
6874 # Object method.
6875 # @note experimental, the syntax may change
6876 #
6877 # Call code for all geometries. This is a simple wrapper for
6878 # ResetReading and while(GetNextFeature).
6879 #
6880 # Example usage:
6881 # \code
6882 # my $area = 0;
6883 # $layer->ForGeometries(sub {my $g = shift; $area += $g->Area}); # computes the total area
6884 # \endcode
6885 #
6886 # @param code a reference to a subroutine, which is called with each
6887 # geometry as an argument
6888 # @param in_place if set to true, the geometry is stored back to the
6889 # layer
6890 #*
6891 sub ForGeometries {
6892  my $self = shift;
6893  my $code = shift;
6894  my $in_place = shift;
6895  $self->ResetReading;
6896  while (my $f = $self->GetNextFeature) {
6897  my $g = $f->Geometry();
6898  $code->($g);
6899  if ($in_place) {
6900  $f->Geometry($g);
6901  $self->SetFeature($f);
6902  }
6903  }
6904 }
6905 
6906 #** @method Geometries()
6907 #*
6908 sub Geometries {
6909  my $self = shift;
6910  $self->ResetReading;
6911  return sub {
6912  my $f = $self->GetNextFeature;
6913  return 0 unless $f;
6914  return $f->Geometry;
6915  }
6916 }
6917 
6918 #** @method scalar GeometryType($field)
6919 # Object method.
6920 # @param field the name or index of the spatial field.
6921 # @return the geometry type of the spatial field.
6922 #*
6923 sub GeometryType {
6924  my $self = shift;
6925  my $d = $self->GetDefn;
6926  my $field = $d->GetGeomFieldIndex(shift // 0);
6927  my $fd = $d->_GetGeomFieldDefn($field);
6928  return $fd->Type if $fd;
6929 }
6930 
6931 #** @method Geo::OGR::DataSource GetDataSource()
6932 # Object method.
6933 # @return the data source object to which this layer object belongs to.
6934 #*
6935 sub GetDataSource {
6936  my $self = shift;
6937  parent($self);
6938 }
6940 #** @method Geo::OGR::FeatureDefn GetDefn()
6941 # Object method.
6942 # A.k.a GetLayerDefn.
6943 # @return a Geo::OGR::FeatureDefn object.
6944 #*
6945 sub GetDefn {
6946  my $self = shift;
6947  my $defn = $self->GetLayerDefn;
6948  keep($defn, $self);
6949 }
6950 
6951 #** @method list GetExtent($force = 1)
6952 # Object method.
6953 # @param force compute the extent even if it is expensive
6954 # @note In scalar context returns a reference to an anonymous array
6955 # containing the extent.
6956 # @return the extent ($minx, $maxx, $miny, $maxy)
6957 # @param force
6958 # @return the extent = ($minx, $maxx, $miny, $maxy) as a listref
6959 #*
6960 sub GetExtent {
6961 }
6962 
6963 #** @method scalar GetFIDColumn()
6964 # Object method.
6965 # @return the name of the underlying database column being used as the
6966 # FID column, or "" if not supported.
6967 #*
6968 sub GetFIDColumn {
6969 }
6970 
6971 #** @method Geo::OGR::Feature GetFeature($fid)
6972 # Object method.
6973 # @param fid feature id
6974 # @return a new Geo::OGR::Feature object that represents the feature in the layer.
6975 #*
6976 sub GetFeature {
6977  my ($self, $fid) = @_;
6978  $fid //= 0;
6979  my $f = $self->_GetFeature($fid);
6980  error(2, "FID=$fid", '"Feature') unless ref $f eq 'Geo::OGR::Feature';
6981  keep($f, $self);
6982 }
6983 
6984 #** @method GetFeatureCount()
6985 #*
6986 sub GetFeatureCount {
6987 }
6988 
6989 #** @method scalar GetFeaturesRead()
6990 # Object method.
6991 # @return integer
6992 #*
6993 sub GetFeaturesRead {
6994 }
6995 
6996 #** @method scalar GetFieldDefn($name)
6997 # Object method.
6998 # Get the definition of a field.
6999 # @param name the name of the field.
7000 # @return a Geo::OGR::FieldDefn object.
7001 #*
7002 sub GetFieldDefn {
7003  my $self = shift;
7004  my $d = $self->GetDefn;
7005  my $field = $d->GetFieldIndex(shift // 0);
7006  return $d->_GetFieldDefn($field);
7007 }
7008 
7009 #** @method list GetFieldNames()
7010 # Object method.
7011 # @return a list of the names of the fields in this layer. The
7012 # non-geometry field names are first in the list and then the geometry
7013 # fields.
7014 #*
7015 sub GetFieldNames {
7016  my $self = shift;
7017  my $d = $self->GetDefn;
7018  my @ret;
7019  for (my $i = 0; $i < $d->GetFieldCount; $i++) {
7020  push @ret, $d->GetFieldDefn($i)->Name();
7021  }
7022  for (my $i = 0; $i < $d->GetGeomFieldCount; $i++) {
7023  push @ret, $d->GetGeomFieldDefn($i)->Name();
7024  }
7025  return @ret;
7026 }
7027 
7028 #** @method scalar GetGeomFieldDefn($name)
7029 # Object method.
7030 # Get the definition of a spatial field.
7031 # @param name the name of the spatial field.
7032 # @return a Geo::OGR::GeomFieldDefn object.
7033 #*
7034 sub GetGeomFieldDefn {
7035  my $self = shift;
7036  my $d = $self->GetDefn;
7037  my $field = $d->GetGeomFieldIndex(shift // 0);
7038  return $d->_GetGeomFieldDefn($field);
7039 }
7040 
7041 #** @method scalar GetName()
7042 # Object method.
7043 # @return the name of the layer.
7044 #*
7045 sub GetName {
7046 }
7047 
7048 #** @method Geo::OGR::Feature GetNextFeature()
7049 # Object method.
7050 # @return iteratively Geo::OGR::Feature objects from the layer. The
7051 # iteration obeys the spatial and the attribute filter.
7052 #*
7053 sub GetNextFeature {
7054 }
7055 
7056 #** @method hash reference GetSchema()
7057 # Object method.
7058 # @brief Get the schema of this layer.
7059 # @note The schema of a layer cannot be set with this method. If you
7060 # have a Geo::OGR::FeatureDefn object before creating the layer, use
7061 # its schema in the Geo::OGR::CreateLayer method.
7062 # @return the schema of this layer, as in Geo::OGR::FeatureDefn::Schema.
7063 #*
7064 sub GetSchema {
7065  my $self = shift;
7066  carp "Schema of a layer should not be set directly." if @_;
7067  if (@_ and @_ % 2 == 0) {
7068  my %schema = @_;
7069  if ($schema{Fields}) {
7070  for my $field (@{$schema{Fields}}) {
7071  $self->CreateField($field);
7072  }
7073  }
7074  }
7075  return $self->GetDefn->Schema;
7076 }
7077 
7078 #** @method Geo::OGR::Geometry GetSpatialFilter()
7079 # Object method.
7080 # @return a new Geo::OGR::Geometry object
7081 #*
7082 sub GetSpatialFilter {
7083 }
7084 
7085 #** @method GetStyleTable()
7086 #*
7087 sub GetStyleTable {
7088 }
7089 
7090 #** @method Identity(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, $callback_data)
7091 # Object method.
7092 # The result layer contains features whose geometries represent areas
7093 # that are in the input layer. The features in the result layer have
7094 # attributes from both input and method layers. The schema of the
7095 # result layer can be set by the user or, if it is empty, is
7096 # initialized to contain all fields in input and method layers.
7097 # @param method method layer.
7098 # @param result result layer.
7099 # @param options a reference to an options hash.
7100 # @param callback [optional] a reference to a subroutine, which will
7101 # be called with parameters (number progress, string msg, callback_data)
7102 # @param callback_data [optional]
7103 #*
7104 sub Identity {
7105 }
7106 
7107 #** @method InsertFeature($feature)
7108 # Object method.
7109 # Creates a new feature which has the schema of the layer and
7110 # initializes it with data from the argument. Then inserts the feature
7111 # into the layer (using CreateFeature). Uses Geo::OGR::Feature::Row or
7112 # Geo::OGR::Feature::Tuple.
7113 # @param feature a Geo::OGR::Feature object or reference to feature
7114 # data in a hash (as in Geo::OGR::Feature::Row) or in an array (as in
7115 # Geo::OGR::Feature::Tuple)
7116 # @return the new feature.
7117 #*
7118 sub InsertFeature {
7119  my $self = shift;
7120  my $feature = shift;
7121  error("Usage: \$feature->InsertFeature(reference to a hash or array).") unless ref($feature);
7122  my $new = Geo::OGR::Feature->new(Schema => $self, Values => $feature);
7123  $self->CreateFeature($new);
7124  return unless defined wantarray;
7125  keep($new, $self);
7126 }
7127 
7128 #** @method Intersection(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, $callback_data)
7129 # Object method.
7130 # The result layer contains features whose geometries represent areas
7131 # that are common between features in the input layer and in the
7132 # method layer. The schema of the result layer can be set before
7133 # calling this method, or is initialized to contain all fields from
7134 # this and method layer.
7135 # @param method method layer.
7136 # @param result result layer.
7137 # @param options a reference to an options hash.
7138 # @param callback [optional] a reference to a subroutine, which will
7139 # be called with parameters (number progress, string msg, callback_data)
7140 # @param callback_data [optional]
7141 #*
7142 sub Intersection {
7143 }
7144 
7145 #** @method ReorderField()
7146 #*
7147 sub ReorderField {
7148 }
7149 
7150 #** @method ReorderFields()
7151 #*
7152 sub ReorderFields {
7153 }
7154 
7155 #** @method ResetReading()
7156 # Object method.
7157 # Initialize the layer object for iterative reading.
7158 #*
7159 sub ResetReading {
7160 }
7161 
7162 #** @method RollbackTransaction()
7163 # Object method.
7164 #*
7165 sub RollbackTransaction {
7166 }
7167 
7168 #** @method hash reference Row(%row)
7169 # Object method.
7170 # Get and/or set the data of a feature that has the supplied feature
7171 # id (the next feature obtained with GetNextFeature is used if feature
7172 # id is not given). Calls Geo::OGR::Feature::Row.
7173 # @param row [optional] feature data
7174 # @return a reference to feature data in a hash
7175 #*
7176 sub Row {
7177  my $self = shift;
7178  my $update = @_ > 0;
7179  my %row = @_;
7180  my $feature = defined $row{FID} ? $self->GetFeature($row{FID}) : $self->GetNextFeature;
7181  return unless $feature;
7182  my $ret;
7183  if (defined wantarray) {
7184  $ret = $feature->Row(@_);
7185  } else {
7186  $feature->Row(@_);
7187  }
7188  $self->SetFeature($feature) if $update;
7189  return unless defined wantarray;
7190  return $ret;
7191 }
7192 
7193 #** @method SetAttributeFilter($filter_string)
7194 # Object method.
7195 # Set or clear the attribute filter.
7196 # @param filter_string a SQL WHERE clause or undef to clear the
7197 # filter.
7198 #*
7199 sub SetAttributeFilter {
7200 }
7201 
7202 #** @method SetFeature($feature)
7203 # Object method.
7204 # @note The feature should have the same schema as the layer.
7205 #
7206 # Replaces a feature in the layer based on the given feature's
7207 # id. Requires RandomWrite capability.
7208 # @param feature a Geo::OGR::Feature object
7209 #*
7210 sub SetFeature {
7211 }
7212 
7213 #** @method SetIgnoredFields(@fields)
7214 # Object method.
7215 # @param fields a list of field names
7216 #*
7217 sub SetIgnoredFields {
7218 }
7219 
7220 #** @method SetNextByIndex($new_index)
7221 # Object method.
7222 # @param new_index the index to which set the read cursor in the
7223 # current iteration
7224 #*
7225 sub SetNextByIndex {
7226 }
7227 
7228 #** @method SetSpatialFilter($filter)
7229 # Object method.
7230 # @param filter [optional] a Geo::OGR::Geometry object. If not given,
7231 # removes the filter if there is one.
7232 #*
7233 sub SetSpatialFilter {
7234 }
7235 
7236 #** @method SetSpatialFilterRect($minx, $miny, $maxx, $maxy)
7237 # Object method.
7238 # @param minx
7239 # @param miny
7240 # @param maxx
7241 # @param maxy
7242 #*
7243 sub SetSpatialFilterRect {
7244 }
7245 
7246 #** @method SetStyleTable()
7247 #*
7248 sub SetStyleTable {
7249 }
7250 
7251 #** @method Geo::OGR::Geometry SpatialFilter(@filter)
7252 # Object method.
7253 # @param filter [optional] a Geo::OGR::Geometry object or a string. An
7254 # undefined value removes the filter if there is one.
7255 # @return a new Geo::OGR::Geometry object
7256 # @param filter [optional] a rectangle ($minx, $miny, $maxx, $maxy).
7257 # @return a new Geo::OGR::Geometry object
7258 #*
7259 sub SpatialFilter {
7260  my $self = shift;
7261  $self->SetSpatialFilter($_[0]) if @_ == 1;
7262  $self->SetSpatialFilterRect(@_) if @_ == 4;
7263  return unless defined wantarray;
7264  $self->GetSpatialFilter;
7265 }
7266 
7267 #** @method Geo::OSR::SpatialReference SpatialReference($name, Geo::OSR::SpatialReference sr)
7268 # Object method.
7269 # @note A.k.a GetSpatialRef.
7270 # Get or set the projection of a spatial field of this layer. Gets or
7271 # sets the projection of the first field if no field name is given.
7272 # @param name [optional] a name of a spatial field in this layer.
7273 # @param sr [optional] a Geo::OSR::SpatialReference object,
7274 # which replaces the existing projection.
7275 # @return a Geo::OSR::SpatialReference object, which represents the
7276 # projection in the given spatial field.
7277 #*
7278 sub SpatialReference {
7279  my $self = shift;
7280  my $d = $self->GetDefn;
7281  my $field = @_ == 2 ? $d->GetGeomFieldIndex(shift // 0) : 0;
7282  my $sr = shift;
7283  my $d2 = $d->_GetGeomFieldDefn($field);
7284  $d2->SpatialReference($sr) if defined $sr;
7285  return $d2->SpatialReference() if defined wantarray;
7286 }
7287 
7288 #** @method StartTransaction()
7289 # Object method.
7290 #*
7291 sub StartTransaction {
7292 }
7293 
7294 #** @method SymDifference(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, $callback_data)
7295 # Object method.
7296 # The result layer contains features whose geometries represent areas
7297 # that are in either in the input layer or in the method layer but not
7298 # in both. The features in the result layer have attributes from both
7299 # input and method layers. For features which represent areas that are
7300 # only in the input or in the method layer the respective attributes
7301 # have undefined values. The schema of the result layer can be set by
7302 # the user or, if it is empty, is initialized to contain all fields in
7303 # the input and method layers.
7304 # @param method method layer.
7305 # @param result result layer.
7306 # @param options a reference to an options hash.
7307 # @param callback [optional] a reference to a subroutine, which will
7308 # be called with parameters (number progress, string msg, callback_data)
7309 # @param callback_data [optional]
7310 #*
7311 sub SymDifference {
7312 }
7313 
7314 #** @method SyncToDisk()
7315 # Object method.
7316 #*
7317 sub SyncToDisk {
7318 }
7319 
7320 #** @method scalar TestCapability($cap)
7321 # Object method.
7322 # @param cap A capability string.
7323 # @return a boolean value indicating whether the layer has the
7324 # specified capability.
7325 #*
7326 sub TestCapability {
7327  my($self, $cap) = @_;
7328  return _TestCapability($self, $CAPABILITIES{$cap});
7329 }
7330 
7331 #** @method list Tuple(@tuple)
7332 # Object method.
7333 # Get and/set the data of a feature that has the supplied feature id
7334 # (the next feature obtained with GetNextFeature is used if feature id
7335 # is not given). The expected data in the tuple is: ([feature id,]
7336 # non-spatial fields, spatial fields). Calls Geo::OGR::Feature::Tuple.
7337 # @param tuple [optional] feature data
7338 # @note The schema of the tuple needs to be the same as that of the
7339 # layer.
7340 # @return a reference to feature data in an array
7341 #*
7342 sub Tuple {
7343  my $self = shift;
7344  my $FID = shift;
7345  my $feature = defined $FID ? $self->GetFeature($FID) : $self->GetNextFeature;
7346  return unless $feature;
7347  my $set = @_ > 0;
7348  unshift @_, $feature->GetFID if $set;
7349  my @ret;
7350  if (defined wantarray) {
7351  @ret = $feature->Tuple(@_);
7352  } else {
7353  $feature->Tuple(@_);
7354  }
7355  $self->SetFeature($feature) if $set;
7356  return unless defined wantarray;
7357  return @ret;
7358 }
7359 
7360 #** @method Union(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, $callback_data)
7361 # Object method.
7362 # The result layer contains features whose geometries represent areas
7363 # that are in either in the input layer or in the method layer. The
7364 # schema of the result layer can be set before calling this method, or
7365 # is initialized to contain all fields from this and method layer.
7366 # @param method method layer.
7367 # @param result result layer.
7368 # @param options a reference to an options hash.
7369 # @param callback [optional] a reference to a subroutine, which will
7370 # be called with parameters (number progress, string msg, callback_data)
7371 # @param callback_data [optional]
7372 #*
7373 sub Union {
7374 }
7375 
7376 #** @method Update(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, $callback_data)
7377 # Object method.
7378 # The result layer contains features whose geometries represent areas
7379 # that are either in the input layer or in the method layer. The
7380 # features in the result layer have areas of the features of the
7381 # method layer or those ares of the features of the input layer that
7382 # are not covered by the method layer. The features of the result
7383 # layer get their attributes from the input layer. The schema of the
7384 # result layer can be set by the user or, if it is empty, is
7385 # initialized to contain all fields in the input layer.
7386 # @param method method layer.
7387 # @param result result layer.
7388 # @param options a reference to an options hash.
7389 # @param callback [optional] a reference to a subroutine, which will
7390 # be called with parameters (number progress, string msg, callback_data)
7391 # @param callback_data [optional]
7392 #*
7393 sub Update {
7394 }
7395 
7396 #** @class Geo::OGR::StyleTable
7397 #*
7398 package Geo::OGR::StyleTable;
7399 
7400 use base qw(Geo::OGR)
7401 
7402 #** @method AddStyle()
7403 #*
7404 sub AddStyle {
7405 }
7406 
7407 #** @method Find()
7408 #*
7409 sub Find {
7410 }
7411 
7412 #** @method GetLastStyleName()
7413 #*
7414 sub GetLastStyleName {
7415 }
7416 
7417 #** @method GetNextStyle()
7418 #*
7419 sub GetNextStyle {
7420 }
7421 
7422 #** @method LoadStyleTable()
7423 #*
7424 sub LoadStyleTable {
7425 }
7426 
7427 #** @method ResetStyleStringReading()
7428 #*
7429 sub ResetStyleStringReading {
7430 }
7431 
7432 #** @method SaveStyleTable()
7433 #*
7434 sub SaveStyleTable {
7435 }
7436 
7437 #** @method new()
7438 #*
7439 sub new {
7440  my $pkg = shift;
7441  my $self = Geo::OGRc::new_StyleTable(@_);
7442  bless $self, $pkg if defined($self);
7443 }
7444 
7445 #** @class Geo::OSR
7446 # @brief Base class for projection related classes.
7447 # @details
7448 #*
7449 package Geo::OSR;
7450 
7451 #** @method list AngularUnits()
7452 # Package subroutine.
7453 # @return list of known angular units.
7454 #*
7455 sub AngularUnits {
7456  return keys %ANGULAR_UNITS;
7457 }
7458 
7459 #** @method CreateCoordinateTransformation()
7460 #*
7461 sub CreateCoordinateTransformation {
7462 }
7463 
7464 #** @method list Datums()
7465 # Package subroutine.
7466 # @return list of known datums.
7467 #*
7468 sub Datums {
7469  return keys %DATUMS;
7470 }
7471 
7472 #** @method GetPROJSearchPaths()
7473 #*
7474 sub GetPROJSearchPaths {
7475 }
7476 
7477 #** @method GetPROJVersionMajor()
7478 #*
7479 sub GetPROJVersionMajor {
7480 }
7481 
7482 #** @method GetPROJVersionMicro()
7483 #*
7484 sub GetPROJVersionMicro {
7485 }
7486 
7487 #** @method GetPROJVersionMinor()
7488 #*
7489 sub GetPROJVersionMinor {
7490 }
7491 
7492 #** @method scalar GetUserInputAsWKT($name)
7493 # Package subroutine.
7494 # @param name the user input
7495 # @return a WKT string.
7496 #*
7497 sub GetUserInputAsWKT {
7498 }
7499 
7500 #** @method scalar GetWellKnownGeogCSAsWKT($name)
7501 # Package subroutine.
7502 # @brief Get well known geographic coordinate system as WKT
7503 # @param name a well known name
7504 # @return a WKT string.
7505 #*
7506 sub GetWellKnownGeogCSAsWKT {
7507 }
7508 
7509 #** @method list LinearUnits()
7510 # Package subroutine.
7511 # @return list of known linear units.
7512 #*
7513 sub LinearUnits {
7514  return keys %LINEAR_UNITS;
7515 }
7516 
7517 #** @method OAMS_AUTHORITY_COMPLIANT()
7518 #*
7519 sub OAMS_AUTHORITY_COMPLIANT {
7520 }
7521 
7522 #** @method OAMS_CUSTOM()
7523 #*
7524 sub OAMS_CUSTOM {
7525 }
7526 
7527 #** @method OAMS_TRADITIONAL_GIS_ORDER()
7528 #*
7529 sub OAMS_TRADITIONAL_GIS_ORDER {
7530 }
7531 
7532 #** @method OAO_Down()
7533 #*
7534 sub OAO_Down {
7535 }
7536 
7537 #** @method OAO_East()
7538 #*
7539 sub OAO_East {
7540 }
7541 
7542 #** @method OAO_North()
7543 #*
7544 sub OAO_North {
7545 }
7546 
7547 #** @method OAO_Other()
7548 #*
7549 sub OAO_Other {
7550 }
7551 
7552 #** @method OAO_South()
7553 #*
7554 sub OAO_South {
7555 }
7556 
7557 #** @method OAO_Up()
7558 #*
7559 sub OAO_Up {
7560 }
7561 
7562 #** @method OAO_West()
7563 #*
7564 sub OAO_West {
7565 }
7566 
7567 #** @method OSRAreaOfUse_east_lon_degree_get()
7568 #*
7569 sub OSRAreaOfUse_east_lon_degree_get {
7570 }
7571 
7572 #** @method OSRAreaOfUse_name_get()
7573 #*
7574 sub OSRAreaOfUse_name_get {
7575 }
7576 
7577 #** @method OSRAreaOfUse_north_lat_degree_get()
7578 #*
7579 sub OSRAreaOfUse_north_lat_degree_get {
7580 }
7581 
7582 #** @method OSRAreaOfUse_south_lat_degree_get()
7583 #*
7584 sub OSRAreaOfUse_south_lat_degree_get {
7585 }
7586 
7587 #** @method OSRAreaOfUse_west_lon_degree_get()
7588 #*
7589 sub OSRAreaOfUse_west_lon_degree_get {
7590 }
7592 #** @method list Parameters()
7593 # Package subroutine.
7594 # @return list of known projection parameters.
7595 #*
7596 sub Parameters {
7597  return keys %PARAMETERS;
7598 }
7599 
7600 #** @method list Projections()
7601 # Package subroutine.
7602 # @return list of known projections.
7603 #*
7604 sub Projections {
7605  return keys %PROJECTIONS;
7606 }
7607 
7608 #** @method SRS_PM_GREENWICH()
7609 #*
7610 sub SRS_PM_GREENWICH {
7611 }
7612 
7613 #** @method SRS_WGS84_INVFLATTENING()
7614 #*
7615 sub SRS_WGS84_INVFLATTENING {
7616 }
7617 
7618 #** @method SRS_WGS84_SEMIMAJOR()
7619 #*
7620 sub SRS_WGS84_SEMIMAJOR {
7621 }
7622 
7623 #** @method SRS_WKT_WGS84_LAT_LONG()
7624 #*
7625 sub SRS_WKT_WGS84_LAT_LONG {
7626 }
7627 
7628 #** @method SetPROJSearchPath()
7629 #*
7630 sub SetPROJSearchPath {
7631 }
7632 
7633 #** @method SetPROJSearchPaths()
7634 #*
7635 sub SetPROJSearchPaths {
7636 }
7637 
7638 #** @class Geo::OSR::AreaOfUse
7639 #*
7640 package Geo::OSR::AreaOfUse;
7641 
7642 use base qw(Geo::OSR)
7643 
7644 #** @method new()
7645 #*
7646 sub new {
7647  my $pkg = shift;
7648  my $self = Geo::OSRc::new_AreaOfUse(@_);
7649  bless $self, $pkg if defined($self);
7650 }
7651 
7652 #** @class Geo::OSR::CoordinateTransformation
7653 # @brief An object for transforming from one projection to another.
7654 # @details
7655 #*
7656 package Geo::OSR::CoordinateTransformation;
7657 
7658 use base qw(Geo::OSR)
7659 
7660 #** @method array reference TransformPoint($x, $y, $z)
7661 # Object method.
7662 # @param x
7663 # @param y
7664 # @param z [optional]
7665 # @return arrayref = [$x, $y, $z]
7666 #*
7667 sub TransformPoint {
7668 }
7669 
7670 #** @method TransformPoints(arrayref points)
7671 # Object method.
7672 # @param points [in/out] a reference to a list of points (line string
7673 # or ring) that is modified in-place. A list of points is: ([x, y, z],
7674 # [x, y, z], ...), where z is optional. Supports also lists of line
7675 # strings and polygons.
7676 #*
7677 sub TransformPoints {
7678  my($self, $points) = @_;
7679  _TransformPoints($self, $points), return unless ref($points->[0]->[0]);
7680  for my $p (@$points) {
7681  TransformPoints($self, $p);
7682  }
7683 }
7684 1;
7685 # This file was automatically generated by SWIG (http://www.swig.org).
7686 # Version 2.0.12
7687 #
7688 # Do not make changes to this file unless you know what you are doing--modify
7689 # the SWIG interface file instead.
7690 }
7691 
7692 #** @method Geo::OSR::CoordinateTransformation new($src, $dst)
7693 # Class method.
7694 # @param src a Geo::OSR::SpatialReference object
7695 # @param dst a Geo::OSR::SpatialReference object
7696 # @return a new Geo::OSR::CoordinateTransformation object
7697 #*
7698 sub new {
7699  my $pkg = shift;
7700  my $self = Geo::OSRc::new_CoordinateTransformation(@_);
7701  bless $self, $pkg if defined($self);
7702 }
7703 
7704 #** @class Geo::OSR::CoordinateTransformationOptions
7705 #*
7706 package Geo::OSR::CoordinateTransformationOptions;
7707 
7708 use base qw(Geo::OSR)
7709 
7710 #** @method SetAreaOfInterest()
7711 #*
7712 sub SetAreaOfInterest {
7713 }
7714 
7715 #** @method SetOperation()
7716 #*
7717 sub SetOperation {
7718 }
7719 
7720 #** @method new()
7721 #*
7722 sub new {
7723  my $pkg = shift;
7724  my $self = Geo::OSRc::new_CoordinateTransformationOptions(@_);
7725  bless $self, $pkg if defined($self);
7726 }
7727 
7728 #** @class Geo::OSR::SpatialReference
7729 # @brief A spatial reference system.
7730 # @details <a href="http://www.gdal.org/classOGRSpatialReference.html">Documentation
7731 # of the underlying C++ class at www.gdal.org</a>
7732 #*
7733 package Geo::OSR::SpatialReference;
7734 
7735 use base qw(Geo::OSR)
7736 
7737 #** @method AddGuessedTOWGS84()
7738 #*
7739 sub AddGuessedTOWGS84 {
7740 }
7741 
7742 #** @method As()
7743 #*
7744 sub As {
7745 }
7746 
7747 #** @method AutoIdentifyEPSG()
7748 # Object method.
7749 # Set EPSG authority info if possible.
7750 #*
7751 sub AutoIdentifyEPSG {
7752 }
7753 
7754 #** @method Geo::OSR::SpatialReference Clone()
7755 # Object method.
7756 # Make a duplicate of this SpatialReference object.
7757 # @return a new Geo::OSR::SpatialReference object
7758 #*
7759 sub Clone {
7760 }
7761 
7762 #** @method Geo::OSR::SpatialReference CloneGeogCS()
7763 # Object method.
7764 # Make a duplicate of the GEOGCS node of this SpatialReference object.
7765 # @return a new Geo::OSR::SpatialReference object
7766 #*
7767 sub CloneGeogCS {
7768 }
7769 
7770 #** @method ConvertToOtherProjection()
7771 #*
7772 sub ConvertToOtherProjection {
7773 }
7774 
7775 #** @method CopyGeogCSFrom($rhs)
7776 # Object method.
7777 # @param rhs Geo::OSR::SpatialReference
7778 #*
7779 sub CopyGeogCSFrom {
7780 }
7781 
7782 #** @method EPSGTreatsAsLatLong()
7783 # Object method.
7784 # Returns TRUE if EPSG feels this geographic coordinate system should be treated as having lat/long coordinate ordering.
7785 #*
7786 sub EPSGTreatsAsLatLong {
7787 }
7788 
7789 #** @method EPSGTreatsAsNorthingEasting()
7790 #*
7791 sub EPSGTreatsAsNorthingEasting {
7792 }
7793 
7794 #** @method Export($format)
7795 # Object method.
7796 # Export the spatial reference to a selected format.
7797 # @note a.k.a. As
7798 #
7799 # @param format One of the following. The return value is explained
7800 # after the format. Other arguments are explained in parenthesis.
7801 # - WKT (Text): Well Known Text string
7802 # - PrettyWKT: Well Known Text string nicely formatted (simplify)
7803 # - Proj4: PROJ.4 string
7804 # - PCI: a list: ($proj_string, $units, [$parms1, ...])
7805 # - USGS: a list: ($code, $zone, [$parms1, ...], $datum)
7806 # - GML (XML): GML based string (dialect)
7807 # - MapInfoCS (MICoordSys): MapInfo style co-ordinate system definition
7808 #
7809 # @note The named parameter syntax also works and is needed is those
7810 # cases when other arguments need or may be given. The format should
7811 # be given using key as, 'to' or 'format'.
7812 #
7813 # @note ExportTo* and AsText methods also exist but are not documented here.
7814 #
7815 # @return a scalar or a list depending on the export format
7816 #*
7817 sub Export {
7818  my $self = shift;
7819  my $format;
7820  $format = pop if @_ == 1;
7821  my %params = @_;
7822  $format //= $params{to} //= $params{format} //= $params{as} //= '';
7823  my $simplify = $params{simplify} // 0;
7824  my $dialect = $params{dialect} // '';
7825  my %converters = (
7826  WKT => sub { return ExportToWkt($self) },
7827  Text => sub { return ExportToWkt($self) },
7828  PrettyWKT => sub { return ExportToPrettyWkt($self, $simplify) },
7829  Proj4 => sub { return ExportToProj4($self) },
7830  PCI => sub { return ExportToPCI($self) },
7831  USGS => sub { return ExportToUSGS($self) },
7832  GML => sub { return ExportToXML($self, $dialect) },
7833  XML => sub { return ExportToXML($self, $dialect) },
7834  MICoordSys => sub { return ExportToMICoordSys() },
7835  MapInfoCS => sub { return ExportToMICoordSys() },
7836  );
7837  error(1, $format, \%converters) unless $converters{$format};
7838  return $converters{$format}->();
7839 }
7840 
7841 #** @method scalar GetAngularUnits()
7842 # Object method.
7843 # @return a number
7844 #*
7845 sub GetAngularUnits {
7846 }
7847 
7848 #** @method GetAngularUnitsName()
7849 #*
7850 sub GetAngularUnitsName {
7851 }
7852 
7853 #** @method GetAreaOfUse()
7854 #*
7855 sub GetAreaOfUse {
7856 }
7857 
7858 #** @method scalar GetAttrValue($name, $child = 0)
7859 # Object method.
7860 # @param name
7861 # @param child
7862 # @return string
7863 #*
7864 sub GetAttrValue {
7865 }
7866 
7867 #** @method scalar GetAuthorityCode($target_key)
7868 # Object method.
7869 # @param target_key
7870 # @return string
7871 #*
7872 sub GetAuthorityCode {
7873 }
7874 
7875 #** @method scalar GetAuthorityName($target_key)
7876 # Object method.
7877 # @param target_key
7878 # @return string
7879 #*
7880 sub GetAuthorityName {
7881 }
7882 
7883 #** @method GetAxisMappingStrategy()
7884 #*
7885 sub GetAxisMappingStrategy {
7886 }
7887 
7888 #** @method GetAxisName()
7889 #*
7890 sub GetAxisName {
7891 }
7892 
7893 #** @method GetAxisOrientation()
7894 #*
7895 sub GetAxisOrientation {
7896 }
7897 
7898 #** @method GetDataAxisToSRSAxisMapping()
7899 #*
7900 sub GetDataAxisToSRSAxisMapping {
7901 }
7902 
7903 #** @method GetInvFlattening()
7904 # Object method.
7905 #*
7906 sub GetInvFlattening {
7907 }
7908 
7909 #** @method scalar GetLinearUnits()
7910 # Object method.
7911 # @return a number
7912 #*
7913 sub GetLinearUnits {
7914 }
7915 
7916 #** @method scalar GetLinearUnitsName()
7917 # Object method.
7918 # @return string
7919 #*
7920 sub GetLinearUnitsName {
7921 }
7922 
7923 #** @method GetName()
7924 #*
7925 sub GetName {
7926 }
7927 
7928 #** @method scalar GetNormProjParm($name, $default_val = 0.0)
7929 # Object method.
7930 # @param name
7931 # @param default_val
7932 # @return a number
7933 #*
7934 sub GetNormProjParm {
7935 }
7936 
7937 #** @method scalar GetProjParm($name, $default_val = 0.0)
7938 # Object method.
7939 # @param name
7940 # @param default_val
7941 # @return a number
7942 #*
7943 sub GetProjParm {
7944 }
7945 
7946 #** @method GetSemiMajor()
7947 # Object method.
7948 #*
7949 sub GetSemiMajor {
7950 }
7951 
7952 #** @method GetSemiMinor()
7953 # Object method.
7954 #*
7955 sub GetSemiMinor {
7956 }
7957 
7958 #** @method GetTOWGS84()
7959 # Object method.
7960 # @return array = ($p1, $p2, $p3, $p4, $p5, $p6, $p7)
7961 #*
7962 sub GetTOWGS84 {
7963 }
7964 
7965 #** @method GetTargetLinearUnits()
7966 #*
7967 sub GetTargetLinearUnits {
7968 }
7969 
7970 #** @method GetUTMZone()
7971 # Object method.
7972 # Get UTM zone information.
7973 # @return The UTM zone (integer). In scalar context the returned value
7974 # is negative for southern hemisphere zones. In list context returns
7975 # two values ($zone, $north), where $zone is always non-negative and
7976 # $north is true or false.
7977 #*
7978 sub GetUTMZone {
7979  my $self = shift;
7980  my $zone = _GetUTMZone($self);
7981  if (wantarray) {
7982  my $north = 1;
7983  if ($zone < 0) {
7984  $zone *= -1;
7985  $north = 0;
7986  }
7987  return ($zone, $north);
7988  } else {
7989  return $zone;
7990  }
7991 }
7992 
7993 #** @method HasTOWGS84()
7994 #*
7995 sub HasTOWGS84 {
7996 }
7997 
7998 #** @method ImportFromOzi()
7999 #*
8000 sub ImportFromOzi {
8001 }
8002 
8003 #** @method scalar IsCompound()
8004 # Object method.
8005 # @return boolean
8006 #*
8007 sub IsCompound {
8008 }
8009 
8010 #** @method scalar IsGeocentric()
8011 # Object method.
8012 # @return boolean
8013 #*
8014 sub IsGeocentric {
8015 }
8016 
8017 #** @method scalar IsGeographic()
8018 # Object method.
8019 # @return boolean
8020 #*
8021 sub IsGeographic {
8022 }
8023 
8024 #** @method scalar IsLocal()
8025 # Object method.
8026 # @return boolean
8027 #*
8028 sub IsLocal {
8029 }
8030 
8031 #** @method scalar IsProjected()
8032 # Object method.
8033 # @return boolean
8034 #*
8035 sub IsProjected {
8036 }
8037 
8038 #** @method scalar IsSame($rs)
8039 # Object method.
8040 # @param rs a Geo::OSR::SpatialReference object
8041 # @return boolean
8042 #*
8043 sub IsSame {
8044 }
8045 
8046 #** @method scalar IsSameGeogCS($rs)
8047 # Object method.
8048 # @param rs a Geo::OSR::SpatialReference object
8049 # @return boolean
8050 #*
8051 sub IsSameGeogCS {
8052 }
8053 
8054 #** @method scalar IsSameVertCS($rs)
8055 # Object method.
8056 # @param rs a Geo::OSR::SpatialReference object
8057 # @return boolean
8058 #*
8059 sub IsSameVertCS {
8060 }
8061 
8062 #** @method scalar IsVertical()
8063 # Object method.
8064 # @return boolean
8065 #*
8066 sub IsVertical {
8067 }
8068 
8069 #** @method MorphFromESRI()
8070 # Object method.
8071 #*
8072 sub MorphFromESRI {
8073 }
8074 
8075 #** @method MorphToESRI()
8076 # Object method.
8077 #*
8078 sub MorphToESRI {
8079 }
8080 
8081 #** @method Set(%params)
8082 # Object method.
8083 # Set a parameter or parameters in the spatial reference object.
8084 # @param params Named parameters. Recognized keys and respective
8085 # values are the following.
8086 # - Authority: authority name (give also TargetKey, Node and Code)
8087 # - TargetKey:
8088 # - Node: partial or complete path to the target node (Node and Value together sets an attribute value)
8089 # - Code: code for value with an authority
8090 # - Value: value to be assigned to a node, a projection parameter or an object
8091 # - AngularUnits: angular units for the geographic coordinate system (give also Value) (one of Geo::OSR::LinearUnits)
8092 # - LinearUnits: linear units for the target node or the object (give also Value and optionally Node) (one of Geo::OSR::LinearUnits)
8093 # - Parameter: projection parameter to set (give also Value and Normalized) (one of Geo::OSR::Parameters)
8094 # - Normalized: set to true to indicate that the Value argument is in "normalized" form
8095 # - Name: a well known name of a geographic coordinate system (e.g. WGS84)
8096 # - GuessFrom: arbitrary text that specifies a projection ("user input")
8097 # - LOCAL_CS: name of a local coordinate system
8098 # - GeocentricCS: name of a geocentric coordinate system
8099 # - VerticalCS: name of a vertical coordinate system (give also Datum and optionally VertDatumType [default is 2005])
8100 # - Datum: a known (OGC or EPSG) name (or(?) one of Geo::OSR::Datums)
8101 # - CoordinateSystem: 'WGS', 'UTM', 'State Plane', or a user visible name (give optionally also Parameters, Zone, North, NAD83, UnitName, UnitConversionFactor, Datum, Spheroid, HorizontalCS, and/or VerticalCS
8102 # - Parameters: a reference to a list containing the coordinate system or projection parameters
8103 # - Zone: zone for setting up UTM or State Plane coordinate systems (State Plane zone in USGS numbering scheme)
8104 # - North: set false for southern hemisphere
8105 # - NAD83: set false if the NAD27 zone definition should be used instead of NAD83
8106 # - UnitName: to override the legal definition for a zone
8107 # - UnitConversionFactor: to override the legal definition for a zone
8108 # - Spheroid: user visible name
8109 # - HorizontalCS: Horizontal coordinate system name
8110 # - Projection: name of a projection, one of Geo::OSR::Projections (give also optionally Parameters and Variant)
8111 #
8112 # @note Numerous Set* methods also exist but are not documented here.
8113 #*
8114 sub Set {
8115  my($self, %params) = @_;
8116  if (exists $params{Authority} and exists $params{TargetKey} and exists $params{Node} and exists $params{Code}) {
8117  SetAuthority($self, $params{TargetKey}, $params{Authority}, $params{Code});
8118  } elsif (exists $params{Node} and exists $params{Value}) {
8119  SetAttrValue($self, $params{Node}, $params{Value});
8120  } elsif (exists $params{AngularUnits} and exists $params{Value}) {
8121  SetAngularUnits($self, $params{AngularUnits}, $params{Value});
8122  } elsif (exists $params{LinearUnits} and exists $params{Node} and exists $params{Value}) {
8123  SetTargetLinearUnits($self, $params{Node}, $params{LinearUnits}, $params{Value});
8124  } elsif (exists $params{LinearUnits} and exists $params{Value}) {
8125  SetLinearUnitsAndUpdateParameters($self, $params{LinearUnits}, $params{Value});
8126  } elsif ($params{Parameter} and exists $params{Value}) {
8127  error(1, $params{Parameter}, \%Geo::OSR::PARAMETERS) unless exists $Geo::OSR::PARAMETERS{$params{Parameter}};
8128  $params{Normalized} ?
8129  SetNormProjParm($self, $params{Parameter}, $params{Value}) :
8130  SetProjParm($self, $params{Parameter}, $params{Value});
8131  } elsif (exists $params{Name}) {
8132  SetWellKnownGeogCS($self, $params{Name});
8133  } elsif (exists $params{GuessFrom}) {
8134  SetFromUserInput($self, $params{GuessFrom});
8135  } elsif (exists $params{LOCAL_CS}) {
8136  SetLocalCS($self, $params{LOCAL_CS});
8137  } elsif (exists $params{GeocentricCS}) {
8138  SetGeocCS($self, $params{GeocentricCS});
8139  } elsif (exists $params{VerticalCS} and $params{Datum}) {
8140  my $type = $params{VertDatumType} || 2005;
8141  SetVertCS($self, $params{VerticalCS}, $params{Datum}, $type);
8142  } elsif (exists $params{CoordinateSystem}) {
8143  my @parameters = ();
8144  @parameters = @{$params{Parameters}} if ref($params{Parameters});
8145  if ($params{CoordinateSystem} eq 'State Plane' and exists $params{Zone}) {
8146  my $NAD83 = exists $params{NAD83} ? $params{NAD83} : 1;
8147  my $name = exists $params{UnitName} ? $params{UnitName} : undef;
8148  my $c = exists $params{UnitConversionFactor} ? $params{UnitConversionFactor} : 0.0;
8149  SetStatePlane($self, $params{Zone}, $NAD83, $name, $c);
8150  } elsif ($params{CoordinateSystem} eq 'UTM' and exists $params{Zone} and exists $params{North}) {
8151  my $north = exists $params{North} ? $params{North} : 1;
8152  SetUTM($self, $params{Zone}, $north);
8153  } elsif ($params{CoordinateSystem} eq 'WGS') {
8154  SetTOWGS84($self, @parameters);
8155  } elsif ($params{CoordinateSystem} and $params{Datum} and $params{Spheroid}) {
8156  SetGeogCS($self, $params{CoordinateSystem}, $params{Datum}, $params{Spheroid}, @parameters);
8157  } elsif ($params{CoordinateSystem} and $params{HorizontalCS} and $params{VerticalCS}) {
8158  SetCompoundCS($self, $params{CoordinateSystem}, $params{HorizontalCS}, $params{VerticalCS});
8159  } else {
8160  SetProjCS($self, $params{CoordinateSystem});
8161  }
8162  } elsif (exists $params{Projection}) {
8163  error(1, $params{Projection}, \%Geo::OSR::PROJECTIONS) unless exists $Geo::OSR::PROJECTIONS{$params{Projection}};
8164  my @parameters = ();
8165  @parameters = @{$params{Parameters}} if ref($params{Parameters});
8166  if ($params{Projection} eq 'Albers_Conic_Equal_Area') {
8167  SetACEA($self, @parameters);
8168  } elsif ($params{Projection} eq 'Azimuthal_Equidistant') {
8169  SetAE($self, @parameters);
8170  } elsif ($params{Projection} eq 'Bonne') {
8171  SetBonne($self, @parameters);
8172  } elsif ($params{Projection} eq 'Cylindrical_Equal_Area') {
8173  SetCEA($self, @parameters);
8174  } elsif ($params{Projection} eq 'Cassini_Soldner') {
8175  SetCS($self, @parameters);
8176  } elsif ($params{Projection} eq 'Equidistant_Conic') {
8177  SetEC($self, @parameters);
8178  # Eckert_I, Eckert_II, Eckert_III, Eckert_V ?
8179  } elsif ($params{Projection} eq 'Eckert_IV') {
8180  SetEckertIV($self, @parameters);
8181  } elsif ($params{Projection} eq 'Eckert_VI') {
8182  SetEckertVI($self, @parameters);
8183  } elsif ($params{Projection} eq 'Equirectangular') {
8184  @parameters == 4 ?
8185  SetEquirectangular($self, @parameters) :
8186  SetEquirectangular2($self, @parameters);
8187  } elsif ($params{Projection} eq 'Gauss_Schreiber_Transverse_Mercator') {
8188  SetGaussSchreiberTMercator($self, @parameters);
8189  } elsif ($params{Projection} eq 'Gall_Stereographic') {
8190  SetGS($self, @parameters);
8191  } elsif ($params{Projection} eq 'Goode_Homolosine') {
8192  SetGH($self, @parameters);
8193  } elsif ($params{Projection} eq 'Interrupted_Goode_Homolosine') {
8194  SetIGH($self);
8195  } elsif ($params{Projection} eq 'Geostationary_Satellite') {
8196  SetGEOS($self, @parameters);
8197  } elsif ($params{Projection} eq 'Gnomonic') {
8198  SetGnomonic($self, @parameters);
8199  } elsif ($params{Projection} eq 'Hotine_Oblique_Mercator') {
8200  # Hotine_Oblique_Mercator_Azimuth_Center ?
8201  SetHOM($self, @parameters);
8202  } elsif ($params{Projection} eq 'Hotine_Oblique_Mercator_Two_Point_Natural_Origin') {
8203  SetHOM2PNO($self, @parameters);
8204  } elsif ($params{Projection} eq 'Krovak') {
8205  SetKrovak($self, @parameters);
8206  } elsif ($params{Projection} eq 'Lambert_Azimuthal_Equal_Area') {
8207  SetLAEA($self, @parameters);
8208  } elsif ($params{Projection} eq 'Lambert_Conformal_Conic_2SP') {
8209  SetLCC($self, @parameters);
8210  } elsif ($params{Projection} eq 'Lambert_Conformal_Conic_1SP') {
8211  SetLCC1SP($self, @parameters);
8212  } elsif ($params{Projection} eq 'Lambert_Conformal_Conic_2SP_Belgium') {
8213  SetLCCB($self, @parameters);
8214  } elsif ($params{Projection} eq 'miller_cylindrical') {
8215  SetMC($self, @parameters);
8216  } elsif ($params{Projection} =~ /^Mercator/) {
8217  # Mercator_1SP, Mercator_2SP, Mercator_Auxiliary_Sphere ?
8218  # variant is in Variant (or Name)
8219  SetMercator($self, @parameters);
8220  } elsif ($params{Projection} eq 'Mollweide') {
8221  SetMollweide($self, @parameters);
8222  } elsif ($params{Projection} eq 'New_Zealand_Map_Grid') {
8223  SetNZMG($self, @parameters);
8224  } elsif ($params{Projection} eq 'Oblique_Stereographic') {
8225  SetOS($self, @parameters);
8226  } elsif ($params{Projection} eq 'Orthographic') {
8227  SetOrthographic($self, @parameters);
8228  } elsif ($params{Projection} eq 'Polyconic') {
8229  SetPolyconic($self, @parameters);
8230  } elsif ($params{Projection} eq 'Polar_Stereographic') {
8231  SetPS($self, @parameters);
8232  } elsif ($params{Projection} eq 'Robinson') {
8233  SetRobinson($self, @parameters);
8234  } elsif ($params{Projection} eq 'Sinusoidal') {
8235  SetSinusoidal($self, @parameters);
8236  } elsif ($params{Projection} eq 'Stereographic') {
8237  SetStereographic($self, @parameters);
8238  } elsif ($params{Projection} eq 'Swiss_Oblique_Cylindrical') {
8239  SetSOC($self, @parameters);
8240  } elsif ($params{Projection} eq 'Transverse_Mercator_South_Orientated') {
8241  SetTMSO($self, @parameters);
8242  } elsif ($params{Projection} =~ /^Transverse_Mercator/) {
8243  my($variant) = $params{Projection} =~ /^Transverse_Mercator_(\w+)/;
8244  $variant //= $params{Variant} //= $params{Name};
8245  $variant ?
8246  SetTMVariant($self, $variant, @parameters) :
8247  SetTM($self, @parameters);
8248  } elsif ($params{Projection} eq 'Tunisia_Mining_Grid') {
8249  SetTMG($self, @parameters);
8250  } elsif ($params{Projection} eq 'VanDerGrinten') {
8251  SetVDG($self, @parameters);
8252  } else {
8253  # Aitoff, Craster_Parabolic, International_Map_of_the_World_Polyconic, Laborde_Oblique_Mercator
8254  # Loximuthal, Miller_Cylindrical, Quadrilateralized_Spherical_Cube, Quartic_Authalic, Two_Point_Equidistant
8255  # Wagner_I, Wagner_II, Wagner_III, Wagner_IV, Wagner_V, Wagner_VI, Wagner_VII
8256  # Winkel_I, Winkel_II, Winkel_Tripel
8257  # ?
8258  SetProjection($self, $params{Projection});
8259  }
8260  } else {
8261  error("Not enough information to create a spatial reference object.");
8262  }
8263 }
8264 
8265 #** @method SetAxisMappingStrategy()
8266 #*
8267 sub SetAxisMappingStrategy {
8268 }
8269 
8270 #** @method SetMercator2SP()
8271 #*
8272 sub SetMercator2SP {
8273 }
8274 
8275 #** @method Validate()
8276 # Object method.
8277 #*
8278 sub Validate {
8279 }
8280 
8281 #** @method Geo::OSR::SpatialReference new(%params)
8282 # Class method.
8283 # Create a new spatial reference object using a named parameter. This
8284 # constructor recognizes the following key words (alternative in
8285 # parenthesis): WKT (Text), Proj4, ESRI, EPSG, EPSGA, PCI, USGS, GML
8286 # (XML), URL, ERMapper (ERM), MapInfoCS (MICoordSys). The value
8287 # depends on the key.
8288 # - WKT: Well Known Text string
8289 # - Proj4: PROJ.4 string
8290 # - ESRI: reference to a list of strings (contents of ESRI .prj file)
8291 # - EPSG: EPSG code number
8292 # - EPSGA: EPSG code number (the resulting CS will have EPSG preferred axis ordering)
8293 # - PCI: listref: [PCI_projection_string, Grid_units_code, [17 cs parameters]]
8294 # - USGS: listref: [Projection_system_code, Zone, [15 cs parameters], Datum_code, Format_flag]
8295 # - GML: GML string
8296 # - URL: URL for downloading the spatial reference from
8297 # - ERMapper: listref: [Projection, Datum, Units]
8298 # - MapInfoCS: MapInfo style co-ordinate system definition
8299 #
8300 # For more information, consult the import methods in <a href="http://www.gdal.org/classOGRSpatialReference.html">OGR documentation</a>.
8301 #
8302 # @note ImportFrom* methods also exist but are not documented here.
8303 #
8304 # Usage:
8305 # \code
8306 # $sr = Geo::OSR::SpatialReference->new( key => value );
8307 # \endcode
8308 # @return a new Geo::OSR::SpatialReference object
8309 #*
8310 sub new {
8311  my $pkg = shift;
8312  my %param = @_;
8313  my $self = Geo::OSRc::new_SpatialReference();
8314  if (exists $param{WKT}) {
8315  ImportFromWkt($self, $param{WKT});
8316  } elsif (exists $param{Text}) {
8317  ImportFromWkt($self, $param{Text});
8318  } elsif (exists $param{Proj4}) {
8319  ImportFromProj4($self, $param{Proj4});
8320  } elsif (exists $param{ESRI}) {
8321  ImportFromESRI($self, @{$param{ESRI}});
8322  } elsif (exists $param{EPSG}) {
8323  ImportFromEPSG($self, $param{EPSG});
8324  } elsif (exists $param{EPSGA}) {
8325  ImportFromEPSGA($self, $param{EPSGA});
8326  } elsif (exists $param{PCI}) {
8327  ImportFromPCI($self, @{$param{PCI}});
8328  } elsif (exists $param{USGS}) {
8329  ImportFromUSGS($self, @{$param{USGS}});
8330  } elsif (exists $param{XML}) {
8331  ImportFromXML($self, $param{XML});
8332  } elsif (exists $param{GML}) {
8333  ImportFromGML($self, $param{GML});
8334  } elsif (exists $param{URL}) {
8335  ImportFromUrl($self, $param{URL});
8336  } elsif (exists $param{ERMapper}) {
8337  ImportFromERM($self, @{$param{ERMapper}});
8338  } elsif (exists $param{ERM}) {
8339  ImportFromERM($self, @{$param{ERM}});
8340  } elsif (exists $param{MICoordSys}) {
8341  ImportFromMICoordSys($self, $param{MICoordSys});
8342  } elsif (exists $param{MapInfoCS}) {
8343  ImportFromMICoordSys($self, $param{MapInfoCS});
8344  } elsif (exists $param{WGS}) {
8345  eval {
8346  SetWellKnownGeogCS($self, 'WGS'.$param{WGS});
8347  };
8348  confess last_error() if $@;
8349  } else {
8350  error("Unrecognized/missing parameters: @_.");
8351  }
8352  bless $self, $pkg if defined $self;
8353 }
8354 
Geo::GDAL::Band::Distance
public Geo::GDAL::Band Distance(hash params)
Geo::GDAL::VersionInfo
public scalar VersionInfo(scalar request='VERSION_NUM')
Geo::OGR::Geometry::ForceToMultiPolygon
public Geo::OGR::Geometry ForceToMultiPolygon(array polygons)
Geo::GDAL::GOA2GetRefreshToken
public method GOA2GetRefreshToken()
Geo::OGR::FieldDefn::Nullable
public scalar Nullable(scalar nullable)
Geo::GDAL::ResamplingTypes
public list ResamplingTypes()
Geo::GDAL::Transformer::TransformPoint
public method TransformPoint()
Geo::GDAL::XML::traverse
public method traverse(coderef subroutine)
Geo::GDAL::ColorTable::Clone
public Geo::GDAL::ColorTable Clone()
Geo::OGR::Layer::Features
public method Features()
Geo::GDAL::Dataset::SpatialReference
public Geo::OSR::SpatialReference SpatialReference(Geo::OSR::SpatialReference sr)
Geo::OGR::Open
public Geo::GDAL::Dataset Open(scalar name, scalar update=0)
Geo::GDAL::RasterAttributeTable::GetRowOfValue
public scalar GetRowOfValue(scalar value)
Geo::OGR::Geometry::SetPointM
public method SetPointM()
Geo::GDAL::Band::Domains
public method Domains()
Geo::GDAL::VSIFEofL
public method VSIFEofL()
Geo::OGR::Layer::GetSchema
public hash reference GetSchema()
Get the schema of this layer.
Geo::OGR::Geometry::Segmentize
public method Segmentize(scalar MaxLength)
Geo::OSR::SpatialReference::AutoIdentifyEPSG
public method AutoIdentifyEPSG()
Geo::GDAL::RasterAttributeTable::GetColumnCount
public scalar GetColumnCount()
Geo::GDAL::Extent::ExpandToInclude
public method ExpandToInclude(scalar extent)
Geo::GNM::GATKShortestPath
public method GATKShortestPath()
Geo::GDAL::VSIF
A GDAL virtual file system.
Definition: all.pm:6939
Geo::GDAL::Dataset::ComputeColorTable
public Geo::GDAL::ColorTable ComputeColorTable(hash params)
Geo::OGR::GeomFieldDefn::Schema
public hash reference Schema(hash params)
Geo::GDAL::PackCharacter
public scalar PackCharacter(scalar DataType)
Geo::OSR::SRS_PM_GREENWICH
public method SRS_PM_GREENWICH()
Geo::GDAL::DataTypeIsComplex
public scalar DataTypeIsComplex(scalar DataType)
Geo::OGR::GeomFieldDefn::GetSchema
public method GetSchema()
Geo::OGR::DataSource::Open
public Geo::GDAL::Dataset Open()
Geo::GNM::GNM_EDGE_DIR_TGTTOSRC
public method GNM_EDGE_DIR_TGTTOSRC()
Geo::OGR::Layer::GetFieldNames
public list GetFieldNames()
Geo::OGR::Layer::GetFieldDefn
public scalar GetFieldDefn(scalar name)
Geo::OGR::Geometry::SetMeasured
public method SetMeasured()
Geo::GDAL::Dataset::ExecuteSQL
public Geo::OGR::Layer ExecuteSQL(scalar statement, scalar geom=undef, scalar dialect="")
Geo::OGR::Feature::SetFieldNull
public method SetFieldNull()
Geo::OGR::FieldDefn::Ignored
public scalar Ignored(scalar ignore)
Geo::OGR::Geometry::Value
public method Value()
Geo::GDAL::OpenEx
public Geo::GDAL::Dataset OpenEx(hash params)
Geo::GDAL::Band::XSize
scalar XSize
Object attribute. scalar (access as $band->{XSize})
Definition: all.pm:1466
Geo::OGR::Geometry::SimplifyPreserveTopology
public method SimplifyPreserveTopology()
Geo::GDAL::Dataset::GetSpatialRef
public method GetSpatialRef()
Geo::OGR::Geometry::ForceToPolygon
public Geo::OGR::Geometry ForceToPolygon()
Geo::OGR::Geometry::SetPoint_2D
public method SetPoint_2D(scalar index, scalar x, scalar y)
Geo::GDAL::Driver::ShortName
scalar ShortName
$driver->{ShortName}
Definition: all.pm:5124
Geo::GDAL::ColorTable::Colors
public list Colors(array colors)
Geo::GDAL::RasterAttributeTable::ChangesAreWrittenToFile
public method ChangesAreWrittenToFile()
Geo::OGR::DataSource::OpenShared
public Geo::GDAL::Dataset OpenShared()
Geo::GDAL::AsyncReader::GetNextUpdatedRegion
public method GetNextUpdatedRegion()
Geo::OSR::SpatialReference::GetAuthorityName
public scalar GetAuthorityName(scalar target_key)
Geo::GDAL::Dataset::Tile
public method Tile(Geo::GDAL::Extent e)
Geo::GDAL::VSIF::Open
public Geo::GDAL::VSIF Open(scalar filename, scalar mode)
Geo::OGR::Geometry::ForceTo
public Geo::OGR::Geometry ForceTo(scalar type, ref options)
Geo::GDAL::GeoTransform
An array of affine transformation coefficients.
Definition: all.pm:5884
Geo::OSR::SpatialReference::GetProjParm
public scalar GetProjParm(scalar name, scalar default_val=0.0)
Geo::GNM::Network::GetFileList
public method GetFileList()
Geo::OGR::Geometry::AddPointM
public method AddPointM()
Geo::OGR::Layer::SetIgnoredFields
public method SetIgnoredFields(array fields)
Geo::GNM::Network::GetLayerByIndex
public method GetLayerByIndex()
Geo::GDAL::Dataset::DEMProcessing
public Geo::GDAL::Dataset DEMProcessing(scalar Dest, scalar Processing, scalar ColorFilename, hashref Options, coderef progress, scalar progress_data)
Geo::OGR::GeometryTypeTest
public scalar GeometryTypeTest(scalar type, scalar test, scalar type2)
Geo::GDAL::GetSignedURL
public method GetSignedURL()
Geo::OGR::StyleTable::ResetStyleStringReading
public method ResetStyleStringReading()
Geo::OSR::OAMS_TRADITIONAL_GIS_ORDER
public method OAMS_TRADITIONAL_GIS_ORDER()
Geo::GDAL::Dataset::WriteTile
public method WriteTile()
Geo::GDAL::GeoTransform::Inv
public method Inv()
Geo::GNM::Network::GetLayerCount
public method GetLayerCount()
Geo::GDAL::Dataset::Domains
public method Domains()
Geo::OGR::Layer::DeleteFeature
public method DeleteFeature(scalar fid)
Geo::GDAL::RasterAttributeTable::FieldUsages
public list FieldUsages()
Geo::OSR::SpatialReference::EPSGTreatsAsNorthingEasting
public method EPSGTreatsAsNorthingEasting()
Geo::GDAL::Driver::CreationOptionList
public list CreationOptionList()
Geo::OGR::Feature::GetField
public list GetField(scalar name)
Geo::OGR::Geometry::Length
public scalar Length()
Geo::GDAL::Band::YSize
scalar YSize
Object attribute. scalar (access as $band->{YSize})
Definition: all.pm:1476
Geo::OGR::FieldDefn::IsDefaultDriverSpecific
public method IsDefaultDriverSpecific()
Geo::OSR::Parameters
public list Parameters()
Geo::OGR::Geometry::GetCoordinateDimension
public scalar GetCoordinateDimension()
Geo::OGR::FeatureDefn::AddField
public method AddField(hash params)
Geo::GDAL::Band::SetDefaultHistogram
public list SetDefaultHistogram(scalar min, scalar max, scalar histogram)
Geo::OSR::SRS_WGS84_SEMIMAJOR
public method SRS_WGS84_SEMIMAJOR()
Geo::OSR::SpatialReference::GetAreaOfUse
public method GetAreaOfUse()
Geo::GDAL::Dataset::Rasterize
public Geo::GDAL::Dataset Rasterize(scalar Dest, hashref Options, coderef progress, scalar progress_data)
Geo::GDAL::Dataset::ReadTile
public method ReadTile()
Geo::OGR::Layer::GetSpatialFilter
public Geo::OGR::Geometry GetSpatialFilter()
Geo::OGR::Feature::Tuple
public list Tuple(array tuple)
Geo::GDAL::VSIGetLastErrorMsg
public method VSIGetLastErrorMsg()
Geo::GDAL::Band::CategoryNames
public list CategoryNames(array names)
Geo::GDAL::Band::RegenerateOverviews
public method RegenerateOverviews(arrayref overviews, scalar resampling, coderef progress, scalar progress_data)
Geo::OGR::Geometry::Polygonize
public method Polygonize()
Geo::OGR::StyleTable::AddStyle
public method AddStyle()
Geo::OSR::SpatialReference::IsGeocentric
public scalar IsGeocentric()
Geo::OSR::AngularUnits
public list AngularUnits()
Geo::OGR::Geometry::GetEnvelope3D
public list GetEnvelope3D()
Geo::GDAL::Band::ReadRaster
public scalar ReadRaster(hash params)
Geo::GNM::Network::CopyLayer
public method CopyLayer()
Geo::OGR::Layer::GetNextFeature
public Geo::OGR::Feature GetNextFeature()
Geo::GNM::GenericNetwork::GetRules
public method GetRules()
Geo::OGR::Layer::Dataset
public method Dataset()
Geo::GDAL::Extent::IsEmpty
public method IsEmpty()
Geo::OGR::FieldDefn::JustifyValues
public list JustifyValues()
Geo::GDAL::RasterAttributeTable::GetRowCount
public scalar GetRowCount()
Geo::OGR::Layer::Feature
public Geo::OGR::Feature Feature(scalar f)
Geo::OGR::Layer::AlterFieldDefn
public method AlterFieldDefn(scalar name, hash params)
Geo::GDAL::ApplyVerticalShiftGrid
public method ApplyVerticalShiftGrid()
Geo::OGR::Layer::GetGeomFieldDefn
public scalar GetGeomFieldDefn(scalar name)
Geo::OGR::Geometry::GetM
public method GetM()
Geo::OSR::SpatialReference::GetAxisMappingStrategy
public method GetAxisMappingStrategy()
Geo::OGR::Layer::FeatureCount
public scalar FeatureCount(scalar force=1)
Geo::GNM::CastToNetwork
public method CastToNetwork()
Geo::GDAL::VSIF::Rename
public method Rename(scalar old, scalar new)
Geo::OGR::Geometry::Distance3D
public method Distance3D()
Geo::GDAL::RasterAttributeTable::SetTableType
public method SetTableType()
Geo::OSR::SpatialReference::GetAxisName
public method GetAxisName()
Geo::GDAL::RasterAttributeTable
An attribute table in a raster band.
Definition: all.pm:6223
Geo::OSR::OSRAreaOfUse_west_lon_degree_get
public method OSRAreaOfUse_west_lon_degree_get()
Geo::OGR::Geometry::Crosses
public scalar Crosses(scalar other)
Geo::OGR::GeomFieldDefn::new
public Geo::OGR::GeomFieldDefn new(hash params)
Create a new spatial field definition.
Geo::OGR::GeomFieldDefn::SetSchema
public method SetSchema()
Geo::GNM::Network::GetProjection
public method GetProjection()
Geo::GDAL::GCP
A ground control point for georeferencing rasters.
Definition: all.pm:5770
Geo::OGR::StyleTable::SaveStyleTable
public method SaveStyleTable()
Geo::OGR
OGR utility functions.
Definition: all.pm:8120
Geo::GDAL::Dataset::RasterCount
scalar RasterCount
scalar (access as $dataset->{RasterCount})
Definition: all.pm:3418
Geo::GDAL::Band
A raster band.
Definition: all.pm:1455
Geo::GDAL::GetErrorCounter
public method GetErrorCounter()
Geo::GDAL::VSIF::MkDir
public method MkDir(scalar path)
Geo::OSR::SpatialReference::IsSame
public scalar IsSame(scalar rs)
Geo::OGR::Geometry::HasCurveGeometry
public method HasCurveGeometry()
Geo::OGR::FeatureDefn::IsStyleIgnored
public scalar IsStyleIgnored()
Geo::OGR::FieldDefn::SubTypes
public method SubTypes()
Geo::OSR::SpatialReference::GetSemiMajor
public method GetSemiMajor()
Geo::GDAL::Band::FlushCache
public method FlushCache()
Geo::GDAL::GetActualURL
public method GetActualURL()
Geo::OGR::Feature::Layer
public Geo::OGR::Layer Layer()
Geo::OSR::SpatialReference::As
public method As()
Geo::GDAL::MajorObject::GetDescription
public scalar GetDescription()
Geo::OSR::OSRAreaOfUse_north_lat_degree_get
public method OSRAreaOfUse_north_lat_degree_get()
Geo::OSR::SpatialReference::GetTargetLinearUnits
public method GetTargetLinearUnits()
Geo::OGR::Geometry::ForceToMultiLineString
public Geo::OGR::Geometry ForceToMultiLineString(array linestrings)
Geo::GDAL::Dataset::ResetReading
public method ResetReading()
Geo::GDAL::Driver::TestCapability
public scalar TestCapability(scalar cap)
Geo::OGR::StyleTable::Find
public method Find()
Geo::GDAL::Driver::Name
public scalar Name()
Geo::GDAL::Band::WriteRaster
public method WriteRaster(hash params)
Geo::OSR::SpatialReference::GetInvFlattening
public method GetInvFlattening()
Geo::GDAL::Dataset::Size
public list Size()
Geo::OGR::Geometry::IsValid
public scalar IsValid()
Geo::OGR::Layer::Update
public method Update(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
Geo::GNM::GATConnectedComponents
public method GATConnectedComponents()
Geo::OGR::Geometry::ConvexHull
public Geo::OGR::Geometry ConvexHull()
Geo::GDAL::SetConfigOption
public method SetConfigOption(scalar key, scalar value)
Geo::OGR::Geometry::GetEnvelope
public list GetEnvelope()
Geo::GDAL::Driver
A driver for a specific dataset format.
Definition: all.pm:5096
Geo::OSR::OSRAreaOfUse_name_get
public method OSRAreaOfUse_name_get()
Geo::GDAL::Dataset::GetLayerNames
public list GetLayerNames()
Geo::OGR::Feature::GetStyleString
public scalar GetStyleString()
Geo::OGR::Geometry::Overlaps
public scalar Overlaps(scalar other)
Geo::OGR::Geometry::new
public Geo::OGR::Geometry new(hash params)
Geo::GDAL::DriverNames
public list DriverNames()
Geo::GDAL::Band::MaskFlags
public list MaskFlags()
Geo::OGR::Geometry::UnionCascaded
public Geo::OGR::Geometry UnionCascaded()
Geo::GDAL::GCP::Column
scalar Column
cell x coordinate (access as $gcp->{Column})
Definition: all.pm:5780
Geo::OGR::Layer::Geometries
public method Geometries()
Geo::OGR::Geometry::AddGeometry
public method AddGeometry(scalar other)
Geo::OGR::Geometry::ForceToCollection
public Geo::OGR::Geometry ForceToCollection(array geometries)
Geo::OGR::FeatureDefn
The schema of a feature or a layer.
Definition: all.pm:9744
Geo::OGR::Layer::GetFeatureCount
public method GetFeatureCount()
Geo::OGR::Geometry
Spatial data.
Definition: all.pm:10966
Geo::GDAL::Driver::Open
public method Open()
Geo::OSR::OAO_Other
public method OAO_Other()
Geo::OGR::Feature::Validate
public scalar Validate(list flags)
Geo::GDAL::Band::BlockSize
public list BlockSize()
Geo::GDAL::CPLHexToBinary
public method CPLHexToBinary()
Geo::OSR::SpatialReference::IsProjected
public scalar IsProjected()
Geo::OGR::Geometry::Extent
public method Extent()
Geo::GDAL::Dataset::RasterXSize
scalar RasterXSize
scalar (access as $dataset->{RasterXSize})
Definition: all.pm:3427
Geo::GDAL::ColorTable::GetPaletteInterpretation
public scalar GetPaletteInterpretation()
Geo::GDAL::Dataset::WriteRaster
public method WriteRaster(hash params)
Geo::GDAL::Open
public Geo::GDAL::Dataset Open(hash params)
Geo::OGR::FieldDefn::new
public Geo::OGR::FieldDefn new(hash params)
Create a new field definition.
Geo::GNM::GenericNetwork::ConnectPointsByLines
public method ConnectPointsByLines()
Geo::GDAL::RasterAttributeTable::Columns
public hash Columns(hash columns)
Geo::GDAL::MajorObject::GetMetadataDomainList
public method GetMetadataDomainList()
Geo::OGR::Geometry::Within
public scalar Within(scalar other)
Geo::OGR::Layer::GetFIDColumn
public scalar GetFIDColumn()
Geo::GDAL::DontUseExceptions
public method DontUseExceptions()
Geo::OGR::Feature::GetSchema
public hash reference GetSchema()
Get the schema of this feature.
Geo::GDAL::VSIF::ReadDirRecursive
public scalar ReadDirRecursive(scalar dir)
Geo::GDAL::ColorTable::GetCount
public scalar GetCount()
Geo::OGR::Feature::GetDefn
public Geo::OGR::FeatureDefn GetDefn()
Geo::GNM::GenericNetwork::DisconnectFeaturesWithId
public method DisconnectFeaturesWithId()
Geo::OSR::SpatialReference::Clone
public Geo::OSR::SpatialReference Clone()
Geo::GNM::Network::GetVersion
public method GetVersion()
Geo::GDAL::VSIF::Read
public scalar Read(scalar count)
Geo::GDAL::Band::ScaleAndOffset
public method ScaleAndOffset(scalar scale, scalar offset)
Geo::GDAL::Band::ComputeBandStats
public method ComputeBandStats(scalar samplestep=1)
Geo::OGR::Layer::Clip
public method Clip(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
Geo::GDAL::RasterAttributeTable::GetTypeOfCol
public scalar GetTypeOfCol(scalar column)
Geo::OSR::SpatialReference::MorphToESRI
public method MorphToESRI()
Geo::OGR::Geometry::FlattenTo2D
public method FlattenTo2D()
Geo::OSR::OAO_East
public method OAO_East()
Geo::GDAL::Dataset::GetGCPProjection
public scalar GetGCPProjection()
Geo::OSR::CoordinateTransformation::TransformPoint
public array reference TransformPoint(scalar x, scalar y, scalar z)
Geo::GDAL::MajorObject::SetDescription
public method SetDescription(scalar NewDesc)
Geo::OSR::SpatialReference::Validate
public method Validate()
Geo::GDAL::Band::ClassCounts
public hashref ClassCounts(scalar classifier, scalar progress=undef, scalar progress_data=undef)
Geo::GDAL::Dataset::SetGCPs2
public method SetGCPs2()
Geo::OGR::Geometry::SwapXY
public method SwapXY()
Geo::GDAL::RasterAttributeTable::GetValueAsInt
public scalar GetValueAsInt(scalar row, scalar column)
Geo::GDAL::errstr
public scalar errstr()
Geo::OGR::Geometry::GeometryType
public scalar GeometryType()
Geo::GDAL::Dataset::Bands
public list Bands()
Geo::GDAL::Band::ColorInterpretation
public scalar ColorInterpretation(scalar color_interpretation)
Geo::OSR::SpatialReference::Set
public method Set(hash params)
Geo::OGR::Geometry::DelaunayTriangulation
public method DelaunayTriangulation()
Geo::GDAL::GeoTransform::NorthUp
public method NorthUp()
Geo::OGR::Layer::SetFeature
public method SetFeature(scalar feature)
Geo::OGR::FeatureDefn::new
public Geo::OGR::FeatureDefn new(hash schema)
Geo::OSR::SpatialReference::GetAngularUnitsName
public method GetAngularUnitsName()
Geo::GDAL::Band::GetMaskFlags
public list GetMaskFlags()
Geo::OGR::Driver
public Geo::GDAL::Driver Driver(scalar name)
Geo::OGR::Geometry::RemoveGeometry
public method RemoveGeometry()
Geo::OGR::Geometry::SetPointZM
public method SetPointZM()
Geo::GDAL::Transformer::TransformGeolocations
public method TransformGeolocations()
Geo::OGR::StyleTable::LoadStyleTable
public method LoadStyleTable()
Geo::OGR::Driver::Copy
public Geo::GDAL::Dataset Copy(Geo::GDAL::Dataset source, scalar name, arrayref options=undef)
Geo::GDAL::MkdirRecursive
public method MkdirRecursive()
Geo::GDAL::GetFileSystemOptions
public method GetFileSystemOptions()
Geo::OGR::Feature::FillUnsetWithDefault
public method FillUnsetWithDefault()
Geo::GDAL::GCP::Row
scalar Row
cell y coordinate (access as $gcp->{Row})
Definition: all.pm:5807
Geo::GDAL::Dataset::GetFileList
public list GetFileList()
Geo::GDAL::Dataset::Dataset
public method Dataset()
Geo::GDAL::Dataset::CommitTransaction
public method CommitTransaction()
Geo::GDAL::AsyncReader::LockBuffer
public method LockBuffer()
Geo::GDAL::Dataset::StartTransaction
public method StartTransaction()
Geo::OGR::Layer::Identity
public method Identity(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
Geo::GDAL::Band::Contours
public Geo::OGR::Layer Contours(scalar DataSource, hashref LayerConstructor, scalar ContourInterval, scalar ContourBase, arrayref FixedLevels, scalar NoDataValue, scalar IDField, scalar ElevField, coderef Progress, scalar ProgressData)
Geo::OSR::SpatialReference::IsCompound
public scalar IsCompound()
Geo::GNM::GenericNetwork::DisconnectFeatures
public method DisconnectFeatures()
Geo::OGR::Feature::SetFID
public method SetFID(scalar id)
Geo::GDAL::XML
A simple XML parser
Definition: all.pm:7335
Geo::OSR::SpatialReference::HasTOWGS84
public method HasTOWGS84()
Geo::OGR::StyleTable
Definition: all.pm:15199
Geo::GDAL::RasterAttributeTable::CreateColumn
public method CreateColumn(scalar name, scalar type, scalar usage)
Geo::GDAL::XML::serialize
public method serialize()
Geo::GDAL::MajorObject
An object, which holds meta data.
Definition: all.pm:6027
Geo::OGR::Feature::FID
public scalar FID(scalar id)
Get or set the id of this feature.
Geo::GNM::GenericNetwork::ChangeBlockState
public method ChangeBlockState()
Geo::OGR::Geometry::PointOnSurface
public method PointOnSurface()
Geo::GDAL::Driver::MIMEType
public scalar MIMEType()
Geo::GDAL::Dataset::Translate
public Geo::GDAL::Dataset Translate(scalar Dest, hashref Options, coderef progress, scalar progress_data)
Geo::GNM::GenericNetwork::DeleteRule
public method DeleteRule()
Geo::OSR
Base class for projection related classes.
Definition: all.pm:15366
Geo::OGR::Feature::SetNativeMediaType
public method SetNativeMediaType()
Geo::OSR::Datums
public list Datums()
Geo::GDAL::FinderClean
public method FinderClean()
Geo::GDAL::VSIF::ReadDir
public list ReadDir(scalar dir)
Geo::GNM::Network::GetName
public method GetName()
Geo::OGR::Geometry::IsEmpty
public scalar IsEmpty()
Geo::GNM::Network::GetLayerByName
public method GetLayerByName()
Geo::OSR::SRS_WKT_WGS84_LAT_LONG
public method SRS_WKT_WGS84_LAT_LONG()
Geo::GDAL::Band::GetStatistics
public list GetStatistics(scalar approx_ok, scalar force)
Geo::OGR::Geometry::ForceToLineString
public Geo::OGR::Geometry ForceToLineString()
Geo::OGR::Feature::Geometry
public method Geometry(scalar name, scalar geometry)
Get or set the value of a geometry field.
Geo::GDAL::CPLBinaryToHex
public method CPLBinaryToHex()
Geo::GDAL::Dataset::CopyLayer
public Geo::OGR::Layer CopyLayer(scalar layer, scalar name, hashref options=undef)
Geo::GDAL::Dataset::Grid
public Geo::GDAL::Dataset Grid(scalar Dest, hashref Options)
Geo::OGR::Geometry::IsMeasured
public method IsMeasured()
Geo::OSR::SpatialReference::MorphFromESRI
public method MorphFromESRI()
Geo::OGR::Layer::GetExtent
public list GetExtent(scalar force=1)
Geo::GDAL::GCP::Id
scalar Id
unique identifier (string) (access as $gcp->{Id})
Definition: all.pm:5789
Geo::OGR::Layer::SetNextByIndex
public method SetNextByIndex(scalar new_index)
Geo::OGR::Geometry::CoordinateDimension
public scalar CoordinateDimension(scalar dimension)
Geo::OGR::Geometry::GetGeometryRef
public scalar GetGeometryRef(scalar index)
Geo::GDAL::GeoTransform::Apply
public method Apply(scalar x, scalar y)
Geo::OGR::Driver::Open
public method Open()
Geo::OSR::GetPROJVersionMicro
public method GetPROJVersionMicro()
Geo::GNM::Network::RollbackTransaction
public method RollbackTransaction()
Geo::OGR::FieldDefn::GetSchema
public method GetSchema()
Geo::OGR::FieldDefn::Types
public list Types()
Geo::OGR::GeomFieldDefn::SpatialReference
public scalar SpatialReference(scalar sr)
Geo::OGR::Geometry::IsRing
public scalar IsRing()
Geo::OGR::FieldDefn::SubType
public scalar SubType(scalar SubType)
Geo::GNM::GNM_EDGE_DIR_BOTH
public method GNM_EDGE_DIR_BOTH()
Geo::GDAL::Dataset::Warp
public Geo::GDAL::Dataset Warp(scalar Dest, hashref Options, coderef progress, scalar progress_data)
Geo::GDAL::Band::GetBandNumber
public scalar GetBandNumber()
Geo::GDAL::VSIGetLastErrorNo
public method VSIGetLastErrorNo()
Geo::GDAL::Dataset::SetSpatialRef
public method SetSpatialRef()
Geo::OSR::SpatialReference::IsSameGeogCS
public scalar IsSameGeogCS(scalar rs)
Geo::OSR::AreaOfUse
Definition: all.pm:16025
Geo::OGR::Feature::GetFieldDefn
public scalar GetFieldDefn(scalar name)
Geo::OGR::HasM
public method HasM()
Geo::OSR::SpatialReference::GetAttrValue
public scalar GetAttrValue(scalar name, scalar child=0)
Geo::GDAL::Band::GetMinimum
public scalar GetMinimum()
Geo::GNM::Network::CommitTransaction
public method CommitTransaction()
Geo::GDAL::Band::Reclassify
public method Reclassify(scalar classifier, scalar progress=undef, scalar progress_data=undef)
Geo::OGR::Geometry::AddPointZM
public method AddPointZM()
Geo::OGR::FieldDefn::Justify
public scalar Justify(scalar justify)
Geo::GDAL::Dataset::AdviseRead
public method AdviseRead()
Geo::GDAL::RmdirRecursive
public method RmdirRecursive()
Geo::OSR::SpatialReference::GetNormProjParm
public scalar GetNormProjParm(scalar name, scalar default_val=0.0)
Geo::OGR::Layer::SyncToDisk
public method SyncToDisk()
Geo::OGR::Geometry::Geometry
public scalar Geometry(scalar n)
Geo::GDAL::Driver::Delete
public method Delete(scalar name)
Geo::GDAL::Band::Checksum
public scalar Checksum(scalar xoff=0, scalar yoff=0, scalar xsize=undef, scalar ysize=undef)
Geo::GDAL::Driver::Domains
public method Domains()
Geo::GDAL::RasterAttributeTable::GetNameOfCol
public scalar GetNameOfCol(scalar column)
Geo::GDAL::ColorTable
A color table from a raster band or a color table, which can be used for a band.
Definition: all.pm:3222
Geo::OGR::Geometry::AddPoint_3D
public method AddPoint_3D(scalar x, scalar y, scalar z)
Geo::GNM::Network::DisconnectAll
public method DisconnectAll()
Geo::OGR::Geometry::SetCoordinateDimension
public method SetCoordinateDimension(scalar dimension)
Geo::OGR::Layer::ReorderFields
public method ReorderFields()
Geo::GNM::GenericNetwork::CreateRule
public method CreateRule()
Geo::GDAL::RasterAttributeTable::Band
public method Band()
Geo::OGR::Geometry::Area
public scalar Area()
Geo::OGR::Feature::IsFieldNull
public method IsFieldNull()
Geo::GDAL::AsyncReader::UnlockBuffer
public method UnlockBuffer()
Geo::GDAL::Dataset::SetStyleTable
public method SetStyleTable()
Geo::OGR::StyleTable::GetNextStyle
public method GetNextStyle()
Geo::GDAL::Dataset::CreateLayer
public Geo::OGR::Layer CreateLayer(hash params)
Create a new vector layer into this dataset.
Geo::GNM::GenericNetwork
Definition: all.pm:7591
Geo::GDAL::Dataset::OpenShared
public Geo::GDAL::Dataset OpenShared()
Geo::GDAL::Extent::new
public Geo::GDAL::Extent new(array params)
Geo::OSR::GetPROJSearchPaths
public method GetPROJSearchPaths()
Geo::GDAL::VSILFILE
Definition: all.pm:7323
Geo::GDAL::Driver::Copy
public Geo::GDAL::Dataset Copy(hash params)
Geo::OSR::SpatialReference
A spatial reference system.
Definition: all.pm:16221
Geo::OGR::Geometry::AddGeometryDirectly
public method AddGeometryDirectly(scalar other)
Geo::OGR::FieldDefn::Name
public scalar Name(scalar name)
Geo::GDAL::VSIFFlushL
public method VSIFFlushL()
Geo::OGR::Geometry::AddPoint_2D
public method AddPoint_2D(scalar x, scalar y)
Geo::OGR::Geometry::TransformTo
public method TransformTo(scalar srs)
Geo::OGR::Geometry::MakeValid
public method MakeValid()
Geo::OGR::Layer::InsertFeature
public method InsertFeature(scalar feature)
Geo::GDAL
GDAL utility functions and a root class for raster classes.
Definition: all.pm:14
Geo::GDAL::Band::Piddle
public method Piddle(scalar piddle, scalar xoff=0, scalar yoff=0, scalar xsize=< width >, scalar ysize=< height >, scalar xdim, scalar ydim)
Geo::OGR::Geometry::Centroid
public Geo::OGR::Geometry Centroid()
Geo::OGR::FieldDefn::Schema
public hash reference Schema(hash params)
Geo::GDAL::Driver
public Geo::GDAL::Driver Driver(scalar Name)
Geo::OGR::Geometry::GetCurveGeometry
public method GetCurveGeometry()
Geo::OSR::SetPROJSearchPaths
public method SetPROJSearchPaths()
Geo::OGR::FeatureDefn::GetName
public scalar GetName()
Geo::OSR::OAMS_CUSTOM
public method OAMS_CUSTOM()
Geo::GDAL::Band::ColorTable
public Geo::GDAL::ColorTable ColorTable(scalar ColorTable)
Geo::OGR::Layer::GetFeature
public Geo::OGR::Feature GetFeature(scalar fid)
Geo::GDAL::OpenFlags
public list OpenFlags()
Geo::GDAL::Dataset::GetNextFeature
public method GetNextFeature()
Geo::OSR::SpatialReference::CloneGeogCS
public Geo::OSR::SpatialReference CloneGeogCS()
Geo::OGR::Feature::GetFID
public scalar GetFID()
Geo::OSR::OSRAreaOfUse_east_lon_degree_get
public method OSRAreaOfUse_east_lon_degree_get()
Geo::GDAL::Band::WriteTile
public method WriteTile(scalar data, scalar xoff=0, scalar yoff=0)
Geo::OGR::FieldDefn::Default
public scalar Default(scalar value)
Geo::OSR::SpatialReference::GetAngularUnits
public scalar GetAngularUnits()
Geo::OGR::Geometry::SetPoint_3D
public method SetPoint_3D(scalar index, scalar x, scalar y, scalar z)
Geo::OGR::StyleTable::GetLastStyleName
public method GetLastStyleName()
Geo::OGR::Feature::Row
public hash reference Row(hash row)
Geo::GDAL::CreatePansharpenedVRT
public method CreatePansharpenedVRT()
Geo::OGR::GeomFieldDefn::Ignored
public scalar Ignored(scalar ignore)
Geo::GDAL::Band::Sieve
public Geo::GDAL::Band Sieve(hash params)
Geo::OGR::FieldDefn
A definition of a non-spatial attribute.
Definition: all.pm:10154
Geo::GDAL::GetConfigOption
public scalar GetConfigOption(scalar key)
Geo::GDAL::RasterAttributeTable::SetValueAsString
public method SetValueAsString(scalar row, scalar column, scalar value)
Geo::GNM::MajorObject
Definition: all.pm:7811
Geo::GDAL::Dataset::RollbackTransaction
public method RollbackTransaction()
Geo::GDAL::GOA2GetAccessToken
public method GOA2GetAccessToken()
Geo::OGR::Geometry::Points
public array reference Points(arrayref points)
Geo::GDAL::MajorObject::SetMetadata
public method SetMetadata(hashref metadata, scalar domain="")
Geo::OSR::OAO_Down
public method OAO_Down()
Geo::OGR::DriverNames
public list DriverNames()
Geo::OGR::Geometry::Intersection
public Geo::OGR::Geometry Intersection(scalar other)
Geo::OGR::Feature::SetStyleString
public method SetStyleString(scalar string)
Geo::OSR::SpatialReference::SetAxisMappingStrategy
public method SetAxisMappingStrategy()
Geo::GDAL::Dataset::ReadRaster
public scalar ReadRaster(hash params)
Geo::OGR::Layer::GetName
public scalar GetName()
Geo::GDAL::Driver::HelpTopic
scalar HelpTopic
$driver->{HelpTopic}
Definition: all.pm:5106
Geo::OGR::Geometry::GetSpatialReference
public Geo::OSR::SpatialReference GetSpatialReference()
Geo::OGR::Geometry::AssignSpatialReference
public method AssignSpatialReference(scalar srs)
Geo::OGR::Geometry::CloseRings
public method CloseRings()
Geo::OGR::GeomFieldDefn::Type
public method Type()
Geo::GDAL::ColorTable::CreateColorRamp
public method CreateColorRamp(scalar start_index, arrayref start_color, scalar end_index, arrayref end_color)
Geo::OGR::Layer::SpatialFilter
public Geo::OGR::Geometry SpatialFilter(array filter)
Geo::OSR::CreateCoordinateTransformation
public method CreateCoordinateTransformation()
Geo::GDAL::RasterAttributeTable::FieldTypes
public list FieldTypes()
Geo::OGR::FeatureDefn::GetGeomFieldDefn
public scalar GetGeomFieldDefn(scalar name)
Geo::GDAL::Dataset::GeoTransform
public Geo::GDAL::GeoTransform GeoTransform(Geo::GDAL::GeoTransform scalar geo_transform)
Geo::GDAL::VSIF::Stat
public list Stat(scalar filename)
Geo::GDAL::Driver::Extension
public scalar Extension()
Geo::GDAL::Band::GetBlockSize
public method GetBlockSize()
Geo::OGR::Layer::SpatialReference
public Geo::OSR::SpatialReference SpatialReference(scalar name, Geo::OSR::SpatialReference sr)
Geo::OGR::Layer::ResetReading
public method ResetReading()
Geo::OGR::FeatureDefn::GetFieldDefn
public scalar GetFieldDefn(scalar name)
Geo::OGR::Geometry::Buffer
public Geo::OGR::Geometry Buffer(scalar distance, scalar quadsecs=30)
Geo::GDAL::VSIF::Unlink
public method Unlink(scalar filename)
Geo::OSR::LinearUnits
public list LinearUnits()
Geo::OGR::Geometry::Distance
public scalar Distance(scalar other)
Geo::OGR::DataSource
A vector dataset.
Definition: all.pm:8526
Geo::OSR::GetWellKnownGeogCSAsWKT
public scalar GetWellKnownGeogCSAsWKT(scalar name)
Get well known geographic coordinate system as WKT
Geo::GNM::Network::GetFeatureByGlobalFID
public method GetFeatureByGlobalFID()
Geo::GDAL::GCP::Z
scalar Z
projection coordinate (access as $gcp->{Z})
Definition: all.pm:5834
Geo::GDAL::VSICurlPartialClearCache
public method VSICurlPartialClearCache()
Geo::OGR::Geometry::AsText
public scalar AsText()
Geo::GDAL::Band::Polygonize
public Geo::OGR::Layer Polygonize(hash params)
Geo::OSR::GetPROJVersionMinor
public method GetPROJVersionMinor()
Geo::OGR::Geometry::BuildPolygonFromEdges
public Geo::OGR::Geometry BuildPolygonFromEdges(scalar BestEffort=0, scalar AutoClose=0, scalar Tolerance=0)
Geo::OSR::OAMS_AUTHORITY_COMPLIANT
public method OAMS_AUTHORITY_COMPLIANT()
Geo::OGR::GeomFieldDefn::Name
public scalar Name(scalar name)
Geo::GDAL::VSIF::Close
public method Close()
Geo::GDAL::DataTypeValueRange
public list DataTypeValueRange(scalar DataType)
Geo::OGR::FieldDefn::Width
public scalar Width(scalar width)
Geo::OGR::Geometry::SymDifference
public Geo::OGR::Geometry SymDifference(scalar other)
Geo::GDAL::Extent
A rectangular area in projection coordinates: xmin, ymin, xmax, ymax.
Definition: all.pm:5593
Geo::OSR::CoordinateTransformationOptions::SetOperation
public method SetOperation()
Geo::GDAL::MajorObject::Description
public scalar Description(scalar description)
Geo::OGR::Geometry::GetPoint_3D
public scalar GetPoint_3D(scalar index=0)
Geo::GDAL::RasterAttributeTable::Value
public scalar Value(scalar row, scalar column, scalar value)
Geo::GDAL::Band::SetStatistics
public method SetStatistics(scalar min, scalar max, scalar mean, scalar stddev)
Geo::OGR::Layer::SetAttributeFilter
public method SetAttributeFilter(scalar filter_string)
Geo::OGR::Layer::Erase
public method Erase(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
Geo::GDAL::UseExceptions
public method UseExceptions()
Geo::GNM::GenericNetwork::ConnectFeatures
public method ConnectFeatures()
Geo::OGR::Geometry::GeometryTypes
public list GeometryTypes()
Geo::GDAL::Band::AdviseRead
public method AdviseRead()
Geo::GDAL::RasterAttributeTable::SetValueAsInt
public method SetValueAsInt(scalar row, scalar column, scalar value)
Geo::GDAL::Dataset::Dither
public Geo::GDAL::Band Dither(hash params)
Geo::OGR::Geometry::Union
public Geo::OGR::Geometry Union(scalar other)
Geo::GDAL::ColorTable::new
public Geo::GDAL::ColorTable new(scalar GDALPaletteInterp='RGB')
Geo::OGR::Geometry::Dissolve
public list Dissolve()
Geo::OSR::CoordinateTransformationOptions
Definition: all.pm:16148
Geo::OGR::Geometry::Collect
public Geo::OGR::Geometry Collect(array geometries)
Geo::GDAL::Dataset::TestCapability
public method TestCapability()
Geo::GDAL::EscapeString
public method EscapeString()
Geo::OSR::SpatialReference::IsSameVertCS
public scalar IsSameVertCS(scalar rs)
Geo::OGR::GeomFieldDefn::Types
public method Types()
Geo::GDAL::Dataset::Extent
public Geo::GDAL::Extent Extent(array params)
Geo::GNM::GenericNetwork::ReconnectFeatures
public method ReconnectFeatures()
Geo::OGR::Feature::IsFieldSetAndNotNull
public method IsFieldSetAndNotNull()
Geo::OGR::Layer::ReorderField
public method ReorderField()
Geo::GDAL::Band::GetDefaultHistogram
public list GetDefaultHistogram(scalar force=1, coderef progress=undef, scalar progress_data=undef)
Geo::GDAL::GOA2GetAuthorizationURL
public method GOA2GetAuthorizationURL()
Geo::OSR::SpatialReference::SetMercator2SP
public method SetMercator2SP()
Geo::OGR::GeomFieldDefn::Nullable
public scalar Nullable(scalar nullable)
Geo::OGR::Layer::Tuple
public list Tuple(array tuple)
Geo::OGR::Geometry::AddPoint
public method AddPoint(scalar x, scalar y, scalar z)
Geo::GDAL::Band::GetMaskBand
public Geo::GDAL::Band GetMaskBand()
Geo::GDAL::Band::PackCharacter
public scalar PackCharacter()
Geo::GDAL::Band::ColorInterpretations
public method ColorInterpretations()
Geo::OGR::Layer::DataSource
public method DataSource()
Geo::GDAL::Band::GetHistogram
public list GetHistogram(hash parameters)
Geo::OSR::SpatialReference::IsVertical
public scalar IsVertical()
Geo::GDAL::Band::HasArbitraryOverviews
public method HasArbitraryOverviews()
Geo::OGR::GeometryTypeModify
public scalar GeometryTypeModify(scalar type, scalar modifier)
Geo::OGR::Geometry::Move
public method Move(scalar dx, scalar dy, scalar dz)
Geo::GDAL::SetCacheMax
public method SetCacheMax(scalar Bytes)
Geo::OGR::Layer::TestCapability
public scalar TestCapability(scalar cap)
Geo::OSR::SpatialReference::GetSemiMinor
public method GetSemiMinor()
Geo::GDAL::RasterAttributeTable::Clone
public Geo::GDAL::RasterAttributeTable Clone()
Geo::OGR::Geometry::AsBinary
public scalar AsBinary()
Geo::GDAL::RasterAttributeTable::DumpReadable
public method DumpReadable()
Geo::GDAL::VSIF::Seek
public method Seek(scalar offset, scalar whence)
Geo::OGR::Geometry::GetX
public scalar GetX(scalar index=0)
Geo::GDAL::GCP::X
scalar X
projection coordinate (access as $gcp->{X})
Definition: all.pm:5816
Geo::OGR::Layer::SetSpatialFilterRect
public method SetSpatialFilterRect(scalar minx, scalar miny, scalar maxx, scalar maxy)
Geo::OGR::Layer::GetDataSource
public Geo::OGR::DataSource GetDataSource()
Geo::OGR::Layer
A collection of similar features.
Definition: all.pm:13595
Geo::OGR::Geometry::Set3D
public method Set3D()
Geo::OSR::SpatialReference::GetUTMZone
public method GetUTMZone()
Geo::OSR::OSRAreaOfUse_south_lat_degree_get
public method OSRAreaOfUse_south_lat_degree_get()
Geo::GDAL::VSIF::Tell
public scalar Tell()
Geo::OSR::SpatialReference::GetLinearUnits
public scalar GetLinearUnits()
Geo::GDAL::Driver::CopyFiles
public method CopyFiles(scalar NewName, scalar OldName)
Geo::OGR::GetOpenDSCount
public method GetOpenDSCount()
Geo::GDAL::Driver::CreationDataTypes
public list CreationDataTypes()
Geo::GDAL::Const
Definition: Const.pm:7
Geo::OGR::SetNonLinearGeometriesEnabledFlag
public method SetNonLinearGeometriesEnabledFlag()
Geo::OSR::SpatialReference::EPSGTreatsAsLatLong
public method EPSGTreatsAsLatLong()
Geo::OGR::Driver::Create
public Geo::GDAL::Dataset Create(scalar name, hashref options=undef)
Geo::GDAL::VSIF::RmDir
public method RmDir(scalar path)
Geo::GDAL::Band::Unit
public method Unit(scalar type)
Geo::GDAL::GetFileSystemsPrefixes
public method GetFileSystemsPrefixes()
Geo::OGR::Layer::StartTransaction
public method StartTransaction()
Geo::GDAL::GetCacheUsed
public scalar GetCacheUsed()
Geo::OGR::Layer::GetStyleTable
public method GetStyleTable()
Geo::GDAL::Driver::LongName
scalar LongName
$driver->{LongName}
Definition: all.pm:5115
Geo::GDAL::Band::Dataset
public Geo::GDAL::Dataset Dataset()
Geo::OGR::Feature::SetField
public method SetField(scalar name, array Value)
Geo::OGR::Feature::DumpReadable
public method DumpReadable()
Geo::OGR::Geometry::ApproximateArcAngles
public Geo::OGR::Geometry ApproximateArcAngles(hash params)
Geo::GDAL::RasterAttributeTable::GetTableType
public method GetTableType()
Geo::GDAL::DecToDMS
public scalar DecToDMS(scalar angle, scalar axis, scalar precision=2)
Geo::OGR::Layer::ForGeometries
public method ForGeometries(scalar code, scalar in_place)
Geo::OSR::Projections
public list Projections()
Geo::OGR::Layer::GeometryType
public scalar GeometryType(scalar field)
Geo::GDAL::Dataset::GetDriver
public method GetDriver()
Geo::GDAL::RasterAttributeTable::SetRowCount
public method SetRowCount(scalar count)
Geo::OGR::FeatureDefn::GetSchema
public hash reference GetSchema()
Get the schema of this feature or layer definition.
Geo::GNM::GenericNetwork::DeleteAllRules
public method DeleteAllRules()
Geo::OSR::SpatialReference::IsLocal
public scalar IsLocal()
Geo::GDAL::MajorObject::Domains
public method Domains()
Geo::OGR::Layer::CreateFeature
public method CreateFeature()
Geo::OSR::SpatialReference::GetName
public method GetName()
Geo::OGR::Feature::Equal
public scalar Equal(scalar feature)
Geo::GDAL::Dataset::RasterYSize
scalar RasterYSize
scalar (access as $dataset->{RasterYSize})
Definition: all.pm:3436
Geo::GDAL::Band::ComputeStatistics
public list ComputeStatistics(scalar approx_ok, scalar progress=undef, scalar progress_data=undef)
Geo::OSR::SpatialReference::Export
public method Export(scalar format)
Geo::OGR::Geometry::Intersects
public scalar Intersects(scalar other)
Geo::GDAL::GCP::Info
scalar Info
informational message (access as $gcp->{Info})
Definition: all.pm:5798
Geo::OGR::FieldDefn::SetSchema
public method SetSchema()
Geo::OSR::CoordinateTransformation::TransformPoints
public method TransformPoints(arrayref points)
Geo::OGR::Geometry::ForceToMultiPoint
public Geo::OGR::Geometry ForceToMultiPoint(array points)
Geo::GDAL::Transformer
Definition: all.pm:6867
Geo::OGR::FeatureDefn::SetStyleIgnored
public method SetStyleIgnored(scalar IgnoreState)
Geo::OGR::Geometry::Is3D
public method Is3D()
Geo::OGR::GeomFieldDefn::GeometryType
public scalar GeometryType(scalar type)
Geo::OGR::Geometry::GetPointCount
public scalar GetPointCount()
Geo::GDAL::Dataset::Open
public Geo::GDAL::Dataset Open()
Geo::GDAL::Dataset::AddBand
public method AddBand(scalar datatype='Byte', hashref options={})
Geo::GNM::Network::StartTransaction
public method StartTransaction()
Geo::GDAL::Dataset::Info
public scalar Info(hashref Options)
Geo::OGR::Geometry::Empty
public method Empty()
Geo::GDAL::GetCacheMax
public scalar GetCacheMax()
Geo::GDAL::GCP::Y
scalar Y
projection coordinate (access as $gcp->{Y})
Definition: all.pm:5825
Geo::GDAL::GeoTransform::new
public method new(array params)
Geo::OGR::FieldDefn::Precision
public scalar Precision(scalar precision)
Geo::OGR::Flatten
public method Flatten()
Geo::OGR::Layer::Capabilities
public list Capabilities()
Geo::GDAL::Dataset::BuildOverviews
public method BuildOverviews(scalar resampling, arrayref overviews, coderef progress, scalar progress_data)
Geo::OSR::SpatialReference::GetTOWGS84
public method GetTOWGS84()
Geo::GDAL::MajorObject::GetMetadata
public hash reference GetMetadata(scalar domain="")
Geo::OSR::SpatialReference::GetLinearUnitsName
public scalar GetLinearUnitsName()
Geo::GDAL::PackedDMSToDec
public scalar PackedDMSToDec(scalar packed)
Geo::OGR::Geometry::Contains
public scalar Contains(scalar other)
Geo::OGR::Geometry::SetPoint
public method SetPoint(scalar index, scalar x, scalar y, scalar z)
Geo::GDAL::Dataset::Nearblack
public Geo::GDAL::Dataset Nearblack(scalar Dest, hashref Options, coderef progress, scalar progress_data)
Geo::OSR::SpatialReference::IsGeographic
public scalar IsGeographic()
Geo::OSR::SpatialReference::GetDataAxisToSRSAxisMapping
public method GetDataAxisToSRSAxisMapping()
Geo::GDAL::BuildVRT
public method BuildVRT()
Geo::GDAL::VSIF::Truncate
public method Truncate(scalar new_size)
Geo::OGR::Geometry::Boundary
public Geo::OGR::Geometry Boundary()
Geo::GDAL::PushFinderLocation
public method PushFinderLocation(scalar path)
Geo::OGR::GetNonLinearGeometriesEnabledFlag
public method GetNonLinearGeometriesEnabledFlag()
Geo::OGR::Layer::Intersection
public method Intersection(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
Geo::OGR::GeometryTypes
public list GeometryTypes()
Geo::OSR::OAO_West
public method OAO_West()
Geo::GNM
Base class for geographical networks in GDAL.
Definition: all.pm:7427
Geo::GDAL::RasterAttributeTable::GetColOfUsage
public scalar GetColOfUsage(scalar usage)
Geo::OGR::Geometry::GetPoint_2D
public scalar GetPoint_2D(scalar index=0)
Geo::GDAL::GetJPEG2000StructureAsString
public method GetJPEG2000StructureAsString()
Geo::OSR::OAO_Up
public method OAO_Up()
Geo::OGR::Layer::CommitTransaction
public method CommitTransaction()
Geo::GDAL::Driver::Capabilities
public list Capabilities()
Geo::GDAL::Dataset::ReleaseResultSet
public method ReleaseResultSet(scalar layer)
Geo::OGR::Layer::Row
public hash reference Row(hash row)
Geo::OGR::Feature::SetFrom
public method SetFrom(scalar other, scalar forgiving=1, hashref map)
Geo::OGR::Geometry::IsSimple
public scalar IsSimple()
Geo::OGR::Geometry::GetDimension
public scalar GetDimension()
Geo::GDAL::Driver::Rename
public method Rename(scalar NewName, scalar OldName)
Geo::GDAL::Extent::Size
public list Size()
Geo::GDAL::VSIF::Write
public method Write(scalar scalar)
Geo::OSR::SRS_WGS84_INVFLATTENING
public method SRS_WGS84_INVFLATTENING()
Geo::GDAL::IdentifyDriverEx
public method IdentifyDriverEx()
Geo::GDAL::Band::GetMaximum
public scalar GetMaximum()
Geo::GDAL::Dataset::GetLayer
public Geo::OGR::Layer GetLayer(scalar name)
Geo::OGR::Layer::SetSpatialFilter
public method SetSpatialFilter(scalar filter)
Geo::OGR::Feature::SetNativeData
public method SetNativeData()
Geo::GDAL::Band::GetOverview
public Geo::GDAL::Band GetOverview(scalar index)
Geo::OGR::Layer::ForFeatures
public method ForFeatures(scalar code, scalar in_place)
Geo::OGR::FieldDefn::Type
public scalar Type(scalar type)
Geo::OGR::Geometry::GetPoint
public list GetPoint(scalar index=0)
Geo::GDAL::Band::CreateMaskBand
public method CreateMaskBand(array flags)
Geo::OGR::FeatureDefn::Feature
public method Feature()
Geo::GDAL::Band::RegenerateOverview
public method RegenerateOverview(Geo::GDAL::Band overview, scalar resampling, coderef progress, scalar progress_data)
Geo::GNM::GATDijkstraShortestPath
public method GATDijkstraShortestPath()
Geo::OGR::Layer::GetDefn
public Geo::OGR::FeatureDefn GetDefn()
Geo::OGR::HasZ
public method HasZ()
Geo::GDAL::Band::NoDataValue
public scalar NoDataValue(scalar NoDataValue)
Geo::OSR::GetUserInputAsWKT
public scalar GetUserInputAsWKT(scalar name)
Geo::OSR::SpatialReference::GetAxisOrientation
public method GetAxisOrientation()
Geo::OGR::Geometry::ByteOrders
public list ByteOrders()
Geo::OGR::Geometry::WkbSize
public scalar WkbSize()
Geo::OGR::FeatureDefn::GetFieldNames
public list GetFieldNames()
Geo::GDAL::Dataset::Driver
public Geo::GDAL::Driver Driver()
Geo::OGR::Layer::Union
public method Union(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
Geo::GDAL::VSIErrorReset
public method VSIErrorReset()
Geo::GDAL::GetDataTypeSize
public scalar GetDataTypeSize(scalar DataType)
Geo::GNM::Network::GetProjectionRef
public method GetProjectionRef()
Geo::OSR::SpatialReference::ImportFromOzi
public method ImportFromOzi()
Geo::OSR::SpatialReference::AddGuessedTOWGS84
public method AddGuessedTOWGS84()
Geo::OGR::FeatureDefn::DeleteField
public method DeleteField(scalar name)
Geo::GDAL::Band::Size
public list Size()
Geo::OSR::SpatialReference::GetAuthorityCode
public scalar GetAuthorityCode(scalar target_key)
Geo::OGR::Geometry::Equals
public scalar Equals(scalar other)
Geo::GDAL::Driver::stdout_redirection_wrapper
public method stdout_redirection_wrapper()
Geo::OGR::Geometry::Point
public list Point(scalar index, scalar x, scalar y, scalar z)
Geo::GDAL::Dataset::GetStyleTable
public method GetStyleTable()
Geo::GNM::CastToGenericNetwork
public method CastToGenericNetwork()
Geo::OSR::GetPROJVersionMajor
public method GetPROJVersionMajor()
Geo::GDAL::FindFile
public scalar FindFile(scalar basename)
Geo::GDAL::MajorObject::Metadata
public hash reference Metadata(hashref metadata=undef, scalar domain='')
Geo::OGR::Feature::GetNativeMediaType
public method GetNativeMediaType()
Geo::OGR::Geometry::Feature
public method Feature()
Geo::OGR::Geometry::Disjoint
public scalar Disjoint(scalar other)
Geo::GDAL::RasterAttributeTable::GetValueAsDouble
public scalar GetValueAsDouble(scalar row, scalar column)
Geo::GDAL::Band::RasterAttributeTable
public method RasterAttributeTable()
Geo::OGR::GeomFieldDefn
A definition of a spatial attribute.
Definition: all.pm:10642
Geo::GDAL::Dataset::Warped
public Geo::GDAL::Dataset Warped(hash params)
Geo::GDAL::Extent::Overlaps
public scalar Overlaps(scalar extent)
Geo::OGR::Layer::SymDifference
public method SymDifference(Geo::OGR::Layer method, Geo::OGR::Layer result, hashref options, coderef callback, scalar callback_data)
Geo::GDAL::Dataset::GetGCPSpatialRef
public method GetGCPSpatialRef()
Geo::GDAL::ColorTable::Color
public list Color(scalar index, array color)
Geo::OSR::SetPROJSearchPath
public method SetPROJSearchPath()
Geo::OSR::CoordinateTransformation
An object for transforming from one projection to another.
Definition: all.pm:16059
Geo::GDAL::VSICurlClearCache
public method VSICurlClearCache()
Geo::OGR::Geometry::GetLinearGeometry
public method GetLinearGeometry()
Geo::GDAL::Band::FillNoData
public method FillNoData(scalar mask, scalar max_search_dist, scalar smoothing_iterations, scalar options, coderef progress, scalar progress_data)
Geo::GDAL::RIOResamplingTypes
public list RIOResamplingTypes()
Geo::OGR::SetGenerate_DB2_V72_BYTE_ORDER
public method SetGenerate_DB2_V72_BYTE_ORDER(scalar Generate_DB2_V72_BYTE_ORDER)
Geo::OSR::OAO_North
public method OAO_North()
Geo::OSR::SpatialReference::CopyGeogCSFrom
public method CopyGeogCSFrom(scalar rhs)
Geo::OGR::Geometry::Difference
public Geo::OGR::Geometry Difference(scalar other)
Geo::OGR::Geometry::Simplify
public Geo::OGR::Geometry Simplify(scalar Tolerance)
Geo::GDAL::RasterAttributeTable::GetValueAsString
public scalar GetValueAsString(scalar row, scalar column)
Geo::OGR::Feature
A collection of non-spatial and spatial attributes.
Definition: all.pm:8684
Geo::GDAL::Dataset::GCPs
public list GCPs(array GCPs, Geo::OSR::SpatialReference sr)
Geo::OGR::Layer::CreateField
public method CreateField(hash params)
Geo::GDAL::Band::DataType
public scalar DataType()
Geo::OGR::Geometry::Transform
public method Transform(scalar trans)
Geo::GNM::GNM_EDGE_DIR_SRCTOTGT
public method GNM_EDGE_DIR_SRCTOTGT()
Geo::OGR::Layer::SetStyleTable
public method SetStyleTable()
Geo::OGR::Geometry::Clone
public Geo::OGR::Geometry Clone()
Geo::GDAL::Extent::Overlap
public scalar Overlap(scalar extent)
Geo::OGR::Layer::GetFeaturesRead
public scalar GetFeaturesRead()
Geo::OGR::Feature::Clone
public Geo::OGR::Feature Clone()
Geo::OGR::Feature::GetFieldNames
public list GetFieldNames()
Geo::GDAL::RasterAttributeTable::SetValueAsDouble
public method SetValueAsDouble(scalar row, scalar column, scalar value)
Geo::GDAL::Dataset
A set of associated raster bands or vector layer source.
Definition: all.pm:3408
Geo::GDAL::Band::GetOverviewCount
public scalar GetOverviewCount()
Geo::GDAL::Drivers
public list Drivers()
Geo::OGR::Feature::GetGeomFieldDefn
public scalar GetGeomFieldDefn(scalar name)
Geo::GDAL::RasterAttributeTable::GetUsageOfCol
public scalar GetUsageOfCol(scalar column)
Geo::GDAL::VSIF::Flush
public method Flush()
Geo::OGR::Geometry::GeometryCount
public scalar GeometryCount()
Geo::OGR::Geometry::GetY
public scalar GetY(scalar index=0)
Geo::OGR::ByteOrders
public list ByteOrders()
Geo::GDAL::Band::AttributeTable
public Geo::GDAL::RasterAttributeTable AttributeTable(scalar AttributeTable)
Geo::GDAL::Band::ReadTile
public array reference ReadTile(scalar xoff=0, scalar yoff=0, scalar xsize=< width >, scalar ysize=< height >)
Geo::GDAL::DataTypes
public list DataTypes()
Geo::OGR::Geometry::Touches
public scalar Touches(scalar other)
Geo::GDAL::Band::DeleteNoDataValue
public scalar DeleteNoDataValue()
Geo::OGR::Feature::GetNativeData
public method GetNativeData()
Geo::OGR::Geometry::As
public scalar As(hash params)
Geo::GDAL::AsyncReader
Enable asynchronous requests.
Definition: all.pm:1386
Geo::GDAL::PopFinderLocation
public method PopFinderLocation()
Geo::OGR::Layer::RollbackTransaction
public method RollbackTransaction()
Geo::OGR::Layer::DeleteField
public method DeleteField(scalar field)
Geo::GDAL::Dataset::CreateMaskBand
public method CreateMaskBand()
Geo::OSR::CoordinateTransformationOptions::SetAreaOfInterest
public method SetAreaOfInterest()
Geo::GDAL::RasterAttributeTable::LinearBinning
public method LinearBinning(scalar Row0MinIn, scalar BinSizeIn)
Geo::OGR::Drivers
public list Drivers()
Geo::OGR::Geometry::GetPointZM
public method GetPointZM()
Geo::GDAL::Band::Fill
public method Fill(scalar real_part, scalar imag_part=0.0)
Geo::OGR::OpenShared
public Geo::GDAL::Dataset OpenShared(scalar name, scalar update=0)
Geo::GDAL::Dataset::DeleteLayer
public method DeleteLayer(scalar name)
Geo::OSR::SpatialReference::ConvertToOtherProjection
public method ConvertToOtherProjection()
Geo::GDAL::VSIFOpenExL
public method VSIFOpenExL()
Geo::GDAL::Dataset::Band
public Geo::GDAL::Band Band(scalar index)
Geo::GNM::Network
Definition: all.pm:7822
Geo::GDAL::ContourGenerateEx
public method ContourGenerateEx()
Geo::GDAL::DecToPackedDMS
public scalar DecToPackedDMS(scalar dec)
Geo::OSR::OAO_South
public method OAO_South()
Geo::GNM::GenericNetwork::ChangeAllBlockState
public method ChangeAllBlockState()
Geo::GNM::Network::GetPath
public method GetPath()
Geo::GDAL::Driver::Create
public Geo::GDAL::Dataset Create(hash params)
Geo::OGR::FeatureDefn::IsSame
public method IsSame(Geo::OGR::FeatureDefn defn)
Geo::GDAL::Band::ComputeRasterMinMax
public method ComputeRasterMinMax(scalar approx_ok=0)
Geo::GDAL::IdentifyDriver
public Geo::GDAL::Driver IdentifyDriver(scalar path, scalar siblings)
Geo::OGR::Geometry::GetZ
public scalar GetZ(scalar index=0)
Geo::OSR::SpatialReference::new
public Geo::OSR::SpatialReference new(hash params)
Geo::OGR::Feature::Field
public method Field(scalar name, scalar value,...)
Get, set, or unset the field value.