ffi-gdal 0.0.4 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -1
  3. data/Rakefile +12 -1
  4. data/TODO.md +11 -0
  5. data/ffi-gdal.gemspec +2 -2
  6. data/lib/ext/error_symbols.rb +59 -0
  7. data/lib/ext/float_ext.rb +15 -0
  8. data/lib/ext/narray_ext.rb +16 -0
  9. data/lib/ext/to_bool.rb +2 -0
  10. data/lib/ffi-gdal.rb +139 -4
  11. data/lib/ffi/{gdal/cpl_conv.rb → cpl/conv_h.rb} +2 -3
  12. data/lib/ffi/{gdal/cpl_error.rb → cpl/error_h.rb} +1 -25
  13. data/lib/ffi/cpl/minixml_h.rb +14 -0
  14. data/lib/ffi/{gdal/cpl_string.rb → cpl/string_h.rb} +0 -25
  15. data/lib/ffi/{gdal/cpl_vsi.rb → cpl/vsi_h.rb} +0 -0
  16. data/lib/ffi/cpl/xml_node.rb +13 -0
  17. data/lib/ffi/gdal.rb +57 -593
  18. data/lib/ffi/gdal/alg_h.rb +127 -0
  19. data/lib/ffi/gdal/gdal_grid_data_metrics_options.rb +14 -0
  20. data/lib/ffi/gdal/gdal_grid_inverse_distance_to_a_power_options.rb +19 -0
  21. data/lib/ffi/gdal/gdal_grid_moving_average_options.rb +14 -0
  22. data/lib/ffi/gdal/gdal_grid_nearest_neighbor_options.rb +13 -0
  23. data/lib/ffi/gdal/gdal_h.rb +683 -0
  24. data/lib/ffi/gdal/gdal_rpc_info.rb +27 -0
  25. data/lib/ffi/gdal/gdal_transformer_info.rb +14 -0
  26. data/lib/ffi/gdal/gdal_warp_options.rb +43 -0
  27. data/lib/ffi/gdal/grid_h.rb +51 -0
  28. data/lib/ffi/gdal/version.rb +1 -1
  29. data/lib/ffi/gdal/warper_h.rb +48 -0
  30. data/lib/ffi/ogr.rb +12 -0
  31. data/lib/ffi/ogr/api_h.rb +553 -0
  32. data/lib/ffi/ogr/core_h.rb +148 -0
  33. data/lib/ffi/ogr/featurestyle_h.rb +22 -0
  34. data/lib/ffi/ogr/geocoding_h.rb +21 -0
  35. data/lib/ffi/ogr/ogr_contour_writer_info.rb +14 -0
  36. data/lib/ffi/ogr/ogr_envelope.rb +12 -0
  37. data/lib/ffi/ogr/ogr_envelope_3d.rb +14 -0
  38. data/lib/ffi/ogr/ogr_field.rb +50 -0
  39. data/lib/ffi/ogr/ogr_style_param.rb +12 -0
  40. data/lib/ffi/ogr/ogr_style_value.rb +13 -0
  41. data/lib/ffi/ogr/srs_api_h.rb +325 -0
  42. data/lib/gdal/color_entry.rb +47 -0
  43. data/lib/gdal/color_entry_extensions.rb +30 -0
  44. data/lib/gdal/color_interpretation.rb +15 -0
  45. data/lib/gdal/color_table.rb +146 -0
  46. data/lib/gdal/color_table_extensions.rb +47 -0
  47. data/lib/gdal/color_table_types/cmyk.rb +25 -0
  48. data/lib/gdal/color_table_types/gray.rb +9 -0
  49. data/lib/gdal/color_table_types/hls.rb +21 -0
  50. data/lib/gdal/color_table_types/rgb.rb +25 -0
  51. data/lib/gdal/data_type.rb +38 -0
  52. data/lib/gdal/dataset.rb +437 -0
  53. data/lib/gdal/dataset_extensions.rb +496 -0
  54. data/lib/gdal/driver.rb +244 -0
  55. data/lib/gdal/driver_extensions.rb +56 -0
  56. data/lib/gdal/environment_methods.rb +43 -0
  57. data/lib/{ffi-gdal → gdal}/exceptions.rb +4 -1
  58. data/lib/gdal/geo_transform.rb +188 -0
  59. data/lib/gdal/geo_transform_extensions.rb +90 -0
  60. data/lib/gdal/logger.rb +7 -0
  61. data/lib/{ffi-gdal → gdal}/major_object.rb +15 -14
  62. data/lib/gdal/options.rb +49 -0
  63. data/lib/gdal/raster_attribute_table.rb +185 -0
  64. data/lib/gdal/raster_attribute_table_extensions.rb +40 -0
  65. data/lib/{ffi-gdal → gdal}/raster_band.rb +227 -99
  66. data/lib/gdal/raster_band_extensions.rb +198 -0
  67. data/lib/{ffi-gdal → gdal}/version_info.rb +8 -0
  68. data/lib/gdal/warp_operation.rb +96 -0
  69. data/lib/ogr/coordinate_transformation.rb +108 -0
  70. data/lib/ogr/data_source.rb +172 -0
  71. data/lib/ogr/data_source_extensions.rb +32 -0
  72. data/lib/ogr/driver.rb +119 -0
  73. data/lib/ogr/envelope.rb +80 -0
  74. data/lib/ogr/envelope_extensions.rb +92 -0
  75. data/lib/ogr/exceptions.rb +35 -0
  76. data/lib/ogr/feature.rb +212 -0
  77. data/lib/ogr/feature_definition.rb +120 -0
  78. data/lib/ogr/feature_definition_extensions.rb +36 -0
  79. data/lib/ogr/feature_extensions.rb +31 -0
  80. data/lib/ogr/field.rb +91 -0
  81. data/lib/ogr/field_extensions.rb +23 -0
  82. data/lib/ogr/geocoding_session.rb +84 -0
  83. data/lib/ogr/geometry.rb +617 -0
  84. data/lib/ogr/geometry_extensions.rb +60 -0
  85. data/lib/ogr/geometry_types/collection.rb +45 -0
  86. data/lib/ogr/geometry_types/curve.rb +120 -0
  87. data/lib/ogr/geometry_types/surface.rb +20 -0
  88. data/lib/ogr/layer.rb +226 -0
  89. data/lib/ogr/layer_extensions.rb +55 -0
  90. data/lib/ogr/line_string.rb +7 -0
  91. data/lib/ogr/linear_ring.rb +6 -0
  92. data/lib/ogr/multi_line_string.rb +9 -0
  93. data/lib/ogr/multi_point.rb +7 -0
  94. data/lib/ogr/multi_polygon.rb +14 -0
  95. data/lib/ogr/point.rb +89 -0
  96. data/lib/ogr/polygon.rb +9 -0
  97. data/lib/ogr/spatial_reference.rb +723 -0
  98. data/lib/ogr/spatial_reference_extensions.rb +32 -0
  99. data/lib/ogr/style_table.rb +17 -0
  100. data/lib/ogr/style_table_extensions.rb +16 -0
  101. data/spec/{ffi-gdal/integration → integration}/color_table_info_spec.rb +1 -1
  102. data/spec/{ffi-gdal/integration → integration}/dataset_info_spec.rb +0 -0
  103. data/spec/{ffi-gdal/integration → integration}/driver_info_spec.rb +1 -1
  104. data/spec/{ffi-gdal/integration → integration}/geo_transform_info_spec.rb +0 -0
  105. data/spec/{ffi-gdal/integration → integration}/raster_attribute_table_info_spec.rb +1 -1
  106. data/spec/{ffi-gdal/integration → integration}/raster_band_info_spec.rb +5 -5
  107. data/spec/spec_helper.rb +4 -1
  108. data/spec/support/shapefiles/states_21basic/states.prj +1 -0
  109. data/spec/support/shapefiles/states_21basic/states.sbn +0 -0
  110. data/spec/support/shapefiles/states_21basic/states.sbx +0 -0
  111. data/spec/support/shapefiles/states_21basic/states.shp +0 -0
  112. data/spec/support/worldfiles/SR_50M/SR_50M.VERSION.txt +1 -0
  113. data/spec/support/worldfiles/SR_50M/SR_50M.prj +1 -0
  114. data/spec/support/worldfiles/SR_50M/SR_50M.tfw +6 -0
  115. data/spec/{ext/cpl_error_symbols_spec.rb → unit/ext/error_symbols_spec.rb} +1 -1
  116. data/spec/unit/gdal/color_table_spec.rb +146 -0
  117. data/spec/unit/ogr/layer_spec.rb +97 -0
  118. data/spec/unit/ogr/linear_ring_spec.rb +111 -0
  119. data/spec/unit/ogr/point_spec.rb +321 -0
  120. data/spec/{ffi-gdal/unit → unit}/version_info_spec.rb +1 -1
  121. data/testing_gdal.rb +168 -0
  122. data/testing_gdalwarp.rb +91 -0
  123. data/testing_layer_to_layer.rb +35 -0
  124. data/testing_ndvi.rb +76 -0
  125. data/testing_nir.rb +77 -0
  126. data/testing_ogr.rb +63 -0
  127. metadata +167 -59
  128. data/lib/ext/cpl_error_symbols.rb +0 -37
  129. data/lib/ffi-gdal/color_table.rb +0 -59
  130. data/lib/ffi-gdal/dataset.rb +0 -359
  131. data/lib/ffi-gdal/driver.rb +0 -151
  132. data/lib/ffi-gdal/geo_transform.rb +0 -137
  133. data/lib/ffi-gdal/raster_attribute_table.rb +0 -78
  134. data/lib/ffi/gdal/ogr_api.rb +0 -21
  135. data/lib/ffi/gdal/ogr_core.rb +0 -195
  136. data/lib/ffi/gdal/ogr_srs_api.rb +0 -44
  137. data/meow.rb +0 -144
  138. data/rubby.rb +0 -224
data/lib/ffi/gdal.rb CHANGED
@@ -1,9 +1,57 @@
1
1
  require 'ffi'
2
2
 
3
3
  module FFI
4
+ module Library
5
+ alias_method :old_attach_function, :attach_function
6
+
7
+ def attach_function(*args)
8
+ old_attach_function(*args)
9
+ rescue FFI::NotFoundError
10
+ @unsupported_gdal_functions ||= []
11
+ warn "Function '#{args.first}' is not available in this build of GDAL/OGR v#{FFI::GDAL.GDALVersionInfo('RELEASE_NAME')}"
12
+ @unsupported_gdal_functions << args.first
13
+ end
14
+
15
+ def unsupported_gdal_functions
16
+ @unsupported_gdal_functions ||= []
17
+ end
18
+ end
19
+
4
20
  module GDAL
5
21
  extend ::FFI::Library
6
22
 
23
+ autoload :GDALColorEntry,
24
+ File.expand_path('gdal/gdal_color_entry', __dir__)
25
+ autoload :GDALGCP,
26
+ File.expand_path('gdal/gdal_gcp', __dir__)
27
+ autoload :GDALGridDataMetricsOptions,
28
+ File.expand_path('gdal/gdal_grid_data_metrics_options', __dir__)
29
+ autoload :GDALGridInverseDistanceToAPowerOptions,
30
+ File.expand_path('gdal/gdal_grid_inverse_distance_to_a_power_options', __dir__)
31
+ autoload :GDALGridMovingAverageOptions,
32
+ File.expand_path('gdal/gdal_grid_moving_average_options', __dir__)
33
+ autoload :GDALGridNearestNeighborOptions,
34
+ File.expand_path('gdal/gdal_grid_nearest_neighbor_options', __dir__)
35
+ autoload :GDALRPCInfo,
36
+ File.expand_path('gdal/gdal_rpc_info', __dir__)
37
+ autoload :GDALTransformerInfo,
38
+ File.expand_path('gdal/gdal_transformer_info', __dir__)
39
+ autoload :GDALWarpOptions,
40
+ File.expand_path('gdal/gdal_warp_options', __dir__)
41
+
42
+ autoload :OGRContourWriterInfo,
43
+ File.expand_path('ogr/ogr_contour_writer_info', __dir__)
44
+ autoload :OGREnvelope,
45
+ File.expand_path('ogr/ogr_envelope', __dir__)
46
+ autoload :OGREnvelope3D,
47
+ File.expand_path('ogr/ogr_envelope_3d', __dir__)
48
+ autoload :OGRField,
49
+ File.expand_path('ogr/ogr_field', __dir__)
50
+ autoload :OGRStyleParam,
51
+ File.expand_path('ogr/ogr_style_param', __dir__)
52
+ autoload :OGRStyleValue,
53
+ File.expand_path('ogr/ogr_style_value', __dir__)
54
+
7
55
  def self.search_paths
8
56
  @search_paths ||= begin
9
57
  return if ENV['GDAL_LIBRARY_PATH']
@@ -33,602 +81,18 @@ module FFI
33
81
  end
34
82
 
35
83
  ffi_lib(gdal_library_path)
84
+
85
+ attach_function :GDALVersionInfo, %i[string], :string
86
+ attach_function :GDALCheckVersion, %i[int int string], :bool
36
87
  end
37
88
  end
38
89
 
39
90
  require_relative 'gdal/version'
40
- require_relative 'gdal/cpl_conv'
41
- require_relative 'gdal/cpl_error'
42
- require_relative 'gdal/cpl_string'
43
- require_relative 'gdal/cpl_vsi'
44
- require_relative 'gdal/gdal_color_entry'
45
- require_relative 'gdal/gdal_gcp'
46
- require_relative 'gdal/ogr_core'
47
- require_relative 'gdal/ogr_api'
48
- require_relative 'gdal/ogr_srs_api'
91
+ require_relative 'cpl/conv_h'
92
+ require_relative 'cpl/error_h'
93
+ require_relative 'cpl/minixml_h'
94
+ require_relative 'cpl/string_h'
95
+ require_relative 'cpl/vsi_h'
49
96
  require_relative '../ext/to_bool'
50
97
 
51
- module FFI
52
- module GDAL
53
-
54
- #-----------------------------------------------------------------
55
- # Defines
56
- #-----------------------------------------------------------------
57
- GDALMD_AREA_OR_POINT = 'AREA_OR_POINT'
58
- GDALMD_AOP_AREA = 'Area'
59
- GDALMD_AOP_POINT = 'Point'
60
-
61
- CPLE_WrongFormat = 200
62
-
63
- GDAL_DMD_LONGNAME = 'DMD_LONGNAME'
64
- GDAL_DMD_HELPTOPIC = 'DMD_HELPTOPIC'
65
- GDAL_DMD_MIMETYPE = 'DMD_MIMETYPE'
66
- GDAL_DMD_EXTENSION = 'DMD_EXTENSION'
67
- GDAL_DMD_EXTENSIONS = 'DMD_EXTENSIONS'
68
- GDAL_DMD_CREATIONOPTIONLIST = 'DMD_CREATIONOPTIONLIST'
69
- GDAL_DMD_OPTIONLIST = 'DMD_OPTIONLIST'
70
- GDAL_DMD_CREATIONDATATYPES = 'DMD_CREATIONDATATYPES'
71
- GDAL_DMD_SUBDATASETS = 'DMD_SUBDATASETS'
72
-
73
- GDAL_DCAP_OPEN = 'DCAP_OPEN'
74
- GDAL_DCAP_CREATE = 'DCAP_CREATE'
75
- GDAL_DCAP_CREATECOPY = 'DCAP_CREATECOPY'
76
- GDAL_DCAP_VIRTUALIO = 'DCAP_VIRTUALIO'
77
- GDAL_DCAP_RASTER = 'DCAP_RASTER'
78
- GDAL_DCAP_VECTOR = 'DCAP_VECTOR'
79
-
80
- GDAL_OF_READONLY = 0x00
81
- GDAL_OF_UPDATE = 0x01
82
- GDAL_OF_ALL = 0x00
83
- GDAL_OF_RASTER = 0x02
84
- GDAL_OF_VECTOR = 0x04
85
- GDAL_OF_SHARED = 0x20
86
- GDAL_OF_VERBOSE_ERROR = 0x40
87
-
88
- GDAL_DS_LAYER_CREATIONOPTIONLIST= 'DS_LAYER_CREATIONOPTIONLIST'
89
-
90
- GMF_ALL_VALID = 0x01
91
- GMF_PER_DATASET = 0x02
92
- GMF_ALPHA = 0x04
93
- GMF_NODATA = 0x08
94
-
95
- def srcval(popo_source, e_src_type, ii)
96
- end
97
-
98
- def gdal_check_version(psz_calling_component_name)
99
- end
100
-
101
- #-----------------------------------------------------------------
102
- # Enums
103
- #-----------------------------------------------------------------
104
- GDALDataType = enum :GDT_Unknown, 0,
105
- :GDT_Byte, 1,
106
- :GDT_UInt16, 2,
107
- :GDT_Int16, 3,
108
- :GDT_UInt32, 4,
109
- :GDT_Int32, 5,
110
- :GDT_Float32, 6,
111
- :GDT_Float64, 7,
112
- :GDT_CInt16, 8,
113
- :GDT_CInt32, 9,
114
- :GDT_CFloat32, 10,
115
- :GDT_CFloat64, 11,
116
- :GDT_TypeCount, 12
117
-
118
- GDALAsyncStatusType = enum :GARIO_PENDING, 0,
119
- :GARIO_UPDATE, 1,
120
- :GARIO_ERROR, 2,
121
- :GARIO_COMPLETE, 3,
122
- :GARIO_TypeCount, 4
123
-
124
- GDALAccess = enum :GA_ReadOnly, 0,
125
- :GA_update, 1
126
-
127
- GDALRWFlag = enum :GF_Read, 0,
128
- :GF_Write, 1
129
-
130
- GDALColorInterp = enum :GCI_Undefined, 0,
131
- :GCI_GrayIndex, 1,
132
- :GCI_PaletteIndex, 2,
133
- :GCI_RedBand, 3,
134
- :GCI_GreenBand, 4,
135
- :GCI_BlueBand, 5,
136
- :GCI_AlphaBand, 6,
137
- :GCI_HueBand, 7,
138
- :GCI_SaturationBand, 8,
139
- :GCI_LightnessBand, 9,
140
- :GCI_CyanBand, 10,
141
- :GCI_MagentaBand, 11,
142
- :GCI_YellowBand, 12,
143
- :GCI_BlackBand, 13,
144
- :GCI_YCbCr_YBand, 14,
145
- :GCI_YCbCr_CbBand, 15,
146
- :GCI_YCbCr_CrBand, 16,
147
- :GCI_Max, 16 # Seems wrong that this is also 16...
148
-
149
- GDALPaletteInterp = enum :GPI_Gray, 0,
150
- :GPI_RGB, 1,
151
- :GPI_CMYK, 2,
152
- :GPI_HLS, 3
153
-
154
- GDALRATFieldType = enum :GFT_Integer,
155
- :GFT_Real,
156
- :GFT_String
157
-
158
- GDALRATFieldUsage = enum :GFU_Generic, 0,
159
- :GFU_PixelCount, 1,
160
- :GFU_Name, 2,
161
- :GFU_Min, 3,
162
- :GFU_Max, 4,
163
- :GFU_MinMax, 5,
164
- :GFU_Red, 6,
165
- :GFU_Green, 7,
166
- :GFU_Blue, 8,
167
- :GFU_Alpha, 9,
168
- :GFU_RedMin, 10,
169
- :GFU_GreenMin, 11,
170
- :GFU_BlueMin, 12,
171
- :GFU_AlphaMin, 13,
172
- :GFU_RedMax, 14,
173
- :GFU_GreenMax, 15,
174
- :GFU_BlueMax, 16,
175
- :GFU_AlphaMax, 17,
176
- :GFU_MaxCount
177
-
178
- GDALTileOrganization = enum :GTO_TIP,
179
- :GTO_BIT,
180
- :GTO_BSQ
181
-
182
- #-----------------------------------------------------------------
183
- # typedefs
184
- #-----------------------------------------------------------------
185
- typedef :pointer, :GDALMajorObjectH
186
- typedef :pointer, :GDALDatasetH
187
- typedef :pointer, :GDALRasterBandH
188
- typedef :pointer, :GDALDriverH
189
- typedef :pointer, :GDALColorTableH
190
- typedef :pointer, :GDALRasterAttributeTableH
191
- typedef :pointer, :GDALAsyncReaderH
192
- #typedef :pointer, :OGRGeometryH
193
-
194
- #-----------------------------------------------------------------
195
- # functions
196
- #-----------------------------------------------------------------
197
- # @param completion [Float]
198
- # @param message [String]
199
- # @param progress_arg [Pointer]
200
- # @return [Boolean] true if the operation should continue; false if the
201
- # user has cancelled.
202
- callback :GDALProgressFunc, [:double, :string, :pointer], :bool
203
-
204
- callback :GDALDerivedPixelFunc,
205
- [:pointer, :int, :pointer, :int, :int, GDALDataType, GDALDataType, :int, :int],
206
- :int
207
-
208
- attach_function :GDALVersionInfo, %i[string], :string
209
-
210
- # DataType
211
- attach_function :GDALGetDataTypeSize, [GDALDataType], :int
212
- attach_function :GDALDataTypeIsComplex, [GDALDataType], :int
213
- attach_function :GDALGetDataTypeName, [GDALDataType], :string
214
- attach_function :GDALGetDataTypeByName, [:string], GDALDataType
215
- attach_function :GDALDataTypeUnion, [GDALDataType, GDALDataType], GDALDataType
216
-
217
- # AsyncStatus
218
- #attach_function :GDALGetAsyncStatusTypeName, [GDALAsyncStatusType], :string
219
- #attach_function :GDALGetAsyncStatusTypeByName, [:string], GDALAsyncStatusType
220
-
221
- # ColorInterpretation
222
- attach_function :GDALGetColorInterpretationName, [GDALColorInterp], :string
223
- attach_function :GDALGetColorInterpretationByName, [:string], GDALColorInterp
224
-
225
- # PaletteInterpretation
226
- attach_function :GDALGetPaletteInterpretationName, [GDALPaletteInterp], :string
227
- attach_function :GDALGetPaletteInterpretation, [:GDALColorTableH], GDALPaletteInterp
228
- attach_function :GDALGetColorEntryCount, [:GDALColorTableH], :int
229
- attach_function :GDALGetColorEntry, [:GDALColorTableH, :int], GDALColorEntry.ptr
230
- attach_function :GDALGetColorEntryAsRGB, [:GDALColorTableH, :int, GDALColorEntry], :int
231
-
232
- attach_function :GDALAllRegister, [], :void
233
- attach_function :GDALCreate,
234
- [:GDALDriverH, :string, :int, :int, :int, GDALDataType, :pointer],
235
- :GDALDatasetH
236
- attach_function :GDALCreateCopy,
237
- [:GDALDriverH, :string, :GDALDatasetH, :int, :pointer, :GDALProgressFunc, :pointer],
238
- :GDALDatasetH
239
- attach_function :GDALIdentifyDriver,
240
- [:string, :pointer],
241
- :GDALDriverH
242
- attach_function :GDALOpen, [:string, GDALAccess], :GDALDatasetH
243
- attach_function :GDALOpenShared,
244
- [:string, GDALAccess],
245
- :GDALDatasetH
246
- #attach_function :GDALOpenEx,
247
- #[:string, :uint, :string, :string, :string],
248
- #:GDALDatasetH
249
-
250
- attach_function :GDALDumpOpenDatasets, [:pointer], :int
251
- attach_function :GDALGetDriverByName, [:string], :GDALDriverH
252
- attach_function :GDALGetDriverCount, [], :int
253
- attach_function :GDALGetDriver, [:int], :GDALDriverH
254
- attach_function :GDALDestroyDriver, [:GDALDriverH], :void
255
- attach_function :GDALRegisterDriver, [:GDALDriverH], :int
256
- attach_function :GDALDeregisterDriver, [:GDALDriverH], :void
257
- attach_function :GDALDestroyDriverManager, [:void], :void
258
- #attach_function :GDALDestroy, [], :void
259
-
260
- attach_function :GDALDeleteDataset, [:GDALDriverH, :string], CPLErr
261
- attach_function :GDALRenameDataset,
262
- [:GDALDriverH, :string, :string],
263
- CPLErr
264
- attach_function :GDALCopyDatasetFiles,
265
- [:GDALDriverH, :string, :string],
266
- CPLErr
267
-
268
- attach_function :GDALValidateCreationOptions,
269
- [:GDALDriverH, :pointer],
270
- CPLErr
271
-
272
- attach_function :GDALGetDriverShortName, [:GDALDriverH], :string
273
- attach_function :GDALGetDriverLongName, [:GDALDriverH], :string
274
- attach_function :GDALGetDriverHelpTopic, [:GDALDriverH], :string
275
- attach_function :GDALGetDriverCreationOptionList, [:GDALDriverH], :string
276
-
277
- attach_function :GDALInitGCPs, [:int, :pointer], :void
278
- attach_function :GDALDeinitGCPs, [:int, :pointer], :void
279
- attach_function :GDALDuplicateGCPs, [:int, :pointer], :pointer
280
- attach_function :GDALGCPsToGeoTransform,
281
- [:int, :pointer, :pointer, :int],
282
- :int
283
- attach_function :GDALInvGeoTransform,
284
- [:pointer, :pointer],
285
- :int
286
- attach_function :GDALApplyGeoTransform,
287
- [:pointer, :double, :double, :pointer, :pointer],
288
- :void
289
- #attach_function :GDALComposeGeoTransforms,
290
- # [:pointer, :pointer, :pointer],
291
- # :void
292
-
293
- #attach_function :GDALGetMetadataDomainList, [:GDALMajorObjectH], :pointer
294
- attach_function :GDALGetMetadata, [:GDALMajorObjectH, :string], :pointer
295
- attach_function :GDALSetMetadata,
296
- [:GDALMajorObjectH, :pointer, :string],
297
- CPLErr
298
- attach_function :GDALGetMetadataItem,
299
- [:GDALMajorObjectH, :string, :string],
300
- :string
301
- attach_function :GDALSetMetadataItem,
302
- [:GDALMajorObjectH, :string, :string, :string],
303
- CPLErr
304
- attach_function :GDALGetDescription, [:GDALMajorObjectH], :string
305
- attach_function :GDALSetDescription, [:GDALMajorObjectH, :string], :void
306
-
307
- attach_function :GDALGetDatasetDriver, [:GDALMajorObjectH], :GDALDriverH
308
- attach_function :GDALGetFileList, [:GDALDatasetH], :pointer
309
- attach_function :GDALClose, [:GDALDatasetH], :void
310
-
311
- #-----------------
312
- # Raster functions
313
- #-----------------
314
- attach_function :GDALGetRasterXSize, [:GDALDatasetH], :int
315
- attach_function :GDALGetRasterYSize, [:GDALDatasetH], :int
316
- attach_function :GDALGetRasterCount, [:GDALDatasetH], :int
317
- attach_function :GDALGetRasterBand, [:GDALDatasetH, :int], :GDALRasterBandH
318
-
319
- attach_function :GDALAddBand,
320
- [:GDALDatasetH, GDALDataType, :pointer],
321
- CPLErr
322
-
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
345
-
346
- attach_function :GDALDatasetRasterIO,
347
- [
348
- :GDALDatasetH,
349
- GDALRWFlag,
350
- :int,
351
- :int,
352
- :int,
353
- :int,
354
- :pointer,
355
- :int,
356
- :int,
357
- GDALDataType,
358
- :int,
359
- :pointer,
360
- :int,
361
- :int,
362
- :int
363
- ], CPLErr
364
-
365
- attach_function :GDALDatasetAdviseRead,
366
- [
367
- :GDALDatasetH,
368
- :int,
369
- :int,
370
- :int,
371
- :int,
372
- :int,
373
- :int,
374
- GDALDataType,
375
- :int,
376
- :pointer,
377
- :pointer
378
- ], CPLErr
379
-
380
- #-----------------
381
- # Projection functions
382
- #-----------------
383
- attach_function :GDALGetProjectionRef, [:GDALDatasetH], :string
384
- attach_function :GDALSetProjection, [:GDALDatasetH, :string], CPLErr
385
- attach_function :GDALGetGeoTransform, [:GDALDatasetH, :pointer], CPLErr
386
- attach_function :GDALSetGeoTransform,
387
- [:GDALDatasetH, :pointer],
388
- CPLErr
389
- attach_function :GDALGetGCPCount, [:GDALDatasetH], :int
390
- attach_function :GDALGetGCPProjection, [:GDALDatasetH], :string
391
- attach_function :GDALGetGCPs, [:GDALDatasetH], :pointer
392
- attach_function :GDALSetGCPs,
393
- [:GDALDatasetH, :int, :pointer, :string],
394
- CPLErr
395
-
396
- attach_function :GDALGetInternalHandle, [:GDALDatasetH, :string], :pointer
397
- attach_function :GDALReferenceDataset, [:GDALDatasetH], :int
398
- attach_function :GDALDereferenceDataset, [:GDALDatasetH], :int
399
-
400
- attach_function :GDALBuildOverviews,
401
- [
402
- :GDALDatasetH,
403
- :string,
404
- :int,
405
- :pointer,
406
- :int,
407
- :pointer,
408
- :GDALProgressFunc,
409
- :pointer
410
- ], CPLErr
411
-
412
- attach_function :GDALGetOpenDatasets, [:pointer, :pointer], :void
413
- attach_function :GDALGetAccess, [:GDALDatasetH], :int
414
- attach_function :GDALFlushCache, [:GDALDatasetH], :void
415
- attach_function :GDALCreateDatasetMaskBand, [:GDALDatasetH, :int], CPLErr
416
- attach_function :GDALDatasetCopyWholeRaster,
417
- [:GDALDatasetH, :GDALDatasetH, :pointer, :GDALProgressFunc, :pointer],
418
- CPLErr
419
- #attach_function :GDALRasterBandCopyWholeRaster,
420
- # [
421
- # :GDALRasterBandH,
422
- # :GDALRasterBandH,
423
- # :pointer,
424
- # :GDALProgressFunc,
425
- # :pointer
426
- # ], CPLErr
427
- attach_function :GDALRegenerateOverviews,
428
- [
429
- :GDALRasterBandH,
430
- :int,
431
- :pointer,
432
- :string,
433
- :GDALProgressFunc,
434
- :pointer
435
- ], CPLErr
436
- attach_function :GDALGetMaskBand, [:GDALRasterBandH], :GDALRasterBandH
437
- attach_function :GDALGetMaskFlags, [:GDALRasterBandH], :int
438
- #attach_function :GDALDatasetGetLayerCount, [:GDALDatasetH], :int
439
- #attach_function :GDALDatasetGetLayer, [:GDALDatasetH, :int], :OGRLayerH
440
- #attach_function :GDALDatasetGetLayerByName, [:GDALDatasetH, :string], :OGRLayerH
441
- #attach_function :GDALDatasetDeleteLayer, [:GDALDatasetH, :int], :OGRErr
442
- #attach_function :GDALDatasetCreateLayer
443
- #attach_function :GDALDatasetCopyLayer
444
- #attach_function :GDALDatasetTestCapability, [:GDALDatasetH, :string], :int
445
- #attach_function :GDALDatasetExecuteSQL,
446
- # [:GDALDatasetH, :string, :OGRGeometryH, :string],
447
- # :int
448
- #attach_function :GDALDatasetReleaseResultSet
449
- #attach_function :GDALDatasetGetStyleTable, [:GDALDatasetH], :OGRStyleTableH
450
- #attach_function :GDALDatasetSetStyleTableDirectly
451
- #attach_function :GDALDatasetSetStyleTable
452
-
453
- attach_function :GDALGetRasterDataType, [:GDALRasterBandH], GDALDataType
454
- attach_function :GDALGetBlockSize,
455
- [:GDALRasterBandH, :pointer, :pointer],
456
- GDALDataType
457
-
458
- attach_function :GDALRasterAdviseRead,
459
- [
460
- :GDALRasterBandH,
461
- :int,
462
- :int,
463
- :int,
464
- :int,
465
- :int,
466
- :int,
467
- GDALDataType,
468
- :pointer
469
- ], CPLErr
470
-
471
- attach_function :GDALRasterIO,
472
- [
473
- :GDALRasterBandH,
474
- GDALRWFlag,
475
- :int,
476
- :int,
477
- :int,
478
- :int,
479
- :pointer,
480
- :int,
481
- :int,
482
- GDALDataType,
483
- :int,
484
- :int
485
- ], CPLErr
486
- attach_function :GDALReadBlock,
487
- [:GDALRasterBandH, :int, :int, :pointer],
488
- CPLErr
489
- attach_function :GDALWriteBlock,
490
- [:GDALRasterBandH, :int, :int, :pointer],
491
- CPLErr
492
- attach_function :GDALGetRasterBandXSize, [:GDALRasterBandH], :int
493
- attach_function :GDALGetRasterBandYSize, [:GDALRasterBandH], :int
494
- attach_function :GDALGetRasterAccess, [:GDALRasterBandH], GDALAccess
495
- attach_function :GDALGetBandNumber, [:GDALRasterBandH], :int
496
- attach_function :GDALGetBandDataset, [:GDALRasterBandH], :GDALDatasetH
497
- attach_function :GDALGetRasterColorInterpretation,
498
- [:GDALRasterBandH],
499
- GDALColorInterp
500
- attach_function :GDALSetRasterColorInterpretation,
501
- [:GDALRasterBandH, GDALColorInterp],
502
- CPLErr
503
- attach_function :GDALGetRasterColorTable,
504
- [:GDALRasterBandH],
505
- :GDALColorTableH
506
-
507
- attach_function :GDALHasArbitraryOverviews, [:GDALRasterBandH], :int
508
- attach_function :GDALGetOverviewCount, [:GDALRasterBandH], :int
509
- attach_function :GDALGetOverview, [:GDALRasterBandH, :int], :GDALRasterBandH
510
- attach_function :GDALGetRasterNoDataValue,
511
- [:GDALRasterBandH, :pointer],
512
- :double
513
- attach_function :GDALSetRasterNoDataValue,
514
- [:GDALRasterBandH, :double],
515
- CPLErr
516
- attach_function :GDALGetRasterCategoryNames,
517
- [:GDALRasterBandH],
518
- :pointer
519
- attach_function :GDALSetRasterCategoryNames,
520
- [:GDALRasterBandH, :pointer],
521
- CPLErr
522
- attach_function :GDALGetRasterMinimum,
523
- [:GDALRasterBandH, :pointer],
524
- :double
525
- attach_function :GDALGetRasterMaximum,
526
- [:GDALRasterBandH, :pointer],
527
- :double
528
- attach_function :GDALGetRasterStatistics,
529
- [:GDALRasterBandH, :bool, :bool, :pointer, :pointer, :pointer, :pointer],
530
- CPLErr
531
- attach_function :GDALComputeRasterStatistics,
532
- [
533
- :GDALRasterBandH,
534
- :int,
535
- :int,
536
- :pointer,
537
- :pointer,
538
- :pointer,
539
- :pointer,
540
- :GDALProgressFunc,
541
- :pointer
542
- ], CPLErr
543
- attach_function :GDALSetRasterStatistics,
544
- [:GDALRasterBandH, :double, :double, :double, :double],
545
- CPLErr
546
- attach_function :GDALGetRasterUnitType, [:GDALRasterBandH], :string
547
- #attach_function :GDALSetRasterUnitType, [:GDALRasterBandH, :string], CPLErr
548
- attach_function :GDALGetRasterOffset, [:GDALRasterBandH, :pointer], :double
549
- attach_function :GDALSetRasterOffset, [:GDALRasterBandH, :double], CPLErr
550
- attach_function :GDALGetRasterScale, [:GDALRasterBandH, :pointer], :double
551
- attach_function :GDALSetRasterScale, [:GDALRasterBandH, :double], CPLErr
552
- attach_function :GDALComputeRasterMinMax,
553
- [:GDALRasterBandH, :int, :pointer],
554
- :void
555
- attach_function :GDALFlushRasterCache, [:GDALRasterBandH], CPLErr
556
- attach_function :GDALGetRasterHistogram,
557
- [
558
- :GDALRasterBandH,
559
- :double,
560
- :double,
561
- :int,
562
- :pointer,
563
- :bool,
564
- :bool,
565
- :GDALProgressFunc,
566
- :pointer
567
- ], CPLErr
568
-
569
- attach_function :GDALGetDefaultHistogram,
570
- [
571
- :GDALRasterBandH,
572
- :pointer,
573
- :pointer,
574
- :pointer,
575
- :pointer,
576
- :bool,
577
- :GDALProgressFunc,
578
- :pointer
579
- ], CPLErr
580
- attach_function :GDALSetDefaultHistogram,
581
- [
582
- :GDALRasterBandH,
583
- :double,
584
- :double,
585
- :int,
586
- :pointer
587
- ], CPLErr
588
-
589
- attach_function :GDALGetRandomRasterSample,
590
- [:GDALRasterBandH, :int, :pointer],
591
- :int
592
- attach_function :GDALGetRasterSampleOverview,
593
- [:GDALRasterBandH, :int],
594
- :GDALRasterBandH
595
- attach_function :GDALFillRaster,
596
- [:GDALRasterBandH, :double, :double],
597
- CPLErr
598
-
599
- # Raster Attribute Table functions
600
- attach_function :GDALGetDefaultRAT,
601
- [:GDALRasterBandH],
602
- :GDALRasterAttributeTableH
603
- attach_function :GDALSetDefaultRAT,
604
- [:GDALRasterBandH, :GDALRasterAttributeTableH],
605
- CPLErr
606
- attach_function :GDALRATGetColumnCount,
607
- [:GDALRasterAttributeTableH],
608
- :int
609
- attach_function :GDALRATGetNameOfCol,
610
- [:GDALRasterAttributeTableH, :int],
611
- :string
612
- attach_function :GDALRATGetUsageOfCol,
613
- [:GDALRasterAttributeTableH, :int],
614
- GDALRATFieldUsage
615
- attach_function :GDALRATGetTypeOfCol,
616
- [:GDALRasterAttributeTableH, :int],
617
- GDALRATFieldType
618
- attach_function :GDALRATGetColOfUsage,
619
- [:GDALRasterAttributeTableH, GDALRATFieldUsage],
620
- :int
621
- attach_function :GDALRATGetRowCount,
622
- [:GDALRasterAttributeTableH],
623
- :int
624
- attach_function :GDALRATTranslateToColorTable,
625
- [:GDALRasterAttributeTableH, :int],
626
- :GDALColorTableH
627
- attach_function :GDALRATDumpReadable,
628
- [:GDALRasterAttributeTableH, :string],
629
- :void
630
-
631
- # Register all drivers!
632
- FFI::GDAL.GDALAllRegister
633
- end
634
- end
98
+ require_relative 'gdal/gdal_h'