line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# This file was automatically generated by SWIG (http://www.swig.org). |
2
|
|
|
|
|
|
|
# Version 3.0.5 |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Do not make changes to this file unless you know what you are doing--modify |
5
|
|
|
|
|
|
|
# the SWIG interface file instead. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Geo::GDAL; |
8
|
6
|
|
|
6
|
|
133010
|
use base qw(Exporter); |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
633
|
|
9
|
6
|
|
|
6
|
|
28
|
use base qw(DynaLoader); |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
7623
|
|
10
|
|
|
|
|
|
|
require Geo::OGR; |
11
|
|
|
|
|
|
|
require Geo::OSR; |
12
|
|
|
|
|
|
|
package Geo::GDALc; |
13
|
|
|
|
|
|
|
bootstrap Geo::GDAL; |
14
|
|
|
|
|
|
|
package Geo::GDAL; |
15
|
|
|
|
|
|
|
@EXPORT = qw(); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# ---------- BASE METHODS ------------- |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package Geo::GDAL; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub TIEHASH { |
22
|
0
|
|
|
0
|
|
0
|
my ($classname,$obj) = @_; |
23
|
0
|
|
|
|
|
0
|
return bless $obj, $classname; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
0
|
|
|
sub CLEAR { } |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
0
|
|
|
sub FIRSTKEY { } |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
0
|
|
|
sub NEXTKEY { } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub FETCH { |
33
|
2634
|
|
|
2634
|
|
67289
|
my ($self,$field) = @_; |
34
|
2634
|
|
|
|
|
4295
|
my $member_func = "swig_${field}_get"; |
35
|
2634
|
|
|
|
|
13333
|
$self->$member_func(); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub STORE { |
39
|
0
|
|
|
0
|
|
0
|
my ($self,$field,$newval) = @_; |
40
|
0
|
|
|
|
|
0
|
my $member_func = "swig_${field}_set"; |
41
|
0
|
|
|
|
|
0
|
$self->$member_func($newval); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub this { |
45
|
0
|
|
|
0
|
0
|
0
|
my $ptr = shift; |
46
|
0
|
|
|
|
|
0
|
return tied(%$ptr); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# ------- FUNCTION WRAPPERS -------- |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
package Geo::GDAL; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
*callback_d_cp_vp = *Geo::GDALc::callback_d_cp_vp; |
55
|
|
|
|
|
|
|
*UseExceptions = *Geo::GDALc::UseExceptions; |
56
|
|
|
|
|
|
|
*DontUseExceptions = *Geo::GDALc::DontUseExceptions; |
57
|
|
|
|
|
|
|
*Debug = *Geo::GDALc::Debug; |
58
|
|
|
|
|
|
|
*SetErrorHandler = *Geo::GDALc::SetErrorHandler; |
59
|
|
|
|
|
|
|
*Error = *Geo::GDALc::Error; |
60
|
|
|
|
|
|
|
*GOA2GetAuthorizationURL = *Geo::GDALc::GOA2GetAuthorizationURL; |
61
|
|
|
|
|
|
|
*GOA2GetRefreshToken = *Geo::GDALc::GOA2GetRefreshToken; |
62
|
|
|
|
|
|
|
*GOA2GetAccessToken = *Geo::GDALc::GOA2GetAccessToken; |
63
|
|
|
|
|
|
|
*PushErrorHandler = *Geo::GDALc::PushErrorHandler; |
64
|
|
|
|
|
|
|
*PopErrorHandler = *Geo::GDALc::PopErrorHandler; |
65
|
|
|
|
|
|
|
*ErrorReset = *Geo::GDALc::ErrorReset; |
66
|
|
|
|
|
|
|
*EscapeString = *Geo::GDALc::EscapeString; |
67
|
|
|
|
|
|
|
*GetLastErrorNo = *Geo::GDALc::GetLastErrorNo; |
68
|
|
|
|
|
|
|
*GetLastErrorType = *Geo::GDALc::GetLastErrorType; |
69
|
|
|
|
|
|
|
*GetLastErrorMsg = *Geo::GDALc::GetLastErrorMsg; |
70
|
|
|
|
|
|
|
*PushFinderLocation = *Geo::GDALc::PushFinderLocation; |
71
|
|
|
|
|
|
|
*PopFinderLocation = *Geo::GDALc::PopFinderLocation; |
72
|
|
|
|
|
|
|
*FinderClean = *Geo::GDALc::FinderClean; |
73
|
|
|
|
|
|
|
*FindFile = *Geo::GDALc::FindFile; |
74
|
|
|
|
|
|
|
*ReadDir = *Geo::GDALc::ReadDir; |
75
|
|
|
|
|
|
|
*ReadDirRecursive = *Geo::GDALc::ReadDirRecursive; |
76
|
|
|
|
|
|
|
*SetConfigOption = *Geo::GDALc::SetConfigOption; |
77
|
|
|
|
|
|
|
*GetConfigOption = *Geo::GDALc::GetConfigOption; |
78
|
|
|
|
|
|
|
*CPLBinaryToHex = *Geo::GDALc::CPLBinaryToHex; |
79
|
|
|
|
|
|
|
*CPLHexToBinary = *Geo::GDALc::CPLHexToBinary; |
80
|
|
|
|
|
|
|
*FileFromMemBuffer = *Geo::GDALc::FileFromMemBuffer; |
81
|
|
|
|
|
|
|
*Unlink = *Geo::GDALc::Unlink; |
82
|
|
|
|
|
|
|
*HasThreadSupport = *Geo::GDALc::HasThreadSupport; |
83
|
|
|
|
|
|
|
*Mkdir = *Geo::GDALc::Mkdir; |
84
|
|
|
|
|
|
|
*Rmdir = *Geo::GDALc::Rmdir; |
85
|
|
|
|
|
|
|
*Rename = *Geo::GDALc::Rename; |
86
|
|
|
|
|
|
|
*Stat = *Geo::GDALc::Stat; |
87
|
|
|
|
|
|
|
*VSIFOpenL = *Geo::GDALc::VSIFOpenL; |
88
|
|
|
|
|
|
|
*VSIFCloseL = *Geo::GDALc::VSIFCloseL; |
89
|
|
|
|
|
|
|
*VSIFSeekL = *Geo::GDALc::VSIFSeekL; |
90
|
|
|
|
|
|
|
*VSIFTellL = *Geo::GDALc::VSIFTellL; |
91
|
|
|
|
|
|
|
*VSIFTruncateL = *Geo::GDALc::VSIFTruncateL; |
92
|
|
|
|
|
|
|
*VSIFWriteL = *Geo::GDALc::VSIFWriteL; |
93
|
|
|
|
|
|
|
*VSIFReadL = *Geo::GDALc::VSIFReadL; |
94
|
|
|
|
|
|
|
*GDAL_GCP_GCPX_get = *Geo::GDALc::GDAL_GCP_GCPX_get; |
95
|
|
|
|
|
|
|
*GDAL_GCP_GCPX_set = *Geo::GDALc::GDAL_GCP_GCPX_set; |
96
|
|
|
|
|
|
|
*GDAL_GCP_GCPY_get = *Geo::GDALc::GDAL_GCP_GCPY_get; |
97
|
|
|
|
|
|
|
*GDAL_GCP_GCPY_set = *Geo::GDALc::GDAL_GCP_GCPY_set; |
98
|
|
|
|
|
|
|
*GDAL_GCP_GCPZ_get = *Geo::GDALc::GDAL_GCP_GCPZ_get; |
99
|
|
|
|
|
|
|
*GDAL_GCP_GCPZ_set = *Geo::GDALc::GDAL_GCP_GCPZ_set; |
100
|
|
|
|
|
|
|
*GDAL_GCP_GCPPixel_get = *Geo::GDALc::GDAL_GCP_GCPPixel_get; |
101
|
|
|
|
|
|
|
*GDAL_GCP_GCPPixel_set = *Geo::GDALc::GDAL_GCP_GCPPixel_set; |
102
|
|
|
|
|
|
|
*GDAL_GCP_GCPLine_get = *Geo::GDALc::GDAL_GCP_GCPLine_get; |
103
|
|
|
|
|
|
|
*GDAL_GCP_GCPLine_set = *Geo::GDALc::GDAL_GCP_GCPLine_set; |
104
|
|
|
|
|
|
|
*GDAL_GCP_Info_get = *Geo::GDALc::GDAL_GCP_Info_get; |
105
|
|
|
|
|
|
|
*GDAL_GCP_Info_set = *Geo::GDALc::GDAL_GCP_Info_set; |
106
|
|
|
|
|
|
|
*GDAL_GCP_Id_get = *Geo::GDALc::GDAL_GCP_Id_get; |
107
|
|
|
|
|
|
|
*GDAL_GCP_Id_set = *Geo::GDALc::GDAL_GCP_Id_set; |
108
|
|
|
|
|
|
|
*GCPsToGeoTransform = *Geo::GDALc::GCPsToGeoTransform; |
109
|
|
|
|
|
|
|
*TermProgress_nocb = *Geo::GDALc::TermProgress_nocb; |
110
|
|
|
|
|
|
|
*_ComputeMedianCutPCT = *Geo::GDALc::_ComputeMedianCutPCT; |
111
|
|
|
|
|
|
|
*_DitherRGB2PCT = *Geo::GDALc::_DitherRGB2PCT; |
112
|
|
|
|
|
|
|
*_ReprojectImage = *Geo::GDALc::_ReprojectImage; |
113
|
|
|
|
|
|
|
*_ComputeProximity = *Geo::GDALc::_ComputeProximity; |
114
|
|
|
|
|
|
|
*_RasterizeLayer = *Geo::GDALc::_RasterizeLayer; |
115
|
|
|
|
|
|
|
*_Polygonize = *Geo::GDALc::_Polygonize; |
116
|
|
|
|
|
|
|
*FillNodata = *Geo::GDALc::FillNodata; |
117
|
|
|
|
|
|
|
*_SieveFilter = *Geo::GDALc::_SieveFilter; |
118
|
|
|
|
|
|
|
*_RegenerateOverviews = *Geo::GDALc::_RegenerateOverviews; |
119
|
|
|
|
|
|
|
*_RegenerateOverview = *Geo::GDALc::_RegenerateOverview; |
120
|
|
|
|
|
|
|
*ContourGenerate = *Geo::GDALc::ContourGenerate; |
121
|
|
|
|
|
|
|
*_AutoCreateWarpedVRT = *Geo::GDALc::_AutoCreateWarpedVRT; |
122
|
|
|
|
|
|
|
*ApplyGeoTransform = *Geo::GDALc::ApplyGeoTransform; |
123
|
|
|
|
|
|
|
*InvGeoTransform = *Geo::GDALc::InvGeoTransform; |
124
|
|
|
|
|
|
|
*VersionInfo = *Geo::GDALc::VersionInfo; |
125
|
|
|
|
|
|
|
*AllRegister = *Geo::GDALc::AllRegister; |
126
|
|
|
|
|
|
|
*GDALDestroyDriverManager = *Geo::GDALc::GDALDestroyDriverManager; |
127
|
|
|
|
|
|
|
*GetCacheMax = *Geo::GDALc::GetCacheMax; |
128
|
|
|
|
|
|
|
*GetCacheUsed = *Geo::GDALc::GetCacheUsed; |
129
|
|
|
|
|
|
|
*SetCacheMax = *Geo::GDALc::SetCacheMax; |
130
|
|
|
|
|
|
|
*_GetDataTypeSize = *Geo::GDALc::_GetDataTypeSize; |
131
|
|
|
|
|
|
|
*_DataTypeIsComplex = *Geo::GDALc::_DataTypeIsComplex; |
132
|
|
|
|
|
|
|
*GetDataTypeName = *Geo::GDALc::GetDataTypeName; |
133
|
|
|
|
|
|
|
*GetDataTypeByName = *Geo::GDALc::GetDataTypeByName; |
134
|
|
|
|
|
|
|
*GetColorInterpretationName = *Geo::GDALc::GetColorInterpretationName; |
135
|
|
|
|
|
|
|
*GetPaletteInterpretationName = *Geo::GDALc::GetPaletteInterpretationName; |
136
|
|
|
|
|
|
|
*DecToDMS = *Geo::GDALc::DecToDMS; |
137
|
|
|
|
|
|
|
*PackedDMSToDec = *Geo::GDALc::PackedDMSToDec; |
138
|
|
|
|
|
|
|
*DecToPackedDMS = *Geo::GDALc::DecToPackedDMS; |
139
|
|
|
|
|
|
|
*ParseXMLString = *Geo::GDALc::ParseXMLString; |
140
|
|
|
|
|
|
|
*SerializeXMLTree = *Geo::GDALc::SerializeXMLTree; |
141
|
|
|
|
|
|
|
*GetJPEG2000StructureAsString = *Geo::GDALc::GetJPEG2000StructureAsString; |
142
|
|
|
|
|
|
|
*GetDriverCount = *Geo::GDALc::GetDriverCount; |
143
|
|
|
|
|
|
|
*GetDriverByName = *Geo::GDALc::GetDriverByName; |
144
|
|
|
|
|
|
|
*_GetDriver = *Geo::GDALc::_GetDriver; |
145
|
|
|
|
|
|
|
*_Open = *Geo::GDALc::_Open; |
146
|
|
|
|
|
|
|
*OpenEx = *Geo::GDALc::OpenEx; |
147
|
|
|
|
|
|
|
*_OpenShared = *Geo::GDALc::_OpenShared; |
148
|
|
|
|
|
|
|
*IdentifyDriver = *Geo::GDALc::IdentifyDriver; |
149
|
|
|
|
|
|
|
*GeneralCmdLineProcessor = *Geo::GDALc::GeneralCmdLineProcessor; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
############# Class : Geo::GDAL::MajorObject ############## |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
package Geo::GDAL::MajorObject; |
154
|
6
|
|
|
6
|
|
35
|
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
1477
|
|
155
|
|
|
|
|
|
|
@ISA = qw( Geo::GDAL ); |
156
|
|
|
|
|
|
|
%OWNER = (); |
157
|
|
|
|
|
|
|
*GetDescription = *Geo::GDALc::MajorObject_GetDescription; |
158
|
|
|
|
|
|
|
*SetDescription = *Geo::GDALc::MajorObject_SetDescription; |
159
|
|
|
|
|
|
|
*GetMetadataDomainList = *Geo::GDALc::MajorObject_GetMetadataDomainList; |
160
|
|
|
|
|
|
|
*GetMetadata = *Geo::GDALc::MajorObject_GetMetadata; |
161
|
|
|
|
|
|
|
*SetMetadata = *Geo::GDALc::MajorObject_SetMetadata; |
162
|
|
|
|
|
|
|
*GetMetadataItem = *Geo::GDALc::MajorObject_GetMetadataItem; |
163
|
|
|
|
|
|
|
*SetMetadataItem = *Geo::GDALc::MajorObject_SetMetadataItem; |
164
|
|
|
|
|
|
|
sub DISOWN { |
165
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
166
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
167
|
0
|
|
|
|
|
0
|
delete $OWNER{$ptr}; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub ACQUIRE { |
171
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
172
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
173
|
0
|
|
|
|
|
0
|
$OWNER{$ptr} = 1; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
############# Class : Geo::GDAL::Driver ############## |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
package Geo::GDAL::Driver; |
180
|
6
|
|
|
6
|
|
38
|
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
1799
|
|
181
|
|
|
|
|
|
|
@ISA = qw( Geo::GDAL::MajorObject Geo::GDAL ); |
182
|
|
|
|
|
|
|
%OWNER = (); |
183
|
|
|
|
|
|
|
%ITERATORS = (); |
184
|
|
|
|
|
|
|
*swig_ShortName_get = *Geo::GDALc::Driver_ShortName_get; |
185
|
|
|
|
|
|
|
*swig_ShortName_set = *Geo::GDALc::Driver_ShortName_set; |
186
|
|
|
|
|
|
|
*swig_LongName_get = *Geo::GDALc::Driver_LongName_get; |
187
|
|
|
|
|
|
|
*swig_LongName_set = *Geo::GDALc::Driver_LongName_set; |
188
|
|
|
|
|
|
|
*swig_HelpTopic_get = *Geo::GDALc::Driver_HelpTopic_get; |
189
|
|
|
|
|
|
|
*swig_HelpTopic_set = *Geo::GDALc::Driver_HelpTopic_set; |
190
|
|
|
|
|
|
|
*_Create = *Geo::GDALc::Driver__Create; |
191
|
|
|
|
|
|
|
*CreateCopy = *Geo::GDALc::Driver_CreateCopy; |
192
|
|
|
|
|
|
|
*Delete = *Geo::GDALc::Driver_Delete; |
193
|
|
|
|
|
|
|
*Rename = *Geo::GDALc::Driver_Rename; |
194
|
|
|
|
|
|
|
*CopyFiles = *Geo::GDALc::Driver_CopyFiles; |
195
|
|
|
|
|
|
|
*Register = *Geo::GDALc::Driver_Register; |
196
|
|
|
|
|
|
|
*Deregister = *Geo::GDALc::Driver_Deregister; |
197
|
|
|
|
|
|
|
sub DISOWN { |
198
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
199
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
200
|
0
|
|
|
|
|
0
|
delete $OWNER{$ptr}; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub ACQUIRE { |
204
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
205
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
206
|
0
|
|
|
|
|
0
|
$OWNER{$ptr} = 1; |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
############# Class : Geo::GDAL::GCP ############## |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
package Geo::GDAL::GCP; |
213
|
6
|
|
|
6
|
|
34
|
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
2838
|
|
214
|
|
|
|
|
|
|
@ISA = qw( Geo::GDAL ); |
215
|
|
|
|
|
|
|
%OWNER = (); |
216
|
|
|
|
|
|
|
%ITERATORS = (); |
217
|
|
|
|
|
|
|
*swig_X_get = *Geo::GDALc::GCP_X_get; |
218
|
|
|
|
|
|
|
*swig_X_set = *Geo::GDALc::GCP_X_set; |
219
|
|
|
|
|
|
|
*swig_Y_get = *Geo::GDALc::GCP_Y_get; |
220
|
|
|
|
|
|
|
*swig_Y_set = *Geo::GDALc::GCP_Y_set; |
221
|
|
|
|
|
|
|
*swig_Z_get = *Geo::GDALc::GCP_Z_get; |
222
|
|
|
|
|
|
|
*swig_Z_set = *Geo::GDALc::GCP_Z_set; |
223
|
|
|
|
|
|
|
*swig_Column_get = *Geo::GDALc::GCP_Column_get; |
224
|
|
|
|
|
|
|
*swig_Column_set = *Geo::GDALc::GCP_Column_set; |
225
|
|
|
|
|
|
|
*swig_Row_get = *Geo::GDALc::GCP_Row_get; |
226
|
|
|
|
|
|
|
*swig_Row_set = *Geo::GDALc::GCP_Row_set; |
227
|
|
|
|
|
|
|
*swig_Info_get = *Geo::GDALc::GCP_Info_get; |
228
|
|
|
|
|
|
|
*swig_Info_set = *Geo::GDALc::GCP_Info_set; |
229
|
|
|
|
|
|
|
*swig_Id_get = *Geo::GDALc::GCP_Id_get; |
230
|
|
|
|
|
|
|
*swig_Id_set = *Geo::GDALc::GCP_Id_set; |
231
|
|
|
|
|
|
|
sub new { |
232
|
0
|
|
|
0
|
|
0
|
my $pkg = shift; |
233
|
0
|
|
|
|
|
0
|
my $self = Geo::GDALc::new_GCP(@_); |
234
|
0
|
0
|
|
|
|
0
|
bless $self, $pkg if defined($self); |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
sub DESTROY { |
238
|
0
|
|
|
0
|
|
0
|
my $self; |
239
|
0
|
0
|
|
|
|
0
|
if ($_[0]->isa('SCALAR')) { |
240
|
0
|
|
|
|
|
0
|
$self = $_[0]; |
241
|
|
|
|
|
|
|
} else { |
242
|
0
|
0
|
|
|
|
0
|
return unless $_[0]->isa('HASH'); |
243
|
0
|
|
|
|
|
0
|
$self = tied(%{$_[0]}); |
|
0
|
|
|
|
|
0
|
|
244
|
0
|
0
|
|
|
|
0
|
return unless defined $self; |
245
|
|
|
|
|
|
|
} |
246
|
0
|
|
|
|
|
0
|
delete $ITERATORS{$self}; |
247
|
0
|
0
|
|
|
|
0
|
if (exists $OWNER{$self}) { |
248
|
0
|
|
|
|
|
0
|
Geo::GDALc::delete_GCP($self); |
249
|
0
|
|
|
|
|
0
|
delete $OWNER{$self}; |
250
|
|
|
|
|
|
|
} |
251
|
0
|
|
|
|
|
0
|
$self->RELEASE_PARENTS(); |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
sub DISOWN { |
255
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
256
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
257
|
0
|
|
|
|
|
0
|
delete $OWNER{$ptr}; |
258
|
|
|
|
|
|
|
} |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
sub ACQUIRE { |
261
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
262
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
263
|
0
|
|
|
|
|
0
|
$OWNER{$ptr} = 1; |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
############# Class : Geo::GDAL::AsyncReader ############## |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
package Geo::GDAL::AsyncReader; |
270
|
6
|
|
|
6
|
|
38
|
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
1952
|
|
271
|
|
|
|
|
|
|
@ISA = qw( Geo::GDAL ); |
272
|
|
|
|
|
|
|
%OWNER = (); |
273
|
|
|
|
|
|
|
%ITERATORS = (); |
274
|
|
|
|
|
|
|
sub DESTROY { |
275
|
0
|
0
|
|
0
|
|
0
|
return unless $_[0]->isa('HASH'); |
276
|
0
|
|
|
|
|
0
|
my $self = tied(%{$_[0]}); |
|
0
|
|
|
|
|
0
|
|
277
|
0
|
0
|
|
|
|
0
|
return unless defined $self; |
278
|
0
|
|
|
|
|
0
|
delete $ITERATORS{$self}; |
279
|
0
|
0
|
|
|
|
0
|
if (exists $OWNER{$self}) { |
280
|
0
|
|
|
|
|
0
|
Geo::GDALc::delete_AsyncReader($self); |
281
|
0
|
|
|
|
|
0
|
delete $OWNER{$self}; |
282
|
|
|
|
|
|
|
} |
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
*GetNextUpdatedRegion = *Geo::GDALc::AsyncReader_GetNextUpdatedRegion; |
286
|
|
|
|
|
|
|
*LockBuffer = *Geo::GDALc::AsyncReader_LockBuffer; |
287
|
|
|
|
|
|
|
*UnlockBuffer = *Geo::GDALc::AsyncReader_UnlockBuffer; |
288
|
|
|
|
|
|
|
sub DISOWN { |
289
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
290
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
291
|
0
|
|
|
|
|
0
|
delete $OWNER{$ptr}; |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
sub ACQUIRE { |
295
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
296
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
297
|
0
|
|
|
|
|
0
|
$OWNER{$ptr} = 1; |
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
############# Class : Geo::GDAL::Dataset ############## |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
package Geo::GDAL::Dataset; |
304
|
6
|
|
|
6
|
|
31
|
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
3165
|
|
305
|
|
|
|
|
|
|
@ISA = qw( Geo::GDAL::MajorObject Geo::GDAL ); |
306
|
|
|
|
|
|
|
%OWNER = (); |
307
|
|
|
|
|
|
|
%ITERATORS = (); |
308
|
|
|
|
|
|
|
*swig_RasterXSize_get = *Geo::GDALc::Dataset_RasterXSize_get; |
309
|
|
|
|
|
|
|
*swig_RasterXSize_set = *Geo::GDALc::Dataset_RasterXSize_set; |
310
|
|
|
|
|
|
|
*swig_RasterYSize_get = *Geo::GDALc::Dataset_RasterYSize_get; |
311
|
|
|
|
|
|
|
*swig_RasterYSize_set = *Geo::GDALc::Dataset_RasterYSize_set; |
312
|
|
|
|
|
|
|
*swig_RasterCount_get = *Geo::GDALc::Dataset_RasterCount_get; |
313
|
|
|
|
|
|
|
*swig_RasterCount_set = *Geo::GDALc::Dataset_RasterCount_set; |
314
|
|
|
|
|
|
|
sub DESTROY { |
315
|
58
|
|
|
58
|
|
2443
|
my $self; |
316
|
58
|
100
|
|
|
|
271
|
if ($_[0]->isa('SCALAR')) { |
317
|
29
|
|
|
|
|
43
|
$self = $_[0]; |
318
|
|
|
|
|
|
|
} else { |
319
|
29
|
50
|
|
|
|
113
|
return unless $_[0]->isa('HASH'); |
320
|
29
|
|
|
|
|
43
|
$self = tied(%{$_[0]}); |
|
29
|
|
|
|
|
64
|
|
321
|
29
|
50
|
|
|
|
89
|
return unless defined $self; |
322
|
|
|
|
|
|
|
} |
323
|
58
|
|
|
|
|
108
|
delete $ITERATORS{$self}; |
324
|
58
|
100
|
|
|
|
172
|
if (exists $OWNER{$self}) { |
325
|
28
|
|
|
|
|
2423
|
Geo::GDALc::delete_Dataset($self); |
326
|
28
|
|
|
|
|
76
|
delete $OWNER{$self}; |
327
|
|
|
|
|
|
|
} |
328
|
58
|
|
|
|
|
163
|
$self->RELEASE_PARENTS(); |
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
*_GetDriver = *Geo::GDALc::Dataset__GetDriver; |
332
|
|
|
|
|
|
|
*_GetRasterBand = *Geo::GDALc::Dataset__GetRasterBand; |
333
|
|
|
|
|
|
|
*GetProjection = *Geo::GDALc::Dataset_GetProjection; |
334
|
|
|
|
|
|
|
*GetProjectionRef = *Geo::GDALc::Dataset_GetProjectionRef; |
335
|
|
|
|
|
|
|
*SetProjection = *Geo::GDALc::Dataset_SetProjection; |
336
|
|
|
|
|
|
|
*GetGeoTransform = *Geo::GDALc::Dataset_GetGeoTransform; |
337
|
|
|
|
|
|
|
*SetGeoTransform = *Geo::GDALc::Dataset_SetGeoTransform; |
338
|
|
|
|
|
|
|
*_BuildOverviews = *Geo::GDALc::Dataset__BuildOverviews; |
339
|
|
|
|
|
|
|
*GetGCPCount = *Geo::GDALc::Dataset_GetGCPCount; |
340
|
|
|
|
|
|
|
*GetGCPProjection = *Geo::GDALc::Dataset_GetGCPProjection; |
341
|
|
|
|
|
|
|
*GetGCPs = *Geo::GDALc::Dataset_GetGCPs; |
342
|
|
|
|
|
|
|
*SetGCPs = *Geo::GDALc::Dataset_SetGCPs; |
343
|
|
|
|
|
|
|
*FlushCache = *Geo::GDALc::Dataset_FlushCache; |
344
|
|
|
|
|
|
|
*_AddBand = *Geo::GDALc::Dataset__AddBand; |
345
|
|
|
|
|
|
|
*_CreateMaskBand = *Geo::GDALc::Dataset__CreateMaskBand; |
346
|
|
|
|
|
|
|
*GetFileList = *Geo::GDALc::Dataset_GetFileList; |
347
|
|
|
|
|
|
|
*_WriteRaster = *Geo::GDALc::Dataset__WriteRaster; |
348
|
|
|
|
|
|
|
*_ReadRaster = *Geo::GDALc::Dataset__ReadRaster; |
349
|
|
|
|
|
|
|
*StartTransaction = *Geo::GDALc::Dataset_StartTransaction; |
350
|
|
|
|
|
|
|
*CommitTransaction = *Geo::GDALc::Dataset_CommitTransaction; |
351
|
|
|
|
|
|
|
*RollbackTransaction = *Geo::GDALc::Dataset_RollbackTransaction; |
352
|
|
|
|
|
|
|
sub DISOWN { |
353
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
354
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
355
|
0
|
|
|
|
|
0
|
delete $OWNER{$ptr}; |
356
|
|
|
|
|
|
|
} |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
sub ACQUIRE { |
359
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
360
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
361
|
0
|
|
|
|
|
0
|
$OWNER{$ptr} = 1; |
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
############# Class : Geo::GDAL::Band ############## |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
package Geo::GDAL::Band; |
368
|
6
|
|
|
6
|
|
30
|
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
9573
|
|
369
|
|
|
|
|
|
|
@ISA = qw( Geo::GDAL::MajorObject Geo::GDAL ); |
370
|
|
|
|
|
|
|
%OWNER = (); |
371
|
|
|
|
|
|
|
%ITERATORS = (); |
372
|
|
|
|
|
|
|
*swig_XSize_get = *Geo::GDALc::Band_XSize_get; |
373
|
|
|
|
|
|
|
*swig_XSize_set = *Geo::GDALc::Band_XSize_set; |
374
|
|
|
|
|
|
|
*swig_YSize_get = *Geo::GDALc::Band_YSize_get; |
375
|
|
|
|
|
|
|
*swig_YSize_set = *Geo::GDALc::Band_YSize_set; |
376
|
|
|
|
|
|
|
*swig_DataType_get = *Geo::GDALc::Band_DataType_get; |
377
|
|
|
|
|
|
|
*swig_DataType_set = *Geo::GDALc::Band_DataType_set; |
378
|
|
|
|
|
|
|
*GetDataset = *Geo::GDALc::Band_GetDataset; |
379
|
|
|
|
|
|
|
*GetBand = *Geo::GDALc::Band_GetBand; |
380
|
|
|
|
|
|
|
*GetBlockSize = *Geo::GDALc::Band_GetBlockSize; |
381
|
|
|
|
|
|
|
*GetColorInterpretation = *Geo::GDALc::Band_GetColorInterpretation; |
382
|
|
|
|
|
|
|
*GetRasterColorInterpretation = *Geo::GDALc::Band_GetRasterColorInterpretation; |
383
|
|
|
|
|
|
|
*SetColorInterpretation = *Geo::GDALc::Band_SetColorInterpretation; |
384
|
|
|
|
|
|
|
*SetRasterColorInterpretation = *Geo::GDALc::Band_SetRasterColorInterpretation; |
385
|
|
|
|
|
|
|
*GetNoDataValue = *Geo::GDALc::Band_GetNoDataValue; |
386
|
|
|
|
|
|
|
*SetNoDataValue = *Geo::GDALc::Band_SetNoDataValue; |
387
|
|
|
|
|
|
|
*GetUnitType = *Geo::GDALc::Band_GetUnitType; |
388
|
|
|
|
|
|
|
*SetUnitType = *Geo::GDALc::Band_SetUnitType; |
389
|
|
|
|
|
|
|
*GetRasterCategoryNames = *Geo::GDALc::Band_GetRasterCategoryNames; |
390
|
|
|
|
|
|
|
*SetRasterCategoryNames = *Geo::GDALc::Band_SetRasterCategoryNames; |
391
|
|
|
|
|
|
|
*GetMinimum = *Geo::GDALc::Band_GetMinimum; |
392
|
|
|
|
|
|
|
*GetMaximum = *Geo::GDALc::Band_GetMaximum; |
393
|
|
|
|
|
|
|
*GetOffset = *Geo::GDALc::Band_GetOffset; |
394
|
|
|
|
|
|
|
*GetScale = *Geo::GDALc::Band_GetScale; |
395
|
|
|
|
|
|
|
*SetOffset = *Geo::GDALc::Band_SetOffset; |
396
|
|
|
|
|
|
|
*SetScale = *Geo::GDALc::Band_SetScale; |
397
|
|
|
|
|
|
|
*GetStatistics = *Geo::GDALc::Band_GetStatistics; |
398
|
|
|
|
|
|
|
*ComputeStatistics = *Geo::GDALc::Band_ComputeStatistics; |
399
|
|
|
|
|
|
|
*SetStatistics = *Geo::GDALc::Band_SetStatistics; |
400
|
|
|
|
|
|
|
*GetOverviewCount = *Geo::GDALc::Band_GetOverviewCount; |
401
|
|
|
|
|
|
|
*GetOverview = *Geo::GDALc::Band_GetOverview; |
402
|
|
|
|
|
|
|
*Checksum = *Geo::GDALc::Band_Checksum; |
403
|
|
|
|
|
|
|
*ComputeRasterMinMax = *Geo::GDALc::Band_ComputeRasterMinMax; |
404
|
|
|
|
|
|
|
*ComputeBandStats = *Geo::GDALc::Band_ComputeBandStats; |
405
|
|
|
|
|
|
|
*Fill = *Geo::GDALc::Band_Fill; |
406
|
|
|
|
|
|
|
*_ReadRaster = *Geo::GDALc::Band__ReadRaster; |
407
|
|
|
|
|
|
|
*_WriteRaster = *Geo::GDALc::Band__WriteRaster; |
408
|
|
|
|
|
|
|
*FlushCache = *Geo::GDALc::Band_FlushCache; |
409
|
|
|
|
|
|
|
*GetRasterColorTable = *Geo::GDALc::Band_GetRasterColorTable; |
410
|
|
|
|
|
|
|
*GetColorTable = *Geo::GDALc::Band_GetColorTable; |
411
|
|
|
|
|
|
|
*SetRasterColorTable = *Geo::GDALc::Band_SetRasterColorTable; |
412
|
|
|
|
|
|
|
*SetColorTable = *Geo::GDALc::Band_SetColorTable; |
413
|
|
|
|
|
|
|
*GetDefaultRAT = *Geo::GDALc::Band_GetDefaultRAT; |
414
|
|
|
|
|
|
|
*SetDefaultRAT = *Geo::GDALc::Band_SetDefaultRAT; |
415
|
|
|
|
|
|
|
*GetMaskBand = *Geo::GDALc::Band_GetMaskBand; |
416
|
|
|
|
|
|
|
*_GetMaskFlags = *Geo::GDALc::Band__GetMaskFlags; |
417
|
|
|
|
|
|
|
*_CreateMaskBand = *Geo::GDALc::Band__CreateMaskBand; |
418
|
|
|
|
|
|
|
*_GetHistogram = *Geo::GDALc::Band__GetHistogram; |
419
|
|
|
|
|
|
|
*GetDefaultHistogram = *Geo::GDALc::Band_GetDefaultHistogram; |
420
|
|
|
|
|
|
|
*SetDefaultHistogram = *Geo::GDALc::Band_SetDefaultHistogram; |
421
|
|
|
|
|
|
|
*HasArbitraryOverviews = *Geo::GDALc::Band_HasArbitraryOverviews; |
422
|
|
|
|
|
|
|
*GetCategoryNames = *Geo::GDALc::Band_GetCategoryNames; |
423
|
|
|
|
|
|
|
*SetCategoryNames = *Geo::GDALc::Band_SetCategoryNames; |
424
|
|
|
|
|
|
|
*ContourGenerate = *Geo::GDALc::Band_ContourGenerate; |
425
|
|
|
|
|
|
|
sub DISOWN { |
426
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
427
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
428
|
0
|
|
|
|
|
0
|
delete $OWNER{$ptr}; |
429
|
|
|
|
|
|
|
} |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
sub ACQUIRE { |
432
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
433
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
434
|
0
|
|
|
|
|
0
|
$OWNER{$ptr} = 1; |
435
|
|
|
|
|
|
|
} |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
############# Class : Geo::GDAL::ColorTable ############## |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
package Geo::GDAL::ColorTable; |
441
|
6
|
|
|
6
|
|
34
|
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
457
|
|
442
|
|
|
|
|
|
|
@ISA = qw( Geo::GDAL ); |
443
|
|
|
|
|
|
|
%OWNER = (); |
444
|
6
|
|
|
6
|
|
78
|
use Carp; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
2700
|
|
445
|
|
|
|
|
|
|
sub new { |
446
|
16
|
|
|
16
|
|
2439
|
my($pkg, $pi) = @_; |
447
|
16
|
50
|
66
|
|
|
75
|
$pi = $PALETTE_INTERPRETATION_STRING2INT{$pi} if defined $pi and exists $PALETTE_INTERPRETATION_STRING2INT{$pi}; |
448
|
16
|
|
|
|
|
150
|
my $self = Geo::GDALc::new_ColorTable($pi); |
449
|
16
|
50
|
|
|
|
119
|
bless $self, $pkg if defined($self); |
450
|
|
|
|
|
|
|
} |
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
sub DESTROY { |
453
|
56
|
|
|
56
|
|
3888
|
my $self; |
454
|
56
|
100
|
|
|
|
322
|
if ($_[0]->isa('SCALAR')) { |
455
|
28
|
|
|
|
|
41
|
$self = $_[0]; |
456
|
|
|
|
|
|
|
} else { |
457
|
28
|
50
|
|
|
|
92
|
return unless $_[0]->isa('HASH'); |
458
|
28
|
|
|
|
|
37
|
$self = tied(%{$_[0]}); |
|
28
|
|
|
|
|
425
|
|
459
|
28
|
50
|
|
|
|
72
|
return unless defined $self; |
460
|
|
|
|
|
|
|
} |
461
|
56
|
|
|
|
|
96
|
delete $ITERATORS{$self}; |
462
|
56
|
100
|
|
|
|
154
|
if (exists $OWNER{$self}) { |
463
|
16
|
|
|
|
|
83
|
Geo::GDALc::delete_ColorTable($self); |
464
|
16
|
|
|
|
|
38
|
delete $OWNER{$self}; |
465
|
|
|
|
|
|
|
} |
466
|
56
|
|
|
|
|
127
|
$self->RELEASE_PARENTS(); |
467
|
|
|
|
|
|
|
} |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
*Clone = *Geo::GDALc::ColorTable_Clone; |
470
|
|
|
|
|
|
|
*_GetPaletteInterpretation = *Geo::GDALc::ColorTable__GetPaletteInterpretation; |
471
|
|
|
|
|
|
|
*GetCount = *Geo::GDALc::ColorTable_GetCount; |
472
|
|
|
|
|
|
|
*GetColorEntry = *Geo::GDALc::ColorTable_GetColorEntry; |
473
|
|
|
|
|
|
|
*GetColorEntryAsRGB = *Geo::GDALc::ColorTable_GetColorEntryAsRGB; |
474
|
|
|
|
|
|
|
*_SetColorEntry = *Geo::GDALc::ColorTable__SetColorEntry; |
475
|
|
|
|
|
|
|
*CreateColorRamp = *Geo::GDALc::ColorTable_CreateColorRamp; |
476
|
|
|
|
|
|
|
sub DISOWN { |
477
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
478
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
479
|
0
|
|
|
|
|
0
|
delete $OWNER{$ptr}; |
480
|
|
|
|
|
|
|
} |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
sub ACQUIRE { |
483
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
484
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
485
|
0
|
|
|
|
|
0
|
$OWNER{$ptr} = 1; |
486
|
|
|
|
|
|
|
} |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
############# Class : Geo::GDAL::RasterAttributeTable ############## |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
package Geo::GDAL::RasterAttributeTable; |
492
|
6
|
|
|
6
|
|
31
|
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
4277
|
|
493
|
|
|
|
|
|
|
@ISA = qw( Geo::GDAL ); |
494
|
|
|
|
|
|
|
%OWNER = (); |
495
|
|
|
|
|
|
|
sub new { |
496
|
2
|
|
|
2
|
|
551
|
my $pkg = shift; |
497
|
2
|
|
|
|
|
40
|
my $self = Geo::GDALc::new_RasterAttributeTable(@_); |
498
|
2
|
50
|
|
|
|
28
|
bless $self, $pkg if defined($self); |
499
|
|
|
|
|
|
|
} |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
sub DESTROY { |
502
|
6
|
|
|
6
|
|
348
|
my $self; |
503
|
6
|
100
|
|
|
|
48
|
if ($_[0]->isa('SCALAR')) { |
504
|
3
|
|
|
|
|
6
|
$self = $_[0]; |
505
|
|
|
|
|
|
|
} else { |
506
|
3
|
50
|
|
|
|
17
|
return unless $_[0]->isa('HASH'); |
507
|
3
|
|
|
|
|
7
|
$self = tied(%{$_[0]}); |
|
3
|
|
|
|
|
10
|
|
508
|
3
|
50
|
|
|
|
11
|
return unless defined $self; |
509
|
|
|
|
|
|
|
} |
510
|
6
|
|
|
|
|
14
|
delete $ITERATORS{$self}; |
511
|
6
|
100
|
|
|
|
22
|
if (exists $OWNER{$self}) { |
512
|
2
|
|
|
|
|
30
|
Geo::GDALc::delete_RasterAttributeTable($self); |
513
|
2
|
|
|
|
|
6
|
delete $OWNER{$self}; |
514
|
|
|
|
|
|
|
} |
515
|
6
|
|
|
|
|
20
|
$self->RELEASE_PARENTS(); |
516
|
|
|
|
|
|
|
} |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
*Clone = *Geo::GDALc::RasterAttributeTable_Clone; |
519
|
|
|
|
|
|
|
*GetColumnCount = *Geo::GDALc::RasterAttributeTable_GetColumnCount; |
520
|
|
|
|
|
|
|
*GetNameOfCol = *Geo::GDALc::RasterAttributeTable_GetNameOfCol; |
521
|
|
|
|
|
|
|
*_GetUsageOfCol = *Geo::GDALc::RasterAttributeTable__GetUsageOfCol; |
522
|
|
|
|
|
|
|
*_GetTypeOfCol = *Geo::GDALc::RasterAttributeTable__GetTypeOfCol; |
523
|
|
|
|
|
|
|
*_GetColOfUsage = *Geo::GDALc::RasterAttributeTable__GetColOfUsage; |
524
|
|
|
|
|
|
|
*GetRowCount = *Geo::GDALc::RasterAttributeTable_GetRowCount; |
525
|
|
|
|
|
|
|
*GetValueAsString = *Geo::GDALc::RasterAttributeTable_GetValueAsString; |
526
|
|
|
|
|
|
|
*GetValueAsInt = *Geo::GDALc::RasterAttributeTable_GetValueAsInt; |
527
|
|
|
|
|
|
|
*GetValueAsDouble = *Geo::GDALc::RasterAttributeTable_GetValueAsDouble; |
528
|
|
|
|
|
|
|
*SetValueAsString = *Geo::GDALc::RasterAttributeTable_SetValueAsString; |
529
|
|
|
|
|
|
|
*SetValueAsInt = *Geo::GDALc::RasterAttributeTable_SetValueAsInt; |
530
|
|
|
|
|
|
|
*SetValueAsDouble = *Geo::GDALc::RasterAttributeTable_SetValueAsDouble; |
531
|
|
|
|
|
|
|
*SetRowCount = *Geo::GDALc::RasterAttributeTable_SetRowCount; |
532
|
|
|
|
|
|
|
*_CreateColumn = *Geo::GDALc::RasterAttributeTable__CreateColumn; |
533
|
|
|
|
|
|
|
*GetLinearBinning = *Geo::GDALc::RasterAttributeTable_GetLinearBinning; |
534
|
|
|
|
|
|
|
*SetLinearBinning = *Geo::GDALc::RasterAttributeTable_SetLinearBinning; |
535
|
|
|
|
|
|
|
*GetRowOfValue = *Geo::GDALc::RasterAttributeTable_GetRowOfValue; |
536
|
|
|
|
|
|
|
*ChangesAreWrittenToFile = *Geo::GDALc::RasterAttributeTable_ChangesAreWrittenToFile; |
537
|
|
|
|
|
|
|
*DumpReadable = *Geo::GDALc::RasterAttributeTable_DumpReadable; |
538
|
|
|
|
|
|
|
sub DISOWN { |
539
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
540
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
541
|
0
|
|
|
|
|
0
|
delete $OWNER{$ptr}; |
542
|
|
|
|
|
|
|
} |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
sub ACQUIRE { |
545
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
546
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
547
|
0
|
|
|
|
|
0
|
$OWNER{$ptr} = 1; |
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
############# Class : Geo::GDAL::Transformer ############## |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
package Geo::GDAL::Transformer; |
554
|
6
|
|
|
6
|
|
30
|
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
2143
|
|
555
|
|
|
|
|
|
|
@ISA = qw( Geo::GDAL ); |
556
|
|
|
|
|
|
|
%OWNER = (); |
557
|
|
|
|
|
|
|
%ITERATORS = (); |
558
|
|
|
|
|
|
|
sub new { |
559
|
0
|
|
|
0
|
|
0
|
my $pkg = shift; |
560
|
0
|
|
|
|
|
0
|
my $self = Geo::GDALc::new_Transformer(@_); |
561
|
0
|
0
|
|
|
|
0
|
bless $self, $pkg if defined($self); |
562
|
|
|
|
|
|
|
} |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
sub DESTROY { |
565
|
0
|
0
|
|
0
|
|
0
|
return unless $_[0]->isa('HASH'); |
566
|
0
|
|
|
|
|
0
|
my $self = tied(%{$_[0]}); |
|
0
|
|
|
|
|
0
|
|
567
|
0
|
0
|
|
|
|
0
|
return unless defined $self; |
568
|
0
|
|
|
|
|
0
|
delete $ITERATORS{$self}; |
569
|
0
|
0
|
|
|
|
0
|
if (exists $OWNER{$self}) { |
570
|
0
|
|
|
|
|
0
|
Geo::GDALc::delete_Transformer($self); |
571
|
0
|
|
|
|
|
0
|
delete $OWNER{$self}; |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
} |
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
*TransformPoint = *Geo::GDALc::Transformer_TransformPoint; |
576
|
|
|
|
|
|
|
*_TransformPoints = *Geo::GDALc::Transformer__TransformPoints; |
577
|
|
|
|
|
|
|
*TransformGeolocations = *Geo::GDALc::Transformer_TransformGeolocations; |
578
|
|
|
|
|
|
|
sub DISOWN { |
579
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
580
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
581
|
0
|
|
|
|
|
0
|
delete $OWNER{$ptr}; |
582
|
|
|
|
|
|
|
} |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
sub ACQUIRE { |
585
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
586
|
0
|
|
|
|
|
0
|
my $ptr = tied(%$self); |
587
|
0
|
|
|
|
|
0
|
$OWNER{$ptr} = 1; |
588
|
|
|
|
|
|
|
} |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
# ------- VARIABLE STUBS -------- |
592
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
package Geo::GDAL; |
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
*TermProgress = *Geo::GDALc::TermProgress; |
596
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
package Geo::GDAL; |
599
|
6
|
|
|
6
|
|
31
|
use strict; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
153
|
|
600
|
6
|
|
|
6
|
|
40
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
204
|
|
601
|
6
|
|
|
6
|
|
27
|
use Carp; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
346
|
|
602
|
6
|
|
|
6
|
|
5828
|
use Encode; |
|
6
|
|
|
|
|
69561
|
|
|
6
|
|
|
|
|
561
|
|
603
|
6
|
|
|
6
|
|
3297
|
use Geo::GDAL::Const; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
281
|
|
604
|
6
|
|
|
6
|
|
5555
|
use Geo::OGR; |
|
6
|
|
|
|
|
21
|
|
|
6
|
|
|
|
|
459
|
|
605
|
6
|
|
|
6
|
|
46
|
use Geo::OSR; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
620
|
|
606
|
|
|
|
|
|
|
# $VERSION is the Perl module (CPAN) version number, which must be |
607
|
|
|
|
|
|
|
# an increasing floating point number. $GDAL_VERSION is the |
608
|
|
|
|
|
|
|
# version number of the GDAL that this module is a part of. It is |
609
|
|
|
|
|
|
|
# used in build time to check the version of GDAL against which we |
610
|
|
|
|
|
|
|
# build. |
611
|
|
|
|
|
|
|
# For GDAL 2.0 or above, GDAL X.Y.Z should then |
612
|
|
|
|
|
|
|
# VERSION = X + Y / 100.0 + Z / 10000.0 |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
our $VERSION = '2.00012'; |
615
|
|
|
|
|
|
|
our $GDAL_VERSION = '2.0.1'; |
616
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
=pod |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
=head1 NAME |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
Geo::GDAL - Perl extension for the GDAL library for geospatial data |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
=head1 SYNOPSIS |
624
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
use Geo::GDAL; |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
my $raster_file = shift @ARGV; |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
my $raster_dataset = Geo::GDAL::Open($file); |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
my $raster_data = $dataset->GetRasterBand(1)->ReadTile; |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
my $vector_datasource = Geo::OGR::Open('./'); |
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
my $vector_layer = $datasource->Layer('borders'); # e.g. a shapefile borders.shp in current directory |
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
$vector_layer->ResetReading(); |
638
|
|
|
|
|
|
|
while (my $feature = $vector_layer->GetNextFeature()) { |
639
|
|
|
|
|
|
|
my $geometry = $feature->GetGeometry(); |
640
|
|
|
|
|
|
|
my $value = $feature->GetField($field); |
641
|
|
|
|
|
|
|
} |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
=head1 DESCRIPTION |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
This Perl module lets you to manage (read, analyse, write) geospatial |
646
|
|
|
|
|
|
|
data stored in several formats. |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
=head2 EXPORT |
649
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
None by default. |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
=head1 SEE ALSO |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
The GDAL home page is L |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
The documentation of this module is written in Doxygen format. See |
657
|
|
|
|
|
|
|
L |
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
=head1 AUTHOR |
660
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
Ari Jolma |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
Copyright (C) 2005- by Ari Jolma and GDAL bindings developers. |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
668
|
|
|
|
|
|
|
it under the terms of MIT License |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
L |
671
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
=head1 REPOSITORY |
673
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
L |
675
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
=cut |
677
|
|
|
|
|
|
|
|
678
|
6
|
|
|
|
|
15958
|
use vars qw/ |
679
|
|
|
|
|
|
|
@DATA_TYPES @ACCESS_TYPES @RESAMPLING_TYPES @RIO_RESAMPLING_TYPES @NODE_TYPES |
680
|
|
|
|
|
|
|
%TYPE_STRING2INT %TYPE_INT2STRING |
681
|
|
|
|
|
|
|
%ACCESS_STRING2INT %ACCESS_INT2STRING |
682
|
|
|
|
|
|
|
%RESAMPLING_STRING2INT %RESAMPLING_INT2STRING |
683
|
|
|
|
|
|
|
%RIO_RESAMPLING_STRING2INT %RIO_RESAMPLING_INT2STRING |
684
|
|
|
|
|
|
|
%NODE_TYPE_STRING2INT %NODE_TYPE_INT2STRING |
685
|
6
|
|
|
6
|
|
33
|
/; |
|
6
|
|
|
|
|
12
|
|
686
|
|
|
|
|
|
|
for (keys %Geo::GDAL::Const::) { |
687
|
|
|
|
|
|
|
next if /TypeCount/; |
688
|
|
|
|
|
|
|
push(@DATA_TYPES, $1), next if /^GDT_(\w+)/; |
689
|
|
|
|
|
|
|
push(@ACCESS_TYPES, $1), next if /^GA_(\w+)/; |
690
|
|
|
|
|
|
|
push(@RESAMPLING_TYPES, $1), next if /^GRA_(\w+)/; |
691
|
|
|
|
|
|
|
push(@RIO_RESAMPLING_TYPES, $1), next if /^GRIORA_(\w+)/; |
692
|
|
|
|
|
|
|
push(@NODE_TYPES, $1), next if /^CXT_(\w+)/; |
693
|
|
|
|
|
|
|
} |
694
|
|
|
|
|
|
|
for my $string (@DATA_TYPES) { |
695
|
|
|
|
|
|
|
my $int = eval "\$Geo::GDAL::Const::GDT_$string"; |
696
|
|
|
|
|
|
|
$TYPE_STRING2INT{$string} = $int; |
697
|
|
|
|
|
|
|
$TYPE_INT2STRING{$int} = $string; |
698
|
|
|
|
|
|
|
} |
699
|
|
|
|
|
|
|
for my $string (@ACCESS_TYPES) { |
700
|
|
|
|
|
|
|
my $int = eval "\$Geo::GDAL::Const::GA_$string"; |
701
|
|
|
|
|
|
|
$ACCESS_STRING2INT{$string} = $int; |
702
|
|
|
|
|
|
|
$ACCESS_INT2STRING{$int} = $string; |
703
|
|
|
|
|
|
|
} |
704
|
|
|
|
|
|
|
for my $string (@RESAMPLING_TYPES) { |
705
|
|
|
|
|
|
|
my $int = eval "\$Geo::GDAL::Const::GRA_$string"; |
706
|
|
|
|
|
|
|
$RESAMPLING_STRING2INT{$string} = $int; |
707
|
|
|
|
|
|
|
$RESAMPLING_INT2STRING{$int} = $string; |
708
|
|
|
|
|
|
|
} |
709
|
|
|
|
|
|
|
for my $string (@RIO_RESAMPLING_TYPES) { |
710
|
|
|
|
|
|
|
my $int = eval "\$Geo::GDAL::Const::GRIORA_$string"; |
711
|
|
|
|
|
|
|
$RIO_RESAMPLING_STRING2INT{$string} = $int; |
712
|
|
|
|
|
|
|
$RIO_RESAMPLING_INT2STRING{$int} = $string; |
713
|
|
|
|
|
|
|
} |
714
|
|
|
|
|
|
|
for my $string (@NODE_TYPES) { |
715
|
|
|
|
|
|
|
my $int = eval "\$Geo::GDAL::Const::CXT_$string"; |
716
|
|
|
|
|
|
|
$NODE_TYPE_STRING2INT{$string} = $int; |
717
|
|
|
|
|
|
|
$NODE_TYPE_INT2STRING{$int} = $string; |
718
|
|
|
|
|
|
|
} |
719
|
|
|
|
|
|
|
|
720
|
|
|
|
116
|
0
|
|
sub RELEASE_PARENTS { |
721
|
|
|
|
|
|
|
} |
722
|
|
|
|
|
|
|
|
723
|
|
|
|
|
|
|
sub DataTypes { |
724
|
4
|
|
|
4
|
0
|
1181
|
return @DATA_TYPES; |
725
|
|
|
|
|
|
|
} |
726
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
sub AccessTypes { |
728
|
1
|
|
|
1
|
0
|
4120
|
return @ACCESS_TYPES; |
729
|
|
|
|
|
|
|
} |
730
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
sub ResamplingTypes { |
732
|
1
|
|
|
1
|
0
|
279
|
return @RESAMPLING_TYPES; |
733
|
|
|
|
|
|
|
} |
734
|
|
|
|
|
|
|
|
735
|
|
|
|
|
|
|
sub RIOResamplingTypes { |
736
|
2
|
|
|
2
|
0
|
267
|
return @RIO_RESAMPLING_TYPES; |
737
|
|
|
|
|
|
|
} |
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
sub NodeTypes { |
740
|
1
|
|
|
1
|
0
|
323
|
return @NODE_TYPES; |
741
|
|
|
|
|
|
|
} |
742
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
sub NodeType { |
744
|
287
|
|
|
287
|
0
|
767
|
my $type = shift; |
745
|
287
|
50
|
|
|
|
1297
|
return $NODE_TYPE_INT2STRING{$type} if $type =~ /^\d/; |
746
|
0
|
|
|
|
|
0
|
return $NODE_TYPE_STRING2INT{$type}; |
747
|
|
|
|
|
|
|
} |
748
|
|
|
|
|
|
|
|
749
|
|
|
|
|
|
|
sub NodeData { |
750
|
281
|
|
|
281
|
0
|
359
|
my $node = shift; |
751
|
281
|
|
|
|
|
489
|
return (Geo::GDAL::NodeType($node->[0]), $node->[1]); |
752
|
|
|
|
|
|
|
} |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
sub Children { |
755
|
34
|
|
|
34
|
0
|
41
|
my $node = shift; |
756
|
34
|
|
|
|
|
100
|
return @$node[2..$#$node]; |
757
|
|
|
|
|
|
|
} |
758
|
|
|
|
|
|
|
|
759
|
|
|
|
|
|
|
sub Child { |
760
|
140
|
|
|
140
|
0
|
180
|
my($node, $child) = @_; |
761
|
140
|
|
|
|
|
283
|
return $node->[2+$child]; |
762
|
|
|
|
|
|
|
} |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
sub GetDataTypeSize { |
765
|
22
|
|
|
22
|
0
|
534
|
my $t = shift; |
766
|
22
|
|
|
|
|
34
|
my $t2 = $t; |
767
|
22
|
100
|
|
|
|
65
|
$t2 = $TYPE_STRING2INT{$t} if exists $TYPE_STRING2INT{$t}; |
768
|
22
|
50
|
|
|
|
58
|
confess "Unknown data type: '$t'." unless exists $TYPE_INT2STRING{$t2}; |
769
|
22
|
|
|
|
|
87
|
return _GetDataTypeSize($t2); |
770
|
|
|
|
|
|
|
} |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
sub DataTypeValueRange { |
773
|
12
|
|
|
12
|
0
|
42
|
my $t = shift; |
774
|
12
|
50
|
|
|
|
28
|
confess "Unknown data type: '$t'." unless exists $TYPE_STRING2INT{$t}; |
775
|
|
|
|
|
|
|
# these values are from gdalrasterband.cpp |
776
|
12
|
100
|
|
|
|
33
|
return (0,255) if $t =~ /Byte/; |
777
|
11
|
100
|
|
|
|
28
|
return (0,65535) if $t =~/UInt16/; |
778
|
10
|
100
|
|
|
|
28
|
return (-32768,32767) if $t =~/Int16/; |
779
|
8
|
100
|
|
|
|
24
|
return (0,4294967295) if $t =~/UInt32/; |
780
|
7
|
100
|
|
|
|
22
|
return (-2147483648,2147483647) if $t =~/Int32/; |
781
|
5
|
100
|
|
|
|
18
|
return (-4294967295.0,4294967295.0) if $t =~/Float32/; |
782
|
3
|
100
|
|
|
|
16
|
return (-4294967295.0,4294967295.0) if $t =~/Float64/; |
783
|
|
|
|
|
|
|
} |
784
|
|
|
|
|
|
|
|
785
|
|
|
|
|
|
|
sub DataTypeIsComplex { |
786
|
12
|
|
|
12
|
0
|
6289
|
my $t = shift; |
787
|
12
|
|
|
|
|
22
|
my $t2 = $t; |
788
|
12
|
50
|
|
|
|
38
|
$t2 = $TYPE_STRING2INT{$t} if exists $TYPE_STRING2INT{$t}; |
789
|
12
|
50
|
|
|
|
28
|
confess "Unknown data type: '$t'." unless exists $TYPE_INT2STRING{$t2}; |
790
|
12
|
|
|
|
|
40
|
return _DataTypeIsComplex($t2); |
791
|
|
|
|
|
|
|
} |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
sub PackCharacter { |
794
|
44
|
|
|
44
|
0
|
218
|
my $t = shift; |
795
|
44
|
100
|
|
|
|
164
|
$t = $TYPE_INT2STRING{$t} if exists $TYPE_INT2STRING{$t}; |
796
|
44
|
50
|
|
|
|
118
|
confess "Unknown data type: '$t'." unless exists $TYPE_STRING2INT{$t}; |
797
|
44
|
|
|
|
|
181
|
my $is_big_endian = unpack("h*", pack("s", 1)) =~ /01/; # from Programming Perl |
798
|
44
|
100
|
|
|
|
164
|
return 'C' if $t =~ /^Byte$/; |
799
|
35
|
50
|
|
|
|
90
|
return ($is_big_endian ? 'n': 'v') if $t =~ /^UInt16$/; |
|
|
100
|
|
|
|
|
|
800
|
33
|
100
|
|
|
|
145
|
return 's' if $t =~ /^Int16$/; |
801
|
31
|
50
|
|
|
|
84
|
return ($is_big_endian ? 'N' : 'V') if $t =~ /^UInt32$/; |
|
|
100
|
|
|
|
|
|
802
|
29
|
100
|
|
|
|
102
|
return 'l' if $t =~ /^Int32$/; |
803
|
18
|
100
|
|
|
|
77
|
return 'f' if $t =~ /^Float32$/; |
804
|
16
|
100
|
|
|
|
91
|
return 'd' if $t =~ /^Float64$/; |
805
|
|
|
|
|
|
|
} |
806
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
sub GetDriverNames { |
808
|
2
|
|
|
2
|
0
|
523
|
my @names; |
809
|
2
|
|
|
|
|
14
|
for my $i (0..GetDriverCount()-1) { |
810
|
294
|
|
|
|
|
1122
|
my $driver = _GetDriver($i); |
811
|
294
|
|
|
|
|
2649
|
my $md = $driver->GetMetadata; |
812
|
294
|
100
|
66
|
|
|
1417
|
next unless $md->{DCAP_RASTER} and $md->{DCAP_RASTER} eq 'YES'; |
813
|
210
|
|
|
|
|
965
|
push @names, _GetDriver($i)->Name; |
814
|
|
|
|
|
|
|
} |
815
|
2
|
|
|
|
|
98
|
return @names; |
816
|
|
|
|
|
|
|
} |
817
|
|
|
|
|
|
|
|
818
|
|
|
|
|
|
|
sub Drivers { |
819
|
1
|
|
|
1
|
0
|
12
|
my @drivers; |
820
|
1
|
|
|
|
|
11
|
for my $i (0..GetDriverCount()-1) { |
821
|
147
|
|
|
|
|
515
|
my $driver = _GetDriver($i); |
822
|
147
|
|
|
|
|
1453
|
my $md = $driver->GetMetadata; |
823
|
147
|
100
|
66
|
|
|
759
|
next unless $md->{DCAP_RASTER} and $md->{DCAP_RASTER} eq 'YES'; |
824
|
105
|
|
|
|
|
652
|
push @drivers, _GetDriver($i); |
825
|
|
|
|
|
|
|
} |
826
|
1
|
|
|
|
|
17
|
return @drivers; |
827
|
|
|
|
|
|
|
} |
828
|
|
|
|
|
|
|
|
829
|
|
|
|
|
|
|
sub GetDriver { |
830
|
129
|
|
|
129
|
0
|
44677
|
my($name) = @_; |
831
|
129
|
50
|
|
|
|
301
|
$name = 0 unless defined $name; |
832
|
129
|
|
|
|
|
148
|
my $driver; |
833
|
129
|
50
|
|
|
|
473
|
$driver = _GetDriver($name) if $name =~ /^\d+$/; # is the name an index to driver list? |
834
|
129
|
50
|
|
|
|
1200
|
$driver = GetDriverByName("$name") unless $driver; |
835
|
129
|
50
|
|
|
|
395
|
if ($driver) { |
836
|
129
|
|
|
|
|
1650
|
my $md = $driver->GetMetadata; |
837
|
|
|
|
|
|
|
confess "Driver exists but does not have raster capabilities." |
838
|
129
|
50
|
33
|
|
|
704
|
unless $md->{DCAP_RASTER} and $md->{DCAP_RASTER} eq 'YES'; |
839
|
129
|
|
|
|
|
1034
|
return $driver; |
840
|
|
|
|
|
|
|
} |
841
|
0
|
|
|
|
|
0
|
confess "Driver not found: '$name'. Maybe support for it was not built in?"; |
842
|
|
|
|
|
|
|
} |
843
|
|
|
|
|
|
|
*Driver = *GetDriver; |
844
|
|
|
|
|
|
|
|
845
|
|
|
|
|
|
|
sub Open { |
846
|
2
|
|
|
2
|
0
|
13
|
my @p = @_; |
847
|
2
|
50
|
|
|
|
10
|
if (defined $p[1]) { |
848
|
2
|
50
|
|
|
|
11
|
confess "Unknown access type: '$p[1]'." unless exists $Geo::GDAL::ACCESS_STRING2INT{$p[1]}; |
849
|
2
|
|
|
|
|
6
|
$p[1] = $Geo::GDAL::ACCESS_STRING2INT{$p[1]}; |
850
|
|
|
|
|
|
|
} |
851
|
2
|
|
|
|
|
1021
|
return _Open(@p); |
852
|
|
|
|
|
|
|
} |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
sub OpenShared { |
855
|
2
|
|
|
2
|
0
|
298
|
my @p = @_; |
856
|
2
|
50
|
|
|
|
8
|
if (defined $p[1]) { |
857
|
2
|
50
|
|
|
|
10
|
confess "Unknown access type: '$p[1]'." unless exists $Geo::GDAL::ACCESS_STRING2INT{$p[1]}; |
858
|
2
|
|
|
|
|
5
|
$p[1] = $Geo::GDAL::ACCESS_STRING2INT{$p[1]}; |
859
|
|
|
|
|
|
|
} |
860
|
2
|
|
|
|
|
654
|
return _OpenShared(@p); |
861
|
|
|
|
|
|
|
} |
862
|
|
|
|
|
|
|
|
863
|
|
|
|
|
|
|
sub ComputeMedianCutPCT { |
864
|
3
|
|
|
3
|
0
|
10
|
my @p = @_; |
865
|
3
|
100
|
100
|
|
|
17
|
$p[6] = 1 if $p[5] and not defined $p[6]; |
866
|
3
|
|
|
|
|
115
|
_ComputeMedianCutPCT(@p); |
867
|
|
|
|
|
|
|
} |
868
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
sub DitherRGB2PCT { |
870
|
0
|
|
|
0
|
0
|
0
|
my @p = @_; |
871
|
0
|
0
|
0
|
|
|
0
|
$p[6] = 1 if $p[5] and not defined $p[6]; |
872
|
0
|
|
|
|
|
0
|
_DitherRGB2PCT(@p); |
873
|
|
|
|
|
|
|
} |
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
sub ComputeProximity { |
876
|
0
|
|
|
0
|
0
|
0
|
my @p = @_; |
877
|
0
|
0
|
0
|
|
|
0
|
$p[4] = 1 if $p[3] and not defined $p[4]; |
878
|
0
|
|
|
|
|
0
|
_ComputeProximity(@p); |
879
|
|
|
|
|
|
|
} |
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
sub RasterizeLayer { |
882
|
0
|
|
|
0
|
0
|
0
|
my @p = @_; |
883
|
0
|
0
|
0
|
|
|
0
|
$p[8] = 1 if $p[7] and not defined $p[8]; |
884
|
0
|
|
|
|
|
0
|
_RasterizeLayer(@p); |
885
|
|
|
|
|
|
|
} |
886
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
sub Polygonize { |
888
|
0
|
|
|
0
|
0
|
0
|
my @params = @_; |
889
|
0
|
0
|
0
|
|
|
0
|
$params[6] = 1 if $params[5] and not defined $params[6]; |
890
|
0
|
0
|
|
|
|
0
|
$params[3] = $params[2]->GetLayerDefn->GetFieldIndex($params[3]) unless $params[3] =~ /^\d/; |
891
|
0
|
|
|
|
|
0
|
_Polygonize(@params); |
892
|
|
|
|
|
|
|
} |
893
|
|
|
|
|
|
|
|
894
|
|
|
|
|
|
|
sub SieveFilter { |
895
|
0
|
|
|
0
|
0
|
0
|
my @p = @_; |
896
|
0
|
0
|
0
|
|
|
0
|
$p[7] = 1 if $p[6] and not defined $p[7]; |
897
|
0
|
|
|
|
|
0
|
_SieveFilter(@p); |
898
|
|
|
|
|
|
|
} |
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
sub RegenerateOverviews { |
901
|
1
|
|
|
1
|
0
|
3
|
my @p = @_; |
902
|
1
|
50
|
|
|
|
4
|
$p[2] = uc($p[2]) if $p[2]; # see overview.cpp:2030 |
903
|
1
|
50
|
33
|
|
|
7
|
$p[4] = 1 if $p[3] and not defined $p[4]; |
904
|
1
|
|
|
|
|
1776
|
_RegenerateOverviews(@p); |
905
|
|
|
|
|
|
|
} |
906
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
sub RegenerateOverview { |
908
|
2
|
|
|
2
|
0
|
7
|
my @p = @_; |
909
|
2
|
100
|
|
|
|
11
|
$p[2] = uc($p[2]) if $p[2]; # see overview.cpp:2030 |
910
|
2
|
50
|
33
|
|
|
12
|
$p[4] = 1 if $p[3] and not defined $p[4]; |
911
|
2
|
|
|
|
|
1915
|
_RegenerateOverview(@p); |
912
|
|
|
|
|
|
|
} |
913
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
sub ReprojectImage { |
915
|
0
|
|
|
0
|
0
|
0
|
my @p = @_; |
916
|
0
|
0
|
0
|
|
|
0
|
$p[8] = 1 if $p[7] and not defined $p[8]; |
917
|
0
|
0
|
|
|
|
0
|
if (defined $p[4]) { |
918
|
0
|
0
|
|
|
|
0
|
confess "Unknown data type: '$p[4]'." unless exists $Geo::GDAL::RESAMPLING_STRING2INT{$p[4]}; |
919
|
0
|
|
|
|
|
0
|
$p[4] = $Geo::GDAL::RESAMPLING_STRING2INT{$p[4]}; |
920
|
|
|
|
|
|
|
} |
921
|
0
|
|
|
|
|
0
|
return _ReprojectImage(@p); |
922
|
|
|
|
|
|
|
} |
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
sub AutoCreateWarpedVRT { |
925
|
0
|
|
|
0
|
0
|
0
|
my @p = @_; |
926
|
0
|
|
|
|
|
0
|
for my $i (1..2) { |
927
|
0
|
0
|
0
|
|
|
0
|
if (defined $p[$i] and ref($p[$i])) { |
928
|
0
|
|
|
|
|
0
|
$p[$i] = $p[$i]->ExportToWkt; |
929
|
|
|
|
|
|
|
} |
930
|
|
|
|
|
|
|
} |
931
|
0
|
0
|
|
|
|
0
|
if (defined $p[3]) { |
932
|
0
|
0
|
|
|
|
0
|
confess "Unknown data type: '$p[3]'." unless exists $Geo::GDAL::RESAMPLING_STRING2INT{$p[3]}; |
933
|
0
|
|
|
|
|
0
|
$p[3] = $Geo::GDAL::RESAMPLING_STRING2INT{$p[3]}; |
934
|
|
|
|
|
|
|
} |
935
|
0
|
|
|
|
|
0
|
return _AutoCreateWarpedVRT(@p); |
936
|
|
|
|
|
|
|
} |
937
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
|
939
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
package Geo::GDAL::MajorObject; |
942
|
6
|
|
|
6
|
|
51
|
use strict; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
171
|
|
943
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
264
|
|
944
|
6
|
|
|
6
|
|
29
|
use vars qw/@DOMAINS/; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
1244
|
|
945
|
|
|
|
|
|
|
|
946
|
|
|
|
|
|
|
sub Domains { |
947
|
0
|
|
|
0
|
|
0
|
return @DOMAINS; |
948
|
|
|
|
|
|
|
} |
949
|
|
|
|
|
|
|
|
950
|
|
|
|
|
|
|
sub Description { |
951
|
0
|
|
|
0
|
|
0
|
my($self, $desc) = @_; |
952
|
0
|
0
|
|
|
|
0
|
SetDescription($self, $desc) if defined $desc; |
953
|
0
|
0
|
|
|
|
0
|
GetDescription($self) if defined wantarray; |
954
|
|
|
|
|
|
|
} |
955
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
sub Metadata { |
957
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
958
|
0
|
|
|
|
|
0
|
my $metadata; |
959
|
0
|
0
|
|
|
|
0
|
$metadata = shift if ref $_[0]; |
960
|
0
|
|
|
|
|
0
|
my $domain = shift; |
961
|
0
|
0
|
|
|
|
0
|
$domain = '' unless defined $domain; |
962
|
0
|
0
|
|
|
|
0
|
SetMetadata($self, $metadata, $domain) if defined $metadata; |
963
|
0
|
0
|
|
|
|
0
|
GetMetadata($self, $domain) if defined wantarray; |
964
|
|
|
|
|
|
|
} |
965
|
|
|
|
|
|
|
|
966
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
package Geo::GDAL::Driver; |
968
|
6
|
|
|
6
|
|
30
|
use strict; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
128
|
|
969
|
6
|
|
|
6
|
|
28
|
use warnings; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
153
|
|
970
|
6
|
|
|
6
|
|
31
|
use Carp; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
464
|
|
971
|
6
|
|
|
6
|
|
33
|
use vars qw/@CAPABILITIES @DOMAINS/; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
5899
|
|
972
|
|
|
|
|
|
|
for (keys %Geo::GDAL::Const::) { |
973
|
|
|
|
|
|
|
next if /TypeCount/; |
974
|
|
|
|
|
|
|
push(@CAPABILITIES, $1), next if /^DCAP_(\w+)/; |
975
|
|
|
|
|
|
|
} |
976
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
sub Domains { |
978
|
2
|
|
|
2
|
|
291
|
return @DOMAINS; |
979
|
|
|
|
|
|
|
} |
980
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
sub Name { |
982
|
213
|
|
|
213
|
|
645
|
my $self = shift; |
983
|
213
|
|
|
|
|
605
|
return $self->{ShortName}; |
984
|
|
|
|
|
|
|
} |
985
|
|
|
|
|
|
|
|
986
|
|
|
|
|
|
|
sub Capabilities { |
987
|
2
|
|
|
2
|
|
3
|
my $self = shift; |
988
|
2
|
100
|
|
|
|
10
|
return @CAPABILITIES unless $self; |
989
|
1
|
|
|
|
|
17
|
my $h = $self->GetMetadata; |
990
|
1
|
|
|
|
|
3
|
my @cap; |
991
|
1
|
|
|
|
|
3
|
for my $cap (@CAPABILITIES) { |
992
|
9
|
|
|
|
|
19
|
my $test = $h->{'DCAP_'.uc($cap)}; |
993
|
9
|
100
|
66
|
|
|
35
|
push @cap, $cap if defined($test) and $test eq 'YES'; |
994
|
|
|
|
|
|
|
} |
995
|
1
|
|
|
|
|
8
|
return @cap; |
996
|
|
|
|
|
|
|
} |
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
sub TestCapability { |
999
|
5
|
|
|
5
|
|
11
|
my($self, $cap) = @_; |
1000
|
5
|
|
|
|
|
80
|
my $h = $self->GetMetadata->{'DCAP_'.uc($cap)}; |
1001
|
5
|
50
|
33
|
|
|
39
|
return (defined($h) and $h eq 'YES') ? 1 : undef; |
1002
|
|
|
|
|
|
|
} |
1003
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
sub Extension { |
1005
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
1006
|
1
|
|
|
|
|
17
|
my $h = $self->GetMetadata; |
1007
|
1
|
|
|
|
|
5
|
return $h->{DMD_EXTENSION}; |
1008
|
|
|
|
|
|
|
} |
1009
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
sub MIMEType { |
1011
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
1012
|
1
|
|
|
|
|
16
|
my $h = $self->GetMetadata; |
1013
|
1
|
|
|
|
|
6
|
return $h->{DMD_MIMETYPE}; |
1014
|
|
|
|
|
|
|
} |
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
sub CreationOptionList { |
1017
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
1018
|
1
|
|
|
|
|
2
|
my @options; |
1019
|
1
|
|
|
|
|
17
|
my $h = $self->GetMetadata->{DMD_CREATIONOPTIONLIST}; |
1020
|
1
|
50
|
|
|
|
7
|
if ($h) { |
1021
|
1
|
|
|
|
|
253
|
$h = Geo::GDAL::ParseXMLString($h); |
1022
|
1
|
|
|
|
|
7
|
my($type, $value) = Geo::GDAL::NodeData($h); |
1023
|
1
|
50
|
|
|
|
5
|
if ($value eq 'CreationOptionList') { |
1024
|
1
|
|
|
|
|
4
|
for my $o (Geo::GDAL::Children($h)) { |
1025
|
33
|
|
|
|
|
35
|
my %option; |
1026
|
33
|
|
|
|
|
65
|
for my $a (Geo::GDAL::Children($o)) { |
1027
|
140
|
|
|
|
|
223
|
my(undef, $key) = Geo::GDAL::NodeData($a); |
1028
|
140
|
|
|
|
|
312
|
my(undef, $value) = Geo::GDAL::NodeData(Geo::GDAL::Child($a, 0)); |
1029
|
140
|
100
|
|
|
|
312
|
if ($key eq 'Value') { |
1030
|
37
|
|
|
|
|
38
|
push @{$option{$key}}, $value; |
|
37
|
|
|
|
|
104
|
|
1031
|
|
|
|
|
|
|
} else { |
1032
|
103
|
|
|
|
|
264
|
$option{$key} = $value; |
1033
|
|
|
|
|
|
|
} |
1034
|
|
|
|
|
|
|
} |
1035
|
33
|
|
|
|
|
80
|
push @options, \%option; |
1036
|
|
|
|
|
|
|
} |
1037
|
|
|
|
|
|
|
} |
1038
|
|
|
|
|
|
|
} |
1039
|
1
|
|
|
|
|
56
|
return @options; |
1040
|
|
|
|
|
|
|
} |
1041
|
|
|
|
|
|
|
|
1042
|
|
|
|
|
|
|
sub CreationDataTypes { |
1043
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
1044
|
1
|
|
|
|
|
16
|
my $h = $self->GetMetadata; |
1045
|
1
|
50
|
|
|
|
18
|
return split /\s+/, $h->{DMD_CREATIONDATATYPES} if $h->{DMD_CREATIONDATATYPES}; |
1046
|
|
|
|
|
|
|
} |
1047
|
|
|
|
|
|
|
|
1048
|
|
|
|
|
|
|
sub Create { |
1049
|
22
|
|
|
22
|
|
141
|
my $self = shift; |
1050
|
22
|
|
|
|
|
164
|
my %defaults = ( Name => 'unnamed', |
1051
|
|
|
|
|
|
|
Width => 256, |
1052
|
|
|
|
|
|
|
Height => 256, |
1053
|
|
|
|
|
|
|
Bands => 1, |
1054
|
|
|
|
|
|
|
Type => 'Byte', |
1055
|
|
|
|
|
|
|
Options => {} ); |
1056
|
22
|
|
|
|
|
39
|
my %params; |
1057
|
22
|
100
|
66
|
|
|
195
|
if (@_ == 0) { |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1058
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
1059
|
0
|
|
|
|
|
0
|
%params = %{$_[0]}; |
|
0
|
|
|
|
|
0
|
|
1060
|
|
|
|
|
|
|
} elsif (exists $defaults{$_[0]} and @_ % 2 == 0) { |
1061
|
8
|
|
|
|
|
30
|
%params = @_; |
1062
|
|
|
|
|
|
|
} else { |
1063
|
12
|
|
|
|
|
68
|
($params{Name}, $params{Width}, $params{Height}, $params{Bands}, $params{Type}, $params{Options}) = @_; |
1064
|
|
|
|
|
|
|
} |
1065
|
22
|
|
|
|
|
86
|
for my $k (keys %params) { |
1066
|
90
|
50
|
|
|
|
223
|
carp "Create: unrecognized named parameter '$k'." unless exists $defaults{$k}; |
1067
|
|
|
|
|
|
|
} |
1068
|
22
|
|
|
|
|
68
|
for my $k (keys %defaults) { |
1069
|
132
|
100
|
|
|
|
325
|
$params{$k} = $defaults{$k} unless defined $params{$k}; |
1070
|
|
|
|
|
|
|
} |
1071
|
22
|
|
|
|
|
43
|
my $type; |
1072
|
22
|
50
|
|
|
|
81
|
confess "Unknown data type: '$params{Type}'." unless exists $Geo::GDAL::TYPE_STRING2INT{$params{Type}}; |
1073
|
22
|
|
|
|
|
52
|
$type = $Geo::GDAL::TYPE_STRING2INT{$params{Type}}; |
1074
|
22
|
|
|
|
|
8423
|
return $self->_Create($params{Name}, $params{Width}, $params{Height}, $params{Bands}, $type, $params{Options}); |
1075
|
|
|
|
|
|
|
} |
1076
|
|
|
|
|
|
|
*CreateDataset = *Create; |
1077
|
|
|
|
|
|
|
*Copy = *CreateCopy; |
1078
|
|
|
|
|
|
|
|
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
|
1081
|
|
|
|
|
|
|
|
1082
|
|
|
|
|
|
|
package Geo::GDAL::Dataset; |
1083
|
6
|
|
|
6
|
|
36
|
use strict; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
136
|
|
1084
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
172
|
|
1085
|
6
|
|
|
6
|
|
32
|
use Carp; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
334
|
|
1086
|
6
|
|
|
6
|
|
30
|
use vars qw/%BANDS @DOMAINS/; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
11423
|
|
1087
|
|
|
|
|
|
|
@DOMAINS = qw/IMAGE_STRUCTURE SUBDATASETS GEOLOCATION/; |
1088
|
|
|
|
|
|
|
|
1089
|
|
|
|
|
|
|
sub Domains { |
1090
|
2
|
|
|
2
|
|
14
|
return @DOMAINS; |
1091
|
|
|
|
|
|
|
} |
1092
|
|
|
|
|
|
|
*GetDriver = *_GetDriver; |
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
sub Open { |
1095
|
0
|
|
|
0
|
|
0
|
return Geo::GDAL::Open(@_); |
1096
|
|
|
|
|
|
|
} |
1097
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
sub OpenShared { |
1099
|
0
|
|
|
0
|
|
0
|
return Geo::GDAL::OpenShared(@_); |
1100
|
|
|
|
|
|
|
} |
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
sub Size { |
1103
|
5
|
|
|
5
|
|
23
|
my $self = shift; |
1104
|
5
|
|
|
|
|
26
|
return ($self->{RasterXSize}, $self->{RasterYSize}); |
1105
|
|
|
|
|
|
|
} |
1106
|
|
|
|
|
|
|
|
1107
|
|
|
|
|
|
|
sub Bands { |
1108
|
2
|
|
|
2
|
|
12
|
my $self = shift; |
1109
|
2
|
|
|
|
|
3
|
my @bands; |
1110
|
2
|
|
|
|
|
15
|
for my $i (1..$self->{RasterCount}) { |
1111
|
3
|
|
|
|
|
5
|
push @bands, GetRasterBand($self, $i); |
1112
|
|
|
|
|
|
|
} |
1113
|
2
|
|
|
|
|
13
|
return @bands; |
1114
|
|
|
|
|
|
|
} |
1115
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
sub GetRasterBand { |
1117
|
33
|
|
|
33
|
|
1831
|
my($self, $index) = @_; |
1118
|
33
|
100
|
|
|
|
94
|
$index = 1 unless defined $index; |
1119
|
33
|
|
|
|
|
199
|
my $band = _GetRasterBand($self, $index); |
1120
|
33
|
|
|
|
|
57
|
$BANDS{tied(%{$band})} = $self; |
|
33
|
|
|
|
|
145
|
|
1121
|
33
|
|
|
|
|
93
|
return $band; |
1122
|
|
|
|
|
|
|
} |
1123
|
|
|
|
|
|
|
*Band = *GetRasterBand; |
1124
|
|
|
|
|
|
|
|
1125
|
|
|
|
|
|
|
sub AddBand { |
1126
|
3
|
|
|
3
|
|
315
|
my @p = @_; |
1127
|
3
|
50
|
|
|
|
12
|
if (defined $p[1]) { |
1128
|
3
|
50
|
|
|
|
12
|
confess "Unknown data type: '$p[1]'." unless exists $Geo::GDAL::TYPE_STRING2INT{$p[1]}; |
1129
|
3
|
|
|
|
|
9
|
$p[1] = $Geo::GDAL::TYPE_STRING2INT{$p[1]}; |
1130
|
|
|
|
|
|
|
} |
1131
|
3
|
|
|
|
|
42
|
return _AddBand(@p); |
1132
|
|
|
|
|
|
|
} |
1133
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
sub Projection { |
1135
|
0
|
|
|
0
|
|
0
|
my($self, $proj) = @_; |
1136
|
0
|
0
|
|
|
|
0
|
SetProjection($self, $proj) if defined $proj; |
1137
|
0
|
0
|
|
|
|
0
|
GetProjection($self) if defined wantarray; |
1138
|
|
|
|
|
|
|
} |
1139
|
|
|
|
|
|
|
|
1140
|
|
|
|
|
|
|
sub SpatialReference { |
1141
|
0
|
|
|
0
|
|
0
|
my($self, $sr) = @_; |
1142
|
0
|
0
|
|
|
|
0
|
SetProjection($self, $sr->As('WKT')) if defined $sr; |
1143
|
0
|
0
|
|
|
|
0
|
return Geo::OSR::SpatialReference->new(GetProjection($self)) if defined wantarray; |
1144
|
|
|
|
|
|
|
} |
1145
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
sub GeoTransform { |
1147
|
5
|
|
|
5
|
|
24
|
my $self = shift; |
1148
|
5
|
|
|
|
|
8
|
eval { |
1149
|
5
|
100
|
|
|
|
20
|
if (@_ == 1) { |
|
|
50
|
|
|
|
|
|
1150
|
3
|
|
|
|
|
26
|
SetGeoTransform($self, $_[0]); |
1151
|
|
|
|
|
|
|
} elsif (@_ > 1) { |
1152
|
0
|
|
|
|
|
0
|
SetGeoTransform($self, \@_); |
1153
|
|
|
|
|
|
|
} |
1154
|
|
|
|
|
|
|
}; |
1155
|
5
|
50
|
|
|
|
22
|
confess $@ if $@; |
1156
|
5
|
100
|
|
|
|
17
|
return unless defined wantarray; |
1157
|
2
|
|
|
|
|
12
|
my $t = GetGeoTransform($self); |
1158
|
2
|
50
|
|
|
|
7
|
if (wantarray) { |
1159
|
0
|
|
|
|
|
0
|
return @$t; |
1160
|
|
|
|
|
|
|
} else { |
1161
|
2
|
|
|
|
|
9
|
return Geo::GDAL::GeoTransform->new($t); |
1162
|
|
|
|
|
|
|
} |
1163
|
|
|
|
|
|
|
} |
1164
|
|
|
|
|
|
|
|
1165
|
|
|
|
|
|
|
sub GCPs { |
1166
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
1167
|
0
|
0
|
|
|
|
0
|
if (@_ > 0) { |
1168
|
0
|
|
|
|
|
0
|
my $proj = pop @_; |
1169
|
0
|
0
|
0
|
|
|
0
|
$proj = $proj->Export('WKT') if $proj and ref($proj); |
1170
|
0
|
|
|
|
|
0
|
SetGCPs($self, \@_, $proj); |
1171
|
|
|
|
|
|
|
} |
1172
|
0
|
0
|
|
|
|
0
|
return unless defined wantarray; |
1173
|
0
|
|
|
|
|
0
|
my $proj = Geo::OSR::SpatialReference->new(GetGCPProjection($self)); |
1174
|
0
|
|
|
|
|
0
|
my $GCPs = GetGCPs($self); |
1175
|
0
|
|
|
|
|
0
|
return (@$GCPs, $proj); |
1176
|
|
|
|
|
|
|
} |
1177
|
|
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
sub ReadRaster { |
1179
|
1
|
|
|
1
|
|
9
|
my $self = shift; |
1180
|
1
|
|
|
|
|
5
|
my ($width, $height) = $self->Size; |
1181
|
1
|
|
|
|
|
5
|
my ($type) = $self->Band->DataType; |
1182
|
1
|
|
|
|
|
4
|
my %d = ( |
1183
|
|
|
|
|
|
|
XOFF => 0, |
1184
|
|
|
|
|
|
|
YOFF => 0, |
1185
|
|
|
|
|
|
|
XSIZE => $width, |
1186
|
|
|
|
|
|
|
YSIZE => $height, |
1187
|
|
|
|
|
|
|
BUFXSIZE => undef, |
1188
|
|
|
|
|
|
|
BUFYSIZE => undef, |
1189
|
|
|
|
|
|
|
BUFTYPE => $type, |
1190
|
|
|
|
|
|
|
BANDLIST => [1], |
1191
|
|
|
|
|
|
|
BUFPIXELSPACE => 0, |
1192
|
|
|
|
|
|
|
BUFLINESPACE => 0, |
1193
|
|
|
|
|
|
|
BUFBANDSPACE => 0, |
1194
|
|
|
|
|
|
|
RESAMPLEALG => 'NearestNeighbour', |
1195
|
|
|
|
|
|
|
PROGRESS => undef, |
1196
|
|
|
|
|
|
|
PROGRESSDATA => undef |
1197
|
|
|
|
|
|
|
); |
1198
|
1
|
|
|
|
|
3
|
my %p; |
1199
|
|
|
|
|
|
|
my $t; |
1200
|
1
|
50
|
|
|
|
5
|
if (defined $_[0]) { |
1201
|
1
|
|
|
|
|
3
|
$t = uc($_[0]); |
1202
|
1
|
|
|
|
|
3
|
$t =~ s/_//g; |
1203
|
|
|
|
|
|
|
} |
1204
|
1
|
50
|
33
|
|
|
17
|
if (@_ == 0) { |
|
|
50
|
33
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1205
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
1206
|
0
|
|
|
|
|
0
|
%p = %{$_[0]}; |
|
0
|
|
|
|
|
0
|
|
1207
|
|
|
|
|
|
|
} elsif (@_ % 2 == 0 and (defined $t and exists $d{$t})) { |
1208
|
0
|
|
|
|
|
0
|
%p = @_; |
1209
|
|
|
|
|
|
|
} else { |
1210
|
1
|
|
|
|
|
11
|
($p{xoff},$p{yoff},$p{xsize},$p{ysize},$p{buf_xsize},$p{buf_ysize},$p{buf_type},$p{band_list},$p{buf_pixel_space},$p{buf_line_space},$p{buf_band_space},$p{resample_alg},$p{progress},$p{progress_data}) = @_; |
1211
|
|
|
|
|
|
|
} |
1212
|
1
|
|
|
|
|
6
|
for (keys %p) { |
1213
|
14
|
|
|
|
|
26
|
my $u = uc($_); |
1214
|
14
|
|
|
|
|
26
|
$u =~ s/_//g; |
1215
|
14
|
50
|
|
|
|
34
|
carp "Unknown named parameter '$_'." unless exists $d{$u}; |
1216
|
14
|
|
|
|
|
32
|
$p{$u} = $p{$_}; |
1217
|
|
|
|
|
|
|
} |
1218
|
1
|
|
|
|
|
6
|
for (keys %d) { |
1219
|
14
|
100
|
|
|
|
34
|
$p{$_} = $d{$_} unless defined $p{$_}; |
1220
|
|
|
|
|
|
|
} |
1221
|
|
|
|
|
|
|
confess "Unknown resampling algorithm: '$p{RESAMPLEALG}'." |
1222
|
1
|
50
|
|
|
|
11
|
unless exists $Geo::GDAL::RIO_RESAMPLING_STRING2INT{$p{RESAMPLEALG}}; |
1223
|
1
|
|
|
|
|
3
|
$p{RESAMPLEALG} = $Geo::GDAL::RIO_RESAMPLING_STRING2INT{$p{RESAMPLEALG}}; |
1224
|
1
|
50
|
|
|
|
5
|
unless ($Geo::GDAL::TYPE_INT2STRING{$p{BUFTYPE}}) { |
1225
|
|
|
|
|
|
|
confess "Unknown data type: '$p{BUFTYPE}'." |
1226
|
1
|
50
|
|
|
|
5
|
unless exists $Geo::GDAL::TYPE_STRING2INT{$p{BUFTYPE}}; |
1227
|
1
|
|
|
|
|
3
|
$p{BUFTYPE} = $Geo::GDAL::TYPE_STRING2INT{$p{BUFTYPE}}; |
1228
|
|
|
|
|
|
|
} |
1229
|
1
|
|
|
|
|
45
|
$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}); |
1230
|
|
|
|
|
|
|
} |
1231
|
|
|
|
|
|
|
|
1232
|
|
|
|
|
|
|
sub WriteRaster { |
1233
|
1
|
|
|
1
|
|
323
|
my $self = shift; |
1234
|
1
|
|
|
|
|
4
|
my ($width, $height) = $self->Size; |
1235
|
1
|
|
|
|
|
5
|
my ($type) = $self->Band->DataType; |
1236
|
1
|
|
|
|
|
4
|
my %d = ( |
1237
|
|
|
|
|
|
|
XOFF => 0, |
1238
|
|
|
|
|
|
|
YOFF => 0, |
1239
|
|
|
|
|
|
|
XSIZE => $width, |
1240
|
|
|
|
|
|
|
YSIZE => $height, |
1241
|
|
|
|
|
|
|
BUF => undef, |
1242
|
|
|
|
|
|
|
BUFXSIZE => undef, |
1243
|
|
|
|
|
|
|
BUFYSIZE => undef, |
1244
|
|
|
|
|
|
|
BUFTYPE => $type, |
1245
|
|
|
|
|
|
|
BANDLIST => [1], |
1246
|
|
|
|
|
|
|
BUFPIXELSPACE => 0, |
1247
|
|
|
|
|
|
|
BUFLINESPACE => 0, |
1248
|
|
|
|
|
|
|
BUFBANDSPACE => 0 |
1249
|
|
|
|
|
|
|
); |
1250
|
1
|
|
|
|
|
2
|
my %p; |
1251
|
|
|
|
|
|
|
my $t; |
1252
|
1
|
50
|
|
|
|
4
|
if (defined $_[0]) { |
1253
|
1
|
|
|
|
|
3
|
$t = uc($_[0]); |
1254
|
1
|
|
|
|
|
3
|
$t =~ s/_//g; |
1255
|
|
|
|
|
|
|
} |
1256
|
1
|
50
|
33
|
|
|
18
|
if (@_ == 0) { |
|
|
50
|
33
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1257
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
1258
|
0
|
|
|
|
|
0
|
%p = %{$_[0]}; |
|
0
|
|
|
|
|
0
|
|
1259
|
|
|
|
|
|
|
} elsif (@_ % 2 == 0 and (defined $t and exists $d{$t})) { |
1260
|
1
|
|
|
|
|
5
|
%p = @_; |
1261
|
|
|
|
|
|
|
} else { |
1262
|
0
|
|
|
|
|
0
|
($p{xoff},$p{yoff},$p{xsize},$p{ysize},$p{buf},$p{buf_xsize},$p{buf_ysize},$p{buf_type},$p{band_list},$p{buf_pixel_space},$p{buf_line_space},$p{buf_band_space}) = @_; |
1263
|
|
|
|
|
|
|
} |
1264
|
1
|
|
|
|
|
5
|
for (keys %p) { |
1265
|
4
|
|
|
|
|
7
|
my $u = uc($_); |
1266
|
4
|
|
|
|
|
6
|
$u =~ s/_//g; |
1267
|
4
|
50
|
|
|
|
10
|
carp "Unknown named parameter '$_'." unless exists $d{$u}; |
1268
|
4
|
|
|
|
|
11
|
$p{$u} = $p{$_}; |
1269
|
|
|
|
|
|
|
} |
1270
|
1
|
|
|
|
|
5
|
for (keys %d) { |
1271
|
12
|
100
|
|
|
|
32
|
$p{$_} = $d{$_} unless defined $p{$_}; |
1272
|
|
|
|
|
|
|
} |
1273
|
1
|
50
|
|
|
|
6
|
unless ($Geo::GDAL::TYPE_INT2STRING{$p{BUFTYPE}}) { |
1274
|
|
|
|
|
|
|
confess "Unknown data type: '$p{BUFTYPE}'." |
1275
|
1
|
50
|
|
|
|
4
|
unless exists $Geo::GDAL::TYPE_STRING2INT{$p{BUFTYPE}}; |
1276
|
1
|
|
|
|
|
3
|
$p{BUFTYPE} = $Geo::GDAL::TYPE_STRING2INT{$p{BUFTYPE}}; |
1277
|
|
|
|
|
|
|
} |
1278
|
1
|
|
|
|
|
449
|
$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}); |
1279
|
|
|
|
|
|
|
} |
1280
|
|
|
|
|
|
|
|
1281
|
|
|
|
|
|
|
sub BuildOverviews { |
1282
|
1
|
|
|
1
|
|
10
|
my $self = shift; |
1283
|
1
|
|
|
|
|
4
|
my @p = @_; |
1284
|
1
|
50
|
|
|
|
7
|
$p[0] = uc($p[0]) if $p[0]; |
1285
|
1
|
|
|
|
|
3
|
eval { |
1286
|
1
|
|
|
|
|
1850
|
$self->_BuildOverviews(@p); |
1287
|
|
|
|
|
|
|
}; |
1288
|
1
|
50
|
|
|
|
9
|
confess $@ if $@; |
1289
|
|
|
|
|
|
|
} |
1290
|
|
|
|
|
|
|
|
1291
|
|
|
|
|
|
|
|
1292
|
|
|
|
|
|
|
|
1293
|
|
|
|
|
|
|
|
1294
|
|
|
|
|
|
|
package Geo::GDAL::Band; |
1295
|
6
|
|
|
6
|
|
38
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
138
|
|
1296
|
6
|
|
|
6
|
|
36
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
174
|
|
1297
|
6
|
|
|
6
|
|
6060
|
use POSIX; |
|
6
|
|
|
|
|
49055
|
|
|
6
|
|
|
|
|
37
|
|
1298
|
6
|
|
|
6
|
|
21237
|
use Carp; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
332
|
|
1299
|
6
|
|
|
6
|
|
30
|
use Scalar::Util 'blessed'; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
296
|
|
1300
|
6
|
|
|
|
|
22528
|
use vars qw/ |
1301
|
|
|
|
|
|
|
@COLOR_INTERPRETATIONS |
1302
|
|
|
|
|
|
|
%COLOR_INTERPRETATION_STRING2INT %COLOR_INTERPRETATION_INT2STRING @DOMAINS |
1303
|
|
|
|
|
|
|
%MASK_FLAGS |
1304
|
6
|
|
|
6
|
|
33
|
/; |
|
6
|
|
|
|
|
11
|
|
1305
|
|
|
|
|
|
|
for (keys %Geo::GDAL::Const::) { |
1306
|
|
|
|
|
|
|
next if /TypeCount/; |
1307
|
|
|
|
|
|
|
push(@COLOR_INTERPRETATIONS, $1), next if /^GCI_(\w+)/; |
1308
|
|
|
|
|
|
|
} |
1309
|
|
|
|
|
|
|
for my $string (@COLOR_INTERPRETATIONS) { |
1310
|
|
|
|
|
|
|
my $int = eval "\$Geo::GDAL::Constc::GCI_$string"; |
1311
|
|
|
|
|
|
|
$COLOR_INTERPRETATION_STRING2INT{$string} = $int; |
1312
|
|
|
|
|
|
|
$COLOR_INTERPRETATION_INT2STRING{$int} = $string; |
1313
|
|
|
|
|
|
|
} |
1314
|
|
|
|
|
|
|
@DOMAINS = qw/IMAGE_STRUCTURE RESAMPLING/; |
1315
|
|
|
|
|
|
|
%MASK_FLAGS = (AllValid => 1, PerDataset => 2, Alpha => 4, NoData => 8); |
1316
|
|
|
|
|
|
|
|
1317
|
|
|
|
|
|
|
sub Domains { |
1318
|
1
|
|
|
1
|
|
5
|
return @DOMAINS; |
1319
|
|
|
|
|
|
|
} |
1320
|
|
|
|
|
|
|
|
1321
|
|
|
|
|
|
|
sub ColorInterpretations { |
1322
|
1
|
|
|
1
|
|
12
|
return @COLOR_INTERPRETATIONS; |
1323
|
|
|
|
|
|
|
} |
1324
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
sub MaskFlags { |
1326
|
1
|
|
|
1
|
|
12
|
my @f = sort {$MASK_FLAGS{$a} <=> $MASK_FLAGS{$b}} keys %MASK_FLAGS; |
|
5
|
|
|
|
|
12
|
|
1327
|
1
|
|
|
|
|
4
|
return @f; |
1328
|
|
|
|
|
|
|
} |
1329
|
|
|
|
|
|
|
|
1330
|
|
|
|
|
|
|
sub DESTROY { |
1331
|
68
|
|
|
68
|
|
10407
|
my $self; |
1332
|
68
|
100
|
|
|
|
317
|
if ($_[0]->isa('SCALAR')) { |
1333
|
34
|
|
|
|
|
57
|
$self = $_[0]; |
1334
|
|
|
|
|
|
|
} else { |
1335
|
34
|
50
|
|
|
|
159
|
return unless $_[0]->isa('HASH'); |
1336
|
34
|
|
|
|
|
47
|
$self = tied(%{$_[0]}); |
|
34
|
|
|
|
|
72
|
|
1337
|
34
|
50
|
|
|
|
88
|
return unless defined $self; |
1338
|
|
|
|
|
|
|
} |
1339
|
68
|
|
|
|
|
126
|
delete $ITERATORS{$self}; |
1340
|
68
|
50
|
|
|
|
172
|
if (exists $OWNER{$self}) { |
1341
|
0
|
|
|
|
|
0
|
delete $OWNER{$self}; |
1342
|
|
|
|
|
|
|
} |
1343
|
68
|
|
|
|
|
158
|
$self->RELEASE_PARENTS(); |
1344
|
|
|
|
|
|
|
} |
1345
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
sub RELEASE_PARENTS { |
1347
|
68
|
|
|
68
|
|
95
|
my $self = shift; |
1348
|
68
|
|
|
|
|
724
|
delete $Geo::GDAL::Dataset::BANDS{$self}; |
1349
|
|
|
|
|
|
|
} |
1350
|
|
|
|
|
|
|
|
1351
|
|
|
|
|
|
|
sub Size { |
1352
|
682
|
|
|
682
|
|
1671
|
my $self = shift; |
1353
|
682
|
|
|
|
|
2089
|
return ($self->{XSize}, $self->{YSize}); |
1354
|
|
|
|
|
|
|
} |
1355
|
|
|
|
|
|
|
|
1356
|
|
|
|
|
|
|
sub DataType { |
1357
|
685
|
|
|
685
|
|
862
|
my $self = shift; |
1358
|
685
|
|
|
|
|
1964
|
return $Geo::GDAL::TYPE_INT2STRING{$self->{DataType}}; |
1359
|
|
|
|
|
|
|
} |
1360
|
|
|
|
|
|
|
|
1361
|
|
|
|
|
|
|
sub PackCharacter { |
1362
|
1
|
|
|
1
|
|
11
|
my $self = shift; |
1363
|
1
|
|
|
|
|
6
|
return Geo::GDAL::PackCharacter($self->DataType); |
1364
|
|
|
|
|
|
|
} |
1365
|
|
|
|
|
|
|
|
1366
|
|
|
|
|
|
|
sub NoDataValue { |
1367
|
3
|
|
|
3
|
|
270
|
my $self = shift; |
1368
|
3
|
100
|
|
|
|
12
|
if (@_ > 0) { |
1369
|
1
|
50
|
|
|
|
5
|
if (defined $_[0]) { |
1370
|
1
|
|
|
|
|
7
|
SetNoDataValue($self, $_[0]); |
1371
|
|
|
|
|
|
|
} else { |
1372
|
0
|
|
|
|
|
0
|
SetNoDataValue($self, POSIX::FLT_MAX); # hopefully an "out of range" value |
1373
|
|
|
|
|
|
|
} |
1374
|
|
|
|
|
|
|
} |
1375
|
3
|
|
|
|
|
15
|
GetNoDataValue($self); |
1376
|
|
|
|
|
|
|
} |
1377
|
|
|
|
|
|
|
|
1378
|
|
|
|
|
|
|
sub Unit { |
1379
|
2
|
|
|
2
|
|
511
|
my $self = shift; |
1380
|
2
|
100
|
|
|
|
7
|
if (@_ > 0) { |
1381
|
1
|
|
|
|
|
2
|
my $unit = shift; |
1382
|
1
|
50
|
|
|
|
4
|
$unit = '' unless defined $unit; |
1383
|
1
|
|
|
|
|
8
|
SetUnitType($self, $unit); |
1384
|
|
|
|
|
|
|
} |
1385
|
2
|
100
|
|
|
|
6
|
return unless defined wantarray; |
1386
|
1
|
|
|
|
|
9
|
GetUnitType($self); |
1387
|
|
|
|
|
|
|
} |
1388
|
|
|
|
|
|
|
|
1389
|
|
|
|
|
|
|
sub ScaleAndOffset { |
1390
|
2
|
|
|
2
|
|
5
|
my $self = shift; |
1391
|
2
|
100
|
66
|
|
|
19
|
SetScale($self, $_[0]) if @_ > 0 and defined $_[0]; |
1392
|
2
|
100
|
66
|
|
|
15
|
SetOffset($self, $_[1]) if @_ > 1 and defined $_[1]; |
1393
|
2
|
100
|
|
|
|
8
|
return unless defined wantarray; |
1394
|
1
|
|
|
|
|
5
|
my $scale = GetScale($self); |
1395
|
1
|
|
|
|
|
5
|
my $offset = GetOffset($self); |
1396
|
1
|
|
|
|
|
4
|
return ($scale, $offset); |
1397
|
|
|
|
|
|
|
} |
1398
|
|
|
|
|
|
|
|
1399
|
|
|
|
|
|
|
sub ReadTile { |
1400
|
10
|
|
|
10
|
|
443
|
my($self, $xoff, $yoff, $xsize, $ysize) = @_; |
1401
|
10
|
100
|
|
|
|
42
|
$xoff = 0 unless defined $xoff; |
1402
|
10
|
100
|
|
|
|
31
|
$yoff = 0 unless defined $yoff; |
1403
|
10
|
100
|
|
|
|
60
|
$xsize = $self->{XSize} - $xoff unless defined $xsize; |
1404
|
10
|
100
|
|
|
|
59
|
$ysize = $self->{YSize} - $yoff unless defined $ysize; |
1405
|
10
|
|
|
|
|
43
|
my $buf = $self->ReadRaster($xoff, $yoff, $xsize, $ysize); |
1406
|
10
|
|
|
|
|
54
|
my $pc = Geo::GDAL::PackCharacter($self->{DataType}); |
1407
|
10
|
|
|
|
|
49
|
my $w = $xsize * Geo::GDAL::GetDataTypeSize($self->{DataType})/8; |
1408
|
10
|
|
|
|
|
22
|
my $offset = 0; |
1409
|
10
|
|
|
|
|
15
|
my @data; |
1410
|
10
|
|
|
|
|
32
|
for (0..$ysize-1) { |
1411
|
319
|
|
|
|
|
1240
|
my $sub = substr($buf, $offset, $w); |
1412
|
319
|
|
|
|
|
8422
|
my @d = unpack($pc."[$xsize]", $sub); |
1413
|
319
|
|
|
|
|
2391
|
push @data, \@d; |
1414
|
319
|
|
|
|
|
552
|
$offset += $w; |
1415
|
|
|
|
|
|
|
} |
1416
|
10
|
|
|
|
|
37
|
return \@data; |
1417
|
|
|
|
|
|
|
} |
1418
|
|
|
|
|
|
|
|
1419
|
|
|
|
|
|
|
sub WriteTile { |
1420
|
9
|
|
|
9
|
|
309394
|
my($self, $data, $xoff, $yoff) = @_; |
1421
|
9
|
100
|
|
|
|
41
|
$xoff = 0 unless defined $xoff; |
1422
|
9
|
100
|
|
|
|
25
|
$yoff = 0 unless defined $yoff; |
1423
|
9
|
|
|
|
|
13
|
my $xsize = @{$data->[0]}; |
|
9
|
|
|
|
|
25
|
|
1424
|
9
|
50
|
|
|
|
60
|
$xsize = $self->{XSize} - $xoff if $xsize > $self->{XSize} - $xoff; |
1425
|
9
|
|
|
|
|
26
|
my $ysize = @{$data}; |
|
9
|
|
|
|
|
23
|
|
1426
|
9
|
50
|
|
|
|
35
|
$ysize = $self->{YSize} - $yoff if $ysize > $self->{YSize} - $yoff; |
1427
|
9
|
|
|
|
|
47
|
my $pc = Geo::GDAL::PackCharacter($self->{DataType}); |
1428
|
9
|
|
|
|
|
39
|
for my $i (0..$ysize-1) { |
1429
|
319
|
|
|
|
|
583
|
my $scanline = pack($pc."[$xsize]", @{$data->[$i]}); |
|
319
|
|
|
|
|
2314
|
|
1430
|
319
|
|
|
|
|
877
|
$self->WriteRaster( $xoff, $yoff+$i, $xsize, 1, $scanline ); |
1431
|
|
|
|
|
|
|
} |
1432
|
|
|
|
|
|
|
} |
1433
|
|
|
|
|
|
|
|
1434
|
|
|
|
|
|
|
sub ColorInterpretation { |
1435
|
25
|
|
|
25
|
|
711
|
my($self, $ci) = @_; |
1436
|
25
|
100
|
|
|
|
54
|
if (defined $ci) { |
1437
|
12
|
|
|
|
|
18
|
my $ci2 = $ci; |
1438
|
12
|
50
|
|
|
|
48
|
$ci2 = $COLOR_INTERPRETATION_STRING2INT{$ci} if exists $COLOR_INTERPRETATION_STRING2INT{$ci}; |
1439
|
12
|
50
|
|
|
|
36
|
confess "Unknown color interpretation: '$ci'." unless exists $COLOR_INTERPRETATION_INT2STRING{$ci2}; |
1440
|
12
|
|
|
|
|
60
|
SetRasterColorInterpretation($self, $ci2); |
1441
|
12
|
|
|
|
|
28
|
return $ci; |
1442
|
|
|
|
|
|
|
} else { |
1443
|
13
|
|
|
|
|
79
|
return $COLOR_INTERPRETATION_INT2STRING{GetRasterColorInterpretation($self)}; |
1444
|
|
|
|
|
|
|
} |
1445
|
|
|
|
|
|
|
} |
1446
|
|
|
|
|
|
|
|
1447
|
|
|
|
|
|
|
sub ColorTable { |
1448
|
23
|
|
|
23
|
|
80
|
my $self = shift; |
1449
|
23
|
100
|
66
|
|
|
134
|
SetRasterColorTable($self, $_[0]) if @_ and defined $_[0]; |
1450
|
23
|
100
|
|
|
|
60
|
return unless defined wantarray; |
1451
|
12
|
|
|
|
|
64
|
GetRasterColorTable($self); |
1452
|
|
|
|
|
|
|
} |
1453
|
|
|
|
|
|
|
|
1454
|
|
|
|
|
|
|
sub CategoryNames { |
1455
|
2
|
|
|
2
|
|
13
|
my $self = shift; |
1456
|
2
|
100
|
|
|
|
26
|
SetRasterCategoryNames($self, \@_) if @_; |
1457
|
2
|
100
|
|
|
|
8
|
return unless defined wantarray; |
1458
|
1
|
|
|
|
|
10
|
my $n = GetRasterCategoryNames($self); |
1459
|
1
|
|
|
|
|
6
|
return @$n; |
1460
|
|
|
|
|
|
|
} |
1461
|
|
|
|
|
|
|
|
1462
|
|
|
|
|
|
|
sub AttributeTable { |
1463
|
2
|
|
|
2
|
|
8
|
my $self = shift; |
1464
|
2
|
100
|
66
|
|
|
30
|
SetDefaultRAT($self, $_[0]) if @_ and defined $_[0]; |
1465
|
2
|
100
|
|
|
|
17
|
return unless defined wantarray; |
1466
|
1
|
|
|
|
|
7
|
my $r = GetDefaultRAT($self); |
1467
|
1
|
50
|
|
|
|
7
|
$Geo::GDAL::RasterAttributeTable::BANDS{$r} = $self if $r; |
1468
|
1
|
|
|
|
|
3
|
return $r; |
1469
|
|
|
|
|
|
|
} |
1470
|
|
|
|
|
|
|
|
1471
|
|
|
|
|
|
|
sub GetHistogram { |
1472
|
3
|
|
|
3
|
|
1070
|
my $self = shift; |
1473
|
3
|
|
|
|
|
31
|
my %defaults = (Min => -0.5, |
1474
|
|
|
|
|
|
|
Max => 255.5, |
1475
|
|
|
|
|
|
|
Buckets => 256, |
1476
|
|
|
|
|
|
|
IncludeOutOfRange => 0, |
1477
|
|
|
|
|
|
|
ApproxOK => 0, |
1478
|
|
|
|
|
|
|
Progress => undef, |
1479
|
|
|
|
|
|
|
ProgressData => undef); |
1480
|
3
|
|
|
|
|
10
|
my %params = @_; |
1481
|
3
|
|
|
|
|
13
|
for (keys %params) { |
1482
|
5
|
50
|
|
|
|
18
|
carp "unknown parameter $_ in Geo::GDAL::Band::GetHistogram" unless exists $defaults{$_}; |
1483
|
|
|
|
|
|
|
} |
1484
|
3
|
|
|
|
|
16
|
for (keys %defaults) { |
1485
|
21
|
100
|
|
|
|
64
|
$params{$_} = $defaults{$_} unless defined $params{$_}; |
1486
|
|
|
|
|
|
|
} |
1487
|
3
|
50
|
33
|
|
|
36
|
$params{ProgressData} = 1 if $params{Progress} and not defined $params{ProgressData}; |
1488
|
|
|
|
|
|
|
_GetHistogram($self, $params{Min}, $params{Max}, $params{Buckets}, |
1489
|
|
|
|
|
|
|
$params{IncludeOutOfRange}, $params{ApproxOK}, |
1490
|
3
|
|
|
|
|
1770
|
$params{Progress}, $params{ProgressData}); |
1491
|
|
|
|
|
|
|
} |
1492
|
|
|
|
|
|
|
|
1493
|
|
|
|
|
|
|
sub Contours { |
1494
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
1495
|
0
|
|
|
|
|
0
|
my %defaults = (DataSource => undef, |
1496
|
|
|
|
|
|
|
LayerConstructor => {Name => 'contours'}, |
1497
|
|
|
|
|
|
|
ContourInterval => 100, |
1498
|
|
|
|
|
|
|
ContourBase => 0, |
1499
|
|
|
|
|
|
|
FixedLevels => [], |
1500
|
|
|
|
|
|
|
NoDataValue => undef, |
1501
|
|
|
|
|
|
|
IDField => -1, |
1502
|
|
|
|
|
|
|
ElevField => -1, |
1503
|
|
|
|
|
|
|
Progress => undef, |
1504
|
|
|
|
|
|
|
ProgressData => undef); |
1505
|
0
|
|
|
|
|
0
|
my %params; |
1506
|
0
|
0
|
0
|
|
|
0
|
if (!defined($_[0]) or (blessed($_[0]) and $_[0]->isa('Geo::OGR::DataSource'))) { |
|
|
|
0
|
|
|
|
|
1507
|
|
|
|
|
|
|
($params{DataSource}, $params{LayerConstructor}, |
1508
|
|
|
|
|
|
|
$params{ContourInterval}, $params{ContourBase}, |
1509
|
|
|
|
|
|
|
$params{FixedLevels}, $params{NoDataValue}, |
1510
|
|
|
|
|
|
|
$params{IDField}, $params{ElevField}, |
1511
|
0
|
|
|
|
|
0
|
$params{Progress}, $params{ProgressData}) = @_; |
1512
|
|
|
|
|
|
|
} else { |
1513
|
0
|
|
|
|
|
0
|
%params = @_; |
1514
|
0
|
0
|
|
|
|
0
|
if (exists $params{progress}) { |
1515
|
0
|
|
|
|
|
0
|
$params{Progress} = $params{progress}; |
1516
|
0
|
|
|
|
|
0
|
delete $params{progress}; |
1517
|
|
|
|
|
|
|
} |
1518
|
0
|
0
|
|
|
|
0
|
if (exists $params{progress_data}) { |
1519
|
0
|
|
|
|
|
0
|
$params{ProgressData} = $params{progress_data}; |
1520
|
0
|
|
|
|
|
0
|
delete $params{progress_data}; |
1521
|
|
|
|
|
|
|
} |
1522
|
|
|
|
|
|
|
} |
1523
|
0
|
|
|
|
|
0
|
for (keys %params) { |
1524
|
0
|
0
|
|
|
|
0
|
carp "unknown parameter $_ in Geo::GDAL::Band::Contours" unless exists $defaults{$_}; |
1525
|
|
|
|
|
|
|
} |
1526
|
0
|
|
|
|
|
0
|
for (keys %defaults) { |
1527
|
0
|
0
|
|
|
|
0
|
$params{$_} = $defaults{$_} unless defined $params{$_}; |
1528
|
|
|
|
|
|
|
} |
1529
|
|
|
|
|
|
|
$params{DataSource} = Geo::OGR::GetDriver('Memory')->CreateDataSource('ds') |
1530
|
0
|
0
|
|
|
|
0
|
unless defined $params{DataSource}; |
1531
|
0
|
0
|
|
|
|
0
|
$params{LayerConstructor}->{Schema} = {} unless $params{LayerConstructor}->{Schema}; |
1532
|
0
|
0
|
|
|
|
0
|
$params{LayerConstructor}->{Schema}{Fields} = [] unless $params{LayerConstructor}->{Schema}{Fields}; |
1533
|
0
|
|
|
|
|
0
|
my %fields; |
1534
|
0
|
0
|
0
|
|
|
0
|
unless ($params{IDField} =~ /^[+-]?\d+$/ or $fields{$params{IDField}}) { |
1535
|
0
|
|
|
|
|
0
|
push @{$params{LayerConstructor}->{Schema}{Fields}}, {Name => $params{IDField}, Type => 'Integer'}; |
|
0
|
|
|
|
|
0
|
|
1536
|
|
|
|
|
|
|
} |
1537
|
0
|
0
|
0
|
|
|
0
|
unless ($params{ElevField} =~ /^[+-]?\d+$/ or $fields{$params{ElevField}}) { |
1538
|
0
|
0
|
|
|
|
0
|
my $type = $self->DataType() =~ /Float/ ? 'Real' : 'Integer'; |
1539
|
0
|
|
|
|
|
0
|
push @{$params{LayerConstructor}->{Schema}{Fields}}, {Name => $params{ElevField}, Type => $type}; |
|
0
|
|
|
|
|
0
|
|
1540
|
|
|
|
|
|
|
} |
1541
|
0
|
|
|
|
|
0
|
my $layer = $params{DataSource}->CreateLayer($params{LayerConstructor}); |
1542
|
0
|
|
|
|
|
0
|
my $schema = $layer->GetLayerDefn; |
1543
|
0
|
|
|
|
|
0
|
for ('IDField', 'ElevField') { |
1544
|
0
|
0
|
|
|
|
0
|
$params{$_} = $schema->GetFieldIndex($params{$_}) unless $params{$_} =~ /^[+-]?\d+$/; |
1545
|
|
|
|
|
|
|
} |
1546
|
0
|
0
|
0
|
|
|
0
|
$params{ProgressData} = 1 if $params{Progress} and not defined $params{ProgressData}; |
1547
|
|
|
|
|
|
|
ContourGenerate($self, $params{ContourInterval}, $params{ContourBase}, $params{FixedLevels}, |
1548
|
|
|
|
|
|
|
$params{NoDataValue}, $layer, $params{IDField}, $params{ElevField}, |
1549
|
0
|
|
|
|
|
0
|
$params{Progress}, $params{ProgressData}); |
1550
|
0
|
|
|
|
|
0
|
return $layer; |
1551
|
|
|
|
|
|
|
} |
1552
|
|
|
|
|
|
|
|
1553
|
|
|
|
|
|
|
sub FillNodata { |
1554
|
2
|
|
|
2
|
|
306
|
my $self = shift; |
1555
|
2
|
|
|
|
|
5
|
my $mask = shift; |
1556
|
2
|
100
|
|
|
|
15
|
$mask = $self->GetMaskBand unless $mask; |
1557
|
2
|
|
|
|
|
5
|
my @p = @_; |
1558
|
2
|
50
|
|
|
|
9
|
$p[0] = 10 unless defined $p[0]; |
1559
|
2
|
50
|
|
|
|
15
|
$p[1] = 0 unless defined $p[1]; |
1560
|
2
|
50
|
|
|
|
7
|
$p[2] = undef unless defined $p[2]; |
1561
|
2
|
50
|
|
|
|
7
|
$p[3] = undef unless defined $p[3]; |
1562
|
2
|
50
|
|
|
|
7
|
$p[4] = undef unless defined $p[1]; |
1563
|
2
|
|
|
|
|
12529
|
Geo::GDAL::FillNodata($self, $mask, @p); |
1564
|
|
|
|
|
|
|
} |
1565
|
|
|
|
|
|
|
*GetBandNumber = *GetBand; |
1566
|
|
|
|
|
|
|
|
1567
|
|
|
|
|
|
|
sub ReadRaster { |
1568
|
11
|
|
|
11
|
|
1309
|
my $self = shift; |
1569
|
11
|
|
|
|
|
34
|
my ($width, $height) = $self->Size; |
1570
|
11
|
|
|
|
|
44
|
my ($type) = $self->DataType; |
1571
|
11
|
|
|
|
|
117
|
my %d = ( |
1572
|
|
|
|
|
|
|
XOFF => 0, |
1573
|
|
|
|
|
|
|
YOFF => 0, |
1574
|
|
|
|
|
|
|
XSIZE => $width, |
1575
|
|
|
|
|
|
|
YSIZE => $height, |
1576
|
|
|
|
|
|
|
BUFXSIZE => undef, |
1577
|
|
|
|
|
|
|
BUFYSIZE => undef, |
1578
|
|
|
|
|
|
|
BUFTYPE => $type, |
1579
|
|
|
|
|
|
|
BUFPIXELSPACE => 0, |
1580
|
|
|
|
|
|
|
BUFLINESPACE => 0, |
1581
|
|
|
|
|
|
|
RESAMPLEALG => 'NearestNeighbour', |
1582
|
|
|
|
|
|
|
PROGRESS => undef, |
1583
|
|
|
|
|
|
|
PROGRESSDATA => undef |
1584
|
|
|
|
|
|
|
); |
1585
|
11
|
|
|
|
|
19
|
my %p; |
1586
|
|
|
|
|
|
|
my $t; |
1587
|
11
|
100
|
|
|
|
51
|
if (defined $_[0]) { |
1588
|
10
|
|
|
|
|
20
|
$t = uc($_[0]); |
1589
|
10
|
|
|
|
|
25
|
$t =~ s/_//g; |
1590
|
|
|
|
|
|
|
} |
1591
|
11
|
100
|
33
|
|
|
97
|
if (@_ == 0) { |
|
|
50
|
33
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1592
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
1593
|
0
|
|
|
|
|
0
|
%p = %{$_[0]}; |
|
0
|
|
|
|
|
0
|
|
1594
|
|
|
|
|
|
|
} elsif (@_ % 2 == 0 and (defined $t and exists $d{$t})) { |
1595
|
0
|
|
|
|
|
0
|
%p = @_; |
1596
|
|
|
|
|
|
|
} else { |
1597
|
10
|
|
|
|
|
75
|
($p{xoff},$p{yoff},$p{xsize},$p{ysize},$p{buf_xsize},$p{buf_ysize},$p{buf_type},$p{buf_pixel_space},$p{buf_line_space},$p{resample_alg},$p{progress},$p{progress_data}) = @_; |
1598
|
|
|
|
|
|
|
} |
1599
|
11
|
|
|
|
|
49
|
for (keys %p) { |
1600
|
120
|
|
|
|
|
178
|
my $u = uc($_); |
1601
|
120
|
|
|
|
|
229
|
$u =~ s/_//g; |
1602
|
120
|
50
|
|
|
|
290
|
carp "Unknown named parameter '$_'." unless exists $d{$u}; |
1603
|
120
|
|
|
|
|
239
|
$p{$u} = $p{$_}; |
1604
|
|
|
|
|
|
|
} |
1605
|
11
|
|
|
|
|
45
|
for (keys %d) { |
1606
|
132
|
100
|
|
|
|
321
|
$p{$_} = $d{$_} unless defined $p{$_}; |
1607
|
|
|
|
|
|
|
} |
1608
|
|
|
|
|
|
|
confess "Unknown resampling algorithm: '$p{RESAMPLEALG}'." |
1609
|
11
|
50
|
|
|
|
46
|
unless exists $Geo::GDAL::RIO_RESAMPLING_STRING2INT{$p{RESAMPLEALG}}; |
1610
|
11
|
|
|
|
|
29
|
$p{RESAMPLEALG} = $Geo::GDAL::RIO_RESAMPLING_STRING2INT{$p{RESAMPLEALG}}; |
1611
|
11
|
50
|
|
|
|
38
|
unless ($Geo::GDAL::TYPE_INT2STRING{$p{BUFTYPE}}) { |
1612
|
|
|
|
|
|
|
confess "Unknown data type: '$p{BUFTYPE}'." |
1613
|
11
|
50
|
|
|
|
35
|
unless exists $Geo::GDAL::TYPE_STRING2INT{$p{BUFTYPE}}; |
1614
|
11
|
|
|
|
|
28
|
$p{BUFTYPE} = $Geo::GDAL::TYPE_STRING2INT{$p{BUFTYPE}}; |
1615
|
|
|
|
|
|
|
} |
1616
|
11
|
|
|
|
|
3494
|
$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}); |
1617
|
|
|
|
|
|
|
} |
1618
|
|
|
|
|
|
|
|
1619
|
|
|
|
|
|
|
sub WriteRaster { |
1620
|
670
|
|
|
670
|
|
15338
|
my $self = shift; |
1621
|
670
|
|
|
|
|
1388
|
my ($width, $height) = $self->Size; |
1622
|
670
|
|
|
|
|
2062
|
my ($type) = $self->DataType; |
1623
|
670
|
|
|
|
|
3849
|
my %d = ( |
1624
|
|
|
|
|
|
|
XOFF => 0, |
1625
|
|
|
|
|
|
|
YOFF => 0, |
1626
|
|
|
|
|
|
|
XSIZE => $width, |
1627
|
|
|
|
|
|
|
YSIZE => $height, |
1628
|
|
|
|
|
|
|
BUF => undef, |
1629
|
|
|
|
|
|
|
BUFXSIZE => undef, |
1630
|
|
|
|
|
|
|
BUFYSIZE => undef, |
1631
|
|
|
|
|
|
|
BUFTYPE => $type, |
1632
|
|
|
|
|
|
|
BUFPIXELSPACE => 0, |
1633
|
|
|
|
|
|
|
BUFLINESPACE => 0 |
1634
|
|
|
|
|
|
|
); |
1635
|
670
|
|
|
|
|
842
|
my %p; |
1636
|
|
|
|
|
|
|
my $t; |
1637
|
670
|
50
|
|
|
|
1535
|
if (defined $_[0]) { |
1638
|
670
|
|
|
|
|
959
|
$t = uc($_[0]); |
1639
|
670
|
|
|
|
|
1028
|
$t =~ s/_//g; |
1640
|
|
|
|
|
|
|
} |
1641
|
670
|
50
|
33
|
|
|
2793
|
if (@_ == 0) { |
|
|
50
|
66
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1642
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
1643
|
0
|
|
|
|
|
0
|
%p = %{$_[0]}; |
|
0
|
|
|
|
|
0
|
|
1644
|
|
|
|
|
|
|
} elsif (@_ % 2 == 0 and (defined $t and exists $d{$t})) { |
1645
|
1
|
|
|
|
|
5
|
%p = @_; |
1646
|
|
|
|
|
|
|
} else { |
1647
|
669
|
|
|
|
|
3150
|
($p{xoff},$p{yoff},$p{xsize},$p{ysize},$p{buf},$p{buf_xsize},$p{buf_ysize},$p{buf_type},$p{buf_pixel_space},$p{buf_line_space}) = @_; |
1648
|
|
|
|
|
|
|
} |
1649
|
670
|
|
|
|
|
2157
|
for (keys %p) { |
1650
|
6693
|
|
|
|
|
9314
|
my $u = uc($_); |
1651
|
6693
|
|
|
|
|
11332
|
$u =~ s/_//g; |
1652
|
6693
|
50
|
|
|
|
14042
|
carp "Unknown named parameter '$_'." unless exists $d{$u}; |
1653
|
6693
|
|
|
|
|
13345
|
$p{$u} = $p{$_}; |
1654
|
|
|
|
|
|
|
} |
1655
|
670
|
|
|
|
|
2375
|
for (keys %d) { |
1656
|
6700
|
100
|
|
|
|
15193
|
$p{$_} = $d{$_} unless defined $p{$_}; |
1657
|
|
|
|
|
|
|
} |
1658
|
670
|
50
|
|
|
|
2061
|
unless ($Geo::GDAL::TYPE_INT2STRING{$p{BUFTYPE}}) { |
1659
|
|
|
|
|
|
|
confess "Unknown data type: '$p{BUFTYPE}'." |
1660
|
670
|
50
|
|
|
|
1547
|
unless exists $Geo::GDAL::TYPE_STRING2INT{$p{BUFTYPE}}; |
1661
|
670
|
|
|
|
|
1263
|
$p{BUFTYPE} = $Geo::GDAL::TYPE_STRING2INT{$p{BUFTYPE}}; |
1662
|
|
|
|
|
|
|
} |
1663
|
670
|
|
|
|
|
6664
|
$self->_WriteRaster($p{XOFF},$p{YOFF},$p{XSIZE},$p{YSIZE},$p{BUF},$p{BUFXSIZE},$p{BUFYSIZE},$p{BUFTYPE},$p{BUFPIXELSPACE},$p{BUFLINESPACE}); |
1664
|
|
|
|
|
|
|
} |
1665
|
|
|
|
|
|
|
|
1666
|
|
|
|
|
|
|
sub GetMaskFlags { |
1667
|
2
|
|
|
2
|
|
295
|
my $self = shift; |
1668
|
2
|
|
|
|
|
41
|
my $f = $self->_GetMaskFlags; |
1669
|
2
|
|
|
|
|
5
|
my @f; |
1670
|
2
|
|
|
|
|
7
|
for my $flag (keys %MASK_FLAGS) { |
1671
|
8
|
100
|
|
|
|
26
|
push @f, $flag if $f & $MASK_FLAGS{$flag}; |
1672
|
|
|
|
|
|
|
} |
1673
|
2
|
50
|
|
|
|
11
|
return wantarray ? @f : $f; |
1674
|
|
|
|
|
|
|
} |
1675
|
|
|
|
|
|
|
|
1676
|
|
|
|
|
|
|
sub CreateMaskBand { |
1677
|
1
|
|
|
1
|
|
339
|
my $self = shift; |
1678
|
1
|
|
|
|
|
2
|
my $f = 0; |
1679
|
1
|
50
|
33
|
|
|
11
|
if (@_ and $_[0] =~ /^\d$/) { |
1680
|
0
|
|
|
|
|
0
|
$f = shift; |
1681
|
|
|
|
|
|
|
} else { |
1682
|
1
|
|
|
|
|
3
|
for my $flag (@_) { |
1683
|
1
|
50
|
|
|
|
17
|
carp "Unknown mask flag: '$flag'." unless $MASK_FLAGS{$flag}; |
1684
|
1
|
|
|
|
|
4
|
$f |= $MASK_FLAGS{$flag}; |
1685
|
|
|
|
|
|
|
} |
1686
|
|
|
|
|
|
|
} |
1687
|
1
|
|
|
|
|
434
|
$self->_CreateMaskBand($f); |
1688
|
|
|
|
|
|
|
} |
1689
|
|
|
|
|
|
|
|
1690
|
|
|
|
|
|
|
# GetMaskBand should be redefined and the result should be put into |
1691
|
|
|
|
|
|
|
# %Geo::GDAL::Dataset::BANDS |
1692
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
# GetOverview should be redefined and the result should be put into |
1694
|
|
|
|
|
|
|
# %Geo::GDAL::Dataset::BANDS |
1695
|
|
|
|
|
|
|
|
1696
|
|
|
|
|
|
|
sub RegenerateOverview { |
1697
|
1
|
|
|
1
|
|
7
|
my $self = shift; |
1698
|
|
|
|
|
|
|
#Geo::GDAL::Band overview, scalar resampling, subref callback, scalar callback_data |
1699
|
1
|
|
|
|
|
4
|
my @p = @_; |
1700
|
1
|
|
|
|
|
4
|
Geo::GDAL::RegenerateOverview($self, @p); |
1701
|
|
|
|
|
|
|
} |
1702
|
|
|
|
|
|
|
|
1703
|
|
|
|
|
|
|
sub RegenerateOverviews { |
1704
|
1
|
|
|
1
|
|
7
|
my $self = shift; |
1705
|
|
|
|
|
|
|
#arrayref overviews, scalar resampling, subref callback, scalar callback_data |
1706
|
1
|
|
|
|
|
19
|
my @p = @_; |
1707
|
1
|
|
|
|
|
7
|
Geo::GDAL::RegenerateOverviews($self, @p); |
1708
|
|
|
|
|
|
|
} |
1709
|
|
|
|
|
|
|
|
1710
|
|
|
|
|
|
|
|
1711
|
|
|
|
|
|
|
|
1712
|
|
|
|
|
|
|
|
1713
|
|
|
|
|
|
|
package Geo::GDAL::ColorTable; |
1714
|
6
|
|
|
6
|
|
42
|
use strict; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
159
|
|
1715
|
6
|
|
|
6
|
|
34
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
216
|
|
1716
|
6
|
|
|
6
|
|
33
|
use Carp; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
340
|
|
1717
|
6
|
|
|
|
|
2584
|
use vars qw/ |
1718
|
|
|
|
|
|
|
%PALETTE_INTERPRETATION_STRING2INT %PALETTE_INTERPRETATION_INT2STRING |
1719
|
6
|
|
|
6
|
|
29
|
/; |
|
6
|
|
|
|
|
12
|
|
1720
|
|
|
|
|
|
|
for my $string (qw/Gray RGB CMYK HLS/) { |
1721
|
|
|
|
|
|
|
my $int = eval "\$Geo::GDAL::Constc::GPI_$string"; |
1722
|
|
|
|
|
|
|
$PALETTE_INTERPRETATION_STRING2INT{$string} = $int; |
1723
|
|
|
|
|
|
|
$PALETTE_INTERPRETATION_INT2STRING{$int} = $string; |
1724
|
|
|
|
|
|
|
} |
1725
|
|
|
|
|
|
|
|
1726
|
|
|
|
|
|
|
sub GetPaletteInterpretation { |
1727
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
1728
|
0
|
|
|
|
|
0
|
return $PALETTE_INTERPRETATION_INT2STRING{GetPaletteInterpretation($self)}; |
1729
|
|
|
|
|
|
|
} |
1730
|
|
|
|
|
|
|
|
1731
|
|
|
|
|
|
|
sub SetColorEntry { |
1732
|
16
|
|
|
16
|
|
72
|
my $self = shift; |
1733
|
16
|
|
|
|
|
23
|
my $index = shift; |
1734
|
16
|
|
|
|
|
37
|
my $color; |
1735
|
16
|
100
|
|
|
|
40
|
if (ref($_[0]) eq 'ARRAY') { |
1736
|
11
|
|
|
|
|
19
|
$color = shift; |
1737
|
|
|
|
|
|
|
} else { |
1738
|
5
|
|
|
|
|
11
|
$color = [@_]; |
1739
|
|
|
|
|
|
|
} |
1740
|
16
|
|
|
|
|
29
|
eval { |
1741
|
16
|
|
|
|
|
77
|
$self->_SetColorEntry($index, $color); |
1742
|
|
|
|
|
|
|
}; |
1743
|
16
|
50
|
|
|
|
54
|
confess $@ if $@; |
1744
|
|
|
|
|
|
|
} |
1745
|
|
|
|
|
|
|
|
1746
|
|
|
|
|
|
|
sub ColorEntry { |
1747
|
7
|
|
|
7
|
|
14
|
my $self = shift; |
1748
|
7
|
|
|
|
|
13
|
my $index = shift; |
1749
|
7
|
100
|
|
|
|
30
|
SetColorEntry($self, $index, @_) if @_ > 0; |
1750
|
7
|
100
|
|
|
|
54
|
GetColorEntry($self, $index) if defined wantarray; |
1751
|
|
|
|
|
|
|
} |
1752
|
|
|
|
|
|
|
|
1753
|
|
|
|
|
|
|
sub ColorTable { |
1754
|
4
|
|
|
4
|
|
311
|
my $self = shift; |
1755
|
4
|
|
|
|
|
8
|
my @table; |
1756
|
4
|
100
|
|
|
|
15
|
if (@_) { |
1757
|
2
|
|
|
|
|
3
|
my $index = 0; |
1758
|
2
|
|
|
|
|
7
|
for my $color (@_) { |
1759
|
4
|
|
|
|
|
12
|
push @table, [ColorEntry($self, $index, @$color)]; |
1760
|
4
|
|
|
|
|
10
|
$index++; |
1761
|
|
|
|
|
|
|
} |
1762
|
|
|
|
|
|
|
} else { |
1763
|
2
|
|
|
|
|
14
|
for (my $index = 0; $index < GetCount($self); $index++) { |
1764
|
2
|
|
|
|
|
6
|
push @table, [ColorEntry($self, $index)]; |
1765
|
|
|
|
|
|
|
} |
1766
|
|
|
|
|
|
|
} |
1767
|
4
|
|
|
|
|
15
|
return @table; |
1768
|
|
|
|
|
|
|
} |
1769
|
|
|
|
|
|
|
*ColorEntries = *ColorTable; |
1770
|
|
|
|
|
|
|
|
1771
|
|
|
|
|
|
|
|
1772
|
|
|
|
|
|
|
|
1773
|
|
|
|
|
|
|
|
1774
|
|
|
|
|
|
|
package Geo::GDAL::RasterAttributeTable; |
1775
|
6
|
|
|
6
|
|
33
|
use strict; |
|
6
|
|
|
|
|
18
|
|
|
6
|
|
|
|
|
212
|
|
1776
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
195
|
|
1777
|
6
|
|
|
6
|
|
30
|
use Carp; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
443
|
|
1778
|
6
|
|
|
|
|
5954
|
use vars qw/ %BANDS |
1779
|
|
|
|
|
|
|
@FIELD_TYPES @FIELD_USAGES |
1780
|
|
|
|
|
|
|
%FIELD_TYPE_STRING2INT %FIELD_TYPE_INT2STRING |
1781
|
|
|
|
|
|
|
%FIELD_USAGE_STRING2INT %FIELD_USAGE_INT2STRING |
1782
|
6
|
|
|
6
|
|
32
|
/; |
|
6
|
|
|
|
|
11
|
|
1783
|
|
|
|
|
|
|
for (keys %Geo::GDAL::Const::) { |
1784
|
|
|
|
|
|
|
next if /TypeCount/; |
1785
|
|
|
|
|
|
|
push(@FIELD_TYPES, $1), next if /^GFT_(\w+)/; |
1786
|
|
|
|
|
|
|
push(@FIELD_USAGES, $1), next if /^GFU_(\w+)/; |
1787
|
|
|
|
|
|
|
} |
1788
|
|
|
|
|
|
|
for my $string (@FIELD_TYPES) { |
1789
|
|
|
|
|
|
|
my $int = eval "\$Geo::GDAL::Constc::GFT_$string"; |
1790
|
|
|
|
|
|
|
$FIELD_TYPE_STRING2INT{$string} = $int; |
1791
|
|
|
|
|
|
|
$FIELD_TYPE_INT2STRING{$int} = $string; |
1792
|
|
|
|
|
|
|
} |
1793
|
|
|
|
|
|
|
for my $string (@FIELD_USAGES) { |
1794
|
|
|
|
|
|
|
my $int = eval "\$Geo::GDAL::Constc::GFU_$string"; |
1795
|
|
|
|
|
|
|
$FIELD_USAGE_STRING2INT{$string} = $int; |
1796
|
|
|
|
|
|
|
$FIELD_USAGE_INT2STRING{$int} = $string; |
1797
|
|
|
|
|
|
|
} |
1798
|
|
|
|
|
|
|
|
1799
|
|
|
|
|
|
|
sub FieldTypes { |
1800
|
1
|
|
|
1
|
|
15
|
return @FIELD_TYPES; |
1801
|
|
|
|
|
|
|
} |
1802
|
|
|
|
|
|
|
|
1803
|
|
|
|
|
|
|
sub FieldUsages { |
1804
|
1
|
|
|
1
|
|
18
|
return @FIELD_USAGES; |
1805
|
|
|
|
|
|
|
} |
1806
|
|
|
|
|
|
|
|
1807
|
|
|
|
|
|
|
sub RELEASE_PARENTS { |
1808
|
6
|
|
|
6
|
|
12
|
my $self = shift; |
1809
|
6
|
|
|
|
|
28
|
delete $BANDS{$self}; |
1810
|
|
|
|
|
|
|
} |
1811
|
|
|
|
|
|
|
|
1812
|
|
|
|
|
|
|
sub GetUsageOfCol { |
1813
|
57
|
|
|
57
|
|
16243
|
my($self, $col) = @_; |
1814
|
57
|
|
|
|
|
311
|
$FIELD_USAGE_INT2STRING{_GetUsageOfCol($self, $col)}; |
1815
|
|
|
|
|
|
|
} |
1816
|
|
|
|
|
|
|
|
1817
|
|
|
|
|
|
|
sub GetColOfUsage { |
1818
|
0
|
|
|
0
|
|
0
|
my($self, $usage) = @_; |
1819
|
0
|
|
|
|
|
0
|
_GetColOfUsage($self, $FIELD_USAGE_STRING2INT{$usage}); |
1820
|
|
|
|
|
|
|
} |
1821
|
|
|
|
|
|
|
|
1822
|
|
|
|
|
|
|
sub GetTypeOfCol { |
1823
|
57
|
|
|
57
|
|
15718
|
my($self, $col) = @_; |
1824
|
57
|
|
|
|
|
319
|
$FIELD_TYPE_INT2STRING{_GetTypeOfCol($self, $col)}; |
1825
|
|
|
|
|
|
|
} |
1826
|
|
|
|
|
|
|
|
1827
|
|
|
|
|
|
|
sub Columns { |
1828
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
1829
|
0
|
|
|
|
|
0
|
my %columns; |
1830
|
0
|
0
|
|
|
|
0
|
if (@_) { # create columns |
1831
|
0
|
|
|
|
|
0
|
%columns = @_; |
1832
|
0
|
|
|
|
|
0
|
for my $name (keys %columns) { |
1833
|
0
|
|
|
|
|
0
|
$self->CreateColumn($name, $columns{$name}{Type}, $columns{$name}{Usage}); |
1834
|
|
|
|
|
|
|
} |
1835
|
|
|
|
|
|
|
} |
1836
|
0
|
|
|
|
|
0
|
%columns = (); |
1837
|
0
|
|
|
|
|
0
|
for my $c (0..$self->GetColumnCount-1) { |
1838
|
0
|
|
|
|
|
0
|
my $name = $self->GetNameOfCol($c); |
1839
|
0
|
|
|
|
|
0
|
$columns{$name}{Type} = $self->GetTypeOfCol($c); |
1840
|
0
|
|
|
|
|
0
|
$columns{$name}{Usage} = $self->GetUsageOfCol($c); |
1841
|
|
|
|
|
|
|
} |
1842
|
0
|
|
|
|
|
0
|
return %columns; |
1843
|
|
|
|
|
|
|
} |
1844
|
|
|
|
|
|
|
|
1845
|
|
|
|
|
|
|
sub CreateColumn { |
1846
|
57
|
|
|
57
|
|
447
|
my($self, $name, $type, $usage) = @_; |
1847
|
57
|
50
|
|
|
|
130
|
confess "Unknown RAT column type: '$type'." unless exists $FIELD_TYPE_STRING2INT{$type}; |
1848
|
57
|
50
|
|
|
|
125
|
confess "Unknown RAT column usage: '$usage'." unless exists $FIELD_USAGE_STRING2INT{$usage}; |
1849
|
57
|
|
|
|
|
89
|
for my $color (qw/Red Green Blue Alpha/) { |
1850
|
228
|
100
|
100
|
|
|
2045
|
carp "RAT column type will be 'Integer' for usage '$color'." if $usage eq $color and $type ne 'Integer'; |
1851
|
|
|
|
|
|
|
} |
1852
|
57
|
|
|
|
|
184
|
$type = $FIELD_TYPE_STRING2INT{$type}; |
1853
|
57
|
|
|
|
|
88
|
$usage = $FIELD_USAGE_STRING2INT{$usage}; |
1854
|
57
|
|
|
|
|
294
|
_CreateColumn($self, $name, $type, $usage); |
1855
|
|
|
|
|
|
|
} |
1856
|
|
|
|
|
|
|
|
1857
|
|
|
|
|
|
|
sub Value { |
1858
|
57
|
|
|
57
|
|
15969
|
my($self, $row, $column) = @_; |
1859
|
57
|
50
|
|
|
|
402
|
SetValueAsString($self, $row, $column, $_[3]) if defined $_[3]; |
1860
|
57
|
50
|
|
|
|
125
|
return unless defined wantarray; |
1861
|
57
|
|
|
|
|
342
|
GetValueAsString($self, $row, $column); |
1862
|
|
|
|
|
|
|
} |
1863
|
|
|
|
|
|
|
|
1864
|
|
|
|
|
|
|
sub LinearBinning { |
1865
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
1866
|
0
|
0
|
|
|
|
0
|
SetLinearBinning($self, @_) if @_ > 0; |
1867
|
0
|
0
|
|
|
|
0
|
return unless defined wantarray; |
1868
|
0
|
|
|
|
|
0
|
my @a = GetLinearBinning($self); |
1869
|
0
|
0
|
|
|
|
0
|
return $a[0] ? ($a[1], $a[2]) : (); |
1870
|
|
|
|
|
|
|
} |
1871
|
|
|
|
|
|
|
|
1872
|
|
|
|
|
|
|
|
1873
|
|
|
|
|
|
|
|
1874
|
|
|
|
|
|
|
|
1875
|
|
|
|
|
|
|
package Geo::GDAL::GCP; |
1876
|
|
|
|
|
|
|
|
1877
|
|
|
|
|
|
|
*swig_Pixel_get = *Geo::GDALc::GCP_Column_get; |
1878
|
|
|
|
|
|
|
*swig_Pixel_set = *Geo::GDALc::GCP_Column_set; |
1879
|
|
|
|
|
|
|
*swig_Line_get = *Geo::GDALc::GCP_Row_get; |
1880
|
|
|
|
|
|
|
*swig_Line_set = *Geo::GDALc::GCP_Row_set; |
1881
|
|
|
|
|
|
|
|
1882
|
|
|
|
|
|
|
|
1883
|
|
|
|
|
|
|
|
1884
|
|
|
|
|
|
|
package Geo::GDAL::VSIF; |
1885
|
6
|
|
|
6
|
|
36
|
use strict; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
189
|
|
1886
|
6
|
|
|
6
|
|
30
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
166
|
|
1887
|
6
|
|
|
6
|
|
31
|
use Carp; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
5782
|
|
1888
|
|
|
|
|
|
|
|
1889
|
|
|
|
|
|
|
sub Open { |
1890
|
0
|
|
|
0
|
|
0
|
my ($path, $mode) = @_; |
1891
|
0
|
|
|
|
|
0
|
my $self = Geo::GDAL::VSIFOpenL($path, $mode); |
1892
|
0
|
|
|
|
|
0
|
bless $self, 'Geo::GDAL::VSIF'; |
1893
|
|
|
|
|
|
|
} |
1894
|
|
|
|
|
|
|
|
1895
|
|
|
|
|
|
|
sub Write { |
1896
|
0
|
|
|
0
|
|
0
|
my ($self, $data) = @_; |
1897
|
0
|
|
|
|
|
0
|
Geo::GDAL::VSIFWriteL($data, $self); |
1898
|
|
|
|
|
|
|
} |
1899
|
|
|
|
|
|
|
|
1900
|
|
|
|
|
|
|
sub Close { |
1901
|
0
|
|
|
0
|
|
0
|
my ($self, $data) = @_; |
1902
|
0
|
|
|
|
|
0
|
eval { |
1903
|
0
|
|
|
|
|
0
|
Geo::GDAL::VSIFCloseL($self); |
1904
|
|
|
|
|
|
|
}; |
1905
|
0
|
0
|
|
|
|
0
|
if ($@) { |
1906
|
0
|
|
|
|
|
0
|
confess "Cannot close file: $@."; |
1907
|
|
|
|
|
|
|
} |
1908
|
|
|
|
|
|
|
} |
1909
|
|
|
|
|
|
|
|
1910
|
|
|
|
|
|
|
sub Read { |
1911
|
0
|
|
|
0
|
|
0
|
my ($self, $count) = @_; |
1912
|
0
|
|
|
|
|
0
|
Geo::GDAL::VSIFReadL($count, $self); |
1913
|
|
|
|
|
|
|
} |
1914
|
|
|
|
|
|
|
|
1915
|
|
|
|
|
|
|
sub Seek { |
1916
|
0
|
|
|
0
|
|
0
|
my ($self, $offset, $whence) = @_; |
1917
|
0
|
|
|
|
|
0
|
Geo::GDAL::VSIFSeekL($self, $offset, $whence); |
1918
|
|
|
|
|
|
|
} |
1919
|
|
|
|
|
|
|
|
1920
|
|
|
|
|
|
|
sub Tell { |
1921
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
1922
|
0
|
|
|
|
|
0
|
Geo::GDAL::VSIFTellL($self); |
1923
|
|
|
|
|
|
|
} |
1924
|
|
|
|
|
|
|
|
1925
|
|
|
|
|
|
|
sub Truncate { |
1926
|
0
|
|
|
0
|
|
0
|
my ($self, $new_size) = @_; |
1927
|
0
|
|
|
|
|
0
|
eval { |
1928
|
0
|
|
|
|
|
0
|
Geo::GDAL::VSIFTruncateL($self, $new_size); |
1929
|
|
|
|
|
|
|
}; |
1930
|
0
|
0
|
|
|
|
0
|
if ($@) { |
1931
|
0
|
|
|
|
|
0
|
confess "Cannot truncate file: $@."; |
1932
|
|
|
|
|
|
|
} |
1933
|
|
|
|
|
|
|
} |
1934
|
|
|
|
|
|
|
|
1935
|
|
|
|
|
|
|
sub MkDir { |
1936
|
0
|
|
|
0
|
|
0
|
my ($path) = @_; |
1937
|
0
|
|
|
|
|
0
|
my $mode = 0; # unused in CPL |
1938
|
0
|
|
|
|
|
0
|
eval { |
1939
|
0
|
|
|
|
|
0
|
Geo::GDAL::Mkdir($path, $mode); |
1940
|
|
|
|
|
|
|
}; |
1941
|
0
|
0
|
|
|
|
0
|
if ($@) { |
1942
|
0
|
|
|
|
|
0
|
confess "Cannot make directory \"$path\": $@."; |
1943
|
|
|
|
|
|
|
} |
1944
|
|
|
|
|
|
|
} |
1945
|
|
|
|
|
|
|
*Mkdir = *MkDir; |
1946
|
|
|
|
|
|
|
|
1947
|
|
|
|
|
|
|
sub ReadDir { |
1948
|
5
|
|
|
5
|
|
12604
|
my ($path) = @_; |
1949
|
5
|
|
|
|
|
47
|
Geo::GDAL::ReadDir($path); |
1950
|
|
|
|
|
|
|
} |
1951
|
|
|
|
|
|
|
|
1952
|
|
|
|
|
|
|
sub ReadDirRecursive { |
1953
|
0
|
|
|
0
|
|
0
|
my ($path) = @_; |
1954
|
0
|
|
|
|
|
0
|
Geo::GDAL::ReadDirRecursive($path); |
1955
|
|
|
|
|
|
|
} |
1956
|
|
|
|
|
|
|
|
1957
|
|
|
|
|
|
|
sub Rename { |
1958
|
0
|
|
|
0
|
|
0
|
my ($old, $new) = @_; |
1959
|
0
|
|
|
|
|
0
|
eval { |
1960
|
0
|
|
|
|
|
0
|
Geo::GDAL::Rename($old, $new); |
1961
|
|
|
|
|
|
|
}; |
1962
|
0
|
0
|
|
|
|
0
|
if ($@) { |
1963
|
0
|
|
|
|
|
0
|
confess "Cannot rename file \"$old\": $@."; |
1964
|
|
|
|
|
|
|
} |
1965
|
|
|
|
|
|
|
} |
1966
|
|
|
|
|
|
|
|
1967
|
|
|
|
|
|
|
sub RmDir { |
1968
|
0
|
|
|
0
|
|
0
|
my ($dirname, $recursive) = @_; |
1969
|
0
|
|
|
|
|
0
|
eval { |
1970
|
0
|
0
|
|
|
|
0
|
if (!$recursive) { |
1971
|
0
|
|
|
|
|
0
|
Geo::GDAL::Rmdir($dirname); |
1972
|
|
|
|
|
|
|
} else { |
1973
|
0
|
|
|
|
|
0
|
for my $f (ReadDir($dirname)) { |
1974
|
0
|
0
|
0
|
|
|
0
|
next if $f eq '..' or $f eq '.'; |
1975
|
0
|
|
|
|
|
0
|
my @s = Stat($dirname.'/'.$f); |
1976
|
0
|
0
|
|
|
|
0
|
if ($s[0] eq 'f') { |
|
|
0
|
|
|
|
|
|
1977
|
0
|
|
|
|
|
0
|
Unlink($dirname.'/'.$f); |
1978
|
|
|
|
|
|
|
} elsif ($s[0] eq 'd') { |
1979
|
0
|
|
|
|
|
0
|
Rmdir($dirname.'/'.$f, 1); |
1980
|
0
|
|
|
|
|
0
|
Rmdir($dirname.'/'.$f); |
1981
|
|
|
|
|
|
|
} |
1982
|
|
|
|
|
|
|
} |
1983
|
0
|
|
|
|
|
0
|
RmDir($dirname); |
1984
|
|
|
|
|
|
|
} |
1985
|
|
|
|
|
|
|
}; |
1986
|
0
|
0
|
|
|
|
0
|
if ($@) { |
1987
|
0
|
0
|
|
|
|
0
|
my $r = $recursive ? ' recursively' : ''; |
1988
|
0
|
|
|
|
|
0
|
confess "Cannot remove directory \"$dirname\"$r: $@."; |
1989
|
|
|
|
|
|
|
} |
1990
|
|
|
|
|
|
|
} |
1991
|
|
|
|
|
|
|
*Rmdir = *RmDir; |
1992
|
|
|
|
|
|
|
|
1993
|
|
|
|
|
|
|
sub Stat { |
1994
|
0
|
|
|
0
|
|
0
|
my ($path) = @_; |
1995
|
0
|
|
|
|
|
0
|
eval { |
1996
|
0
|
|
|
|
|
0
|
Geo::GDAL::Stat($path); |
1997
|
|
|
|
|
|
|
}; |
1998
|
0
|
0
|
|
|
|
0
|
if ($@) { |
1999
|
0
|
|
|
|
|
0
|
confess "Cannot stat file \"$path\": $@."; |
2000
|
|
|
|
|
|
|
} |
2001
|
|
|
|
|
|
|
} |
2002
|
|
|
|
|
|
|
|
2003
|
|
|
|
|
|
|
sub Unlink { |
2004
|
3
|
|
|
3
|
|
4781
|
my ($filename) = @_; |
2005
|
3
|
|
|
|
|
15
|
eval { |
2006
|
3
|
|
|
|
|
36
|
Geo::GDAL::Unlink($filename); |
2007
|
|
|
|
|
|
|
}; |
2008
|
3
|
50
|
|
|
|
12
|
if ($@) { |
2009
|
0
|
|
|
|
|
0
|
confess "Cannot unlink file \"$filename\": $@."; |
2010
|
|
|
|
|
|
|
} |
2011
|
|
|
|
|
|
|
} |
2012
|
|
|
|
|
|
|
|
2013
|
|
|
|
|
|
|
|
2014
|
|
|
|
|
|
|
|
2015
|
|
|
|
|
|
|
|
2016
|
|
|
|
|
|
|
package Geo::GDAL::GeoTransform; |
2017
|
6
|
|
|
6
|
|
34
|
use strict; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
137
|
|
2018
|
6
|
|
|
6
|
|
31
|
use warnings; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
167
|
|
2019
|
6
|
|
|
6
|
|
28
|
use Carp; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
4146
|
|
2020
|
|
|
|
|
|
|
|
2021
|
|
|
|
|
|
|
sub new { |
2022
|
5
|
|
|
5
|
|
2663
|
my $class = shift; |
2023
|
5
|
|
|
|
|
8
|
my $self; |
2024
|
5
|
100
|
|
|
|
19
|
if (@_ == 0) { |
|
|
100
|
|
|
|
|
|
2025
|
2
|
|
|
|
|
7
|
$self = [0,1,0,0,0,1]; |
2026
|
|
|
|
|
|
|
} elsif (@_ == 1) { |
2027
|
2
|
|
|
|
|
10
|
$self = $_[0]; |
2028
|
|
|
|
|
|
|
} else { |
2029
|
1
|
|
|
|
|
3
|
my @a = @_; |
2030
|
1
|
|
|
|
|
2
|
$self = \@a; |
2031
|
|
|
|
|
|
|
} |
2032
|
5
|
|
|
|
|
10
|
bless $self, $class; |
2033
|
5
|
|
|
|
|
54
|
return $self; |
2034
|
|
|
|
|
|
|
} |
2035
|
|
|
|
|
|
|
|
2036
|
|
|
|
|
|
|
sub FromGCPs { |
2037
|
0
|
|
|
0
|
|
|
my @GCPs; |
2038
|
0
|
|
|
|
|
|
my $ApproxOK = 1; |
2039
|
0
|
0
|
|
|
|
|
if (ref($_[0]) eq 'ARRAY') { |
2040
|
0
|
|
|
|
|
|
@GCPs = @{$_[0]}; |
|
0
|
|
|
|
|
|
|
2041
|
0
|
0
|
|
|
|
|
$ApproxOK = $_[1] if defined $_[1]; |
2042
|
|
|
|
|
|
|
} else { |
2043
|
0
|
|
|
|
|
|
@GCPs = @_; |
2044
|
0
|
0
|
|
|
|
|
$ApproxOK = pop @GCPs if !ref($GCPs[$#GCPs]); |
2045
|
|
|
|
|
|
|
} |
2046
|
0
|
|
|
|
|
|
my $self = Geo::GDAL::GCPsToGeoTransform(\@GCPs, $ApproxOK); |
2047
|
0
|
|
|
|
|
|
bless $self, 'Geo::GDAL::GetTransform'; |
2048
|
0
|
|
|
|
|
|
return $self; |
2049
|
|
|
|
|
|
|
} |
2050
|
|
|
|
|
|
|
|
2051
|
|
|
|
|
|
|
sub Apply { |
2052
|
0
|
|
|
0
|
|
|
my ($self, $columns, $rows) = @_; |
2053
|
0
|
|
|
|
|
|
my (@x, @y); |
2054
|
0
|
|
|
|
|
|
for my $i (0..$#$columns) { |
2055
|
0
|
|
|
|
|
|
($x[$i], $y[$i]) = |
2056
|
|
|
|
|
|
|
Geo::GDAL::ApplyGeoTransform($self, $columns->[$i], $rows->[$i]); |
2057
|
|
|
|
|
|
|
} |
2058
|
0
|
|
|
|
|
|
return (\@x, \@y); |
2059
|
|
|
|
|
|
|
} |
2060
|
|
|
|
|
|
|
|
2061
|
|
|
|
|
|
|
sub Inv { |
2062
|
0
|
|
|
0
|
|
|
my $self = shift; |
2063
|
0
|
|
|
|
|
|
my @inv = Geo::GDAL::InvGeoTransform($self); |
2064
|
0
|
0
|
|
|
|
|
unless (defined wantarray) { |
2065
|
0
|
|
|
|
|
|
@$self = @inv; |
2066
|
|
|
|
|
|
|
} else { |
2067
|
0
|
|
|
|
|
|
return new(@inv); |
2068
|
|
|
|
|
|
|
} |
2069
|
|
|
|
|
|
|
} |
2070
|
|
|
|
|
|
|
|
2071
|
|
|
|
|
|
|
1; |