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 'ogr/layer'
3
+ require "ogr/layer"
4
4
 
5
5
  module OGR
6
6
  module LayerMixins
@@ -10,17 +10,17 @@ module OGR
10
10
  # manner for this layer (as opposed to using #next_feature and
11
11
  # #reset_reading).
12
12
  def can_random_read?
13
- test_capability('RandomRead')
13
+ test_capability("RandomRead")
14
14
  end
15
15
 
16
16
  # @return [Boolean] +true+ if #create_feature is allowed on this layer.
17
17
  def can_sequential_write?
18
- test_capability('SequentialWrite')
18
+ test_capability("SequentialWrite")
19
19
  end
20
20
 
21
21
  # @return [Boolean] +true+ if #feature= is allowed on this layer.
22
22
  def can_random_write?
23
- test_capability('RandomWrite')
23
+ test_capability("RandomWrite")
24
24
  end
25
25
 
26
26
  # @return [Boolean] +true+ if this layer implements spatial filtering
@@ -28,78 +28,78 @@ module OGR
28
28
  # it should build and maintain its own spatial index for features in
29
29
  # this layer.
30
30
  def can_fast_spatial_filter?
31
- test_capability('FastSpatialFilter')
31
+ test_capability("FastSpatialFilter")
32
32
  end
33
33
 
34
34
  # @return [Boolean] +true+ if this layer can return a feature count
35
35
  # efficiently (i.e. without counting all of the features).
36
36
  def can_fast_feature_count?
37
- test_capability('FastFeatureCount')
37
+ test_capability("FastFeatureCount")
38
38
  end
39
39
 
40
40
  # @return [Boolean] +true+ if this Layer can return its extent
41
41
  # efficiently (i.e. without scanning all of the features.).
42
42
  def can_fast_get_extent?
43
- test_capability('FastGetExtent')
43
+ test_capability("FastGetExtent")
44
44
  end
45
45
 
46
46
  # @return [Boolean] +true+ if this layer can perform the
47
47
  # #next_feature_index= call efficiently.
48
48
  def can_fast_set_next_by_index?
49
- test_capability('FastSetNextByIndex')
49
+ test_capability("FastSetNextByIndex")
50
50
  end
51
51
 
52
52
  # @return [Boolean] +true+ if new Fields can be created on this Layer.
53
53
  def can_create_field?
54
- test_capability('CreateField')
54
+ test_capability("CreateField")
55
55
  end
56
56
 
57
57
  # @return [Boolean] +true+ if the Layer supports creating new geometry
58
58
  # fields on the current layer.
59
59
  def can_create_geometry_field?
60
- test_capability('CreateGeomField')
60
+ test_capability("CreateGeomField")
61
61
  end
62
62
 
63
63
  # @return [Boolean] +true+ if the Layer supports deleting existing fields
64
64
  # on the current layer.
65
65
  def can_delete_field?
66
- test_capability('DeleteField')
66
+ test_capability("DeleteField")
67
67
  end
68
68
 
69
69
  # @return [Boolean] +true+ if the Layer supports reording fields on the
70
70
  # current layer.
71
71
  def can_reorder_fields?
72
- test_capability('ReorderFields')
72
+ test_capability("ReorderFields")
73
73
  end
74
74
 
75
75
  # @return [Boolean] +true+ if the Layer supports altering the defintition
76
76
  # of an existing field on the current layer.
77
77
  def can_alter_field_definition?
78
- test_capability('AlterFieldDefn')
78
+ test_capability("AlterFieldDefn")
79
79
  end
80
80
 
81
81
  # @return [Boolean] +true+ if the Layer supports deleting Features.
82
82
  def can_delete_feature?
83
- test_capability('DeleteFeature')
83
+ test_capability("DeleteFeature")
84
84
  end
85
85
 
86
86
  # @return [Boolean] +true+ if :OFTString fields are guaranteed to be in
87
87
  # UTF-8.
88
88
  def strings_are_utf_8?
89
- test_capability('StringsAsUTF8')
89
+ test_capability("StringsAsUTF8")
90
90
  end
91
91
 
92
92
  # @return [Boolean] +true+ if this Layer supports transactions. If not,
93
93
  # #start_transaction, #commit_transaction, and #rollback_transaction
94
94
  # will not work in a meaningful manner.
95
95
  def supports_transactions?
96
- test_capability('Transactions')
96
+ test_capability("Transactions")
97
97
  end
98
98
 
99
99
  # @return [Boolean] +true+ if this Layer supports reading or writing
100
100
  # curve geometries.
101
101
  def supports_curve_geometries?
102
- test_capability('CurveGeometries')
102
+ test_capability("CurveGeometries")
103
103
  end
104
104
  end
105
105
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ogr/layer'
3
+ require "ogr/layer"
4
4
 
5
5
  module OGR
6
6
  class Layer
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ogr/spatial_reference'
3
+ require "ogr/spatial_reference"
4
4
 
5
5
  module OGR
6
6
  class SpatialReference
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ogr/spatial_reference'
3
+ require "ogr/spatial_reference"
4
4
 
5
5
  module OGR
6
6
  module SpatialReferenceMixins
@@ -124,7 +124,7 @@ module OGR
124
124
  object = new(spatial_reference_or_wkt)
125
125
  ogr_err = yield object.c_pointer
126
126
 
127
- OGR::ErrorHandling.handle_ogr_err('Unable to build SpatialReference') do
127
+ OGR::ErrorHandling.handle_ogr_err("Unable to build SpatialReference") do
128
128
  ogr_err
129
129
  end
130
130
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ogr/style_table'
3
+ require "ogr/style_table"
4
4
 
5
5
  module OGR
6
6
  class StyleTable
data/lib/ogr/feature.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'date'
4
- require_relative '../ogr'
5
- require_relative '../gdal'
3
+ require "date"
4
+ require_relative "../ogr"
5
+ require_relative "../gdal"
6
6
 
7
7
  module OGR
8
8
  class Feature
@@ -26,7 +26,7 @@ module OGR
26
26
  fd_or_pointer.autorelease = false
27
27
  fd_or_pointer
28
28
  else
29
- raise OGR::InvalidFeature, 'OGR::Feature must be instantiated with valid feature'
29
+ raise OGR::InvalidFeature, "OGR::Feature must be instantiated with valid feature"
30
30
  end
31
31
 
32
32
  if !pointer.is_a?(FFI::Pointer) || pointer.null?
@@ -50,7 +50,7 @@ module OGR
50
50
  def clone
51
51
  # This new feature is owned by the caller and must be released accordingly.
52
52
  feature_ptr = FFI::OGR::API.OGR_F_Clone(@c_pointer)
53
- raise OGR::Failure, 'Unable to clone feature' if feature_ptr.nil?
53
+ raise OGR::Failure, "Unable to clone feature" if feature_ptr.nil?
54
54
 
55
55
  OGR::Feature.new(feature_ptr)
56
56
  end
@@ -59,7 +59,7 @@ module OGR
59
59
  #
60
60
  # @param file_path [String]
61
61
  def dump_readable(file_path = nil)
62
- file_ptr = file_path ? FFI::CPL::Conv.CPLOpenShared(file_path, 'w', false) : nil
62
+ file_ptr = file_path ? FFI::CPL::Conv.CPLOpenShared(file_path, "w", false) : nil
63
63
  FFI::OGR::API.OGR_F_DumpReadable(@c_pointer, file_ptr)
64
64
  FFI::CPL::Conv.CPLCloseShared(file_ptr) if file_ptr
65
65
  end
@@ -74,9 +74,9 @@ module OGR
74
74
  # @raise [OGR::Failure]
75
75
  # TODO: Implement +with_map+
76
76
  def set_from!(_other_feature, _be_forgiving: false, with_map: nil)
77
- raise NotImplementedError, 'with_map: is not yet supported' if with_map
77
+ raise NotImplementedError, "with_map: is not yet supported" if with_map
78
78
 
79
- OGR::ErrorHandling.handle_ogr_err('Unable to set from other feature') do
79
+ OGR::ErrorHandling.handle_ogr_err("Unable to set from other feature") do
80
80
  FFI::OGR::API.OGR_F_SetFrom(@c_pointer, other_feature_ptr)
81
81
  end
82
82
  end
@@ -159,7 +159,7 @@ module OGR
159
159
  # @param index [Integer]
160
160
  # @param value [String]
161
161
  def set_field_binary(index, value)
162
- raise TypeError, 'value must be a binary string' unless value.is_a? String
162
+ raise TypeError, "value must be a binary string" unless value.is_a? String
163
163
 
164
164
  value_ptr = FFI::MemoryPointer.new(:uchar, value.length)
165
165
  value_ptr.put_bytes(0, value)
@@ -249,7 +249,7 @@ module OGR
249
249
  # @param new_geometry [OGR::Geometry]
250
250
  # @raise [OGR::Failure]
251
251
  def set_geometry(new_geometry) # rubocop:disable Naming/AccessorMethodName
252
- OGR::ErrorHandling.handle_ogr_err('Unable to set geometry on feature') do
252
+ OGR::ErrorHandling.handle_ogr_err("Unable to set geometry on feature") do
253
253
  FFI::OGR::API.OGR_F_SetGeometry(@c_pointer, new_geometry.c_pointer)
254
254
  end
255
255
  end
@@ -261,7 +261,7 @@ module OGR
261
261
  def set_geometry_directly(new_geometry) # rubocop:disable Naming/AccessorMethodName
262
262
  new_geometry.c_pointer.autorelease = false
263
263
 
264
- OGR::ErrorHandling.handle_ogr_err('Unable to set geometry directly on feature') do
264
+ OGR::ErrorHandling.handle_ogr_err("Unable to set geometry directly on feature") do
265
265
  FFI::OGR::API.OGR_F_SetGeometryDirectly(@c_pointer, new_geometry.c_pointer)
266
266
  end
267
267
  end
@@ -272,7 +272,7 @@ module OGR
272
272
  # @return [OGR::Geometry]
273
273
  def steal_geometry
274
274
  geometry_ptr = FFI::OGR::API.OGR_F_StealGeometry(@c_pointer)
275
- raise OGR::Failure, 'Unable to steal geometry.' if geometry_ptr.nil? || geometry_ptr.null?
275
+ raise OGR::Failure, "Unable to steal geometry." if geometry_ptr.nil? || geometry_ptr.null?
276
276
 
277
277
  OGR::Geometry.factory(geometry_ptr)
278
278
  end
@@ -285,7 +285,7 @@ module OGR
285
285
  # @param new_fid [Integer]
286
286
  # @raise [OGR::Failure]
287
287
  def fid=(new_fid)
288
- OGR::ErrorHandling.handle_ogr_err('Unable to set FID') do
288
+ OGR::ErrorHandling.handle_ogr_err("Unable to set FID") do
289
289
  FFI::OGR::API.OGR_F_SetFID(@c_pointer, new_fid)
290
290
  end
291
291
  end
@@ -443,9 +443,9 @@ module OGR
443
443
  binary_data_ptr.autorelease = false
444
444
 
445
445
  byte_count = byte_count_ptr.read_int
446
- string = byte_count.positive? ? binary_data_ptr.read_bytes(byte_count) : ''
446
+ string = byte_count.positive? ? binary_data_ptr.read_bytes(byte_count) : ""
447
447
 
448
- string.unpack('C*')
448
+ string.unpack("C*")
449
449
  end
450
450
 
451
451
  def field_as_date_time(index)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../gdal'
4
- require_relative '../ogr'
3
+ require_relative "../gdal"
4
+ require_relative "../ogr"
5
5
 
6
6
  module OGR
7
7
  class FeatureDefinition
data/lib/ogr/field.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'date'
4
- require_relative '../ogr'
5
- require_relative '../gdal'
3
+ require "date"
4
+ require_relative "../ogr"
5
+ require_relative "../gdal"
6
6
 
7
7
  module OGR
8
8
  class Field
@@ -53,7 +53,7 @@ module OGR
53
53
 
54
54
  # TODO: This blows up when another value type has been set.
55
55
  def string
56
- return '' if @c_struct[:string]&.null?
56
+ return "" if @c_struct[:string]&.null?
57
57
 
58
58
  @c_struct[:string].read_string
59
59
  end
@@ -150,7 +150,7 @@ module OGR
150
150
  def binary
151
151
  b = @c_struct[:binary]
152
152
 
153
- b[:count].positive? ? b[:data].read_bytes(b[:count]) : ''
153
+ b[:count].positive? ? b[:data].read_bytes(b[:count]) : ""
154
154
  end
155
155
 
156
156
  # @param new_binary [String] Binary string of 8-bit, unsigned data (uchar).
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../ogr'
3
+ require_relative "../ogr"
4
4
 
5
5
  module OGR
6
6
  class FieldDefinition
data/lib/ogr/geocoder.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../ogr'
3
+ require_relative "../ogr"
4
4
 
5
5
  module OGR
6
6
  # Geocode things! http://www.gdal.org/ogr__geocoding_8h.html
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../geometry_types/container'
4
- require_relative '../geometry_types/surface'
3
+ require_relative "../geometry_types/container"
4
+ require_relative "../geometry_types/surface"
5
5
 
6
6
  module OGR
7
7
  class GeometryCollection
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'geometry_collection'
3
+ require_relative "geometry_collection"
4
4
 
5
5
  module OGR
6
6
  # NOTE: {{#type}} will return :wkbGeometryCollection (read: 2D instead of
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../geometry_types/curve'
3
+ require_relative "../geometry_types/curve"
4
4
 
5
5
  module OGR
6
6
  class LineString
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'line_string'
3
+ require_relative "line_string"
4
4
 
5
5
  module OGR
6
6
  # NOTE: {{#type}} will return :wkbLineString (read: 2D instead of 2.5D) until
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'line_string'
3
+ require_relative "line_string"
4
4
 
5
5
  module OGR
6
6
  class LinearRing < LineString
@@ -14,7 +14,7 @@ module OGR
14
14
  def to_line_string
15
15
  line_string = OGR::LineString.new
16
16
  line_string.spatial_reference = spatial_reference if spatial_reference
17
- line_string.import_from_wkt(to_wkt.sub('LINEARRING', 'LINESTRING'))
17
+ line_string.import_from_wkt(to_wkt.sub("LINEARRING", "LINESTRING"))
18
18
 
19
19
  line_string
20
20
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../geometry_types/curve'
4
- require_relative '../geometry_types/container'
3
+ require_relative "../geometry_types/curve"
4
+ require_relative "../geometry_types/container"
5
5
 
6
6
  module OGR
7
7
  class MultiLineString
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'multi_line_string'
3
+ require_relative "multi_line_string"
4
4
 
5
5
  module OGR
6
6
  # NOTE: {{#type}} will return :wkbMultiLineString (read: 2D instead of 2.5D)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../geometry_types/container'
3
+ require_relative "../geometry_types/container"
4
4
 
5
5
  module OGR
6
6
  class MultiPoint
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'multi_point'
3
+ require_relative "multi_point"
4
4
 
5
5
  module OGR
6
6
  # NOTE: {{#type}} will return :wkbMultiPoint (read: 2D instead of 2.5D) until
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../geometry_types/container'
4
- require_relative '../geometry_types/surface'
3
+ require_relative "../geometry_types/container"
4
+ require_relative "../geometry_types/surface"
5
5
 
6
6
  module OGR
7
7
  class MultiPolygon
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'multi_polygon'
3
+ require_relative "multi_polygon"
4
4
 
5
5
  module OGR
6
6
  # NOTE: {{#type}} will return :wkbMultiPolygon (read: 2D instead of 2.5D)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'point'
3
+ require_relative "point"
4
4
 
5
5
  module OGR
6
6
  # NOTE: {{#type}} will return :wkbPoint (read: 2D instead of 2.5D) until a Z
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../geometry_types/container'
4
- require_relative '../geometry_types/surface'
3
+ require_relative "../geometry_types/container"
4
+ require_relative "../geometry_types/surface"
5
5
 
6
6
  module OGR
7
7
  class Polygon
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'polygon'
3
+ require_relative "polygon"
4
4
 
5
5
  module OGR
6
6
  # NOTE: {{#type}} will return :wkbPolygon (read: 2D instead of 2.5D) until a Z
data/lib/ogr/geometry.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../ogr'
4
- require_relative '../gdal'
3
+ require_relative "../ogr"
4
+ require_relative "../gdal"
5
5
 
6
6
  module OGR
7
7
  module Geometry
@@ -213,7 +213,7 @@ module OGR
213
213
  FFI::OGR::API.OGR_G_GetEnvelope3D(@c_pointer, envelope)
214
214
  when 0 then return nil
215
215
  else
216
- raise 'Unknown envelope dimension.'
216
+ raise "Unknown envelope dimension."
217
217
  end
218
218
 
219
219
  return if envelope.null?
@@ -268,7 +268,7 @@ module OGR
268
268
  # @param file_path [String] The text file to write to.
269
269
  # @param prefix [String] The prefix to put on each line of output.
270
270
  def dump_readable(file_path = nil, prefix: nil)
271
- file_ptr = file_path ? FFI::CPL::Conv.CPLOpenShared(file_path, 'w', false) : nil
271
+ file_ptr = file_path ? FFI::CPL::Conv.CPLOpenShared(file_path, "w", false) : nil
272
272
  FFI::OGR::API.OGR_G_DumpReadable(@c_pointer, file_ptr, prefix)
273
273
  FFI::CPL::Conv.CPLCloseShared(file_ptr) if file_ptr
274
274
  end
@@ -363,7 +363,7 @@ module OGR
363
363
  def ring?
364
364
  FFI::OGR::API.OGR_G_IsRing(@c_pointer)
365
365
  rescue GDAL::Error => e
366
- return false if e.message.include? 'IllegalArgumentException'
366
+ return false if e.message.include? "IllegalArgumentException"
367
367
 
368
368
  raise
369
369
  end
@@ -467,7 +467,7 @@ module OGR
467
467
 
468
468
  return if coord_trans_ptr.nil? || coord_trans_ptr.null?
469
469
 
470
- OGR::ErrorHandling.handle_ogr_err('Unable to transform geometry') do
470
+ OGR::ErrorHandling.handle_ogr_err("Unable to transform geometry") do
471
471
  FFI::OGR::API.OGR_G_Transform(@c_pointer, coord_trans_ptr)
472
472
  end
473
473
  end
@@ -489,7 +489,7 @@ module OGR
489
489
  new_spatial_ref_ptr = GDAL._pointer(OGR::SpatialReference, new_spatial_ref, autorelease: false)
490
490
  return if new_spatial_ref_ptr.null?
491
491
 
492
- OGR::ErrorHandling.handle_ogr_err('Unable to transform geometry') do
492
+ OGR::ErrorHandling.handle_ogr_err("Unable to transform geometry") do
493
493
  FFI::OGR::API.OGR_G_TransformTo(@c_pointer, new_spatial_ref_ptr)
494
494
  end
495
495
  end
@@ -552,7 +552,7 @@ module OGR
552
552
  # @param wkb_data [String] Binary WKB data.
553
553
  # @raise [OGR::Failure]
554
554
  def import_from_wkb(wkb_data)
555
- OGR::ErrorHandling.handle_ogr_err('Unable to import geometry from WKB') do
555
+ OGR::ErrorHandling.handle_ogr_err("Unable to import geometry from WKB") do
556
556
  FFI::OGR::API.OGR_G_ImportFromWkb(@c_pointer, wkb_data, wkb_data.length)
557
557
  end
558
558
  end
@@ -592,7 +592,7 @@ module OGR
592
592
  # @raise [OGR::Failure]
593
593
  def to_wkt
594
594
  GDAL._cpl_read_and_free_string do |output_ptr|
595
- OGR::ErrorHandling.handle_ogr_err('Unable to export to WKT') do
595
+ OGR::ErrorHandling.handle_ogr_err("Unable to export to WKT") do
596
596
  FFI::OGR::API.OGR_G_ExportToWkt(@c_pointer, output_ptr)
597
597
  end
598
598
  end
@@ -602,7 +602,7 @@ module OGR
602
602
  # @raise [OGR::Failure]
603
603
  def to_iso_wkt
604
604
  GDAL._cpl_read_and_free_string do |output_ptr|
605
- OGR::ErrorHandling.handle_ogr_err('Unable to export to WKT') do
605
+ OGR::ErrorHandling.handle_ogr_err("Unable to export to WKT") do
606
606
  FFI::OGR::API.OGR_G_ExportToIsoWkt(@c_pointer, output_ptr)
607
607
  end
608
608
  end
@@ -683,7 +683,7 @@ module OGR
683
683
 
684
684
  linear_ring.spatial_reference = line_string.spatial_reference.clone if line_string.spatial_reference
685
685
 
686
- linear_ring.import_from_wkt(line_string.to_wkt.tr('LINESTRING', 'LINEARRING'))
686
+ linear_ring.import_from_wkt(line_string.to_wkt.tr("LINESTRING", "LINEARRING"))
687
687
  linear_ring.close_rings! if close_rings
688
688
 
689
689
  linear_ring
@@ -71,7 +71,7 @@ module OGR
71
71
  tolerance,
72
72
  ogrerr_ptr)
73
73
 
74
- OGR::ErrorHandling.handle_ogr_err('Unable to create polygon from edges') do
74
+ OGR::ErrorHandling.handle_ogr_err("Unable to create polygon from edges") do
75
75
  FFI::OGR::Core::Err[ogrerr_ptr.read_int]
76
76
  end
77
77
 
@@ -75,7 +75,7 @@ module OGR
75
75
  x_buffer, x_stride, y_buffer,
76
76
  y_stride, z_buffer, z_stride)
77
77
 
78
- log 'Got different number of points than point_count in #point_values' unless num_points == point_count
78
+ log "Got different number of points than point_count in #point_values" unless num_points == point_count
79
79
 
80
80
  x_array = x_buffer.read_array_of_double(buffer_size)
81
81
  y_array = y_buffer.read_array_of_double(buffer_size)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'time'
3
+ require "time"
4
4
 
5
5
  module OGR
6
6
  module InternalHelpers
@@ -15,8 +15,8 @@ module OGR
15
15
  # @param flag [String] 'w' for writing, 'r' for reading.
16
16
  def _boolean_access_flag(flag)
17
17
  case flag
18
- when 'w' then true
19
- when 'r' then false
18
+ when "w" then true
19
+ when "r" then false
20
20
  else raise "Invalid access_flag '#{flag}'. Use 'r' or 'w'."
21
21
  end
22
22
  end
@@ -33,7 +33,7 @@ module OGR
33
33
  case time_zone
34
34
  when 0 then nil
35
35
  when 1 then (Time.now.getlocal.utc_offset / 3600).to_s
36
- when 100 then '+0'
36
+ when 100 then "+0"
37
37
  else raise "Unable to process time zone: #{time_zone}"
38
38
  end
39
39
  end
data/lib/ogr/layer.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../ogr'
4
- require_relative '../gdal'
5
- require_relative 'layer_mixins/ogr_feature_methods'
6
- require_relative 'layer_mixins/ogr_field_methods'
7
- require_relative 'layer_mixins/ogr_layer_method_methods'
8
- require_relative 'layer_mixins/ogr_query_filter_methods'
9
- require_relative 'layer_mixins/ogr_sql_methods'
3
+ require_relative "../ogr"
4
+ require_relative "../gdal"
5
+ require_relative "layer_mixins/ogr_feature_methods"
6
+ require_relative "layer_mixins/ogr_field_methods"
7
+ require_relative "layer_mixins/ogr_layer_method_methods"
8
+ require_relative "layer_mixins/ogr_query_filter_methods"
9
+ require_relative "layer_mixins/ogr_sql_methods"
10
10
 
11
11
  module OGR
12
12
  class Layer
@@ -42,7 +42,7 @@ module OGR
42
42
  # TODO: This seems to occasionally lead to: 28352 illegal hardware
43
43
  # instruction, and sometimes full crashes.
44
44
  def sync_to_disk
45
- OGR::ErrorHandling.handle_ogr_err('Unable to sync layer to disk') do
45
+ OGR::ErrorHandling.handle_ogr_err("Unable to sync layer to disk") do
46
46
  FFI::OGR::API.OGR_L_SyncToDisk(@c_pointer)
47
47
  end
48
48
  end