ffi-gdal 1.0.1 → 1.0.3

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 (199) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +15 -0
  3. data/.github/workflows/codacy.yml +1 -1
  4. data/.github/workflows/dependency-review.yml +1 -1
  5. data/.github/workflows/specs-in-docker.yml +3 -1
  6. data/.prettierrc.yml +4 -0
  7. data/.rubocop.yml +9 -5
  8. data/.rubocop_todo.yml +5 -11
  9. data/.solargraph.yml +13 -0
  10. data/Changelog-0.x.md +229 -174
  11. data/Changelog.md +20 -4
  12. data/Dockerfile.gdal2 +2 -85
  13. data/Gemfile +12 -2
  14. data/LICENSE.txt +1 -1
  15. data/README.md +14 -16
  16. data/Rakefile +6 -6
  17. data/bin/bundle +12 -12
  18. data/bin/rake +6 -6
  19. data/bin/rspec +6 -6
  20. data/bin/rubocop +6 -6
  21. data/examples/extract_and_colorize.rb +15 -15
  22. data/examples/geometries.rb +12 -12
  23. data/examples/gridding.rb +17 -17
  24. data/examples/ogr_layer_to_layer.rb +3 -3
  25. data/examples/raster_erasing.rb +9 -9
  26. data/examples/remove_small_polygons.rb +11 -11
  27. data/examples/testing_gdal.rb +20 -20
  28. data/examples/warping.rb +13 -13
  29. data/ffi-gdal.gemspec +16 -27
  30. data/lib/ext/ffi_library_function_checks.rb +3 -3
  31. data/lib/ext/narray_ext.rb +1 -1
  32. data/lib/ext/to_bool.rb +2 -2
  33. data/lib/ffi/cpl/conv.rb +2 -2
  34. data/lib/ffi/cpl/error.rb +1 -1
  35. data/lib/ffi/cpl/hash_set.rb +2 -2
  36. data/lib/ffi/cpl/http.rb +3 -3
  37. data/lib/ffi/cpl/http_result.rb +2 -2
  38. data/lib/ffi/cpl/list.rb +1 -1
  39. data/lib/ffi/cpl/mime_part.rb +1 -1
  40. data/lib/ffi/cpl/minixml.rb +2 -2
  41. data/lib/ffi/cpl/port.rb +1 -1
  42. data/lib/ffi/cpl/progress.rb +2 -2
  43. data/lib/ffi/cpl/quad_tree.rb +3 -3
  44. data/lib/ffi/cpl/rect_obj.rb +1 -1
  45. data/lib/ffi/cpl/string.rb +1 -1
  46. data/lib/ffi/cpl/vsi.rb +2 -2
  47. data/lib/ffi/cpl/xml_node.rb +1 -1
  48. data/lib/ffi/cpl.rb +11 -11
  49. data/lib/ffi/extensions/gdal/extensions/all.rb +2 -2
  50. data/lib/ffi/extensions/gdal/extensions.rb +2 -2
  51. data/lib/ffi/extensions/rttopo/gbox.rb +1 -1
  52. data/lib/ffi/extensions/rttopo/geom.rb +2 -2
  53. data/lib/ffi/extensions/rttopo.rb +3 -3
  54. data/lib/ffi/gdal/alg.rb +2 -2
  55. data/lib/ffi/gdal/color_entry.rb +1 -1
  56. data/lib/ffi/gdal/gcp.rb +1 -1
  57. data/lib/ffi/gdal/gdal.rb +3 -3
  58. data/lib/ffi/gdal/grid.rb +2 -2
  59. data/lib/ffi/gdal/grid_data_metrics_options.rb +1 -1
  60. data/lib/ffi/gdal/grid_inverse_distance_to_a_power_options.rb +1 -1
  61. data/lib/ffi/gdal/grid_moving_average_options.rb +1 -1
  62. data/lib/ffi/gdal/grid_nearest_neighbor_options.rb +1 -1
  63. data/lib/ffi/gdal/matching.rb +2 -2
  64. data/lib/ffi/gdal/rpc_info.rb +1 -1
  65. data/lib/ffi/gdal/transformer_info.rb +1 -1
  66. data/lib/ffi/gdal/version.rb +1 -1
  67. data/lib/ffi/gdal/vrt.rb +2 -2
  68. data/lib/ffi/gdal/warp_options.rb +1 -1
  69. data/lib/ffi/gdal/warper.rb +2 -2
  70. data/lib/ffi/gdal.rb +22 -22
  71. data/lib/ffi/ogr/api.rb +3 -3
  72. data/lib/ffi/ogr/contour_writer_info.rb +1 -1
  73. data/lib/ffi/ogr/core.rb +9 -9
  74. data/lib/ffi/ogr/envelope.rb +1 -1
  75. data/lib/ffi/ogr/envelope_3d.rb +1 -1
  76. data/lib/ffi/ogr/featurestyle.rb +1 -1
  77. data/lib/ffi/ogr/field.rb +1 -1
  78. data/lib/ffi/ogr/geocoding.rb +2 -2
  79. data/lib/ffi/ogr/srs_api.rb +63 -63
  80. data/lib/ffi/ogr/style_param.rb +2 -2
  81. data/lib/ffi/ogr/style_value.rb +1 -1
  82. data/lib/ffi/ogr.rb +11 -11
  83. data/lib/ffi-gdal.rb +8 -8
  84. data/lib/gdal/color_table.rb +6 -6
  85. data/lib/gdal/dataset/accessors.rb +101 -0
  86. data/lib/gdal/{dataset_mixins → dataset}/algorithm_methods.rb +1 -1
  87. data/lib/gdal/dataset/class_methods.rb +69 -0
  88. data/lib/gdal/dataset/internal_functions.rb +22 -0
  89. data/lib/gdal/{dataset_mixins → dataset}/matching.rb +1 -1
  90. data/lib/gdal/dataset/raster_band_methods.rb +181 -0
  91. data/lib/gdal/{dataset_mixins → dataset}/warp_methods.rb +1 -1
  92. data/lib/gdal/dataset.rb +21 -359
  93. data/lib/gdal/driver.rb +10 -10
  94. data/lib/gdal/environment_methods.rb +1 -1
  95. data/lib/gdal/extensions/all.rb +1 -1
  96. data/lib/gdal/extensions/color_entry/extensions.rb +2 -2
  97. data/lib/gdal/extensions/color_table/extensions.rb +2 -2
  98. data/lib/gdal/extensions/dataset/extensions.rb +11 -11
  99. data/lib/gdal/extensions/driver/extensions.rb +7 -7
  100. data/lib/gdal/extensions/geo_transform/extensions.rb +2 -2
  101. data/lib/gdal/extensions/gridder.rb +8 -8
  102. data/lib/gdal/extensions/gridder_options.rb +6 -6
  103. data/lib/gdal/extensions/raster_attribute_table/extensions.rb +1 -1
  104. data/lib/gdal/extensions/raster_band/algorithm_extensions.rb +4 -4
  105. data/lib/gdal/extensions/raster_band/coloring_extensions.rb +1 -1
  106. data/lib/gdal/extensions/raster_band/extensions.rb +3 -3
  107. data/lib/gdal/extensions/raster_band/io_extensions.rb +4 -4
  108. data/lib/gdal/extensions/raster_band_classifier.rb +3 -3
  109. data/lib/gdal/geo_transform.rb +1 -1
  110. data/lib/gdal/grid.rb +6 -6
  111. data/lib/gdal/grid_algorithms/metric_average_distance.rb +1 -1
  112. data/lib/gdal/grid_algorithms/metric_average_distance_pts.rb +1 -1
  113. data/lib/gdal/grid_algorithms/metric_count.rb +1 -1
  114. data/lib/gdal/grid_algorithms/metric_maximum.rb +1 -1
  115. data/lib/gdal/grid_algorithms/metric_minimum.rb +1 -1
  116. data/lib/gdal/grid_algorithms/metric_range.rb +1 -1
  117. data/lib/gdal/grid_algorithms.rb +9 -9
  118. data/lib/gdal/internal_helpers.rb +3 -3
  119. data/lib/gdal/logger.rb +1 -1
  120. data/lib/gdal/major_object.rb +6 -6
  121. data/lib/gdal/options.rb +2 -2
  122. data/lib/gdal/raster_attribute_table.rb +5 -5
  123. data/lib/gdal/raster_band.rb +24 -24
  124. data/lib/gdal/rpc_info.rb +2 -2
  125. data/lib/gdal/transformer.rb +1 -1
  126. data/lib/gdal/transformers/general_image_projection_transformer.rb +1 -1
  127. data/lib/gdal/transformers/general_image_projection_transformer2.rb +1 -1
  128. data/lib/gdal/transformers/general_image_projection_transformer3.rb +1 -1
  129. data/lib/gdal/version_info.rb +9 -9
  130. data/lib/gdal/virtual_dataset.rb +4 -4
  131. data/lib/gdal/warp_operation.rb +2 -2
  132. data/lib/gdal/warp_options.rb +2 -2
  133. data/lib/gdal.rb +17 -17
  134. data/lib/ogr/coordinate_transformation.rb +5 -5
  135. data/lib/ogr/data_source.rb +9 -9
  136. data/lib/ogr/driver.rb +9 -9
  137. data/lib/ogr/envelope.rb +1 -1
  138. data/lib/ogr/error_handling.rb +1 -1
  139. data/lib/ogr/extensions/all.rb +1 -1
  140. data/lib/ogr/extensions/data_source/capability_methods.rb +4 -4
  141. data/lib/ogr/extensions/data_source/data_source_extensions.rb +1 -1
  142. data/lib/ogr/extensions/driver/capability_methods.rb +3 -3
  143. data/lib/ogr/extensions/envelope/extensions.rb +1 -1
  144. data/lib/ogr/extensions/feature/extensions.rb +1 -1
  145. data/lib/ogr/extensions/feature_definition/extensions.rb +1 -1
  146. data/lib/ogr/extensions/geometries/point/extensions.rb +1 -1
  147. data/lib/ogr/extensions/geometry/container_mixins.rb +10 -10
  148. data/lib/ogr/extensions/geometry/ewkb_io_extensions.rb +3 -3
  149. data/lib/ogr/extensions/geometry/ewkb_record.rb +4 -4
  150. data/lib/ogr/extensions/geometry/extensions.rb +4 -7
  151. data/lib/ogr/extensions/geometry/rttopo_extensions.rb +2 -2
  152. data/lib/ogr/extensions/geometry/wkb_record.rb +3 -3
  153. data/lib/ogr/extensions/geometry_types/curve/extensions.rb +2 -2
  154. data/lib/ogr/extensions/layer/capability_methods.rb +17 -17
  155. data/lib/ogr/extensions/layer/extensions.rb +1 -1
  156. data/lib/ogr/extensions/spatial_reference/extensions.rb +1 -1
  157. data/lib/ogr/extensions/spatial_reference/initializers.rb +2 -2
  158. data/lib/ogr/extensions/style_table/extensions.rb +1 -1
  159. data/lib/ogr/feature.rb +15 -15
  160. data/lib/ogr/feature_definition.rb +2 -2
  161. data/lib/ogr/field.rb +5 -5
  162. data/lib/ogr/field_definition.rb +1 -1
  163. data/lib/ogr/geocoder.rb +1 -1
  164. data/lib/ogr/geometries/geometry_collection.rb +2 -2
  165. data/lib/ogr/geometries/geometry_collection_25d.rb +1 -1
  166. data/lib/ogr/geometries/line_string.rb +1 -1
  167. data/lib/ogr/geometries/line_string_25d.rb +1 -1
  168. data/lib/ogr/geometries/linear_ring.rb +2 -2
  169. data/lib/ogr/geometries/multi_line_string.rb +2 -2
  170. data/lib/ogr/geometries/multi_line_string_25d.rb +1 -1
  171. data/lib/ogr/geometries/multi_point.rb +1 -1
  172. data/lib/ogr/geometries/multi_point_25d.rb +1 -1
  173. data/lib/ogr/geometries/multi_polygon.rb +2 -2
  174. data/lib/ogr/geometries/multi_polygon_25d.rb +1 -1
  175. data/lib/ogr/geometries/point_25d.rb +1 -1
  176. data/lib/ogr/geometries/polygon.rb +2 -2
  177. data/lib/ogr/geometries/polygon_25d.rb +1 -1
  178. data/lib/ogr/geometry.rb +11 -11
  179. data/lib/ogr/geometry_types/container.rb +1 -1
  180. data/lib/ogr/geometry_types/curve.rb +1 -1
  181. data/lib/ogr/internal_helpers.rb +4 -4
  182. data/lib/ogr/layer.rb +8 -8
  183. data/lib/ogr/layer_mixins/ogr_feature_methods.rb +9 -9
  184. data/lib/ogr/layer_mixins/ogr_field_methods.rb +15 -15
  185. data/lib/ogr/layer_mixins/ogr_sql_methods.rb +2 -2
  186. data/lib/ogr/spatial_reference.rb +19 -19
  187. data/lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb +4 -4
  188. data/lib/ogr/spatial_reference_mixins/exporters.rb +9 -9
  189. data/lib/ogr/spatial_reference_mixins/importers.rb +2 -2
  190. data/lib/ogr/spatial_reference_mixins/morphers.rb +2 -2
  191. data/lib/ogr/spatial_reference_mixins/parameter_getter_setters.rb +1 -1
  192. data/lib/ogr/style_table.rb +3 -3
  193. data/lib/ogr/style_tool.rb +1 -1
  194. data/lib/ogr.rb +33 -33
  195. data/rakelib/docker.rake +2 -2
  196. metadata +14 -150
  197. data/bitbucket-pipelines.yml +0 -16
  198. data/tilt/gdal2.yml +0 -22
  199. data/tilt/gdal3.yml +0 -22
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gdal/grid'
4
- require 'gdal/options'
5
- require 'ogr/exceptions'
6
- require 'ogr/geometry'
7
- require 'ogr/spatial_reference'
3
+ require "gdal/grid"
4
+ require "gdal/options"
5
+ require "ogr/exceptions"
6
+ require "ogr/geometry"
7
+ require "ogr/spatial_reference"
8
8
 
9
9
  module GDAL
10
10
  # Object to be used with a {GDAL::Gridder}.
@@ -123,7 +123,7 @@ module GDAL
123
123
  def initialize(algorithm_type)
124
124
  # Options with defaults
125
125
  @output_data_type = :GDT_Float64
126
- @output_format = 'GTiff'
126
+ @output_format = "GTiff"
127
127
  @output_size = { width: 256, height: 256 }
128
128
 
129
129
  # Options without defaults
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gdal/raster_attribute_table'
3
+ require "gdal/raster_attribute_table"
4
4
 
5
5
  module GDAL
6
6
  class RasterAttributeTable
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gdal/raster_band'
3
+ require "gdal/raster_band"
4
4
 
5
5
  module GDAL
6
6
  class RasterBand
@@ -66,11 +66,11 @@ module GDAL
66
66
 
67
67
  unless erase_value
68
68
  raise GDAL::NoRasterEraseValue,
69
- 'Cannot erase values, RasterBand does not have a NODATA value set'
69
+ "Cannot erase values, RasterBand does not have a NODATA value set"
70
70
  end
71
71
 
72
72
  y_size.times do |line_num|
73
- pixel_row = raster_io('r', x_size: x_size, y_size: 1, x_offset: 0, y_offset: line_num)
73
+ pixel_row = raster_io("r", x_size: x_size, y_size: 1, x_offset: 0, y_offset: line_num)
74
74
  pixel_values = GDAL._read_pointer(pixel_row, data_type, x_size)
75
75
  row_changed = false
76
76
  pixel_num = 0
@@ -101,7 +101,7 @@ module GDAL
101
101
  # @param line_number [Integer]
102
102
  def rewrite_pixel_row(write_buffer, pixel_values, line_number)
103
103
  GDAL._write_pointer(write_buffer, data_type, pixel_values)
104
- raster_io('w', write_buffer, x_size: x_size, y_size: 1, y_offset: line_number)
104
+ raster_io("w", write_buffer, x_size: x_size, y_size: 1, y_offset: line_number)
105
105
  write_buffer.clear
106
106
  end
107
107
  end
@@ -76,7 +76,7 @@ module GDAL
76
76
 
77
77
  # @param hex [String]
78
78
  def hex_to_rgb(hex)
79
- hex = hex.sub(/^#/, '')
79
+ hex = hex.sub(/^#/, "")
80
80
  matches = hex.match(/(?<red>[a-zA-Z0-9]{2})(?<green>[a-zA-Z0-9]{2})(?<blue>[a-zA-Z0-9]{2})/)
81
81
 
82
82
  [matches[:red].to_i(16), matches[:green].to_i(16), matches[:blue].to_i(16)]
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gdal/raster_band'
4
- require 'numo/narray'
5
- require_relative 'io_extensions'
3
+ require "gdal/raster_band"
4
+ require "numo/narray"
5
+ require_relative "io_extensions"
6
6
 
7
7
  module GDAL
8
8
  class RasterBand
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gdal/raster_band'
3
+ require "gdal/raster_band"
4
4
 
5
5
  module GDAL
6
6
  class RasterBand
@@ -14,7 +14,7 @@ module GDAL
14
14
  return enum_for(:readlines) unless block_given?
15
15
 
16
16
  y_size.times do |row_number|
17
- scan_line = raster_io('r', x_size: x_size, y_size: 1, y_offset: row_number)
17
+ scan_line = raster_io("r", x_size: x_size, y_size: 1, y_offset: row_number)
18
18
  line_array = GDAL._read_pointer(scan_line, data_type, x_size)
19
19
 
20
20
  yield line_array
@@ -57,7 +57,7 @@ module GDAL
57
57
  data_pointer = GDAL._pointer_from_data_type(data_type)
58
58
  GDAL._write_pointer(data_pointer, data_type, new_value)
59
59
 
60
- raster_io('w', data_pointer, x_size: 1, y_size: 1, x_offset: x, y_offset: y, buffer_x_size: 1, buffer_y_size: 1)
60
+ raster_io("w", data_pointer, x_size: 1, y_size: 1, x_offset: x, y_offset: y, buffer_x_size: 1, buffer_y_size: 1)
61
61
  end
62
62
 
63
63
  # Convenience method for directly getting a single pixel value.
@@ -66,7 +66,7 @@ module GDAL
66
66
  # @param y [Integer] Row number of the pixel to get.
67
67
  # @return [Number]
68
68
  def pixel_value(x, y)
69
- output = raster_io('r', x_size: 1, y_size: 1, x_offset: x, y_offset: y, buffer_x_size: 1, buffer_y_size: 1)
69
+ output = raster_io("r", x_size: 1, y_size: 1, x_offset: x, y_offset: y, buffer_x_size: 1, buffer_y_size: 1)
70
70
 
71
71
  GDAL._read_pointer(output, data_type)
72
72
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gdal'
4
- require 'numo/narray'
3
+ require "gdal"
4
+ require "numo/narray"
5
5
 
6
6
  module GDAL
7
7
  # Takes a list of Ranges of color values and remaps them. Note that these
@@ -35,7 +35,7 @@ module GDAL
35
35
  # @param range [Range] The range of values to map to a new value.
36
36
  # @param map_to_value [Number]
37
37
  def add_range(range, map_to_value)
38
- raise 'range must be a Ruby Range' unless range.is_a? Range
38
+ raise "range must be a Ruby Range" unless range.is_a? Range
39
39
 
40
40
  @ranges << { range: range, map_to: map_to_value }
41
41
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../gdal'
3
+ require_relative "../gdal"
4
4
 
5
5
  module GDAL
6
6
  class GeoTransform
data/lib/gdal/grid.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'forwardable'
4
- require 'narray'
5
- require_relative '../gdal'
6
- require_relative 'grid_algorithms'
3
+ require "forwardable"
4
+ require "narray"
5
+ require_relative "../gdal"
6
+ require_relative "grid_algorithms"
7
7
 
8
8
  module GDAL
9
9
  # Wrapper for GDAL's [Grid API](http://www.gdal.org/grid_tutorial.html).
@@ -38,7 +38,7 @@ module GDAL
38
38
  points = points.to_a if points.is_a? NArray
39
39
  point_count = points.length
40
40
  log "Number of points: #{point_count}"
41
- raise GDAL::NoValuesToGrid, 'No points to grid' if point_count.zero?
41
+ raise GDAL::NoValuesToGrid, "No points to grid" if point_count.zero?
42
42
 
43
43
  points = points.transpose
44
44
  x_input_coordinates_ptr = make_points_pointer(points[0])
@@ -73,7 +73,7 @@ module GDAL
73
73
 
74
74
  # @param points [Array]
75
75
  def make_points_pointer(points)
76
- raise GDAL::Error, 'No points to make pointer for' if points.compact.empty?
76
+ raise GDAL::Error, "No points to make pointer for" if points.compact.empty?
77
77
 
78
78
  input_coordinates_ptr = FFI::MemoryPointer.new(:double, points.length)
79
79
  input_coordinates_ptr.write_array_of_double(points)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'data_metrics_base'
3
+ require_relative "data_metrics_base"
4
4
 
5
5
  module GDAL
6
6
  module GridAlgorithms
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'data_metrics_base'
3
+ require_relative "data_metrics_base"
4
4
 
5
5
  module GDAL
6
6
  module GridAlgorithms
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'data_metrics_base'
3
+ require_relative "data_metrics_base"
4
4
 
5
5
  module GDAL
6
6
  module GridAlgorithms
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'data_metrics_base'
3
+ require_relative "data_metrics_base"
4
4
 
5
5
  module GDAL
6
6
  module GridAlgorithms
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'data_metrics_base'
3
+ require_relative "data_metrics_base"
4
4
 
5
5
  module GDAL
6
6
  module GridAlgorithms
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'data_metrics_base'
3
+ require_relative "data_metrics_base"
4
4
 
5
5
  module GDAL
6
6
  module GridAlgorithms
@@ -3,22 +3,22 @@
3
3
  module GDAL
4
4
  module GridAlgorithms
5
5
  autoload :InverseDistanceToAPower,
6
- File.expand_path('grid_algorithms/inverse_distance_to_a_power', __dir__)
6
+ File.expand_path("grid_algorithms/inverse_distance_to_a_power", __dir__)
7
7
  autoload :MetricAverageDistance,
8
- File.expand_path('grid_algorithms/metric_average_distance', __dir__)
8
+ File.expand_path("grid_algorithms/metric_average_distance", __dir__)
9
9
  autoload :MetricAverageDistancePts,
10
- File.expand_path('grid_algorithms/metric_average_distance_pts', __dir__)
10
+ File.expand_path("grid_algorithms/metric_average_distance_pts", __dir__)
11
11
  autoload :MetricCount,
12
- File.expand_path('grid_algorithms/metric_count', __dir__)
12
+ File.expand_path("grid_algorithms/metric_count", __dir__)
13
13
  autoload :MetricMaximum,
14
- File.expand_path('grid_algorithms/metric_maximum', __dir__)
14
+ File.expand_path("grid_algorithms/metric_maximum", __dir__)
15
15
  autoload :MetricMinimum,
16
- File.expand_path('grid_algorithms/metric_minimum', __dir__)
16
+ File.expand_path("grid_algorithms/metric_minimum", __dir__)
17
17
  autoload :MetricRange,
18
- File.expand_path('grid_algorithms/metric_range', __dir__)
18
+ File.expand_path("grid_algorithms/metric_range", __dir__)
19
19
  autoload :MovingAverage,
20
- File.expand_path('grid_algorithms/moving_average', __dir__)
20
+ File.expand_path("grid_algorithms/moving_average", __dir__)
21
21
  autoload :NearestNeighbor,
22
- File.expand_path('grid_algorithms/nearest_neighbor', __dir__)
22
+ File.expand_path("grid_algorithms/nearest_neighbor", __dir__)
23
23
  end
24
24
  end
@@ -124,7 +124,7 @@ module GDAL
124
124
  yield result_ptr_ptr
125
125
 
126
126
  result = if result_ptr_ptr.null?
127
- ''
127
+ ""
128
128
  else
129
129
  GDAL._read_pointer_pointer_safely(result_ptr_ptr, :string)
130
130
  end
@@ -241,8 +241,8 @@ module GDAL
241
241
  # @raise [GDAL::InvalidAccessFlag] If +char+ is not 'r' or 'w'.
242
242
  def _gdal_access_flag(char)
243
243
  case char
244
- when 'r' then :GF_Read
245
- when 'w' then :GF_Write
244
+ when "r" then :GF_Read
245
+ when "w" then :GF_Write
246
246
  else raise GDAL::InvalidAccessFlag, "Invalid access flag: #{char}"
247
247
  end
248
248
  end
data/lib/gdal/logger.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'log_switch'
3
+ require "log_switch"
4
4
 
5
5
  module GDAL
6
6
  module Logger
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../gdal'
4
- require 'multi_xml'
3
+ require_relative "../gdal"
4
+ require "multi_xml"
5
5
 
6
6
  module GDAL
7
7
  module MajorObject
@@ -31,7 +31,7 @@ module GDAL
31
31
  data_array = m.get_array_of_string(0)
32
32
 
33
33
  data_array.each_with_object({}) do |key_value_pair, obj|
34
- key, value = key_value_pair.split('=', 2)
34
+ key, value = key_value_pair.split("=", 2)
35
35
 
36
36
  begin
37
37
  obj[key] = MultiXml.parse(value)
@@ -44,15 +44,15 @@ module GDAL
44
44
  # @param name [String]
45
45
  # @param domain [String]
46
46
  # @return [String]
47
- def metadata_item(name, domain = '')
47
+ def metadata_item(name, domain = "")
48
48
  item, ptr = FFI::GDAL::GDAL.GDALGetMetadataItem(@c_pointer, name, domain)
49
49
  ptr.autorelease = false
50
50
 
51
51
  item
52
52
  end
53
53
 
54
- def set_metadata_item(name, value, domain = '')
55
- GDAL::CPLErrorHandler.manually_handle('Unable to set metadata item') do
54
+ def set_metadata_item(name, value, domain = "")
55
+ GDAL::CPLErrorHandler.manually_handle("Unable to set metadata item") do
56
56
  FFI::GDAL::GDAL.GDALSetMetadataItem(@c_pointer, name, value.to_s, domain)
57
57
  end
58
58
  end
data/lib/gdal/options.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
3
+ require "ffi"
4
4
 
5
5
  module GDAL
6
6
  # A wrapper for the way GDAL does key/value pair options for methods.
@@ -39,7 +39,7 @@ module GDAL
39
39
  key_and_value, ptr = FFI::CPL::String.CSLGetField(pointer, i)
40
40
  ptr.autorelease = false
41
41
 
42
- key, value = key_and_value.split('=')
42
+ key, value = key_and_value.split("=")
43
43
  o[key.downcase.to_sym] = value
44
44
  end
45
45
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../gdal'
3
+ require_relative "../gdal"
4
4
 
5
5
  module GDAL
6
6
  class RasterAttributeTable
@@ -13,7 +13,7 @@ module GDAL
13
13
  color_table_ptr = GDAL._pointer(GDAL::ColorTable, color_table, autorelease: false)
14
14
  rat_ptr = FFI::GDAL::GDAL.GDALCreateRasterAttributeTable
15
15
 
16
- GDAL::CPLErrorHandler.manually_handle('Unable to initialize from ColorTable') do
16
+ GDAL::CPLErrorHandler.manually_handle("Unable to initialize from ColorTable") do
17
17
  FFI::GDAL::GDAL.GDALRATInitializeFromColorTable(rat_ptr, color_table_ptr)
18
18
  end
19
19
 
@@ -110,7 +110,7 @@ module GDAL
110
110
  # @param usage [FFI::GDAL::GDALRATFieldUsage]
111
111
  # @raise [GDAL::Error]
112
112
  def create_column(name, type, usage)
113
- GDAL::CPLErrorHandler.manually_handle('Unable to create column') do
113
+ GDAL::CPLErrorHandler.manually_handle("Unable to create column") do
114
114
  FFI::GDAL::GDAL.GDALRATCreateColumn(@c_pointer, name, type, usage)
115
115
  end
116
116
  end
@@ -202,7 +202,7 @@ module GDAL
202
202
  # @param bin_size [Float]
203
203
  # @raise [GDAL::Error]
204
204
  def set_linear_binning(row_0_minimum, bin_size)
205
- GDAL::CPLErrorHandler.manually_handle('Unable to set linear binning') do
205
+ GDAL::CPLErrorHandler.manually_handle("Unable to set linear binning") do
206
206
  FFI::GDAL::GDAL.GDALRATSetLinearBinning(@c_pointer, row_0_minimum, bin_size)
207
207
  end
208
208
  end
@@ -219,7 +219,7 @@ module GDAL
219
219
 
220
220
  # @param file_path [String] Without giving a +file_path+, dumps to STDOUT.
221
221
  def dump_readable(file_path = nil)
222
- file_ptr = file_path ? FFI::CPL::Conv.CPLOpenShared(file_path, 'w', false) : nil
222
+ file_ptr = file_path ? FFI::CPL::Conv.CPLOpenShared(file_path, "w", false) : nil
223
223
  FFI::GDAL::GDAL.GDALRATDumpReadable(@c_pointer, file_ptr)
224
224
  FFI::CPL::Conv.CPLCloseShared(file_ptr) if file_ptr
225
225
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bigdecimal'
4
- require 'bigdecimal/util'
5
- require 'narray'
6
- require_relative '../gdal'
7
- require_relative 'raster_band_mixins/algorithm_methods'
8
- require_relative 'major_object'
3
+ require "bigdecimal"
4
+ require "bigdecimal/util"
5
+ require "narray"
6
+ require_relative "../gdal"
7
+ require_relative "raster_band_mixins/algorithm_methods"
8
+ require_relative "major_object"
9
9
 
10
10
  module GDAL
11
11
  class RasterBand # rubocop:disable Metrics/ClassLength
@@ -37,7 +37,7 @@ module GDAL
37
37
 
38
38
  # @raise [GDAL::Error]
39
39
  def flush_cache
40
- GDAL::CPLErrorHandler.manually_handle('Unable to flush cache') do
40
+ GDAL::CPLErrorHandler.manually_handle("Unable to flush cache") do
41
41
  FFI::GDAL::GDAL.GDALFlushRasterCache(@c_pointer)
42
42
  end
43
43
  end
@@ -79,7 +79,7 @@ module GDAL
79
79
  # @param new_color_interp [FFI::GDAL::GDAL::ColorInterp]
80
80
  # @raise [GDAL::Error]
81
81
  def color_interpretation=(new_color_interp)
82
- GDAL::CPLErrorHandler.manually_handle('Unable to set color interpretation') do
82
+ GDAL::CPLErrorHandler.manually_handle("Unable to set color interpretation") do
83
83
  FFI::GDAL::GDAL.GDALSetRasterColorInterpretation(@c_pointer, new_color_interp)
84
84
  end
85
85
  end
@@ -102,7 +102,7 @@ module GDAL
102
102
  def color_table=(new_color_table)
103
103
  color_table_pointer = GDAL::ColorTable.new_pointer(new_color_table)
104
104
 
105
- GDAL::CPLErrorHandler.manually_handle('Unable to set color table') do
105
+ GDAL::CPLErrorHandler.manually_handle("Unable to set color table") do
106
106
  FFI::GDAL::GDAL.GDALSetRasterColorTable(@c_pointer, color_table_pointer)
107
107
  end
108
108
  end
@@ -140,7 +140,7 @@ module GDAL
140
140
  def category_names=(names)
141
141
  names_pointer = GDAL._string_array_to_pointer(names)
142
142
 
143
- GDAL::CPLErrorHandler.manually_handle('Unable to set category names') do
143
+ GDAL::CPLErrorHandler.manually_handle("Unable to set category names") do
144
144
  FFI::GDAL::GDAL.GDALSetRasterCategoryNames(@c_pointer, names_pointer)
145
145
  end
146
146
  end
@@ -153,7 +153,7 @@ module GDAL
153
153
  def no_data_value
154
154
  associated = FFI::MemoryPointer.new(:bool)
155
155
  value = FFI::GDAL::GDAL.GDALGetRasterNoDataValue(@c_pointer, associated)
156
- value = nil if value.to_d == BigDecimal('-10_000_000_000.0')
156
+ value = nil if value.to_d == BigDecimal("-10_000_000_000.0")
157
157
 
158
158
  { value: value, is_associated: associated.read_bytes(1).to_bool }
159
159
  end
@@ -164,7 +164,7 @@ module GDAL
164
164
  # @param value [Float, nil]
165
165
  # @raise [GDAL::Error]
166
166
  def no_data_value=(value)
167
- GDAL::CPLErrorHandler.manually_handle('Unable to set NODATA value') do
167
+ GDAL::CPLErrorHandler.manually_handle("Unable to set NODATA value") do
168
168
  FFI::GDAL::GDAL.GDALSetRasterNoDataValue(@c_pointer, value)
169
169
  end
170
170
  end
@@ -251,7 +251,7 @@ module GDAL
251
251
  end
252
252
  end
253
253
 
254
- GDAL::CPLErrorHandler.manually_handle('Unable to create mask band') do
254
+ GDAL::CPLErrorHandler.manually_handle("Unable to create mask band") do
255
255
  FFI::GDAL::GDAL.GDALCreateMaskBand(@c_pointer, flag_value)
256
256
  end
257
257
  end
@@ -263,7 +263,7 @@ module GDAL
263
263
  # @param imaginary_value [Float]
264
264
  # @raise [GDAL::Error]
265
265
  def fill(real_value, imaginary_value = 0)
266
- GDAL::CPLErrorHandler.manually_handle('Unable to fill raster') do
266
+ GDAL::CPLErrorHandler.manually_handle("Unable to fill raster") do
267
267
  FFI::GDAL::GDAL.GDALFillRaster(@c_pointer, real_value, imaginary_value)
268
268
  end
269
269
  end
@@ -315,7 +315,7 @@ module GDAL
315
315
  mean_ptr = FFI::MemoryPointer.new(:double)
316
316
  standard_deviation_ptr = FFI::MemoryPointer.new(:double)
317
317
 
318
- GDAL::CPLErrorHandler.manually_handle('Unable to compute raster statistics') do
318
+ GDAL::CPLErrorHandler.manually_handle("Unable to compute raster statistics") do
319
319
  FFI::GDAL::GDAL::GDALComputeRasterStatistics(
320
320
  @c_pointer, # hBand
321
321
  approx_ok, # bApproxOK
@@ -352,7 +352,7 @@ module GDAL
352
352
  success = FFI::MemoryPointer.new(:bool)
353
353
  result = FFI::GDAL::GDAL.GDALGetRasterScale(@c_pointer, success)
354
354
 
355
- raise GDAL::Error, 'GDALGetRasterScale failed' unless success.read_bytes(1).to_bool
355
+ raise GDAL::Error, "GDALGetRasterScale failed" unless success.read_bytes(1).to_bool
356
356
 
357
357
  result
358
358
  end
@@ -360,7 +360,7 @@ module GDAL
360
360
  # @param new_scale [Float]
361
361
  # @raise [GDAL::Error]
362
362
  def scale=(new_scale)
363
- GDAL::CPLErrorHandler.manually_handle('Unable to set raster scale') do
363
+ GDAL::CPLErrorHandler.manually_handle("Unable to set raster scale") do
364
364
  FFI::GDAL::GDAL.GDALSetRasterScale(@c_pointer, new_scale.to_f)
365
365
  end
366
366
  end
@@ -381,7 +381,7 @@ module GDAL
381
381
  success = FFI::MemoryPointer.new(:bool)
382
382
  result = FFI::GDAL::GDAL.GDALGetRasterOffset(@c_pointer, success)
383
383
 
384
- raise GDAL::Error, 'GDALGetRasterOffset failed' unless success.read_bytes(1).to_bool
384
+ raise GDAL::Error, "GDALGetRasterOffset failed" unless success.read_bytes(1).to_bool
385
385
 
386
386
  result
387
387
  end
@@ -391,7 +391,7 @@ module GDAL
391
391
  # @param new_offset [Float]
392
392
  # @return [Boolean]
393
393
  def offset=(new_offset)
394
- GDAL::CPLErrorHandler.manually_handle('Unable to set raster offset') do
394
+ GDAL::CPLErrorHandler.manually_handle("Unable to set raster offset") do
395
395
  FFI::GDAL::GDAL.GDALSetRasterOffset(@c_pointer, new_offset)
396
396
  end
397
397
  end
@@ -414,7 +414,7 @@ module GDAL
414
414
  return
415
415
  end
416
416
 
417
- GDAL::CPLErrorHandler.manually_handle('Unable to set unit type') do
417
+ GDAL::CPLErrorHandler.manually_handle("Unable to set unit type") do
418
418
  FFI::GDAL::GDAL.GDALSetRasterUnitType(@c_pointer, new_unit_type)
419
419
  end
420
420
  end
@@ -431,7 +431,7 @@ module GDAL
431
431
  def default_raster_attribute_table=(rat_table)
432
432
  rat_table_ptr = GDAL::RasterAttributeTable.new_pointer(rat_table)
433
433
 
434
- GDAL::CPLErrorHandler.manually_handle('Unable to set default raster attribute table') do
434
+ GDAL::CPLErrorHandler.manually_handle("Unable to set default raster attribute table") do
435
435
  FFI::GDAL::GDAL.GDALSetDefaultRAT(@c_pointer, rat_table_ptr)
436
436
  end
437
437
  end
@@ -592,7 +592,7 @@ module GDAL
592
592
  destination_pointer = GDAL._pointer(GDAL::RasterBand, destination_band)
593
593
  options_ptr = GDAL::Options.pointer(options)
594
594
 
595
- GDAL::CPLErrorHandler.manually_handle('Unable to copy whole raster') do
595
+ GDAL::CPLErrorHandler.manually_handle("Unable to copy whole raster") do
596
596
  FFI::GDAL::GDAL.GDALRasterBandCopyWholeRaster(@c_pointer,
597
597
  destination_pointer,
598
598
  options_ptr,
@@ -691,7 +691,7 @@ module GDAL
691
691
  def read_block(x_block_number, y_block_number, image_buffer = nil)
692
692
  image_buffer ||= FFI::MemoryPointer.new(:buffer_out, block_buffer_size)
693
693
 
694
- GDAL::CPLErrorHandler.manually_handle('Unable to read block') do
694
+ GDAL::CPLErrorHandler.manually_handle("Unable to read block") do
695
695
  FFI::GDAL::GDAL.GDALReadBlock(@c_pointer, x_block_number, y_block_number, image_buffer)
696
696
  end
697
697
 
@@ -707,7 +707,7 @@ module GDAL
707
707
  def write_block(x_block_number, y_block_number, data_pointer = nil)
708
708
  data_pointer ||= FFI::Buffer.alloc_inout(block_buffer_size)
709
709
 
710
- GDAL::CPLErrorHandler.manually_handle('Unable to write block') do
710
+ GDAL::CPLErrorHandler.manually_handle("Unable to write block") do
711
711
  FFI::GDAL::GDAL.GDALWriteBlock(@c_pointer, x_block_number, y_block_number, data_pointer)
712
712
  end
713
713
 
data/lib/gdal/rpc_info.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'forwardable'
4
- require_relative '../gdal'
3
+ require "forwardable"
4
+ require_relative "../gdal"
5
5
 
6
6
  module GDAL
7
7
  # @return [FFI::GDAL::RPCInfo]
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../gdal'
3
+ require_relative "../gdal"
4
4
 
5
5
  module GDAL
6
6
  class Transformer
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base_general_image_projection_transformer'
3
+ require_relative "base_general_image_projection_transformer"
4
4
 
5
5
  module GDAL
6
6
  module Transformers
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base_general_image_projection_transformer'
3
+ require_relative "base_general_image_projection_transformer"
4
4
 
5
5
  module GDAL
6
6
  module Transformers
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'base_general_image_projection_transformer'
3
+ require_relative "base_general_image_projection_transformer"
4
4
 
5
5
  module GDAL
6
6
  module Transformers