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,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 GDAL
@@ -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 GDAL
@@ -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 GDAL
@@ -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 GDAL
@@ -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 GDAL
@@ -2,6 +2,6 @@
2
2
 
3
3
  module FFI
4
4
  module GDAL
5
- VERSION = '1.0.1'
5
+ VERSION = "1.0.3"
6
6
  end
7
7
  end
data/lib/ffi/gdal/vrt.rb CHANGED
@@ -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 GDAL
@@ -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 GDAL
@@ -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 GDAL
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.