ffi-gdal 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/History.md +5 -0
- data/lib/ffi-gdal/major_object.rb +5 -0
- data/lib/ffi-gdal/raster_band.rb +5 -1
- data/lib/ffi/gdal.rb +74 -47
- data/lib/ffi/gdal/cpl_conv.rb +124 -131
- data/lib/ffi/gdal/cpl_error.rb +71 -75
- data/lib/ffi/gdal/cpl_string.rb +101 -108
- data/lib/ffi/gdal/cpl_vsi.rb +95 -102
- data/lib/ffi/gdal/ogr_api.rb +16 -23
- data/lib/ffi/gdal/ogr_core.rb +191 -195
- data/lib/ffi/gdal/ogr_srs_api.rb +37 -41
- data/lib/ffi/gdal/version.rb +1 -1
- data/spec/ffi-gdal/integration/raster_band_info_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfa34b84ed0070848c6fde3721e8ef247a0c6ff9
|
4
|
+
data.tar.gz: f458c3e3f8c0f9d4e3ff0381f75017b6e123e03e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d337efd0962ecf22a455026cdafcf76ea97ab12b173d270763d5eb9bce592778b61ce43b72ea932b380b926a0f77dd5091bb834a42dc7d41780ec1a9d6668b7e
|
7
|
+
data.tar.gz: dd9f8ecd705648a22a5a480b9b8f6e0a34a90eda87da49f95d9298b8989b1171f648878a32c12640d6103aa42cff788823cdb378f6caa8fb423b58f73b836d9d
|
data/Gemfile
CHANGED
data/History.md
CHANGED
@@ -7,6 +7,11 @@ module GDAL
|
|
7
7
|
|
8
8
|
# @return [Array<String>]
|
9
9
|
def metadata_domain_list
|
10
|
+
unless defined? FFI::GDAL::GDALGetMetadataDomainList
|
11
|
+
warn "GDALGetMetadataDomainList is't defined. GDAL::MajorObject#metadata_domain_list disabled."
|
12
|
+
return []
|
13
|
+
end
|
14
|
+
|
10
15
|
# I don't quite get it, but if #GDALGetMetadataDomainList isn't called
|
11
16
|
# twice, the last domain in the list sometimes doesn't get read.
|
12
17
|
GDALGetMetadataDomainList(c_pointer)
|
data/lib/ffi-gdal/raster_band.rb
CHANGED
@@ -300,7 +300,11 @@ module GDAL
|
|
300
300
|
# is feet; other non-standard values are allowed.
|
301
301
|
# @return [FFI::GDAL::CPLErr]
|
302
302
|
def unit_type=(new_unit_type)
|
303
|
-
GDALSetRasterUnitType
|
303
|
+
if defined? FFI::GDAL::GDALSetRasterUnitType
|
304
|
+
GDALSetRasterUnitType(@gdal_raster_band, new_unit_type)
|
305
|
+
else
|
306
|
+
warn "GDALSetRasterUnitType is not defined. Can't call RasterBand#unit_type="
|
307
|
+
end
|
304
308
|
end
|
305
309
|
|
306
310
|
# @return [GDAL::RasterAttributeTable]
|
data/lib/ffi/gdal.rb
CHANGED
@@ -1,4 +1,41 @@
|
|
1
1
|
require 'ffi'
|
2
|
+
|
3
|
+
module FFI
|
4
|
+
module GDAL
|
5
|
+
extend ::FFI::Library
|
6
|
+
|
7
|
+
def self.search_paths
|
8
|
+
@search_paths ||= begin
|
9
|
+
return if ENV['GDAL_LIBRARY_PATH']
|
10
|
+
|
11
|
+
if FFI::Platform.windows?
|
12
|
+
ENV['PATH'].split(File::PATH_SEPARATOR)
|
13
|
+
else
|
14
|
+
%w[/usr/local/{lib64,lib} /opt/local/{lib64,lib} /usr/{lib64,lib} /usr/lib/{x86_64,i386}-linux-gnu]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.find_lib(lib)
|
20
|
+
if ENV['GDAL_LIBRARY_PATH'] && File.file?(ENV['GDAL_LIBRARY_PATH'])
|
21
|
+
ENV['GDAL_LIBRARY_PATH']
|
22
|
+
else
|
23
|
+
Dir.glob(search_paths.map do |path|
|
24
|
+
File.expand_path(File.join(path, "#{lib}.#{FFI::Platform::LIBSUFFIX}"))
|
25
|
+
end).first
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.gdal_library_path
|
30
|
+
return @gdal_library_path if @gdal_library_path
|
31
|
+
|
32
|
+
@gdal_library_path = find_lib('{lib,}gdal*')
|
33
|
+
end
|
34
|
+
|
35
|
+
ffi_lib(gdal_library_path)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
2
39
|
require_relative 'gdal/version'
|
3
40
|
require_relative 'gdal/cpl_conv'
|
4
41
|
require_relative 'gdal/cpl_error'
|
@@ -13,16 +50,6 @@ require_relative '../ext/to_bool'
|
|
13
50
|
|
14
51
|
module FFI
|
15
52
|
module GDAL
|
16
|
-
extend ::FFI::Library
|
17
|
-
ffi_lib 'gdal'
|
18
|
-
|
19
|
-
include CPLError
|
20
|
-
include CPLConv
|
21
|
-
include CPLString
|
22
|
-
include CPLVSI
|
23
|
-
include OGRCore
|
24
|
-
include OGRAPI
|
25
|
-
include OGRSRSAPI
|
26
53
|
|
27
54
|
#-----------------------------------------------------------------
|
28
55
|
# Defines
|
@@ -188,8 +215,8 @@ module FFI
|
|
188
215
|
attach_function :GDALDataTypeUnion, [GDALDataType, GDALDataType], GDALDataType
|
189
216
|
|
190
217
|
# AsyncStatus
|
191
|
-
attach_function :GDALGetAsyncStatusTypeName, [GDALAsyncStatusType], :string
|
192
|
-
attach_function :GDALGetAsyncStatusTypeByName, [:string], GDALAsyncStatusType
|
218
|
+
#attach_function :GDALGetAsyncStatusTypeName, [GDALAsyncStatusType], :string
|
219
|
+
#attach_function :GDALGetAsyncStatusTypeByName, [:string], GDALAsyncStatusType
|
193
220
|
|
194
221
|
# ColorInterpretation
|
195
222
|
attach_function :GDALGetColorInterpretationName, [GDALColorInterp], :string
|
@@ -259,11 +286,11 @@ module FFI
|
|
259
286
|
attach_function :GDALApplyGeoTransform,
|
260
287
|
[:pointer, :double, :double, :pointer, :pointer],
|
261
288
|
:void
|
262
|
-
attach_function :GDALComposeGeoTransforms,
|
263
|
-
|
264
|
-
|
289
|
+
#attach_function :GDALComposeGeoTransforms,
|
290
|
+
# [:pointer, :pointer, :pointer],
|
291
|
+
# :void
|
265
292
|
|
266
|
-
attach_function :GDALGetMetadataDomainList, [:GDALMajorObjectH], :pointer
|
293
|
+
#attach_function :GDALGetMetadataDomainList, [:GDALMajorObjectH], :pointer
|
267
294
|
attach_function :GDALGetMetadata, [:GDALMajorObjectH, :string], :pointer
|
268
295
|
attach_function :GDALSetMetadata,
|
269
296
|
[:GDALMajorObjectH, :pointer, :string],
|
@@ -293,28 +320,28 @@ module FFI
|
|
293
320
|
[:GDALDatasetH, GDALDataType, :pointer],
|
294
321
|
CPLErr
|
295
322
|
|
296
|
-
attach_function :GDALBeginAsyncReader,
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
], :GDALAsyncReaderH
|
314
|
-
|
315
|
-
attach_function :GDALEndAsyncReader,
|
316
|
-
|
317
|
-
|
323
|
+
#attach_function :GDALBeginAsyncReader,
|
324
|
+
# [
|
325
|
+
# :GDALDatasetH,
|
326
|
+
# GDALRWFlag,
|
327
|
+
# :int,
|
328
|
+
# :int,
|
329
|
+
# :int,
|
330
|
+
# :int,
|
331
|
+
# :pointer,
|
332
|
+
# :int,
|
333
|
+
# :int,
|
334
|
+
# GDALDataType,
|
335
|
+
# :int,
|
336
|
+
# :pointer,
|
337
|
+
# :int,
|
338
|
+
# :int,
|
339
|
+
# :int
|
340
|
+
#], :GDALAsyncReaderH
|
341
|
+
|
342
|
+
#attach_function :GDALEndAsyncReader,
|
343
|
+
# [:GDALDatasetH, :GDALAsyncReaderH],
|
344
|
+
# :void
|
318
345
|
|
319
346
|
attach_function :GDALDatasetRasterIO,
|
320
347
|
[
|
@@ -389,14 +416,14 @@ module FFI
|
|
389
416
|
attach_function :GDALDatasetCopyWholeRaster,
|
390
417
|
[:GDALDatasetH, :GDALDatasetH, :pointer, :GDALProgressFunc, :pointer],
|
391
418
|
CPLErr
|
392
|
-
attach_function :GDALRasterBandCopyWholeRaster,
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
419
|
+
#attach_function :GDALRasterBandCopyWholeRaster,
|
420
|
+
# [
|
421
|
+
# :GDALRasterBandH,
|
422
|
+
# :GDALRasterBandH,
|
423
|
+
# :pointer,
|
424
|
+
# :GDALProgressFunc,
|
425
|
+
# :pointer
|
426
|
+
# ], CPLErr
|
400
427
|
attach_function :GDALRegenerateOverviews,
|
401
428
|
[
|
402
429
|
:GDALRasterBandH,
|
@@ -517,7 +544,7 @@ module FFI
|
|
517
544
|
[:GDALRasterBandH, :double, :double, :double, :double],
|
518
545
|
CPLErr
|
519
546
|
attach_function :GDALGetRasterUnitType, [:GDALRasterBandH], :string
|
520
|
-
attach_function :GDALSetRasterUnitType, [:GDALRasterBandH, :string], CPLErr
|
547
|
+
#attach_function :GDALSetRasterUnitType, [:GDALRasterBandH, :string], CPLErr
|
521
548
|
attach_function :GDALGetRasterOffset, [:GDALRasterBandH, :pointer], :double
|
522
549
|
attach_function :GDALSetRasterOffset, [:GDALRasterBandH, :double], CPLErr
|
523
550
|
attach_function :GDALGetRasterScale, [:GDALRasterBandH, :pointer], :double
|
data/lib/ffi/gdal/cpl_conv.rb
CHANGED
@@ -1,151 +1,144 @@
|
|
1
|
-
require 'ffi'
|
2
1
|
require_relative 'cpl_error'
|
3
2
|
require_relative 'cpl_vsi'
|
4
3
|
|
5
4
|
|
6
5
|
module FFI
|
7
6
|
module GDAL
|
8
|
-
module CPLConv
|
9
|
-
extend ::FFI::Library
|
10
|
-
ffi_lib 'gdal'
|
11
7
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
VSIFree(pointer)
|
17
|
-
end
|
8
|
+
def CPLFree(pointer)
|
9
|
+
extend CPLVSI
|
10
|
+
VSIFree(pointer)
|
11
|
+
end
|
18
12
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
13
|
+
#------------------------------------------------------------------------
|
14
|
+
# cpl_port Typedefs
|
15
|
+
#------------------------------------------------------------------------
|
16
|
+
typedef :int, :GInt32
|
17
|
+
typedef :uint, :GUInt32
|
18
|
+
typedef :short, :GInt16
|
19
|
+
typedef :ushort, :GUInt16
|
20
|
+
typedef :uchar, :GByte
|
21
|
+
typedef :int, :GBool
|
22
|
+
typedef :long_long, :GIntBig
|
23
|
+
typedef :ulong_long, :GUIntBig
|
30
24
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
# Functions
|
27
|
+
#--------------------------------------------------------------------------
|
28
|
+
callback :CPLFileFinder, %i[string string], :string
|
35
29
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
30
|
+
#---------
|
31
|
+
# Config
|
32
|
+
#---------
|
33
|
+
attach_function :CPLVerifyConfiguration, %i[], :void
|
34
|
+
attach_function :CPLGetConfigOption, %i[string string], :string
|
35
|
+
attach_function :CPLSetConfigOption, %i[string string], :void
|
36
|
+
attach_function :CPLSetThreadLocalConfigOption, %i[string string], :void
|
37
|
+
attach_function :CPLFreeConfig, %i[], :void
|
44
38
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
39
|
+
#---------
|
40
|
+
# Memory
|
41
|
+
#---------
|
42
|
+
attach_function :CPLMalloc, %i[size_t], :pointer
|
43
|
+
attach_function :CPLCalloc, %i[size_t size_t], :pointer
|
44
|
+
attach_function :CPLRealloc, %i[pointer size_t], :pointer
|
51
45
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
46
|
+
#---------
|
47
|
+
# Strings
|
48
|
+
#---------
|
49
|
+
attach_function :CPLStrdup, %i[string], :string
|
50
|
+
attach_function :CPLStrlwr, %i[string], :string
|
51
|
+
attach_function :CPLFGets, %i[string int pointer], :string
|
52
|
+
attach_function :CPLReadLine, %i[pointer], :string
|
53
|
+
attach_function :CPLReadLineL, %i[pointer], :string
|
54
|
+
attach_function :CPLReadLine2L, %i[pointer int pointer], :string
|
55
|
+
attach_function :CPLAtof, %i[string], :double
|
56
|
+
attach_function :CPLAtofDelim, %i[string char], :double
|
57
|
+
attach_function :CPLStrtod, %i[string pointer], :double
|
58
|
+
attach_function :CPLStrtodDelim, %i[string pointer char], :double
|
59
|
+
attach_function :CPLStrtof, %i[string pointer], :float
|
60
|
+
attach_function :CPLStrtofDelim, %i[string pointer char], :float
|
61
|
+
attach_function :CPLAtofM, %i[string], :double
|
62
|
+
attach_function :CPLScanString, %i[string int int int], :string
|
63
|
+
attach_function :CPLScanDouble, %i[string int], :double
|
64
|
+
attach_function :CPLScanLong, %i[string int], :long
|
65
|
+
attach_function :CPLScanLong, %i[string int], :ulong
|
66
|
+
attach_function :CPLScanUIntBig, %i[string int], :GUIntBig
|
67
|
+
attach_function :CPLScanPointer, %i[string int], :pointer
|
68
|
+
attach_function :CPLPrintString, %i[string string int], :int
|
69
|
+
attach_function :CPLPrintStringFill, %i[string string int], :int
|
76
70
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
71
|
+
#---------
|
72
|
+
# Numbers to strings
|
73
|
+
#---------
|
74
|
+
attach_function :CPLPrintInt32, %i[string GInt32 int], :int
|
75
|
+
attach_function :CPLPrintUIntBig, %i[string GUIntBig int], :int
|
76
|
+
attach_function :CPLPrintDouble, %i[string string double string], :int
|
77
|
+
attach_function :CPLPrintTime, %i[string int string pointer string], :int
|
78
|
+
attach_function :CPLPrintPointer, %i[string pointer int], :int
|
79
|
+
attach_function :CPLGetSymbol, %i[string string], :pointer
|
86
80
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
81
|
+
#---------
|
82
|
+
# Files
|
83
|
+
#---------
|
84
|
+
attach_function :CPLGetExecPath, %i[string int], :int
|
85
|
+
attach_function :CPLGetPath, %i[string], :string
|
86
|
+
attach_function :CPLGetDirname, %i[string], :string
|
87
|
+
attach_function :CPLGetFilename, %i[string], :string
|
88
|
+
attach_function :CPLGetBasename, %i[string], :string
|
89
|
+
attach_function :CPLGetExtension, %i[string], :string
|
90
|
+
attach_function :CPLGetCurrentDir, [], :string
|
91
|
+
attach_function :CPLFormFilename, %i[string string string], :string
|
92
|
+
attach_function :CPLFormCIFilename, %i[string string string], :string
|
93
|
+
attach_function :CPLResetExtension, %i[string string], :string
|
94
|
+
attach_function :CPLProjectRelativeFilename, %i[string string], :string
|
95
|
+
attach_function :CPLIsFilenameRelative, %i[string], :int
|
96
|
+
attach_function :CPLExtractRelativePath, %i[string string pointer], :string
|
97
|
+
attach_function :CPLCleanTrailingSlash, %i[string], :string
|
98
|
+
attach_function :CPLCorrespondingPaths, %i[string string pointer], :pointer
|
99
|
+
attach_function :CPLCheckForFile, %i[string string], :int
|
100
|
+
attach_function :CPLGenerateTempFilename, %i[string], :string
|
101
|
+
attach_function :CPLFindFile, %i[string string], :string
|
102
|
+
attach_function :CPLDefaultFindFile, %i[string string], :string
|
103
|
+
attach_function :CPLPushFileFinder, %i[CPLFileFinder], :void
|
104
|
+
attach_function :CPLPopFileFinder, %i[], :CPLFileFinder
|
105
|
+
attach_function :CPLPushFinderLocation, %i[string], :void
|
106
|
+
attach_function :CPLPopFinderLocation, %i[], :void
|
107
|
+
attach_function :CPLFinderClean, %i[], :void
|
108
|
+
attach_function :CPLStat, %i[string pointer], :int
|
109
|
+
attach_function :CPLOpenShared, %i[string string int], :pointer
|
110
|
+
attach_function :CPLCloseShared, %i[pointer], :void
|
111
|
+
attach_function :CPLGetSharedList, %i[pointer], :pointer
|
112
|
+
attach_function :CPLDumpSharedList, %i[pointer], :void
|
113
|
+
#attach_function :CPLCleanupSharedFileMutex, %i[], :void
|
120
114
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
115
|
+
attach_function :CPLDMSToDec, %i[string], :double
|
116
|
+
attach_function :CPLDecToDMS, %i[double string int], :string
|
117
|
+
attach_function :CPLPackedDMSToDec, %i[double], :double
|
118
|
+
attach_function :CPLDecToPackedDMS, %i[double], :string
|
119
|
+
attach_function :CPLStringToComplex, %i[string pointer pointer], :void
|
120
|
+
attach_function :CPLUnlinkTree, %i[string], :int
|
121
|
+
attach_function :CPLCopyFile, %i[string string], :int
|
122
|
+
attach_function :CPLMoveFile, %i[string string], :int
|
129
123
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
124
|
+
#---------
|
125
|
+
# Zip Files
|
126
|
+
#---------
|
127
|
+
#attach_function :CPLCreateZip, %i[string pointer], :pointer
|
128
|
+
#attach_function :CPLCreateFileInZip, %i[pointer string pointer], CPLErr
|
129
|
+
#attach_function :CPLWriteFileInZip, %i[pointer pointer int], CPLErr
|
130
|
+
#attach_function :CPLCloseFileInZip, %i[pointer], CPLErr
|
131
|
+
#attach_function :CPLCloseZip, %i[pointer], CPLErr
|
132
|
+
#attach_function :CPLZLibDeflate,
|
133
|
+
# %i[pointer size_t int pointer size_t pointer],
|
134
|
+
# :pointer
|
135
|
+
#attach_function :CPLZLibInflate,
|
136
|
+
# %i[pointer size_t pointer size_t pointer],
|
137
|
+
# :pointer
|
144
138
|
|
145
|
-
|
146
|
-
|
139
|
+
#attach_function :CPLValidateXML, %i[string string pointer], :int
|
140
|
+
#attach_function :CPLsetlocale, %i[int string], :string
|
147
141
|
|
148
|
-
|
149
|
-
end
|
142
|
+
#attach_function :CPLCleanupSetlocaleMutex, %i[], :void
|
150
143
|
end
|
151
144
|
end
|