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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d67e9f4bf5c35dd5b8fd8bc6661eb1e4d6d3ae26
4
- data.tar.gz: bc17e333a2f17d7da911db39cdbfd7494dc620d2
3
+ metadata.gz: f3dc48a3584647ad17acba068529c648efd09a4c
4
+ data.tar.gz: 1f92faa1bc794b5e35ba831d072258daf2942618
5
5
  SHA512:
6
- metadata.gz: d6014e176cca5ba88ba825f4eaa2cc41f0117b70c402a622606e463ab21aa3c2a1d41b207edb0e5d1223ecfb95c7644d3a612d6ae265d680f737bd35a5104102
7
- data.tar.gz: d88dd91735e49e182793c2bee36b78ab79dc761bec8ac89cecd01e453afb1f4ac30e5124025fcf474f9fae27e92043355981d2994c9123993c2de6e3b13421bd
6
+ metadata.gz: 5de8ff8356431d9a4d149eb9d93e64462e8eb5a0b7c138bc29dd4683b9e8f747b9e5d7a12e9281eeb405faf13bfd965cf8cae4326beef5db6e125e2cea386c9c
7
+ data.tar.gz: 34dc5007a0c1f7dc27b9cb698ab244bd7324211d182d9c552d42bdc662311ce8b5b61fcb3c27c3e1f48f539171f1149ee33ecf5fc08498575f74391c5af972b3
data/.rubocop.yml CHANGED
@@ -1,17 +1,41 @@
1
- Metrics/ClassLength:
2
- Max: 300
1
+ ---
2
+ inherit_from: .rubocop_todo.yml
3
+
4
+ Lint/UselessAssignment:
5
+ Exclude:
6
+ - examples/geometries.rb
7
+ - examples/testing_gdal.rb
8
+
9
+ Metrics/BlockLength:
10
+ Exclude:
11
+ - spec/**/*_spec.rb
12
+ - spec/support/shared_examples/**/*.rb
13
+
14
+ # Commenting out until .rubocop_todo things are fixed.
15
+ # Metrics/ClassLength:
16
+ # Max: 300
3
17
 
4
18
  Metrics/LineLength:
5
19
  Max: 120
6
20
 
7
- Metrics/MethodLength:
8
- Max: 20
21
+ # Commenting out until .rubocop_todo things are fixed.
22
+ # Metrics/MethodLength:
23
+ # Max: 20
24
+
25
+ Metrics/ModuleLength:
26
+ Exclude:
27
+ - lib/ffi/gdal/alg.rb
28
+ - lib/ffi/gdal/gdal.rb
29
+ - lib/ffi/ogr/api.rb
30
+ - lib/ffi/ogr/srs_api.rb
31
+ Max: 300
9
32
 
10
33
  Metrics/ParameterLists:
11
34
  Exclude:
12
35
  - lib/gdal/dataset.rb
13
36
  - lib/gdal/dataset_mixins/algorithm_methods.rb
14
37
  - lib/gdal/dataset_mixins/extensions.rb
38
+ - lib/gdal/dataset_mixins/warp_methods.rb
15
39
  - lib/gdal/driver.rb
16
40
  - lib/gdal/raster_band.rb
17
41
  - lib/gdal/raster_band_mixins/algorithm_methods.rb
@@ -40,7 +64,9 @@ Style/DoubleNegation:
40
64
 
41
65
  Style/FileName:
42
66
  Exclude:
67
+ - Rakefile
43
68
  - lib/ffi-gdal.rb
69
+ - spec/ffi-gdal_spec.rb
44
70
 
45
71
  Style/FormatString:
46
72
  EnforcedStyle: percent
@@ -66,4 +92,4 @@ AllCops:
66
92
  - ffi-gdal.gemspec
67
93
  Exclude:
68
94
  - vendor/bundle/**/*
69
- TargetRubyVersion: 2.2
95
+ TargetRubyVersion: 2.3
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,70 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2017-04-21 10:44:22 -0700 using RuboCop version 0.48.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 43
10
+ Metrics/AbcSize:
11
+ Max: 74
12
+
13
+ # Offense count: 1
14
+ # Configuration parameters: CountComments, ExcludedMethods.
15
+ Metrics/BlockLength:
16
+ Max: 29
17
+
18
+ # Offense count: 11
19
+ # Configuration parameters: CountComments.
20
+ Metrics/ClassLength:
21
+ Max: 345
22
+
23
+ # Offense count: 13
24
+ Metrics/CyclomaticComplexity:
25
+ Max: 21
26
+
27
+ # Offense count: 84
28
+ # Configuration parameters: CountComments.
29
+ Metrics/MethodLength:
30
+ Max: 78
31
+
32
+ # Offense count: 6
33
+ Metrics/PerceivedComplexity:
34
+ Max: 11
35
+
36
+ # Offense count: 1
37
+ # Configuration parameters: MinBodyLength.
38
+ Style/GuardClause:
39
+ Exclude:
40
+ - 'lib/gdal/gridder/point_extracting.rb'
41
+
42
+ # Adding to allow for targeting ruby 2.3, but the fixes for this cop aren't
43
+ # compatible with ruby 2.2. (I want to keep the frozen-string stuff in)
44
+ #
45
+ # Offense count: 2
46
+ # Cop supports --auto-correct.
47
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
48
+ # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
49
+ Style/IndentHeredoc:
50
+ Exclude:
51
+ - 'spec/integration/gdal/dataset_info_spec.rb'
52
+ - 'spec/unit/ogr/spatial_reference_mixins/exporters_spec.rb'
53
+
54
+ # Adding to allow for targeting ruby 2.3, but the fixes for this cop aren't
55
+ # compatible with ruby 2.2. (I want to keep the frozen-string stuff in)
56
+ #
57
+ # Offense count: 10
58
+ # Cop supports --auto-correct.
59
+ # Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
60
+ # SupportedStyles: predicate, comparison
61
+ Style/NumericPredicate:
62
+ Exclude:
63
+ - 'spec/**/*'
64
+ - 'lib/gdal/merger.rb'
65
+ - 'lib/gdal/raster_attribute_table.rb'
66
+ - 'lib/ogr/feature.rb'
67
+ - 'lib/ogr/feature_definition.rb'
68
+ - 'lib/ogr/field.rb'
69
+ - 'lib/ogr/geometry.rb'
70
+ - 'lib/ogr/layer_mixins/ogr_field_methods.rb'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.3.0
1
+ ruby-2.4.1
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in ffi-gdal.gemspec
data/History.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  Format for this file derived from [http://keepachangelog.com](http://keepachangelog.com).
4
4
 
5
+ ## 1.0.0.beta8 / 2017-04-24
6
+
7
+ ### Improvements
8
+
9
+ * Ruby 2.3 frozen string compatibility.
10
+ * Ruby 2.4 `DateTime` time zone handling in `OGR::Feature#set_field_date_time`.
11
+
12
+ ### Bug Fixes
13
+
14
+ * Ensure `GDAL::RasterBandMixinsIOExtensions#read_blocks_by_block` always yields
15
+ an Array of pixels.
16
+
5
17
  ## 1.0.0.beta7 / 2016-09-21
6
18
 
7
19
  ### Improvements
data/Rakefile CHANGED
@@ -1,5 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
6
+
7
+ RuboCop::RakeTask.new do |t|
8
+ t.fail_on_error = false
9
+ t.formatters = ['RuboCop::Formatter::CheckstyleFormatter']
10
+ t.options = %w[--out tmp/checkstyle.xml]
11
+ t.requires = ['rubocop/formatter/checkstyle_formatter']
12
+ end
3
13
 
4
14
  namespace :spec do
5
15
  RSpec::Core::RakeTask.new(:unit) do |t|
@@ -22,7 +32,7 @@ namespace :spec do
22
32
  --log-file=valgrind_output.log
23
33
  ].join(' ')
24
34
 
25
- cmd = %[valgrind #{valgrind_options} bundle exec rake spec SPEC_OPTS="--format documentation"]
35
+ cmd = %(valgrind #{valgrind_options} bundle exec rake spec SPEC_OPTS="--format documentation")
26
36
  puts cmd
27
37
  system(cmd)
28
38
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'pry'
3
5
  require 'ffi-gdal'
@@ -24,36 +26,31 @@ floyd.extract_natural_color('nc.tif', band_order: %i[nir red green blue]).close
24
26
  # NDVI as Float32
25
27
  floyd.extract_ndvi('ndvi_float.tif', band_order: %i[nir red green blue],
26
28
  data_type: :GDT_Float32,
27
- remove_negatives: true
28
- ).close
29
+ remove_negatives: true).close
29
30
 
30
31
  # NDVI as Byte
31
32
  floyd.extract_ndvi('ndvi_byte.tif', band_order: %i[nir red green blue],
32
33
  data_type: :GDT_Byte,
33
34
  remove_negatives: true,
34
- photometric: 'PALETTE'
35
- ).close
35
+ photometric: 'PALETTE').close
36
36
 
37
37
  # NDVI as UInt16
38
38
  floyd.extract_ndvi('ndvi_uint16.tif', band_order: %i[nir red green blue],
39
39
  data_type: :GDT_UInt16,
40
40
  remove_negatives: true,
41
- photometric: 'PALETTE'
42
- ).close
41
+ photometric: 'PALETTE').close
43
42
 
44
43
  # GNDVI as Byte
45
44
  floyd.extract_gndvi('gndvi_byte.tif', band_order: %i[nir red green blue],
46
45
  data_type: :GDT_Byte,
47
46
  remove_negatives: true,
48
- photometric: 'PALETTE'
49
- ).close
47
+ photometric: 'PALETTE').close
50
48
 
51
49
  # GNDVI as UInt16
52
50
  floyd.extract_gndvi('gndvi_uint16.tif', band_order: %i[nir red green blue],
53
51
  data_type: :GDT_UInt16,
54
52
  remove_negatives: true,
55
- photometric: 'PALETTE'
56
- ).close
53
+ photometric: 'PALETTE').close
57
54
 
58
55
  #---
59
56
  # Colorize after extraction...
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'pry'
3
5
  require 'ffi-gdal'
@@ -25,7 +27,72 @@ multi_point = OGR::Geometry.create_from_wkt(multi_point_wkt)
25
27
  multi_line_string_wkt = 'MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))'
26
28
  multi_line_string = OGR::Geometry.create_from_wkt(multi_line_string_wkt)
27
29
 
28
- multi_polygon_wkt = 'MULTIPOLYGON (((-120.03296317083633 44.226828996384285, -120.03199741570855 44.230616638863914, -120.03305119285443 44.23322276021398, -120.03305439612939 44.23323503554639, -120.03305423080232 44.233247523039175, -120.03305070309673 44.23325975261691, -120.03304394580853 44.233271263913274, -120.03303421330706 44.233281623601044, -120.0330218719597 44.23329044170392, -120.03300738634044 44.23329738627662, -120.03299130174162 44.23330219590042, -120.03297422364709 44.23330468952384, -120.03295679493954 44.23330477327791, -120.0329396717 44.23330244400986, -120.03259652218235 44.23323046886841, -120.03259605091168 44.23323469214073, -120.03259130838445 44.233246748969734, -120.03258339633375 44.23325791928269, -120.03257261443646 44.233267779993575, -120.03255937106756 44.233275957618844, -120.03254416783288 44.23328214242357, -120.03252758057009 44.23328610015274, -120.03251023753826 44.2332876809039, -120.032492795622 44.23328682480475, -120.0324759154512 44.23328356428076, -120.03246023637918 44.23327802282714, -120.03244635226639 44.233270410331386, -120.03229057481504 44.233166296752856, -120.03144275436163 44.23298846700243, -120.03135705202111 44.23542539118272, -120.03135483571377 44.23543806847976, -120.0313491680669 44.2354501823413, -120.0313402724131 44.23546125542315, -120.03132849928409 44.23547085139311, -120.03131431259804 44.235478592124444, -120.03129827137883 44.235484172595754, -120.03128100772805 44.23548737291011, -120.03126320191683 44.23548806696012, -120.03124555558011 44.235486227396926, -120.03122876406881 44.235481926707976, -120.03121348904955 44.23547533436071, -120.03120033243181 44.23546671012462, -120.03118981264993 44.23545639383555, -120.02629194435607 44.229488174527326, -120.0262841759258 44.22947593881562, -120.0262801234077 44.229462813795166, -120.02627996353844 44.22944937186798, -120.0262837032901 44.22943619925734, -120.02629117956641 44.22942387044152, -120.02630206631528 44.22941292309999, -120.02631588874878 44.229403834664076, -120.02650834059244 44.22930162063937, -120.02596466290531 44.22893822933382, -120.02595288197551 44.22892861642798, -120.02594398682248 44.22891752390089, -120.02593832881524 44.2289053899198, -120.02593613145164 44.22889269379079, -120.02593748153026 44.22887993702566, -120.02594232572132 44.2288676235318, -120.02595047267361 44.22885623970722, -120.0259616005729 44.228846235226946, -120.02597526985406 44.22883800528063, -120.0259909405644 44.22883187496161, -120.02600799369236 44.22882808642537, -120.02602575561929 44.228826789324046, -120.02604352472815 44.22882803489487, -120.02606059911827 44.2288317739361, -120.02607630433104 44.22883785875077, -120.02675839864344 44.229168810839475, -120.02688733695234 44.22910032953997, -120.02611125484312 44.228061533840545, -120.02610457348571 44.22805003875662, -120.02610110582951 44.22803783693943, -120.02610098163969 44.228025384999874, -120.02610420556363 44.2280131489091, -120.02611065695699 44.22800158656121, -120.0261200943985 44.22799113063793, -120.02613216472427 44.22798217241707, -120.02614641624366 44.227975047130094, -120.0261623156424 44.22797002141719, -120.02617926794002 44.22796728334896, -120.0261966387548 44.227966935388565, -120.02621377804353 44.22796899055725, -120.02623004442708 44.22797337194719, -120.0262448291917 44.2279799155993, -120.02625757906833 44.22798837663918, -120.02626781693645 44.22799843844071, -120.02754662923428 44.229551257921585, -120.030836241635 44.23114734101261, -120.03136956622194 44.229959117652726, -120.03138391393463 44.22955111324294, -120.03138620312208 44.229538207384174, -120.0313920671636 44.22952589494864, -120.03140126651873 44.229514678887824, -120.03141342540293 44.229505017367465, -120.03142804713777 44.22949730505196, -120.03144453443974 44.229491856982676, -120.03146221381887 44.22948889570851, -120.03148036308987 44.22948854219496, -120.03149824087296 44.229490810882744, -120.03151511687828 44.22949560909792, -120.03153030173767 44.22950274083756, -120.03154317516459 44.22951191477631, -120.0315532112922 44.22952275616695, -120.03156000257852 44.22953482814357, -120.03278854263438 44.22679758476189, -120.03286127379035 44.226512326846944, -120.03286465252121 44.226503048718484, -120.03286991708133 44.22649423317623, -120.03301731535839 44.22629080564284, -120.03302703028369 44.22628013425537, -120.03303948802117 44.22627104306898, -120.03305420051213 44.22626388825138, -120.03307059136289 44.22625895010873, -120.0330880184265 44.22625642210408, -120.03310579896007 44.22625640327766, -120.03312323637284 44.226258894367135, -120.03313964751646 44.22626379777834, -120.03315438944897 44.22627092140904, -120.03316688462326 44.22627998617475, -120.03317664351395 44.22629063694302, -120.03318328379541 44.22630245644617, -120.03318654532022 44.226314981629145, -120.03318630031114 44.22632772179051, -120.0331825583669 44.22634017780693, -120.03296317083633 44.226828996384285)))'
30
+ multi_polygon_wkt = <<-WKT
31
+ MULTIPOLYGON (((-120.03296317083633 44.226828996384285, -120.03199741570855 44.230616638863914,
32
+ -120.03305119285443 44.23322276021398, -120.03305439612939 44.23323503554639,
33
+ -120.03305423080232 44.233247523039175, -120.03305070309673 44.23325975261691,
34
+ -120.03304394580853 44.233271263913274, -120.03303421330706 44.233281623601044,
35
+ -120.0330218719597 44.23329044170392, -120.03300738634044 44.23329738627662,
36
+ -120.03299130174162 44.23330219590042, -120.03297422364709 44.23330468952384,
37
+ -120.03295679493954 44.23330477327791, -120.0329396717 44.23330244400986,
38
+ -120.03259652218235 44.23323046886841, -120.03259605091168 44.23323469214073,
39
+ -120.03259130838445 44.233246748969734, -120.03258339633375 44.23325791928269,
40
+ -120.03257261443646 44.233267779993575, -120.03255937106756 44.233275957618844,
41
+ -120.03254416783288 44.23328214242357, -120.03252758057009 44.23328610015274,
42
+ -120.03251023753826 44.2332876809039, -120.032492795622 44.23328682480475,
43
+ -120.0324759154512 44.23328356428076, -120.03246023637918 44.23327802282714,
44
+ -120.03244635226639 44.233270410331386, -120.03229057481504 44.233166296752856,
45
+ -120.03144275436163 44.23298846700243, -120.03135705202111 44.23542539118272,
46
+ -120.03135483571377 44.23543806847976, -120.0313491680669 44.2354501823413,
47
+ -120.0313402724131 44.23546125542315, -120.03132849928409 44.23547085139311,
48
+ -120.03131431259804 44.235478592124444, -120.03129827137883 44.235484172595754,
49
+ -120.03128100772805 44.23548737291011, -120.03126320191683 44.23548806696012,
50
+ -120.03124555558011 44.235486227396926, -120.03122876406881 44.235481926707976,
51
+ -120.03121348904955 44.23547533436071, -120.03120033243181 44.23546671012462,
52
+ -120.03118981264993 44.23545639383555, -120.02629194435607 44.229488174527326,
53
+ -120.0262841759258 44.22947593881562, -120.0262801234077 44.229462813795166,
54
+ -120.02627996353844 44.22944937186798, -120.0262837032901 44.22943619925734,
55
+ -120.02629117956641 44.22942387044152, -120.02630206631528 44.22941292309999,
56
+ -120.02631588874878 44.229403834664076, -120.02650834059244 44.22930162063937,
57
+ -120.02596466290531 44.22893822933382, -120.02595288197551 44.22892861642798,
58
+ -120.02594398682248 44.22891752390089, -120.02593832881524 44.2289053899198,
59
+ -120.02593613145164 44.22889269379079, -120.02593748153026 44.22887993702566,
60
+ -120.02594232572132 44.2288676235318, -120.02595047267361 44.22885623970722,
61
+ -120.0259616005729 44.228846235226946, -120.02597526985406 44.22883800528063,
62
+ -120.0259909405644 44.22883187496161, -120.02600799369236 44.22882808642537,
63
+ -120.02602575561929 44.228826789324046, -120.02604352472815 44.22882803489487,
64
+ -120.02606059911827 44.2288317739361, -120.02607630433104 44.22883785875077,
65
+ -120.02675839864344 44.229168810839475, -120.02688733695234 44.22910032953997,
66
+ -120.02611125484312 44.228061533840545, -120.02610457348571 44.22805003875662,
67
+ -120.02610110582951 44.22803783693943, -120.02610098163969 44.228025384999874,
68
+ -120.02610420556363 44.2280131489091, -120.02611065695699 44.22800158656121,
69
+ -120.0261200943985 44.22799113063793, -120.02613216472427 44.22798217241707,
70
+ -120.02614641624366 44.227975047130094, -120.0261623156424 44.22797002141719,
71
+ -120.02617926794002 44.22796728334896, -120.0261966387548 44.227966935388565,
72
+ -120.02621377804353 44.22796899055725, -120.02623004442708 44.22797337194719,
73
+ -120.0262448291917 44.2279799155993, -120.02625757906833 44.22798837663918,
74
+ -120.02626781693645 44.22799843844071, -120.02754662923428 44.229551257921585,
75
+ -120.030836241635 44.23114734101261, -120.03136956622194 44.229959117652726,
76
+ -120.03138391393463 44.22955111324294, -120.03138620312208 44.229538207384174,
77
+ -120.0313920671636 44.22952589494864, -120.03140126651873 44.229514678887824,
78
+ -120.03141342540293 44.229505017367465, -120.03142804713777 44.22949730505196,
79
+ -120.03144453443974 44.229491856982676, -120.03146221381887 44.22948889570851,
80
+ -120.03148036308987 44.22948854219496, -120.03149824087296 44.229490810882744,
81
+ -120.03151511687828 44.22949560909792, -120.03153030173767 44.22950274083756,
82
+ -120.03154317516459 44.22951191477631, -120.0315532112922 44.22952275616695,
83
+ -120.03156000257852 44.22953482814357, -120.03278854263438 44.22679758476189,
84
+ -120.03286127379035 44.226512326846944, -120.03286465252121 44.226503048718484,
85
+ -120.03286991708133 44.22649423317623, -120.03301731535839 44.22629080564284,
86
+ -120.03302703028369 44.22628013425537, -120.03303948802117 44.22627104306898,
87
+ -120.03305420051213 44.22626388825138, -120.03307059136289 44.22625895010873,
88
+ -120.0330880184265 44.22625642210408, -120.03310579896007 44.22625640327766,
89
+ -120.03312323637284 44.226258894367135, -120.03313964751646 44.22626379777834,
90
+ -120.03315438944897 44.22627092140904, -120.03316688462326 44.22627998617475,
91
+ -120.03317664351395 44.22629063694302, -120.03318328379541 44.22630245644617,
92
+ -120.03318654532022 44.226314981629145, -120.03318630031114 44.22632772179051,
93
+ -120.0331825583669 44.22634017780693, -120.03296317083633 44.226828996384285)))
94
+ WKT
95
+
29
96
  multi_polygon = OGR::Geometry.create_from_wkt(multi_polygon_wkt)
30
97
 
31
98
  # point_wkt = 'POINT (1 2)'
data/examples/gridding.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'ffi-gdal'
3
5
  require 'gdal/gridder'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'pry'
3
5
  require 'ffi-gdal'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'thor'
3
5
  require 'fileutils'
@@ -15,14 +17,7 @@ module Examples
15
17
  geo_transform = dest_dataset.geo_transform
16
18
 
17
19
  raster_band = dest_dataset.raster_band(1)
18
- extent_polygon = dest_dataset.extent
19
- buffer_size = if extent_polygon.area > 1
20
- extent_polygon.area / -5000
21
- else
22
- extent_polygon.area / -0.5
23
- end
24
-
25
- extent_polygon = extent_polygon.buffer(buffer_size)
20
+ extent_polygon = buffer_extent(dest_dataset.extent)
26
21
 
27
22
  if extent_polygon.empty?
28
23
  raise 'Poorly buffered extent--you should play with these values to get this demo to work.'
@@ -41,6 +36,18 @@ module Examples
41
36
 
42
37
  puts "Erased dataset in #{Time.now - start}s. Output at '#{dest_path}'"
43
38
  end
39
+
40
+ private
41
+
42
+ def buffer_extent(extent_polygon)
43
+ buffer_size = if extent_polygon.area > 1
44
+ extent_polygon.area / -5000
45
+ else
46
+ extent_polygon.area / -0.5
47
+ end
48
+
49
+ extent_polygon.buffer(buffer_size)
50
+ end
44
51
  end
45
52
  end
46
53
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'thor'
3
5
  require 'fileutils'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'RMagick'
2
4
  require 'bundler/setup'
3
5
  require 'pry'
@@ -5,8 +7,13 @@ require 'ffi-gdal'
5
7
 
6
8
  GDAL::Logger.logging_enabled = true
7
9
 
8
- floyd_too_big_wkt = 'MULTIPOLYGON (((-87.55634718933241 31.168633650404765, -87.552227316286 31.16870709121005, -87.55234533348232 31.169808696448463, -87.5478606800096 31.1698913163249, -87.54777484932141 31.168679550914895, -87.54380517997858 31.168615290194918, -87.54396611251944 31.16511760526154, -87.55647593536513 31.164906454793982, -87.55634718933241 31.168633650404765)))'
9
- floyd_wkt = 'MULTIPOLYGON (((-87.5530099868775 31.16710573359053,-87.5530099868775 31.165600160261103,-87.55384683609009 31.16710573359053,-87.5530099868775 31.16710573359053)))'
10
+ floyd_too_big_wkt = 'MULTIPOLYGON (((-87.55634718933241 31.168633650404765,' \
11
+ '-87.552227316286 31.16870709121005, -87.55234533348232 31.169808696448463,' \
12
+ '-87.5478606800096 31.1698913163249, -87.54777484932141 31.168679550914895,' \
13
+ '-87.54380517997858 31.168615290194918, -87.54396611251944 31.16511760526154,' \
14
+ '-87.55647593536513 31.164906454793982, -87.55634718933241 31.168633650404765)))'
15
+ floyd_wkt = 'MULTIPOLYGON (((-87.5530099868775 31.16710573359053,' \
16
+ '-87.5530099868775 31.165600160261103,-87.55384683609009 31.16710573359053,-87.5530099868775 31.16710573359053)))'
10
17
  floyd_srid = 4326
11
18
 
12
19
  harper_path = '/Users/sloveless/Development/projects/ffi-gdal/spec/support/images/Harper/Harper_1058_20140612_NRGB.tif'
data/examples/warping.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'ffi-gdal'
3
5
  require 'gdal/dataset'
@@ -56,7 +58,7 @@ module Examples
56
58
  transformer_arg = GDAL::Transformers::GeneralImageProjectionTransformer2.new(
57
59
  source_dataset, destination_dataset: dest_dataset,
58
60
  insert_center_long: 'FALSE',
59
- # DST_SRS: spatial_reference.to_wkt
61
+ # DST_SRS: spatial_reference.to_wkt
60
62
  )
61
63
  # transformer_arg = GDAL::Transformers::GeneralImageProjectionTransformer.new(
62
64
  # source_dataset, destination_dataset: dest_dataset,
@@ -94,7 +96,8 @@ module Examples
94
96
  suggested_options = source_dataset.suggested_warp_output(transformer_arg)
95
97
 
96
98
  driver = GDAL::Driver.by_name 'GTiff'
97
- ds = driver.create_dataset(path, suggested_options[:pixels], suggested_options[:lines], data_type: source_dataset.raster_band(1).data_type)
99
+ ds = driver.create_dataset(path, suggested_options[:pixels], suggested_options[:lines],
100
+ data_type: source_dataset.raster_band(1).data_type)
98
101
  ds.geo_transform = suggested_options[:geo_transform]
99
102
  ds.projection = dest_wkt
100
103
  ds.raster_band(1).no_data_value = source_dataset.raster_band(1).no_data_value[:value]
@@ -111,11 +114,25 @@ if $PROGRAM_NAME == __FILE__
111
114
 
112
115
  # 32616
113
116
  # harper_wkt = <<-WKT
114
- # POLYGON ((446272.16070421785116196 3450423.99460560129955411, 446267.51794699463061988 3450225.33339292788878083, 446169.27478282485390082 3450181.28046096721664071, 446167.92126038181595504 3449679.13779170718044043, 446257.50292950111906976 3449447.46736949309706688, 446177.33125468820799142 3449388.86781942518427968, 446181.49593684601131827 3449256.37749340012669563, 446201.94002113211899996 3449230.98345079040154815, 446963.20628352143103257 3449239.17042332561686635, 446960.24312665761681274 3449612.50297579308971763, 446866.33160242711892352 3449708.10946208890527487, 446750.25655526417540386 3449727.9624758935533464, 446691.84310374449705705 3449902.8676586695946753, 446610.46438609907636419 3450082.70331544848158956, 446642.15819176007062197 3450128.30150367366150022, 446528.87474136805394664 3450220.39211917016655207, 446272.16070421785116196 3450423.99460560129955411))
117
+ # POLYGON ((446272.16070421785116196 3450423.99460560129955411, 446267.51794699463061988 3450225.33339292788878083,
118
+ # 446169.27478282485390082 3450181.28046096721664071, 446167.92126038181595504 3449679.13779170718044043,
119
+ # 446257.50292950111906976 3449447.46736949309706688, 446177.33125468820799142 3449388.86781942518427968,
120
+ # 446181.49593684601131827 3449256.37749340012669563, 446201.94002113211899996 3449230.98345079040154815,
121
+ # 446963.20628352143103257 3449239.17042332561686635, 446960.24312665761681274 3449612.50297579308971763,
122
+ # 446866.33160242711892352 3449708.10946208890527487, 446750.25655526417540386 3449727.9624758935533464,
123
+ # 446691.84310374449705705 3449902.8676586695946753, 446610.46438609907636419 3450082.70331544848158956,
124
+ # 446642.15819176007062197 3450128.30150367366150022, 446528.87474136805394664 3450220.39211917016655207,
125
+ # 446272.16070421785116196 3450423.99460560129955411))
115
126
  # WKT
127
+
116
128
  # 4326
117
129
  chualar_wkt = <<-WKT
118
- Polygon ((-121.52653414366494644 36.58183382122394534, -121.52612663439269625 36.57798512254166923, -121.52503994300006696 36.57793984373364538, -121.52503994300006696 36.57952460201457967, -121.5239985304154402 36.57952460201457967, -121.52404380922347116 36.57789456492562152, -121.52245905094252976 36.57789456492562152, -121.52264016617463938 36.58151686956775706, -121.52413436683951886 36.58165270599183572, -121.52422492445558078 36.58002266890287757, -121.52513050061611466 36.58002266890287757, -121.52653414366494644 36.58183382122394534))
130
+ Polygon ((-121.52653414366494644 36.58183382122394534, -121.52612663439269625 36.57798512254166923,
131
+ -121.52503994300006696 36.57793984373364538, -121.52503994300006696 36.57952460201457967,
132
+ -121.5239985304154402 36.57952460201457967, -121.52404380922347116 36.57789456492562152,
133
+ -121.52245905094252976 36.57789456492562152, -121.52264016617463938 36.58151686956775706,
134
+ -121.52413436683951886 36.58165270599183572, -121.52422492445558078 36.58002266890287757,
135
+ -121.52513050061611466 36.58002266890287757, -121.52653414366494644 36.58183382122394534))
119
136
  WKT
120
137
 
121
138
  source_path = args.shift
@@ -124,7 +141,8 @@ Polygon ((-121.52653414366494644 36.58183382122394534, -121.52612663439269625 36
124
141
  source_dataset = GDAL::Dataset.open(source_path, 'r')
125
142
  puts "source srid: #{source_dataset.spatial_reference.authority_code.to_i}"
126
143
 
127
- dest_dataset = Examples::Warping.create_destination_reprojected_dataset(source_dataset, dest_path, source_dataset.spatial_reference.authority_code.to_i)
144
+ dest_dataset = Examples::Warping.create_destination_reprojected_dataset(source_dataset,
145
+ dest_path, source_dataset.spatial_reference.authority_code.to_i)
128
146
  # Examples::Warping.copy_dataset(source_dataset, dest_path)
129
147
  # dest_dataset = GDAL::Dataset.open(dest_path, 'w')
130
148
 
data/ffi-gdal.gemspec CHANGED
@@ -1,4 +1,6 @@
1
1
  # coding: utf-8
2
+ # frozen_string_literal: true
3
+
2
4
  lib = File.expand_path('../lib', __FILE__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require 'ffi/gdal/version'
@@ -28,5 +30,6 @@ Gem::Specification.new do |spec|
28
30
  spec.add_development_dependency 'rake'
29
31
  spec.add_development_dependency 'rspec', '~> 3.0'
30
32
  spec.add_development_dependency 'rubocop'
33
+ spec.add_development_dependency 'rubocop-checkstyle_formatter'
31
34
  spec.add_development_dependency 'simplecov', '~> 0.9.0'
32
35
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../ogr/error_handling'
2
4
 
3
5
  class Symbol
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
  require 'ffi/library'
3
5
 
data/lib/ext/float_ext.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Float
2
4
  # Converts a packed DMS value (DDDMMMSSS.SS) into decimal degrees.
3
5
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'narray'
2
4
 
3
5
  class NArray
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumericAsDataType
2
4
  # @param data_type [FFI::GDAL::GDAL::DataType]
3
5
  def to_data_type(data_type)
data/lib/ext/to_bool.rb CHANGED
@@ -1,7 +1,9 @@
1
- class Fixnum
1
+ # frozen_string_literal: true
2
+
3
+ class Integer
2
4
  def to_bool
3
5
  return true if self == 1
4
- return false if self == 0
6
+ return false if zero?
5
7
  raise "Fixnum '#{self}' can't be converted to Boolean."
6
8
  end
7
9
  end
@@ -9,7 +11,7 @@ end
9
11
  class String
10
12
  def to_bool
11
13
  return true if to_i == 1
12
- return false if to_i == 0
14
+ return false if to_i.zero?
13
15
  raise "String '#{self}' can't be converted to Boolean."
14
16
  end
15
17
  end
data/lib/ffi/cpl/conv.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
  require_relative '../../ext/ffi_library_function_checks'
3
5
 
data/lib/ffi/cpl/error.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../../ext/error_symbols'
2
4
  require_relative '../../ext/ffi_library_function_checks'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
  require_relative '../../ext/ffi_library_function_checks'
3
5
 
data/lib/ffi/cpl/http.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
  require_relative 'http_result'
3
5
  require_relative '../../ext/ffi_library_function_checks'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
  require_relative 'mime_part'
3
5
 
data/lib/ffi/cpl/list.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
 
3
5
  module FFI
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
 
3
5
  module FFI
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
  require_relative '../../ext/ffi_library_function_checks'
3
5
 
data/lib/ffi/cpl/port.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
 
3
5
  module FFI
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
  require_relative '../../ext/ffi_library_function_checks'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
  require_relative 'rect_obj'
3
5
  require_relative '../../ext/ffi_library_function_checks'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ffi'
2
4
 
3
5
  module FFI
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative '../../ext/ffi_library_function_checks'
2
4
 
3
5
  module FFI