ffi-gdal 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/.prettierrc.yml +4 -0
  3. data/.rubocop.yml +9 -5
  4. data/.rubocop_todo.yml +5 -11
  5. data/.solargraph.yml +13 -0
  6. data/Changelog-0.x.md +229 -174
  7. data/Changelog.md +21 -5
  8. data/Dockerfile.gdal2 +1 -1
  9. data/Gemfile +12 -2
  10. data/README.md +13 -10
  11. data/Rakefile +6 -6
  12. data/bin/bundle +12 -12
  13. data/bin/rake +7 -7
  14. data/bin/rspec +7 -7
  15. data/bin/rubocop +7 -7
  16. data/examples/extract_and_colorize.rb +15 -15
  17. data/examples/geometries.rb +12 -12
  18. data/examples/gridding.rb +17 -17
  19. data/examples/ogr_layer_to_layer.rb +3 -3
  20. data/examples/raster_erasing.rb +9 -9
  21. data/examples/remove_small_polygons.rb +11 -11
  22. data/examples/testing_gdal.rb +20 -20
  23. data/examples/warping.rb +13 -13
  24. data/ffi-gdal.gemspec +15 -26
  25. data/lib/ext/ffi_library_function_checks.rb +3 -3
  26. data/lib/ext/narray_ext.rb +1 -1
  27. data/lib/ext/to_bool.rb +2 -2
  28. data/lib/ffi/cpl/conv.rb +2 -2
  29. data/lib/ffi/cpl/error.rb +1 -1
  30. data/lib/ffi/cpl/hash_set.rb +2 -2
  31. data/lib/ffi/cpl/http.rb +3 -3
  32. data/lib/ffi/cpl/http_result.rb +2 -2
  33. data/lib/ffi/cpl/list.rb +1 -1
  34. data/lib/ffi/cpl/mime_part.rb +1 -1
  35. data/lib/ffi/cpl/minixml.rb +2 -2
  36. data/lib/ffi/cpl/port.rb +1 -1
  37. data/lib/ffi/cpl/progress.rb +2 -2
  38. data/lib/ffi/cpl/quad_tree.rb +3 -3
  39. data/lib/ffi/cpl/rect_obj.rb +1 -1
  40. data/lib/ffi/cpl/string.rb +1 -1
  41. data/lib/ffi/cpl/vsi.rb +2 -2
  42. data/lib/ffi/cpl/xml_node.rb +1 -1
  43. data/lib/ffi/cpl.rb +11 -11
  44. data/lib/ffi/extensions/gdal/extensions/all.rb +2 -2
  45. data/lib/ffi/extensions/gdal/extensions.rb +2 -2
  46. data/lib/ffi/extensions/rttopo/gbox.rb +1 -1
  47. data/lib/ffi/extensions/rttopo/geom.rb +2 -2
  48. data/lib/ffi/extensions/rttopo.rb +3 -3
  49. data/lib/ffi/gdal/alg.rb +2 -2
  50. data/lib/ffi/gdal/color_entry.rb +1 -1
  51. data/lib/ffi/gdal/gcp.rb +1 -1
  52. data/lib/ffi/gdal/gdal.rb +3 -3
  53. data/lib/ffi/gdal/grid.rb +2 -2
  54. data/lib/ffi/gdal/grid_data_metrics_options.rb +1 -1
  55. data/lib/ffi/gdal/grid_inverse_distance_to_a_power_options.rb +1 -1
  56. data/lib/ffi/gdal/grid_moving_average_options.rb +1 -1
  57. data/lib/ffi/gdal/grid_nearest_neighbor_options.rb +1 -1
  58. data/lib/ffi/gdal/matching.rb +2 -2
  59. data/lib/ffi/gdal/rpc_info.rb +1 -1
  60. data/lib/ffi/gdal/transformer_info.rb +1 -1
  61. data/lib/ffi/gdal/version.rb +1 -1
  62. data/lib/ffi/gdal/vrt.rb +2 -2
  63. data/lib/ffi/gdal/warp_options.rb +1 -1
  64. data/lib/ffi/gdal/warper.rb +2 -2
  65. data/lib/ffi/gdal.rb +22 -22
  66. data/lib/ffi/ogr/api.rb +3 -3
  67. data/lib/ffi/ogr/contour_writer_info.rb +1 -1
  68. data/lib/ffi/ogr/core.rb +9 -9
  69. data/lib/ffi/ogr/envelope.rb +1 -1
  70. data/lib/ffi/ogr/envelope_3d.rb +1 -1
  71. data/lib/ffi/ogr/featurestyle.rb +1 -1
  72. data/lib/ffi/ogr/field.rb +1 -1
  73. data/lib/ffi/ogr/geocoding.rb +2 -2
  74. data/lib/ffi/ogr/srs_api.rb +63 -63
  75. data/lib/ffi/ogr/style_param.rb +2 -2
  76. data/lib/ffi/ogr/style_value.rb +1 -1
  77. data/lib/ffi/ogr.rb +11 -11
  78. data/lib/ffi-gdal.rb +8 -8
  79. data/lib/gdal/color_table.rb +6 -6
  80. data/lib/gdal/dataset/accessors.rb +101 -0
  81. data/lib/gdal/{dataset_mixins → dataset}/algorithm_methods.rb +1 -1
  82. data/lib/gdal/dataset/class_methods.rb +69 -0
  83. data/lib/gdal/dataset/internal_functions.rb +22 -0
  84. data/lib/gdal/{dataset_mixins → dataset}/matching.rb +1 -1
  85. data/lib/gdal/dataset/raster_band_methods.rb +181 -0
  86. data/lib/gdal/{dataset_mixins → dataset}/warp_methods.rb +1 -1
  87. data/lib/gdal/dataset.rb +21 -359
  88. data/lib/gdal/driver.rb +10 -10
  89. data/lib/gdal/environment_methods.rb +1 -1
  90. data/lib/gdal/extensions/all.rb +1 -1
  91. data/lib/gdal/extensions/color_entry/extensions.rb +2 -2
  92. data/lib/gdal/extensions/color_table/extensions.rb +2 -2
  93. data/lib/gdal/extensions/dataset/extensions.rb +11 -11
  94. data/lib/gdal/extensions/driver/extensions.rb +7 -7
  95. data/lib/gdal/extensions/geo_transform/extensions.rb +2 -2
  96. data/lib/gdal/extensions/gridder.rb +8 -8
  97. data/lib/gdal/extensions/gridder_options.rb +6 -6
  98. data/lib/gdal/extensions/raster_attribute_table/extensions.rb +1 -1
  99. data/lib/gdal/extensions/raster_band/algorithm_extensions.rb +4 -4
  100. data/lib/gdal/extensions/raster_band/coloring_extensions.rb +1 -1
  101. data/lib/gdal/extensions/raster_band/extensions.rb +3 -3
  102. data/lib/gdal/extensions/raster_band/io_extensions.rb +4 -4
  103. data/lib/gdal/extensions/raster_band_classifier.rb +3 -3
  104. data/lib/gdal/geo_transform.rb +1 -1
  105. data/lib/gdal/grid.rb +6 -6
  106. data/lib/gdal/grid_algorithms/metric_average_distance.rb +1 -1
  107. data/lib/gdal/grid_algorithms/metric_average_distance_pts.rb +1 -1
  108. data/lib/gdal/grid_algorithms/metric_count.rb +1 -1
  109. data/lib/gdal/grid_algorithms/metric_maximum.rb +1 -1
  110. data/lib/gdal/grid_algorithms/metric_minimum.rb +1 -1
  111. data/lib/gdal/grid_algorithms/metric_range.rb +1 -1
  112. data/lib/gdal/grid_algorithms.rb +9 -9
  113. data/lib/gdal/internal_helpers.rb +3 -3
  114. data/lib/gdal/logger.rb +1 -1
  115. data/lib/gdal/major_object.rb +6 -6
  116. data/lib/gdal/options.rb +2 -2
  117. data/lib/gdal/raster_attribute_table.rb +5 -5
  118. data/lib/gdal/raster_band.rb +24 -24
  119. data/lib/gdal/rpc_info.rb +2 -2
  120. data/lib/gdal/transformer.rb +1 -1
  121. data/lib/gdal/transformers/general_image_projection_transformer.rb +1 -1
  122. data/lib/gdal/transformers/general_image_projection_transformer2.rb +1 -1
  123. data/lib/gdal/transformers/general_image_projection_transformer3.rb +1 -1
  124. data/lib/gdal/version_info.rb +9 -9
  125. data/lib/gdal/virtual_dataset.rb +4 -4
  126. data/lib/gdal/warp_operation.rb +2 -2
  127. data/lib/gdal/warp_options.rb +2 -2
  128. data/lib/gdal.rb +17 -17
  129. data/lib/ogr/coordinate_transformation.rb +5 -5
  130. data/lib/ogr/data_source.rb +9 -9
  131. data/lib/ogr/driver.rb +9 -9
  132. data/lib/ogr/envelope.rb +1 -1
  133. data/lib/ogr/error_handling.rb +1 -1
  134. data/lib/ogr/extensions/all.rb +1 -1
  135. data/lib/ogr/extensions/data_source/capability_methods.rb +4 -4
  136. data/lib/ogr/extensions/data_source/data_source_extensions.rb +1 -1
  137. data/lib/ogr/extensions/driver/capability_methods.rb +3 -3
  138. data/lib/ogr/extensions/envelope/extensions.rb +1 -1
  139. data/lib/ogr/extensions/feature/extensions.rb +1 -1
  140. data/lib/ogr/extensions/feature_definition/extensions.rb +1 -1
  141. data/lib/ogr/extensions/geometries/point/extensions.rb +1 -1
  142. data/lib/ogr/extensions/geometry/container_mixins.rb +10 -10
  143. data/lib/ogr/extensions/geometry/ewkb_io_extensions.rb +3 -3
  144. data/lib/ogr/extensions/geometry/ewkb_record.rb +4 -4
  145. data/lib/ogr/extensions/geometry/extensions.rb +4 -15
  146. data/lib/ogr/extensions/geometry/rttopo_extensions.rb +2 -2
  147. data/lib/ogr/extensions/geometry/wkb_record.rb +3 -3
  148. data/lib/ogr/extensions/geometry_types/curve/extensions.rb +2 -2
  149. data/lib/ogr/extensions/layer/capability_methods.rb +17 -17
  150. data/lib/ogr/extensions/layer/extensions.rb +1 -1
  151. data/lib/ogr/extensions/spatial_reference/extensions.rb +1 -1
  152. data/lib/ogr/extensions/spatial_reference/initializers.rb +2 -2
  153. data/lib/ogr/extensions/style_table/extensions.rb +1 -1
  154. data/lib/ogr/feature.rb +15 -15
  155. data/lib/ogr/feature_definition.rb +2 -2
  156. data/lib/ogr/field.rb +5 -5
  157. data/lib/ogr/field_definition.rb +1 -1
  158. data/lib/ogr/geocoder.rb +1 -1
  159. data/lib/ogr/geometries/geometry_collection.rb +2 -2
  160. data/lib/ogr/geometries/geometry_collection_25d.rb +1 -1
  161. data/lib/ogr/geometries/line_string.rb +1 -1
  162. data/lib/ogr/geometries/line_string_25d.rb +1 -1
  163. data/lib/ogr/geometries/linear_ring.rb +2 -2
  164. data/lib/ogr/geometries/multi_line_string.rb +2 -2
  165. data/lib/ogr/geometries/multi_line_string_25d.rb +1 -1
  166. data/lib/ogr/geometries/multi_point.rb +1 -1
  167. data/lib/ogr/geometries/multi_point_25d.rb +1 -1
  168. data/lib/ogr/geometries/multi_polygon.rb +2 -2
  169. data/lib/ogr/geometries/multi_polygon_25d.rb +1 -1
  170. data/lib/ogr/geometries/point_25d.rb +1 -1
  171. data/lib/ogr/geometries/polygon.rb +2 -2
  172. data/lib/ogr/geometries/polygon_25d.rb +1 -1
  173. data/lib/ogr/geometry.rb +19 -11
  174. data/lib/ogr/geometry_types/container.rb +1 -1
  175. data/lib/ogr/geometry_types/curve.rb +1 -1
  176. data/lib/ogr/internal_helpers.rb +4 -4
  177. data/lib/ogr/layer.rb +8 -8
  178. data/lib/ogr/layer_mixins/ogr_feature_methods.rb +9 -9
  179. data/lib/ogr/layer_mixins/ogr_field_methods.rb +15 -15
  180. data/lib/ogr/layer_mixins/ogr_sql_methods.rb +2 -2
  181. data/lib/ogr/spatial_reference.rb +19 -19
  182. data/lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb +4 -4
  183. data/lib/ogr/spatial_reference_mixins/exporters.rb +9 -9
  184. data/lib/ogr/spatial_reference_mixins/importers.rb +2 -2
  185. data/lib/ogr/spatial_reference_mixins/morphers.rb +2 -2
  186. data/lib/ogr/spatial_reference_mixins/parameter_getter_setters.rb +1 -1
  187. data/lib/ogr/style_table.rb +3 -3
  188. data/lib/ogr/style_tool.rb +1 -1
  189. data/lib/ogr.rb +33 -33
  190. data/rakelib/docker.rake +2 -2
  191. metadata +11 -145
data/lib/ffi/gdal.rb CHANGED
@@ -1,34 +1,34 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
4
- require 'ffi/tools/const_generator'
5
- require_relative 'gdal/exceptions'
6
- require_relative '../ext/ffi_library_function_checks'
3
+ require "ffi"
4
+ require "ffi/tools/const_generator"
5
+ require_relative "gdal/exceptions"
6
+ require_relative "../ext/ffi_library_function_checks"
7
7
 
8
8
  module FFI
9
9
  module GDAL
10
10
  extend ::FFI::Library
11
11
 
12
- autoload :Alg, File.expand_path('gdal/alg.rb', __dir__)
13
- autoload :ColorEntry, File.expand_path('gdal/color_entry.rb', __dir__)
14
- autoload :GDAL, File.expand_path('gdal/gdal.rb', __dir__)
15
- autoload :GCP, File.expand_path('gdal/gcp.rb', __dir__)
16
- autoload :Grid, File.expand_path('gdal/grid.rb', __dir__)
17
- autoload :GridDataMetricsOptions, File.expand_path('gdal/grid_data_metrics_options.rb', __dir__)
12
+ autoload :Alg, File.expand_path("gdal/alg.rb", __dir__)
13
+ autoload :ColorEntry, File.expand_path("gdal/color_entry.rb", __dir__)
14
+ autoload :GDAL, File.expand_path("gdal/gdal.rb", __dir__)
15
+ autoload :GCP, File.expand_path("gdal/gcp.rb", __dir__)
16
+ autoload :Grid, File.expand_path("gdal/grid.rb", __dir__)
17
+ autoload :GridDataMetricsOptions, File.expand_path("gdal/grid_data_metrics_options.rb", __dir__)
18
18
  autoload :GridInverseDistanceToAPowerOptions,
19
- File.expand_path('gdal/grid_inverse_distance_to_a_power_options.rb', __dir__)
20
- autoload :GridMovingAverageOptions, File.expand_path('gdal/grid_moving_average_options.rb', __dir__)
21
- autoload :GridNearestNeighborOptions, File.expand_path('gdal/grid_nearest_neighbor_options.rb', __dir__)
22
- autoload :Matching, File.expand_path('gdal/matching.rb', __dir__)
23
- autoload :RPCInfo, File.expand_path('gdal/rpc_info.rb', __dir__)
24
- autoload :TransformerInfo, File.expand_path('gdal/transformer_info.rb', __dir__)
25
- autoload :VRT, File.expand_path('gdal/vrt.rb', __dir__)
26
- autoload :Warper, File.expand_path('gdal/warper.rb', __dir__)
27
- autoload :WarpOptions, File.expand_path('gdal/warp_options.rb', __dir__)
19
+ File.expand_path("gdal/grid_inverse_distance_to_a_power_options.rb", __dir__)
20
+ autoload :GridMovingAverageOptions, File.expand_path("gdal/grid_moving_average_options.rb", __dir__)
21
+ autoload :GridNearestNeighborOptions, File.expand_path("gdal/grid_nearest_neighbor_options.rb", __dir__)
22
+ autoload :Matching, File.expand_path("gdal/matching.rb", __dir__)
23
+ autoload :RPCInfo, File.expand_path("gdal/rpc_info.rb", __dir__)
24
+ autoload :TransformerInfo, File.expand_path("gdal/transformer_info.rb", __dir__)
25
+ autoload :VRT, File.expand_path("gdal/vrt.rb", __dir__)
26
+ autoload :Warper, File.expand_path("gdal/warper.rb", __dir__)
27
+ autoload :WarpOptions, File.expand_path("gdal/warp_options.rb", __dir__)
28
28
 
29
29
  # @return [String]
30
30
  def self.gdal_library_path
31
- @gdal_library_path ||= ENV.fetch('GDAL_LIBRARY_PATH', 'gdal')
31
+ @gdal_library_path ||= ENV.fetch("GDAL_LIBRARY_PATH", "gdal")
32
32
  end
33
33
 
34
34
  # @return [Array<String>] Related files that contain C constants.
@@ -67,5 +67,5 @@ module FFI
67
67
  end
68
68
  end
69
69
 
70
- require_relative 'gdal/version'
71
- require_relative '../ext/to_bool'
70
+ require_relative "gdal/version"
71
+ require_relative "../ext/to_bool"
data/lib/ffi/ogr/api.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
4
- require_relative '../gdal'
5
- require_relative '../../ext/ffi_library_function_checks'
3
+ require "ffi"
4
+ require_relative "../gdal"
5
+ require_relative "../../ext/ffi_library_function_checks"
6
6
 
7
7
  module FFI
8
8
  module OGR
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
3
+ require "ffi"
4
4
 
5
5
  module FFI
6
6
  module OGR
data/lib/ffi/ogr/core.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
4
- require_relative '../gdal'
5
- require_relative '../../ext/ffi_library_function_checks'
6
- require_relative 'field'
3
+ require "ffi"
4
+ require_relative "../gdal"
5
+ require_relative "../../ext/ffi_library_function_checks"
6
+ require_relative "field"
7
7
 
8
8
  module FFI
9
9
  module OGR
@@ -150,11 +150,11 @@ module FFI
150
150
  # Constants
151
151
  #------------------------------------------------------------------------
152
152
  OGR_ALTER = FFI::ConstGenerator.new do |gen|
153
- gen.include FFI::GDAL._file_with_constants('ogr_core.h')
154
- gen.const :ALTER_NAME_FLAG, '%x'
155
- gen.const :ALTER_TYPE_FLAG, '%x'
156
- gen.const :ALTER_WIDTH_PRECISION_FLAG, '%x'
157
- gen.const :ALTER_ALL_FLAG, '%x'
153
+ gen.include FFI::GDAL._file_with_constants("ogr_core.h")
154
+ gen.const :ALTER_NAME_FLAG, "%x"
155
+ gen.const :ALTER_TYPE_FLAG, "%x"
156
+ gen.const :ALTER_WIDTH_PRECISION_FLAG, "%x"
157
+ gen.const :ALTER_ALL_FLAG, "%x"
158
158
  end
159
159
  OGR_ALTER.calculate
160
160
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
3
+ require "ffi"
4
4
 
5
5
  module FFI
6
6
  module OGR
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
3
+ require "ffi"
4
4
 
5
5
  module FFI
6
6
  module OGR
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
3
+ require "ffi"
4
4
 
5
5
  module FFI
6
6
  module OGR
data/lib/ffi/ogr/field.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../cpl/conv'
3
+ require_relative "../cpl/conv"
4
4
 
5
5
  module FFI
6
6
  module OGR
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
4
- require_relative '../../ext/ffi_library_function_checks'
3
+ require "ffi"
4
+ require_relative "../../ext/ffi_library_function_checks"
5
5
 
6
6
  module FFI
7
7
  module OGR
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
4
- require_relative '../gdal'
5
- require_relative '../../ext/ffi_library_function_checks'
3
+ require "ffi"
4
+ require_relative "../gdal"
5
+ require_relative "../../ext/ffi_library_function_checks"
6
6
 
7
7
  module FFI
8
8
  module OGR
@@ -41,70 +41,70 @@ module FFI
41
41
  # -----------------------------------------------------------------------
42
42
  # Constants
43
43
  # -----------------------------------------------------------------------
44
- SRS_UL = FFI::ConstGenerator.new('SRS_UL') do |gen|
45
- gen.include FFI::GDAL._file_with_constants('ogr_srs_api.h')
46
- gen.const :SRS_UL_METER, '%s', nil, :METER_LABEL, &:inspect
47
- gen.const :SRS_UL_FOOT, '%s', nil, :FOOT_LABEL, &:inspect
48
- gen.const :SRS_UL_FOOT_CONV, '%s', nil, :METER_TO_FOOT, &:to_f
49
- gen.const :SRS_UL_NAUTICAL_MILE, '%s', nil, :NAUTICAL_MILE_LABEL, &:inspect
50
- gen.const :SRS_UL_NAUTICAL_MILE_CONV, '%s', nil, :METER_TO_NAUTICAL_MILE, &:to_f
51
- gen.const :SRS_UL_LINK, '%s', nil, :LINK_LABEL, &:inspect
52
- gen.const :SRS_UL_LINK_CONV, '%s', nil, :METER_TO_LINK, &:to_f
53
- gen.const :SRS_UL_CHAIN, '%s', nil, :CHAIN_LABEL, &:inspect
54
- gen.const :SRS_UL_CHAIN_CONV, '%s', nil, :METER_TO_CHAIN, &:to_f
55
- gen.const :SRS_UL_ROD, '%s', nil, :ROD_LABEL, &:inspect
56
- gen.const :SRS_UL_ROD_CONV, '%s', nil, :METER_TO_ROD, &:to_f
57
- gen.const :SRS_UL_LINK_Clarke, '%s', nil, :LINK_CLARKE_LABEL, &:inspect
58
- gen.const :SRS_UL_LINK_Clarke_CONV, '%s', nil, :METER_TO_LINK_CLARKE, &:to_f
59
- gen.const :SRS_UL_KILOMETER, '%s', nil, :KILOMETER_LABEL, &:inspect
60
- gen.const :SRS_UL_KILOMETER_CONV, '%s', nil, :METER_TO_KILOMETER, &:to_f
61
- gen.const :SRS_UL_DECIMETER, '%s', nil, :DECIMETER_LABEL, &:inspect
62
- gen.const :SRS_UL_DECIMETER_CONV, '%s', nil, :METER_TO_DECIMETER, &:to_f
63
- gen.const :SRS_UL_CENTIMETER, '%s', nil, :CENTIMETER_LABEL, &:inspect
64
- gen.const :SRS_UL_CENTIMETER_CONV, '%s', nil, :METER_TO_CENTIMETER, &:to_f
65
- gen.const :SRS_UL_MILLIMETER, '%s', nil, :MILLIMETER_LABEL, &:inspect
66
- gen.const :SRS_UL_MILLIMETER_CONV, '%s', nil, :METER_TO_MILLIMETER, &:to_f
67
- gen.const :SRS_UL_INTL_NAUT_MILE, '%s', nil, :INTL_NAUTICAL_MILE_LABEL, &:inspect
68
- gen.const :SRS_UL_INTL_NAUT_MILE_CONV, '%s', nil, :METER_TO_INTL_NAUTICAL_MILE, &:to_f
69
- gen.const :SRS_UL_INTL_INCH, '%s', nil, :INTL_INCH_LABEL, &:inspect
70
- gen.const :SRS_UL_INTL_INCH_CONV, '%s', nil, :METER_TO_INTL_INCH, &:to_f
71
- gen.const :SRS_UL_INTL_FOOT, '%s', nil, :INTL_FOOT_LABEL, &:inspect
72
- gen.const :SRS_UL_INTL_FOOT_CONV, '%s', nil, :METER_TO_INTL_FOOT, &:to_f
73
- gen.const :SRS_UL_INTL_YARD, '%s', nil, :INTL_YARD_LABEL, &:inspect
74
- gen.const :SRS_UL_INTL_YARD_CONV, '%s', nil, :METER_TO_INTL_YARD, &:to_f
75
- gen.const :SRS_UL_INTL_STAT_MILE, '%s', nil, :INTL_STATUTE_MILE_LABEL, &:inspect
76
- gen.const :SRS_UL_INTL_STAT_MILE_CONV, '%s', nil, :METER_TO_INTL_STATUTE_MILE, &:to_f
77
- gen.const :SRS_UL_INTL_FATHOM, '%s', nil, :INTL_FATHOM_LABEL, &:inspect
78
- gen.const :SRS_UL_INTL_FATHOM_CONV, '%s', nil, :METER_TO_INTL_FATHOM, &:to_f
79
- gen.const :SRS_UL_INTL_CHAIN, '%s', nil, :INTL_CHAIN_LABEL, &:inspect
80
- gen.const :SRS_UL_INTL_CHAIN_CONV, '%s', nil, :METER_TO_INTL_CHAIN, &:to_f
81
- gen.const :SRS_UL_INTL_LINK, '%s', nil, :INTL_LINK_LABEL, &:inspect
82
- gen.const :SRS_UL_INTL_LINK_CONV, '%s', nil, :METER_TO_INTL_LINK, &:to_f
83
- gen.const :SRS_UL_US_INCH, '%s', nil, :US_INCH_LABEL, &:inspect
84
- gen.const :SRS_UL_US_INCH_CONV, '%s', nil, :METER_TO_US_INCH, &:to_f
85
- gen.const :SRS_UL_US_FOOT, '%s', nil, :US_FOOT_LABEL, &:inspect
86
- gen.const :SRS_UL_US_FOOT_CONV, '%s', nil, :METER_TO_US_FOOT, &:to_f
87
- gen.const :SRS_UL_US_YARD, '%s', nil, :US_YARD_LABEL, &:inspect
88
- gen.const :SRS_UL_US_YARD_CONV, '%s', nil, :METER_TO_US_YARD, &:to_f
89
- gen.const :SRS_UL_US_CHAIN, '%s', nil, :US_CHAIN_LABEL, &:inspect
90
- gen.const :SRS_UL_US_CHAIN_CONV, '%s', nil, :METER_TO_US_CHAIN, &:to_f
91
- gen.const :SRS_UL_US_STAT_MILE, '%s', nil, :US_STATUTE_MILE_LABEL, &:inspect
92
- gen.const :SRS_UL_US_STAT_MILE_CONV, '%s', nil, :METER_TO_US_STATUTE_MILE, &:to_f
93
- gen.const :SRS_UL_INDIAN_YARD, '%s', nil, :INDIAN_YARD_LABEL, &:inspect
94
- gen.const :SRS_UL_INDIAN_YARD_CONV, '%s', nil, :METER_TO_INDIAN_YARD, &:to_f
95
- gen.const :SRS_UL_INDIAN_FOOT, '%s', nil, :INDIAN_FOOT_LABEL, &:inspect
96
- gen.const :SRS_UL_INDIAN_FOOT_CONV, '%s', nil, :METER_TO_INDIAN_FOOT, &:to_f
97
- gen.const :SRS_UL_INDIAN_CHAIN, '%s', nil, :INDIAN_CHAIN_LABEL, &:inspect
98
- gen.const :SRS_UL_INDIAN_CHAIN_CONV, '%s', nil, :METER_TO_INDIAN_CHAIN, &:to_f
44
+ SRS_UL = FFI::ConstGenerator.new("SRS_UL") do |gen| # rubocop:disable Metrics/BlockLength
45
+ gen.include FFI::GDAL._file_with_constants("ogr_srs_api.h")
46
+ gen.const :SRS_UL_METER, "%s", nil, :METER_LABEL, &:inspect
47
+ gen.const :SRS_UL_FOOT, "%s", nil, :FOOT_LABEL, &:inspect
48
+ gen.const :SRS_UL_FOOT_CONV, "%s", nil, :METER_TO_FOOT, &:to_f
49
+ gen.const :SRS_UL_NAUTICAL_MILE, "%s", nil, :NAUTICAL_MILE_LABEL, &:inspect
50
+ gen.const :SRS_UL_NAUTICAL_MILE_CONV, "%s", nil, :METER_TO_NAUTICAL_MILE, &:to_f
51
+ gen.const :SRS_UL_LINK, "%s", nil, :LINK_LABEL, &:inspect
52
+ gen.const :SRS_UL_LINK_CONV, "%s", nil, :METER_TO_LINK, &:to_f
53
+ gen.const :SRS_UL_CHAIN, "%s", nil, :CHAIN_LABEL, &:inspect
54
+ gen.const :SRS_UL_CHAIN_CONV, "%s", nil, :METER_TO_CHAIN, &:to_f
55
+ gen.const :SRS_UL_ROD, "%s", nil, :ROD_LABEL, &:inspect
56
+ gen.const :SRS_UL_ROD_CONV, "%s", nil, :METER_TO_ROD, &:to_f
57
+ gen.const :SRS_UL_LINK_Clarke, "%s", nil, :LINK_CLARKE_LABEL, &:inspect
58
+ gen.const :SRS_UL_LINK_Clarke_CONV, "%s", nil, :METER_TO_LINK_CLARKE, &:to_f
59
+ gen.const :SRS_UL_KILOMETER, "%s", nil, :KILOMETER_LABEL, &:inspect
60
+ gen.const :SRS_UL_KILOMETER_CONV, "%s", nil, :METER_TO_KILOMETER, &:to_f
61
+ gen.const :SRS_UL_DECIMETER, "%s", nil, :DECIMETER_LABEL, &:inspect
62
+ gen.const :SRS_UL_DECIMETER_CONV, "%s", nil, :METER_TO_DECIMETER, &:to_f
63
+ gen.const :SRS_UL_CENTIMETER, "%s", nil, :CENTIMETER_LABEL, &:inspect
64
+ gen.const :SRS_UL_CENTIMETER_CONV, "%s", nil, :METER_TO_CENTIMETER, &:to_f
65
+ gen.const :SRS_UL_MILLIMETER, "%s", nil, :MILLIMETER_LABEL, &:inspect
66
+ gen.const :SRS_UL_MILLIMETER_CONV, "%s", nil, :METER_TO_MILLIMETER, &:to_f
67
+ gen.const :SRS_UL_INTL_NAUT_MILE, "%s", nil, :INTL_NAUTICAL_MILE_LABEL, &:inspect
68
+ gen.const :SRS_UL_INTL_NAUT_MILE_CONV, "%s", nil, :METER_TO_INTL_NAUTICAL_MILE, &:to_f
69
+ gen.const :SRS_UL_INTL_INCH, "%s", nil, :INTL_INCH_LABEL, &:inspect
70
+ gen.const :SRS_UL_INTL_INCH_CONV, "%s", nil, :METER_TO_INTL_INCH, &:to_f
71
+ gen.const :SRS_UL_INTL_FOOT, "%s", nil, :INTL_FOOT_LABEL, &:inspect
72
+ gen.const :SRS_UL_INTL_FOOT_CONV, "%s", nil, :METER_TO_INTL_FOOT, &:to_f
73
+ gen.const :SRS_UL_INTL_YARD, "%s", nil, :INTL_YARD_LABEL, &:inspect
74
+ gen.const :SRS_UL_INTL_YARD_CONV, "%s", nil, :METER_TO_INTL_YARD, &:to_f
75
+ gen.const :SRS_UL_INTL_STAT_MILE, "%s", nil, :INTL_STATUTE_MILE_LABEL, &:inspect
76
+ gen.const :SRS_UL_INTL_STAT_MILE_CONV, "%s", nil, :METER_TO_INTL_STATUTE_MILE, &:to_f
77
+ gen.const :SRS_UL_INTL_FATHOM, "%s", nil, :INTL_FATHOM_LABEL, &:inspect
78
+ gen.const :SRS_UL_INTL_FATHOM_CONV, "%s", nil, :METER_TO_INTL_FATHOM, &:to_f
79
+ gen.const :SRS_UL_INTL_CHAIN, "%s", nil, :INTL_CHAIN_LABEL, &:inspect
80
+ gen.const :SRS_UL_INTL_CHAIN_CONV, "%s", nil, :METER_TO_INTL_CHAIN, &:to_f
81
+ gen.const :SRS_UL_INTL_LINK, "%s", nil, :INTL_LINK_LABEL, &:inspect
82
+ gen.const :SRS_UL_INTL_LINK_CONV, "%s", nil, :METER_TO_INTL_LINK, &:to_f
83
+ gen.const :SRS_UL_US_INCH, "%s", nil, :US_INCH_LABEL, &:inspect
84
+ gen.const :SRS_UL_US_INCH_CONV, "%s", nil, :METER_TO_US_INCH, &:to_f
85
+ gen.const :SRS_UL_US_FOOT, "%s", nil, :US_FOOT_LABEL, &:inspect
86
+ gen.const :SRS_UL_US_FOOT_CONV, "%s", nil, :METER_TO_US_FOOT, &:to_f
87
+ gen.const :SRS_UL_US_YARD, "%s", nil, :US_YARD_LABEL, &:inspect
88
+ gen.const :SRS_UL_US_YARD_CONV, "%s", nil, :METER_TO_US_YARD, &:to_f
89
+ gen.const :SRS_UL_US_CHAIN, "%s", nil, :US_CHAIN_LABEL, &:inspect
90
+ gen.const :SRS_UL_US_CHAIN_CONV, "%s", nil, :METER_TO_US_CHAIN, &:to_f
91
+ gen.const :SRS_UL_US_STAT_MILE, "%s", nil, :US_STATUTE_MILE_LABEL, &:inspect
92
+ gen.const :SRS_UL_US_STAT_MILE_CONV, "%s", nil, :METER_TO_US_STATUTE_MILE, &:to_f
93
+ gen.const :SRS_UL_INDIAN_YARD, "%s", nil, :INDIAN_YARD_LABEL, &:inspect
94
+ gen.const :SRS_UL_INDIAN_YARD_CONV, "%s", nil, :METER_TO_INDIAN_YARD, &:to_f
95
+ gen.const :SRS_UL_INDIAN_FOOT, "%s", nil, :INDIAN_FOOT_LABEL, &:inspect
96
+ gen.const :SRS_UL_INDIAN_FOOT_CONV, "%s", nil, :METER_TO_INDIAN_FOOT, &:to_f
97
+ gen.const :SRS_UL_INDIAN_CHAIN, "%s", nil, :INDIAN_CHAIN_LABEL, &:inspect
98
+ gen.const :SRS_UL_INDIAN_CHAIN_CONV, "%s", nil, :METER_TO_INDIAN_CHAIN, &:to_f
99
99
  end
100
100
 
101
101
  SRS_UL.calculate
102
102
 
103
- SRS_UA = FFI::ConstGenerator.new('SRS_UL') do |gen|
104
- gen.include FFI::GDAL._file_with_constants('ogr_srs_api.h')
105
- gen.const :SRS_UA_DEGREE, '%s', nil, :DEGREE_LABEL, &:inspect
106
- gen.const :SRS_UA_DEGREE_CONV, '%s', nil, :RADIAN_TO_DEGREE, &:to_f
107
- gen.const :SRS_UA_RADIAN, '%s', nil, :RADIAN_LABEL, &:inspect
103
+ SRS_UA = FFI::ConstGenerator.new("SRS_UL") do |gen|
104
+ gen.include FFI::GDAL._file_with_constants("ogr_srs_api.h")
105
+ gen.const :SRS_UA_DEGREE, "%s", nil, :DEGREE_LABEL, &:inspect
106
+ gen.const :SRS_UA_DEGREE_CONV, "%s", nil, :RADIAN_TO_DEGREE, &:to_f
107
+ gen.const :SRS_UA_RADIAN, "%s", nil, :RADIAN_LABEL, &:inspect
108
108
  end
109
109
  SRS_UA.calculate
110
110
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
4
- require_relative '../cpl/port'
3
+ require "ffi"
4
+ require_relative "../cpl/port"
5
5
 
6
6
  module FFI
7
7
  module OGR
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
3
+ require "ffi"
4
4
 
5
5
  module FFI
6
6
  module OGR
data/lib/ffi/ogr.rb CHANGED
@@ -2,16 +2,16 @@
2
2
 
3
3
  module FFI
4
4
  module OGR
5
- autoload :API, File.expand_path('ogr/api.rb', __dir__)
6
- autoload :Core, File.expand_path('ogr/core.rb', __dir__)
7
- autoload :ContourWriterInfo, File.expand_path('ogr/contour_writer_info.rb', __dir__)
8
- autoload :Envelope, File.expand_path('ogr/envelope.rb', __dir__)
9
- autoload :Envelope3D, File.expand_path('ogr/envelope_3d.rb', __dir__)
10
- autoload :Featurestyle, File.expand_path('ogr/featurestyle.rb', __dir__)
11
- autoload :Field, File.expand_path('ogr/field.rb', __dir__)
12
- autoload :Geocoding, File.expand_path('ogr/geocoding.rb', __dir__)
13
- autoload :SRSAPI, File.expand_path('ogr/srs_api.rb', __dir__)
14
- autoload :StyleParam, File.expand_path('ogr/style_param.rb', __dir__)
15
- autoload :StyleValue, File.expand_path('ogr/style_value.rb', __dir__)
5
+ autoload :API, File.expand_path("ogr/api.rb", __dir__)
6
+ autoload :Core, File.expand_path("ogr/core.rb", __dir__)
7
+ autoload :ContourWriterInfo, File.expand_path("ogr/contour_writer_info.rb", __dir__)
8
+ autoload :Envelope, File.expand_path("ogr/envelope.rb", __dir__)
9
+ autoload :Envelope3D, File.expand_path("ogr/envelope_3d.rb", __dir__)
10
+ autoload :Featurestyle, File.expand_path("ogr/featurestyle.rb", __dir__)
11
+ autoload :Field, File.expand_path("ogr/field.rb", __dir__)
12
+ autoload :Geocoding, File.expand_path("ogr/geocoding.rb", __dir__)
13
+ autoload :SRSAPI, File.expand_path("ogr/srs_api.rb", __dir__)
14
+ autoload :StyleParam, File.expand_path("ogr/style_param.rb", __dir__)
15
+ autoload :StyleValue, File.expand_path("ogr/style_value.rb", __dir__)
16
16
  end
17
17
  end
data/lib/ffi-gdal.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
4
- require_relative 'ext/ffi_library_function_checks'
5
- require_relative 'ext/narray_ext'
6
- require_relative 'ext/numeric_as_data_type'
7
- require_relative 'ext/float_ext'
3
+ require "ffi"
4
+ require_relative "ext/ffi_library_function_checks"
5
+ require_relative "ext/narray_ext"
6
+ require_relative "ext/numeric_as_data_type"
7
+ require_relative "ext/float_ext"
8
8
 
9
9
  module FFI
10
- autoload :CPL, File.expand_path('ffi/cpl.rb', __dir__)
11
- autoload :GDAL, File.expand_path('ffi/gdal.rb', __dir__)
12
- autoload :OGR, File.expand_path('ffi/ogr.rb', __dir__)
10
+ autoload :CPL, File.expand_path("ffi/cpl.rb", __dir__)
11
+ autoload :GDAL, File.expand_path("ffi/gdal.rb", __dir__)
12
+ autoload :OGR, File.expand_path("ffi/ogr.rb", __dir__)
13
13
  end
@@ -1,18 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../gdal'
4
- require_relative 'color_entry'
3
+ require_relative "../gdal"
4
+ require_relative "color_entry"
5
5
 
6
6
  module GDAL
7
7
  module ColorTableTypes
8
8
  autoload :CMYK,
9
- File.expand_path('color_table_types/cmyk', __dir__)
9
+ File.expand_path("color_table_types/cmyk", __dir__)
10
10
  autoload :Gray,
11
- File.expand_path('color_table_types/gray', __dir__)
11
+ File.expand_path("color_table_types/gray", __dir__)
12
12
  autoload :HLS,
13
- File.expand_path('color_table_types/hls', __dir__)
13
+ File.expand_path("color_table_types/hls", __dir__)
14
14
  autoload :RGB,
15
- File.expand_path('color_table_types/rgb', __dir__)
15
+ File.expand_path("color_table_types/rgb", __dir__)
16
16
  end
17
17
 
18
18
  class ColorTable
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GDAL
4
+ class Dataset
5
+ module Accessors
6
+ # @return [GDAL::Driver] The driver to be used for working with this
7
+ # dataset.
8
+ def driver
9
+ driver_ptr = FFI::GDAL::GDAL.GDALGetDatasetDriver(@c_pointer)
10
+
11
+ Driver.new(driver_ptr)
12
+ end
13
+
14
+ def projection
15
+ # Returns a pointer to an internal projection reference string. It should
16
+ # not be altered, freed or expected to last for long.
17
+ proj, ptr = FFI::GDAL::GDAL.GDALGetProjectionRef(@c_pointer)
18
+ ptr.autorelease = false
19
+
20
+ proj || ""
21
+ end
22
+
23
+ # @param new_projection [String] Should be in WKT or PROJ.4 format.
24
+ # @raise [GDAL::Error]
25
+ def projection=(new_projection)
26
+ GDAL::CPLErrorHandler.manually_handle("Unable to set projection") do
27
+ FFI::GDAL::GDAL.GDALSetProjection(@c_pointer, new_projection.to_s)
28
+ end
29
+ end
30
+
31
+ # @return [GDAL::GeoTransform]
32
+ # @raise [GDAL::Error]
33
+ def geo_transform
34
+ return @geo_transform if @geo_transform
35
+
36
+ geo_transform_pointer = GDAL::GeoTransform.new_pointer
37
+
38
+ GDAL::CPLErrorHandler.manually_handle("Unable to get geo_transform") do
39
+ FFI::GDAL::GDAL.GDALGetGeoTransform(@c_pointer, geo_transform_pointer)
40
+ end
41
+
42
+ @geo_transform = GeoTransform.new(geo_transform_pointer)
43
+ end
44
+
45
+ # @param new_transform [GDAL::GeoTransform, FFI::Pointer]
46
+ # @return [GDAL::GeoTransform]
47
+ # @raise [GDAL::Error]
48
+ def geo_transform=(new_transform)
49
+ new_pointer = GDAL._pointer(GDAL::GeoTransform, new_transform)
50
+
51
+ GDAL::CPLErrorHandler.manually_handle("Unable to set geo_transform") do
52
+ FFI::GDAL::GDAL.GDALSetGeoTransform(@c_pointer, new_pointer)
53
+ end
54
+
55
+ @geo_transform = new_transform.is_a?(FFI::Pointer) ? GeoTransform.new(new_pointer) : new_transform
56
+ end
57
+
58
+ # @return [String # @return [Integer]
59
+ def gcp_count
60
+ return 0 if null?
61
+
62
+ FFI::GDAL::GDAL.GDALGetGCPCount(@c_pointer)
63
+ end
64
+
65
+ # @return [String]
66
+ def gcp_projection
67
+ return "" if null?
68
+
69
+ proj, ptr = FFI::GDAL::GDAL.GDALGetGCPProjection(@c_pointer)
70
+ ptr.autorelease = false
71
+
72
+ proj
73
+ end
74
+
75
+ # @return [FFI::GDAL::GCP]
76
+ def gcps
77
+ return FFI::GDAL::GCP.new if null?
78
+
79
+ gcp_array_pointer = FFI::GDAL::GDAL.GDALGetGCPs(@c_pointer)
80
+
81
+ if gcp_array_pointer.null?
82
+ FFI::GDAL::GCP.new
83
+ else
84
+ FFI::GDAL::GCP.new(gcp_array_pointer)
85
+ end
86
+ end
87
+
88
+ # Creates a OGR::SpatialReference object from the dataset's projection.
89
+ #
90
+ # @return [OGR::SpatialReference]
91
+ def spatial_reference
92
+ return @spatial_reference if @spatial_reference
93
+
94
+ proj = projection
95
+ return nil if proj.empty?
96
+
97
+ @spatial_reference = OGR::SpatialReference.new(proj)
98
+ end
99
+ end
100
+ end
101
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GDAL
4
- module DatasetMixins
4
+ class Dataset
5
5
  # Wrappers for Warp algorithm methods defined in gdal_alg.h.
6
6
  module AlgorithmMethods
7
7
  # Rasterizes the geometric objects +geometries+ into this raster dataset.
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GDAL
4
+ class Dataset
5
+ module ClassMethods
6
+ # @param path [String] Path to the file that contains the dataset. Can be
7
+ # a local file or a URL.
8
+ # @param access_flag [String] 'r' or 'w'.
9
+ # @param shared [Boolean] Whether or not to open using GDALOpenShared
10
+ # vs GDALOpen. Defaults to +true+.
11
+ def open(path, access_flag, shared: true)
12
+ ds = new(path, access_flag, shared_open: shared)
13
+
14
+ if block_given?
15
+ result = yield ds
16
+ ds.close
17
+ result
18
+ else
19
+ ds
20
+ end
21
+ end
22
+
23
+ # Copy all dataset raster data.
24
+ #
25
+ # This function copies the complete raster contents of one dataset to
26
+ # another similarly configured dataset. The source and destination dataset
27
+ # must have the same number of bands, and the same width and height. The
28
+ # bands do not have to have the same data type.
29
+ #
30
+ # This function is primarily intended to support implementation of driver
31
+ # specific CreateCopy() functions. It implements efficient copying, in
32
+ # particular "chunking" the copy in substantial blocks and, if appropriate,
33
+ # performing the transfer in a pixel interleaved fashion.
34
+ #
35
+ # @param source [GDAL::Dataset, FFI::Pointer]
36
+ # @param destination [GDAL::Dataset, FFI::Pointer]
37
+ # @param options [Hash]
38
+ # @option options interleave: 'pixel'
39
+ # @option options compressed: true
40
+ # @option options skip_holes: true
41
+ # @param progress_function [Proc]
42
+ # @raise [GDAL::Error]
43
+ def copy_whole_raster(source, destination, options = {}, progress_function = nil)
44
+ source_ptr = GDAL._pointer(GDAL::Dataset, source, autorelease: false)
45
+ dest_ptr = GDAL._pointer(GDAL::Dataset, destination, autorelease: false)
46
+ options_ptr = GDAL::Options.pointer(options)
47
+
48
+ GDAL::CPLErrorHandler.manually_handle("Unable to copy whole raster") do
49
+ FFI::GDAL::GDAL.GDALDatasetCopyWholeRaster(source_ptr, dest_ptr, options_ptr, progress_function, nil)
50
+ end
51
+ end
52
+
53
+ # @param dataset [GDAL::Dataset]
54
+ # @return [FFI::AutoPointer]
55
+ def new_pointer(dataset, warn_on_nil: true)
56
+ ptr = GDAL._pointer(GDAL::Dataset, dataset, warn_on_nil: warn_on_nil, autorelease: false)
57
+
58
+ FFI::AutoPointer.new(ptr, Dataset.method(:release))
59
+ end
60
+
61
+ # @param pointer [FFI::Pointer]
62
+ def release(pointer)
63
+ return unless pointer && !pointer.null?
64
+
65
+ FFI::GDAL::GDAL.GDALClose(pointer)
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GDAL
4
+ class Dataset
5
+ module InternalFunctions
6
+ # Makes a pointer of +band_numbers+.
7
+ #
8
+ # @param band_numbers [Array<Integer>]
9
+ # @return [Array<FFI::MemoryPointer, Integer>]
10
+ def self.band_numbers_args(band_numbers)
11
+ band_count = band_numbers&.size || 0
12
+ ptr = FFI::MemoryPointer.new(:int, band_count)
13
+
14
+ ptr.write_array_of_int(band_numbers) if band_numbers
15
+
16
+ ptr.autorelease = false
17
+
18
+ [ptr, band_count]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GDAL
4
- module DatasetMixins
4
+ class Dataset
5
5
  module Matching
6
6
  # @param other_dataset [GDAL::Dataset]
7
7
  # @param options [Hash]