Skip to content

Commit

Permalink
Update GDAL API to 3.1. Version 0.08
Browse files Browse the repository at this point in the history
  • Loading branch information
ajolma committed May 15, 2020
1 parent 9b1a6a5 commit be900d3
Show file tree
Hide file tree
Showing 17 changed files with 227 additions and 27 deletions.
8 changes: 8 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Revision history for Perl extension Geo::GDAL::FFI

0.08 May 15, 2020
- Update GDAL API to 3.1.0
- add a Dataset::GetLayerCount method
- Add POD for GetLayerCount
- Add Dataset::GetLayerCount method
- Raise exceptions when invalid layers are accessed via Dataset::GetLayer
- Better handling of GDAL warnings and debug messages.

0.07 Dec 9, 2018
- Layer GetExtent, GetName, GetParentDataset
- Dataset ExecuteSQL
Expand Down
32 changes: 31 additions & 1 deletion build-tools/parse_h.pl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
GDALCreateCopy => 1,
GDALGetMetadataDomainList => 1,
GDALIdentifyDriver => 1,
GDALIdentifyDriverEx => 1,
GDALValidateCreationOptions => 1,
GDALGetMetadata => 1,
GDALSetMetadata => 1,
Expand Down Expand Up @@ -370,12 +371,20 @@ sub parse_type {
$arg = 'int';
} elsif ($arg =~ /^size_t/) {
$arg = 'size_t';
} elsif ($arg =~ /^const size_t/) {
$arg = 'size_t';
} elsif ($arg =~ /GByte\s*\*/) {
$arg = 'pointer';
} elsif ($arg =~ /^GUInt32\s*\*/) {
$arg = 'uint32*';
} elsif ($arg =~ /^GUInt32/) {
$arg = 'uint32';
} elsif ($arg =~ /^const GInt64\s*\*/) {
$arg = 'int64';
} elsif ($arg =~ /^GUInt64/) {
$arg = 'uint64';
} elsif ($arg =~ /^const GUInt64\s*\*/) {
$arg = 'uint64*';
} elsif ($arg =~ /^GUIntBig\s*\*/) {
$arg = 'uint64*';
} elsif ($arg =~ /^GUIntBig/) {
Expand All @@ -394,6 +403,22 @@ sub parse_type {
$arg = 'void';
} elsif ($arg =~ /^CSLConstList/) {
$arg = 'opaque';
} elsif ($arg =~ /^GPtrDiff_t/) {
$arg = 'int';
} elsif ($arg =~ /^const GPtrDiff_t\s*\*/) {
$arg = 'int*';
} elsif ($arg =~ /^GDALExtendedDataTypeClass/) {
$arg = 'int';
} elsif ($arg =~ /^OSRAxisMappingStrategy/) {
$arg = 'int';
} elsif ($arg =~ /^OSRCRSInfo/) {
$arg = 'opaque';
} elsif ($arg =~ /^(const )?OSRCRSListParameters/) {
$arg = 'opaque';
} elsif ($arg =~ /^(const )?GDALMultiDimInfoOptions/) {
$arg = 'opaque';
} elsif ($arg =~ /^(const )?GDALMultiDimTranslateOptions/) {
$arg = 'opaque';
} else {
die "can't parse arg '$arg'";
}
Expand Down Expand Up @@ -421,7 +446,12 @@ sub pre_process {
next;
}
if ($s =~ /^#ifdef (\w+)/ or $s =~ /^#if defined\((\w+)\)/) {
if ($1 eq 'DEBUG' or $1 eq 'undef' or $1 eq 'GDAL_COMPILATION') {
if (
$1 eq 'DEBUG'
or $1 eq 'undef'
or $1 eq 'GDAL_COMPILATION'
or $1 eq 'USE_DEPRECATED_SRS_WKT_WGS84'
) {
$skip = 1;
next;
}
Expand Down
186 changes: 174 additions & 12 deletions lib/Geo/GDAL/FFI.pm

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/Band.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use warnings;
use Carp;
use FFI::Platypus::Buffer;

our $VERSION = 0.0700;
our $VERSION = 0.0800;

sub DESTROY {
my $self = shift;
Expand Down
2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/Dataset.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use Carp;
use base 'Geo::GDAL::FFI::Object';
use Scalar::Util qw /blessed/;

our $VERSION = 0.0700;
our $VERSION = 0.0800;

sub DESTROY {
my $self = shift;
Expand Down
2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/Driver.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use warnings;
use Carp;
use base 'Geo::GDAL::FFI::Object';

our $VERSION = 0.0700;
our $VERSION = 0.0800;

sub GetName {
my $self = shift;
Expand Down
2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/Feature.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use Carp;
use Encode qw(decode encode);
use FFI::Platypus::Buffer;

our $VERSION = 0.0700;
our $VERSION = 0.0800;

sub new {
my ($class, $defn) = @_;
Expand Down
2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/FeatureDefn.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;
use Carp;

our $VERSION = 0.0700;
our $VERSION = 0.0800;

sub new {
my ($class, $args) = @_;
Expand Down
2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/FieldDefn.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;
use Carp;

our $VERSION = 0.0700;
our $VERSION = 0.0800;

sub new {
my ($class, $args) = @_;
Expand Down
2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/GeomFieldDefn.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;
use Carp;

our $VERSION = 0.0700;
our $VERSION = 0.0800;

sub new {
my ($class, $args) = @_;
Expand Down
2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/Geometry.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;
use Carp;

our $VERSION = 0.0700;
our $VERSION = 0.0800;

my %ref;

Expand Down
2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/Layer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use warnings;
use Carp;
use base 'Geo::GDAL::FFI::Object';

our $VERSION = 0.0700;
our $VERSION = 0.0800;

sub DESTROY {
my $self = shift;
Expand Down
2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/Object.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;
use Carp;

our $VERSION = 0.0700;
our $VERSION = 0.0800;

sub GetDescription {
my $self = shift;
Expand Down
2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/SpatialReference.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use warnings;
use Carp;

our $VERSION = 0.0700;
our $VERSION = 0.0800;

sub new {
my ($class, $arg, @arg) = @_;
Expand Down
2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/VSI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use Carp;
use FFI::Platypus::Buffer;
require Exporter;

our $VERSION = 0.0700;
our $VERSION = 0.0800;

our @ISA = qw(Exporter);
our @EXPORT_OK = qw(Mkdir Rmdir ReadDir FOpen Unlink Rename);
Expand Down
2 changes: 1 addition & 1 deletion lib/Geo/GDAL/FFI/VSI/File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use Carp;
use FFI::Platypus::Buffer;
use FFI::Platypus::Declare;

our $VERSION = 0.0700;
our $VERSION = 0.0800;

sub Open {
my ($class, $path, $access) = @_;
Expand Down
2 changes: 1 addition & 1 deletion t/sr.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ my $gdal = Geo::GDAL::FFI->get_instance();
SKIP: {
skip "GDAL support files not found.", 1 if !$gdal->FindFile('gcs.csv');
my $sr = Geo::GDAL::FFI::SpatialReference->new(EPSG => 3067);
ok($sr->Export('Wkt') eq 'PROJCS["ETRS89 / TM35FIN(E,N)",GEOGCS["ETRS89",DATUM["European_Terrestrial_Reference_System_1989",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6258"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4258"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",27],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","3067"]]',
ok($sr->Export('Wkt') eq 'PROJCS["ETRS89 / TM35FIN(E,N)",GEOGCS["ETRS89",DATUM["European_Terrestrial_Reference_System_1989",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6258"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4258"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",27],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","3067"]]',
'Import/export');
}
}
Expand Down

0 comments on commit be900d3

Please sign in to comment.