ffi-gdal 1.0.0.beta7 → 1.0.0.beta8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (298) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +31 -5
  3. data/.rubocop_todo.yml +70 -0
  4. data/.ruby-version +1 -1
  5. data/Gemfile +2 -0
  6. data/History.md +12 -0
  7. data/Rakefile +11 -1
  8. data/examples/extract_and_colorize.rb +7 -10
  9. data/examples/geometries.rb +68 -1
  10. data/examples/gridding.rb +2 -0
  11. data/examples/ogr_layer_to_layer.rb +2 -0
  12. data/examples/raster_erasing.rb +15 -8
  13. data/examples/remove_small_polygons.rb +2 -0
  14. data/examples/testing_gdal.rb +9 -2
  15. data/examples/warping.rb +23 -5
  16. data/ffi-gdal.gemspec +3 -0
  17. data/lib/ext/error_symbols.rb +2 -0
  18. data/lib/ext/ffi_library_function_checks.rb +2 -0
  19. data/lib/ext/float_ext.rb +2 -0
  20. data/lib/ext/narray_ext.rb +2 -0
  21. data/lib/ext/numeric_as_data_type.rb +2 -0
  22. data/lib/ext/to_bool.rb +5 -3
  23. data/lib/ffi/cpl/conv.rb +2 -0
  24. data/lib/ffi/cpl/error.rb +2 -0
  25. data/lib/ffi/cpl/hash_set.rb +2 -0
  26. data/lib/ffi/cpl/http.rb +2 -0
  27. data/lib/ffi/cpl/http_result.rb +2 -0
  28. data/lib/ffi/cpl/list.rb +2 -0
  29. data/lib/ffi/cpl/mime_part.rb +2 -0
  30. data/lib/ffi/cpl/minixml.rb +2 -0
  31. data/lib/ffi/cpl/port.rb +2 -0
  32. data/lib/ffi/cpl/progress.rb +2 -0
  33. data/lib/ffi/cpl/quad_tree.rb +2 -0
  34. data/lib/ffi/cpl/rect_obj.rb +2 -0
  35. data/lib/ffi/cpl/string.rb +2 -0
  36. data/lib/ffi/cpl/vsi.rb +2 -0
  37. data/lib/ffi/cpl/xml_node.rb +2 -0
  38. data/lib/ffi/cpl.rb +2 -0
  39. data/lib/ffi/gdal/alg.rb +2 -0
  40. data/lib/ffi/gdal/color_entry.rb +2 -0
  41. data/lib/ffi/gdal/exceptions.rb +2 -0
  42. data/lib/ffi/gdal/gcp.rb +2 -0
  43. data/lib/ffi/gdal/gdal.rb +2 -0
  44. data/lib/ffi/gdal/grid.rb +2 -0
  45. data/lib/ffi/gdal/grid_data_metrics_options.rb +2 -0
  46. data/lib/ffi/gdal/grid_inverse_distance_to_a_power_options.rb +2 -0
  47. data/lib/ffi/gdal/grid_moving_average_options.rb +2 -0
  48. data/lib/ffi/gdal/grid_nearest_neighbor_options.rb +2 -0
  49. data/lib/ffi/gdal/matching.rb +2 -0
  50. data/lib/ffi/gdal/rpc_info.rb +2 -0
  51. data/lib/ffi/gdal/transformer_info.rb +2 -0
  52. data/lib/ffi/gdal/version.rb +3 -1
  53. data/lib/ffi/gdal/vrt.rb +2 -0
  54. data/lib/ffi/gdal/warp_options.rb +2 -0
  55. data/lib/ffi/gdal/warper.rb +2 -0
  56. data/lib/ffi/gdal.rb +2 -0
  57. data/lib/ffi/ogr/api.rb +2 -0
  58. data/lib/ffi/ogr/contour_writer_info.rb +2 -0
  59. data/lib/ffi/ogr/core.rb +2 -0
  60. data/lib/ffi/ogr/envelope.rb +2 -0
  61. data/lib/ffi/ogr/envelope_3d.rb +2 -0
  62. data/lib/ffi/ogr/featurestyle.rb +2 -0
  63. data/lib/ffi/ogr/field.rb +2 -0
  64. data/lib/ffi/ogr/geocoding.rb +2 -0
  65. data/lib/ffi/ogr/srs_api.rb +5 -0
  66. data/lib/ffi/ogr/style_param.rb +2 -0
  67. data/lib/ffi/ogr/style_value.rb +2 -0
  68. data/lib/ffi/ogr.rb +2 -0
  69. data/lib/ffi-gdal.rb +2 -0
  70. data/lib/gdal/color_entry.rb +2 -0
  71. data/lib/gdal/color_entry_mixins/extensions.rb +2 -0
  72. data/lib/gdal/color_interpretation.rb +2 -0
  73. data/lib/gdal/color_table.rb +2 -0
  74. data/lib/gdal/color_table_mixins/extensions.rb +2 -0
  75. data/lib/gdal/color_table_types/cmyk.rb +2 -0
  76. data/lib/gdal/color_table_types/gray.rb +2 -0
  77. data/lib/gdal/color_table_types/hls.rb +2 -0
  78. data/lib/gdal/color_table_types/rgb.rb +2 -0
  79. data/lib/gdal/cpl_error_handler.rb +2 -0
  80. data/lib/gdal/data_type.rb +2 -0
  81. data/lib/gdal/dataset.rb +11 -7
  82. data/lib/gdal/dataset_mixins/algorithm_methods.rb +5 -2
  83. data/lib/gdal/dataset_mixins/extensions.rb +2 -0
  84. data/lib/gdal/dataset_mixins/matching.rb +4 -1
  85. data/lib/gdal/dataset_mixins/warp_methods.rb +3 -1
  86. data/lib/gdal/driver.rb +3 -1
  87. data/lib/gdal/driver_mixins/extensions.rb +2 -0
  88. data/lib/gdal/environment_methods.rb +2 -0
  89. data/lib/gdal/exceptions.rb +2 -0
  90. data/lib/gdal/geo_transform.rb +2 -0
  91. data/lib/gdal/geo_transform_mixins/extensions.rb +2 -0
  92. data/lib/gdal/grid.rb +4 -0
  93. data/lib/gdal/grid_algorithms/data_metrics_base.rb +2 -0
  94. data/lib/gdal/grid_algorithms/inverse_distance_to_a_power.rb +2 -0
  95. data/lib/gdal/grid_algorithms/metric_average_distance.rb +2 -0
  96. data/lib/gdal/grid_algorithms/metric_average_distance_pts.rb +2 -0
  97. data/lib/gdal/grid_algorithms/metric_count.rb +2 -0
  98. data/lib/gdal/grid_algorithms/metric_maximum.rb +2 -0
  99. data/lib/gdal/grid_algorithms/metric_minimum.rb +2 -0
  100. data/lib/gdal/grid_algorithms/metric_range.rb +2 -0
  101. data/lib/gdal/grid_algorithms/moving_average.rb +2 -0
  102. data/lib/gdal/grid_algorithms/nearest_neighbor.rb +2 -0
  103. data/lib/gdal/grid_algorithms.rb +2 -0
  104. data/lib/gdal/gridder/point_extracting.rb +2 -0
  105. data/lib/gdal/gridder.rb +4 -1
  106. data/lib/gdal/gridder_options.rb +2 -0
  107. data/lib/gdal/internal_helpers.rb +3 -4
  108. data/lib/gdal/logger.rb +2 -0
  109. data/lib/gdal/major_object.rb +2 -0
  110. data/lib/gdal/merger.rb +2 -0
  111. data/lib/gdal/options.rb +2 -0
  112. data/lib/gdal/raster_attribute_table.rb +2 -0
  113. data/lib/gdal/raster_attribute_table_mixins/extensions.rb +3 -1
  114. data/lib/gdal/raster_band.rb +4 -2
  115. data/lib/gdal/raster_band_classifier.rb +4 -6
  116. data/lib/gdal/raster_band_mixins/algorithm_extensions.rb +2 -0
  117. data/lib/gdal/raster_band_mixins/algorithm_methods.rb +12 -5
  118. data/lib/gdal/raster_band_mixins/coloring_extensions.rb +3 -1
  119. data/lib/gdal/raster_band_mixins/extensions.rb +2 -0
  120. data/lib/gdal/raster_band_mixins/io_extensions.rb +3 -1
  121. data/lib/gdal/rpc_info.rb +2 -0
  122. data/lib/gdal/transformer.rb +2 -0
  123. data/lib/gdal/transformers/approximate_transformer.rb +4 -1
  124. data/lib/gdal/transformers/base_general_image_projection_transformer.rb +4 -1
  125. data/lib/gdal/transformers/gcp_transformer.rb +6 -2
  126. data/lib/gdal/transformers/general_image_projection_transformer.rb +2 -0
  127. data/lib/gdal/transformers/general_image_projection_transformer2.rb +4 -1
  128. data/lib/gdal/transformers/general_image_projection_transformer3.rb +4 -1
  129. data/lib/gdal/transformers/geolocation_transformer.rb +4 -1
  130. data/lib/gdal/transformers/reprojection_transformer.rb +2 -0
  131. data/lib/gdal/transformers/rpc_transformer.rb +4 -1
  132. data/lib/gdal/transformers/tps_transformer.rb +2 -0
  133. data/lib/gdal/version_info.rb +9 -7
  134. data/lib/gdal/virtual_dataset.rb +2 -0
  135. data/lib/gdal/warp_operation.rb +2 -0
  136. data/lib/gdal/warp_options.rb +6 -0
  137. data/lib/gdal.rb +2 -0
  138. data/lib/ogr/coordinate_transformation.rb +2 -0
  139. data/lib/ogr/data_source.rb +2 -0
  140. data/lib/ogr/data_source_extensions.rb +2 -0
  141. data/lib/ogr/data_source_mixins/capability_methods.rb +2 -0
  142. data/lib/ogr/driver.rb +2 -0
  143. data/lib/ogr/driver_mixins/capability_methods.rb +2 -0
  144. data/lib/ogr/envelope.rb +2 -0
  145. data/lib/ogr/envelope_extensions.rb +2 -0
  146. data/lib/ogr/error_handling.rb +2 -0
  147. data/lib/ogr/exceptions.rb +3 -1
  148. data/lib/ogr/feature.rb +14 -8
  149. data/lib/ogr/feature_definition.rb +7 -4
  150. data/lib/ogr/feature_definition_extensions.rb +2 -0
  151. data/lib/ogr/feature_extensions.rb +2 -0
  152. data/lib/ogr/field.rb +2 -0
  153. data/lib/ogr/field_definition.rb +5 -3
  154. data/lib/ogr/geocoder.rb +2 -0
  155. data/lib/ogr/geometries/geometry_collection.rb +2 -0
  156. data/lib/ogr/geometries/geometry_collection_25d.rb +2 -0
  157. data/lib/ogr/geometries/line_string.rb +4 -0
  158. data/lib/ogr/geometries/line_string_25d.rb +2 -0
  159. data/lib/ogr/geometries/linear_ring.rb +2 -0
  160. data/lib/ogr/geometries/multi_line_string.rb +2 -0
  161. data/lib/ogr/geometries/multi_line_string_25d.rb +2 -0
  162. data/lib/ogr/geometries/multi_point.rb +2 -0
  163. data/lib/ogr/geometries/multi_point_25d.rb +2 -0
  164. data/lib/ogr/geometries/multi_polygon.rb +2 -0
  165. data/lib/ogr/geometries/multi_polygon_25d.rb +2 -0
  166. data/lib/ogr/geometries/none_geometry.rb +2 -0
  167. data/lib/ogr/geometries/point.rb +2 -0
  168. data/lib/ogr/geometries/point_25d.rb +2 -0
  169. data/lib/ogr/geometries/polygon.rb +2 -0
  170. data/lib/ogr/geometries/polygon_25d.rb +2 -0
  171. data/lib/ogr/geometries/unknown_geometry.rb +2 -0
  172. data/lib/ogr/geometry.rb +2 -0
  173. data/lib/ogr/geometry_field_definition.rb +4 -1
  174. data/lib/ogr/geometry_mixins/container_mixins.rb +2 -0
  175. data/lib/ogr/geometry_mixins/extensions.rb +9 -7
  176. data/lib/ogr/geometry_types/container.rb +2 -0
  177. data/lib/ogr/geometry_types/curve.rb +2 -0
  178. data/lib/ogr/geometry_types/surface.rb +2 -0
  179. data/lib/ogr/internal_helpers.rb +2 -0
  180. data/lib/ogr/layer.rb +2 -0
  181. data/lib/ogr/layer_mixins/capability_methods.rb +2 -0
  182. data/lib/ogr/layer_mixins/extensions.rb +8 -0
  183. data/lib/ogr/layer_mixins/ogr_feature_methods.rb +2 -0
  184. data/lib/ogr/layer_mixins/ogr_field_methods.rb +6 -2
  185. data/lib/ogr/layer_mixins/ogr_layer_method_methods.rb +2 -0
  186. data/lib/ogr/layer_mixins/ogr_query_filter_methods.rb +8 -3
  187. data/lib/ogr/layer_mixins/ogr_sql_methods.rb +2 -0
  188. data/lib/ogr/spatial_reference.rb +2 -0
  189. data/lib/ogr/spatial_reference_extensions.rb +2 -0
  190. data/lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb +12 -5
  191. data/lib/ogr/spatial_reference_mixins/exporters.rb +2 -0
  192. data/lib/ogr/spatial_reference_mixins/importers.rb +6 -2
  193. data/lib/ogr/spatial_reference_mixins/morphers.rb +2 -0
  194. data/lib/ogr/spatial_reference_mixins/parameter_getter_setters.rb +2 -0
  195. data/lib/ogr/spatial_reference_mixins/type_checks.rb +2 -0
  196. data/lib/ogr/style_table.rb +2 -0
  197. data/lib/ogr/style_table_extensions.rb +2 -0
  198. data/lib/ogr/style_tool.rb +2 -0
  199. data/lib/ogr.rb +2 -0
  200. data/spec/ffi-gdal_spec.rb +2 -0
  201. data/spec/integration/gdal/color_table_info_spec.rb +2 -0
  202. data/spec/integration/gdal/dataset_info_spec.rb +3 -1
  203. data/spec/integration/gdal/driver_info_spec.rb +3 -1
  204. data/spec/integration/gdal/geo_transform_info_spec.rb +2 -0
  205. data/spec/integration/gdal/gridder_spec.rb +2 -0
  206. data/spec/integration/gdal/raster_attribute_table_info_spec.rb +2 -0
  207. data/spec/integration/gdal/raster_band_algorithms_spec.rb +2 -0
  208. data/spec/integration/gdal/raster_band_info_spec.rb +9 -7
  209. data/spec/integration/ogr/layer_spec.rb +2 -0
  210. data/spec/spec_helper.rb +2 -0
  211. data/spec/support/integration_help.rb +2 -0
  212. data/spec/support/shared_contexts.rb +2 -0
  213. data/spec/support/shared_examples/gdal/major_object_examples.rb +2 -0
  214. data/spec/support/shared_examples/ogr/{a_25D_geometry.rb → a_25d_geometry.rb} +2 -0
  215. data/spec/support/shared_examples/ogr/a_container_geometry.rb +2 -0
  216. data/spec/support/shared_examples/ogr/a_geometry.rb +3 -1
  217. data/spec/support/shared_examples/ogr/a_line_string.rb +2 -0
  218. data/spec/unit/ext/error_symbols_spec.rb +2 -0
  219. data/spec/unit/ext/numeric_as_data_type_spec.rb +2 -0
  220. data/spec/unit/ffi/gdal_spec.rb +2 -0
  221. data/spec/unit/gdal/color_entry_spec.rb +2 -0
  222. data/spec/unit/gdal/color_interpretation_spec.rb +2 -0
  223. data/spec/unit/gdal/color_table_mixins/extensions_spec.rb +2 -0
  224. data/spec/unit/gdal/color_table_spec.rb +2 -0
  225. data/spec/unit/gdal/data_type_spec.rb +2 -0
  226. data/spec/unit/gdal/dataset_mixins/warp_methods_spec.rb +4 -1
  227. data/spec/unit/gdal/dataset_spec.rb +2 -0
  228. data/spec/unit/gdal/driver_mixins/extensions_spec.rb +2 -0
  229. data/spec/unit/gdal/driver_spec.rb +2 -0
  230. data/spec/unit/gdal/environment_methods_spec.rb +2 -0
  231. data/spec/unit/gdal/geo_transform_mixins/extensions_spec.rb +2 -0
  232. data/spec/unit/gdal/geo_transform_spec.rb +2 -0
  233. data/spec/unit/gdal/grid_spec.rb +2 -0
  234. data/spec/unit/gdal/gridder/point_extracting_spec.rb +2 -0
  235. data/spec/unit/gdal/gridder_options_spec.rb +2 -0
  236. data/spec/unit/gdal/gridder_spec.rb +2 -0
  237. data/spec/unit/gdal/internal_helpers_spec.rb +2 -0
  238. data/spec/unit/gdal/major_object_spec.rb +2 -0
  239. data/spec/unit/gdal/options_spec.rb +2 -0
  240. data/spec/unit/gdal/raster_attribute_table_spec.rb +2 -0
  241. data/spec/unit/gdal/raster_band_classifier_spec.rb +5 -3
  242. data/spec/unit/gdal/raster_band_mixins/extensions_spec.rb +2 -0
  243. data/spec/unit/gdal/raster_band_mixins/io_extensions_spec.rb +2 -0
  244. data/spec/unit/gdal/raster_band_spec.rb +2 -0
  245. data/spec/unit/gdal/rpc_info_spec.rb +2 -0
  246. data/spec/unit/gdal/version_info_spec.rb +2 -0
  247. data/spec/unit/gdal/virtual_dataset_spec.rb +2 -0
  248. data/spec/unit/gdal/warp_operation_spec.rb +2 -0
  249. data/spec/unit/gdal/warp_options_spec.rb +2 -0
  250. data/spec/unit/ogr/coordinate_transformation_spec.rb +2 -0
  251. data/spec/unit/ogr/data_source_mixins/capability_methods_spec.rb +2 -0
  252. data/spec/unit/ogr/data_source_spec.rb +2 -0
  253. data/spec/unit/ogr/driver_mixins/capability_methods_spec.rb +2 -0
  254. data/spec/unit/ogr/driver_spec.rb +3 -1
  255. data/spec/unit/ogr/envelope_spec.rb +2 -0
  256. data/spec/unit/ogr/feature_definition_spec.rb +2 -0
  257. data/spec/unit/ogr/feature_extensions_spec.rb +2 -0
  258. data/spec/unit/ogr/feature_spec.rb +3 -3
  259. data/spec/unit/ogr/field_definition_spec.rb +2 -0
  260. data/spec/unit/ogr/field_spec.rb +2 -0
  261. data/spec/unit/ogr/geometries/geometry_collection_25d_spec.rb +2 -0
  262. data/spec/unit/ogr/geometries/geometry_collection_spec.rb +2 -0
  263. data/spec/unit/ogr/geometries/line_string_25d_spec.rb +2 -0
  264. data/spec/unit/ogr/geometries/line_string_spec.rb +2 -0
  265. data/spec/unit/ogr/geometries/linear_ring_spec.rb +2 -0
  266. data/spec/unit/ogr/geometries/multi_line_string_25d_spec.rb +2 -0
  267. data/spec/unit/ogr/geometries/multi_line_string_spec.rb +2 -0
  268. data/spec/unit/ogr/geometries/multi_point_25d_spec.rb +2 -0
  269. data/spec/unit/ogr/geometries/multi_point_spec.rb +2 -0
  270. data/spec/unit/ogr/geometries/multi_polygon_25d_spec.rb +2 -0
  271. data/spec/unit/ogr/geometries/multi_polygon_spec.rb +2 -0
  272. data/spec/unit/ogr/geometries/none_geometry_spec.rb +2 -0
  273. data/spec/unit/ogr/geometries/point_25d_spec.rb +2 -0
  274. data/spec/unit/ogr/geometries/point_spec.rb +2 -0
  275. data/spec/unit/ogr/geometries/polygon_25d_spec.rb +2 -0
  276. data/spec/unit/ogr/geometries/polygon_spec.rb +2 -0
  277. data/spec/unit/ogr/geometries/unknown_geometry_spec.rb +2 -0
  278. data/spec/unit/ogr/geometry_field_definition_spec.rb +2 -0
  279. data/spec/unit/ogr/geometry_spec.rb +2 -0
  280. data/spec/unit/ogr/internal_helpers_spec.rb +2 -0
  281. data/spec/unit/ogr/layer_mixins/capability_methods_spec.rb +2 -0
  282. data/spec/unit/ogr/layer_mixins/ogr_feature_methods_spec.rb +2 -0
  283. data/spec/unit/ogr/layer_mixins/ogr_field_methods_spec.rb +2 -0
  284. data/spec/unit/ogr/layer_mixins/ogr_layer_method_methods_spec.rb +2 -0
  285. data/spec/unit/ogr/layer_mixins/ogr_query_filter_methods_spec.rb +2 -0
  286. data/spec/unit/ogr/layer_mixins/ogr_sql_methods_spec.rb +2 -0
  287. data/spec/unit/ogr/layer_spec.rb +2 -0
  288. data/spec/unit/ogr/spatial_reference_mixins/coordinate_system_getter_setters_spec.rb +2 -0
  289. data/spec/unit/ogr/spatial_reference_mixins/exporters_spec.rb +7 -3
  290. data/spec/unit/ogr/spatial_reference_mixins/importers_spec.rb +2 -0
  291. data/spec/unit/ogr/spatial_reference_mixins/morphers_spec.rb +9 -7
  292. data/spec/unit/ogr/spatial_reference_mixins/parameter_getter_setters_spec.rb +2 -0
  293. data/spec/unit/ogr/spatial_reference_mixins/type_checks_spec.rb +2 -0
  294. data/spec/unit/ogr/spatial_reference_spec.rb +4 -2
  295. data/spec/unit/ogr/style_table_spec.rb +2 -0
  296. data/spec/unit/ogr/style_tool_spec.rb +2 -0
  297. data/spec/unit/version_info_spec.rb +2 -0
  298. metadata +20 -6
data/lib/ogr/geocoder.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../ogr'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../geometry_types/container'
2
4
  require_relative '../geometry_types/surface'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'geometry_collection'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../geometry_types/curve'
2
4
 
3
5
  module OGR
@@ -5,6 +7,7 @@ module OGR
5
7
  include OGR::Geometry
6
8
  include GeometryTypes::Curve
7
9
 
10
+ # rubocop:disable Metrics/ParameterLists
8
11
  def self.approximate_arc_angles(center_x, center_y, z, primary_radius, secondary_radius,
9
12
  rotation, start_angle, end_angle, max_angle_step_size_degrees = 0)
10
13
  geometry_ptr = FFI::GDAL::GDAL.OGR_G_ApproximateArcAngles(
@@ -22,6 +25,7 @@ module OGR
22
25
 
23
26
  new(geometry_ptr)
24
27
  end
28
+ # rubocop:enable Metrics/ParameterLists
25
29
 
26
30
  def initialize(geometry_ptr = nil, spatial_reference: nil)
27
31
  geometry_ptr ||= OGR::Geometry.create(:wkbLineString)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'line_string'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'line_string'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../geometry_types/curve'
2
4
  require_relative '../geometry_types/container'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'multi_line_string'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../geometry_types/container'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'multi_point'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../geometry_types/container'
2
4
  require_relative '../geometry_types/surface'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'multi_polygon'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  class NoneGeometry
3
5
  include OGR::Geometry
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  class Point
3
5
  include OGR::Geometry
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'point'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../geometry_types/container'
2
4
  require_relative '../geometry_types/surface'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'polygon'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  class UnknownGeometry
3
5
  include OGR::Geometry
data/lib/ogr/geometry.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../ogr'
2
4
  require_relative 'geometry_mixins/extensions'
3
5
  require_relative '../gdal'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  class GeometryFieldDefinition
3
5
  # @return [FFI::Pointer]
@@ -79,7 +81,8 @@ module OGR
79
81
 
80
82
  FFI::OGR::API.OGR_GFld_SetSpatialRef(
81
83
  @c_pointer,
82
- spatial_ref_ptr)
84
+ spatial_ref_ptr
85
+ )
83
86
  end
84
87
 
85
88
  # @return [Boolean]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module GeometryMixins
3
5
  module ContainerMixins
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module OGR
@@ -7,18 +9,18 @@ module OGR
7
9
  def utm_zone
8
10
  return unless spatial_reference
9
11
 
10
- if spatial_reference.authority_code == '4326'.freeze
11
- self_as_4326 = self
12
+ if spatial_reference.authority_code == '4326'
13
+ self_as4326 = self
12
14
  else
13
- self_as_4326 = dup
14
- self_as_4326.transform_to!(OGR::SpatialReference.new_from_epsg(4326))
15
+ self_as4326 = dup
16
+ self_as4326.transform_to!(OGR::SpatialReference.new_from_epsg(4326))
15
17
  end
16
18
 
17
- self_as_4326 = self_as_4326.buffer(0) unless self_as_4326.valid?
19
+ self_as4326 = self_as4326.buffer(0) unless self_as4326.valid?
18
20
 
19
- return unless self_as_4326.point_on_surface.x
21
+ return unless self_as4326.point_on_surface.x
20
22
 
21
- ((self_as_4326.point_on_surface.x + 180) / 6.to_f).floor + 1
23
+ ((self_as4326.point_on_surface.x + 180) / 6.to_f).floor + 1
22
24
  end
23
25
 
24
26
  # @return [Boolean]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../geometry_mixins/container_mixins'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module GeometryTypes
3
5
  module Curve
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module GeometryTypes
3
5
  module Surface
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'time'
2
4
 
3
5
  module OGR
data/lib/ogr/layer.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../ogr'
2
4
  require_relative '../gdal'
3
5
  require_relative 'layer_mixins/extensions'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module LayerMixins
3
5
  # Helper methods for checking what the Layer is capable of.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module OGR
@@ -122,6 +124,11 @@ module OGR
122
124
  x_ptr = FFI::MemoryPointer.new(:double)
123
125
  y_ptr = FFI::MemoryPointer.new(:double)
124
126
 
127
+ # This block is intentionally long simply for the sake of performance.
128
+ # I've tried refactoring chunks of this out to separate methods and
129
+ # performance suffers greatly. Since this is a key part of gridding (at
130
+ # least at this point), it needs to be as fast as possible.
131
+ # rubocop:disable Metrics/BlockLength
125
132
  each_feature_pointer do |feature_ptr|
126
133
  field_values = field_indices.map.with_index do |j, attribute_index|
127
134
  FFI::OGR::API.send("OGR_F_GetFieldAs#{with_attributes.values[attribute_index].capitalize}", feature_ptr, j)
@@ -204,6 +211,7 @@ module OGR
204
211
  "Not sure how to extract point_values for a #{geom_type}"
205
212
  end
206
213
  end
214
+ # rubocop:enable Metrics/BlockLength
207
215
 
208
216
  log "#point_values took #{Time.now - start}s"
209
217
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module LayerMixins
3
5
  module OGRFeatureMethods
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module LayerMixins
3
5
  module OGRFieldMethods
@@ -81,7 +83,8 @@ module OGR
81
83
  @c_pointer,
82
84
  field_index,
83
85
  new_field_definition_ptr,
84
- flags)
86
+ flags
87
+ )
85
88
 
86
89
  ogr_err.handle_result
87
90
  end
@@ -115,7 +118,8 @@ module OGR
115
118
  ogr_err = FFI::OGR::API.OGR_L_CreateGeomField(
116
119
  @c_pointer,
117
120
  geometry_field_definition_ptr,
118
- approx_ok)
121
+ approx_ok
122
+ )
119
123
 
120
124
  ogr_err.handle_result
121
125
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module LayerMixins
3
5
  # OGR::Layer methods: Ruby methods that operate on a OGR::Layer using a
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module LayerMixins
3
5
  module OGRQueryFilterMethods
@@ -29,7 +31,8 @@ module OGR
29
31
  geometry_ptr = GDAL._pointer(OGR::Geometry, geometry)
30
32
 
31
33
  FFI::OGR::API.OGR_L_SetSpatialFilterEx(
32
- @c_pointer, geometry_field_index, geometry_ptr)
34
+ @c_pointer, geometry_field_index, geometry_ptr
35
+ )
33
36
  end
34
37
 
35
38
  # Only features that geometrically intersect the given rectangle will be
@@ -47,7 +50,8 @@ module OGR
47
50
  min_x,
48
51
  min_y,
49
52
  max_x,
50
- max_y)
53
+ max_y
54
+ )
51
55
  end
52
56
 
53
57
  # Only features that geometrically intersect the given rectangle will be
@@ -68,7 +72,8 @@ module OGR
68
72
  min_x,
69
73
  min_y,
70
74
  max_x,
71
- max_y)
75
+ max_y
76
+ )
72
77
  end
73
78
 
74
79
  # Sets the attribute query string to be used when fetching Features using
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module LayerMixins
3
5
  module OGRSQLMethods
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../ogr'
2
4
  require_relative '../gdal'
3
5
  require_relative 'spatial_reference_extensions'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module SpatialReferenceMixins
3
5
  module CoordinateSystemGetterSetters
@@ -76,7 +78,8 @@ module OGR
76
78
  @c_pointer,
77
79
  x_distance, y_distance, z_distance,
78
80
  x_rotation, y_rotation, z_rotation,
79
- scaling_factor)
81
+ scaling_factor
82
+ )
80
83
 
81
84
  ogr_err.handle_result
82
85
  end
@@ -93,7 +96,8 @@ module OGR
93
96
  @c_pointer,
94
97
  name,
95
98
  horizontal_spatial_ref_ptr,
96
- vertical_spatial_ref_ptr)
99
+ vertical_spatial_ref_ptr
100
+ )
97
101
 
98
102
  ogr_err.handle_result
99
103
  end
@@ -186,7 +190,8 @@ module OGR
186
190
  @c_pointer,
187
191
  target_key,
188
192
  authority,
189
- code)
193
+ code
194
+ )
190
195
 
191
196
  ogr_err.handle_result
192
197
  end
@@ -278,7 +283,8 @@ module OGR
278
283
  zone,
279
284
  nad83,
280
285
  override_unit_label,
281
- override_unit_transform)
286
+ override_unit_transform
287
+ )
282
288
 
283
289
  ogr_err.handle_result
284
290
  end
@@ -458,7 +464,8 @@ module OGR
458
464
  @c_pointer,
459
465
  center_lat, center_long,
460
466
  scale,
461
- false_easting, false_northing)
467
+ false_easting, false_northing
468
+ )
462
469
 
463
470
  ogr_err.handle_result
464
471
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module SpatialReferenceMixins
3
5
  module Exporters
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module SpatialReferenceMixins
3
5
  module Importers
@@ -198,7 +200,8 @@ module OGR
198
200
  projection_system_code,
199
201
  zone,
200
202
  proj_ptr,
201
- datum)
203
+ datum
204
+ )
202
205
 
203
206
  ogr_err.handle_result
204
207
  end
@@ -227,7 +230,8 @@ module OGR
227
230
  @c_pointer,
228
231
  projection_name,
229
232
  datum_name,
230
- linear_unit_name)
233
+ linear_unit_name
234
+ )
231
235
 
232
236
  ogr_err.handle_result
233
237
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module SpatialReferenceMixins
3
5
  module Morphers
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module SpatialReferenceMixins
3
5
  module ParameterGetterSetters
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OGR
2
4
  module SpatialReferenceMixins
3
5
  module TypeChecks
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../ogr'
2
4
  require_relative 'style_table_extensions'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module OGR
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../ogr'
2
4
 
3
5
  module OGR
data/lib/ogr.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'ffi-gdal'
2
4
  require_relative 'ogr/internal_helpers'
3
5
  require_relative 'ogr/exceptions'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi-gdal'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi-gdal'
3
5
  require 'gdal'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi-gdal'
3
5
  require 'gdal'
@@ -185,7 +187,7 @@ GEOGCS["WGS 84",
185
187
 
186
188
  describe '#gcp_count' do
187
189
  it 'is a Fixnum' do
188
- expect(subject.gcp_count).to be_a Fixnum
190
+ expect(subject.gcp_count).to be_a Integer
189
191
  end
190
192
  end
191
193
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi-gdal'
3
5
  require 'gdal'
@@ -20,7 +22,7 @@ RSpec.describe 'Driver Info', type: :integration do
20
22
 
21
23
  describe '.count' do
22
24
  it 'is a non-zero Integer' do
23
- expect(GDAL::Driver.count).to be_a Fixnum
25
+ expect(GDAL::Driver.count).to be_a Integer
24
26
  expect(GDAL::Driver.count).to be > 0
25
27
  end
26
28
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi-gdal'
3
5
  require 'gdal'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'gdal/gridder'
3
5
  require 'ogr/data_source'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi-gdal'
3
5
  require 'gdal'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'gdal/dataset'
3
5
  require 'gdal/raster_band'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'ffi-gdal'
3
5
  require 'gdal'
@@ -24,14 +26,14 @@ RSpec.describe 'Raster Band Info', type: :integration do
24
26
 
25
27
  describe '#x_size' do
26
28
  it 'is a non-zero Integer' do
27
- expect(subject.x_size).to be_a Fixnum
29
+ expect(subject.x_size).to be_a Integer
28
30
  expect(subject.x_size).to be > 0
29
31
  end
30
32
  end
31
33
 
32
34
  describe '#y_size' do
33
35
  it 'is a non-zero Integer' do
34
- expect(subject.y_size).to be_a Fixnum
36
+ expect(subject.y_size).to be_a Integer
35
37
  expect(subject.y_size).to be > 0
36
38
  end
37
39
  end
@@ -42,7 +44,7 @@ RSpec.describe 'Raster Band Info', type: :integration do
42
44
 
43
45
  describe '#number' do
44
46
  it 'is a non-zero Integer' do
45
- expect(subject.number).to be_a Fixnum
47
+ expect(subject.number).to be_a Integer
46
48
  expect(subject.number).to be > 0
47
49
  end
48
50
  end
@@ -122,7 +124,7 @@ RSpec.describe 'Raster Band Info', type: :integration do
122
124
 
123
125
  describe '#overview_count' do
124
126
  it 'is a Fixnum' do
125
- expect(subject.overview_count).to be_a Fixnum
127
+ expect(subject.overview_count).to be_a Integer
126
128
  end
127
129
  end
128
130
 
@@ -169,7 +171,7 @@ RSpec.describe 'Raster Band Info', type: :integration do
169
171
  it 'has a :minimum that ranges between 0.0/-32768.0 and 255.0' do
170
172
  min = subject.statistics[:minimum]
171
173
  unless min == -32_768.0
172
- expect(subject.statistics[:minimum]).to satisfy { |v| v >= 0 || v == -32_768 }
174
+ expect(subject.statistics[:minimum]).to(satisfy { |v| v >= 0 || v == -32_768 })
173
175
  expect(subject.statistics[:minimum]).to be <= 255.0
174
176
  end
175
177
  end
@@ -255,14 +257,14 @@ RSpec.describe 'Raster Band Info', type: :integration do
255
257
  end
256
258
 
257
259
  it 'has :buckets as a Fixnum' do
258
- expect(histogram[:buckets]).to be_a Fixnum if histogram
260
+ expect(histogram[:buckets]).to be_a Integer if histogram
259
261
  end
260
262
 
261
263
  it 'has :totals as an Array of 0 or 256 Fixnums' do
262
264
  if histogram
263
265
  expect(histogram[:totals]).to be_an Array
264
266
  expect(histogram[:totals].size).to eq(256).or eq(0)
265
- expect(histogram[:totals].all? { |t| t.class == Fixnum }).to eq true
267
+ expect(histogram[:totals].all? { |t| t.class == Integer }).to eq true
266
268
  end
267
269
  end
268
270
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'ogr'
3
5