ffi-gdal 1.0.0.beta16 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (324) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +17 -0
  3. data/.github/workflows/codacy.yml +61 -0
  4. data/.github/workflows/codeql.yml +74 -0
  5. data/.github/workflows/continuous-integration.yml +36 -0
  6. data/.github/workflows/dependency-review.yml +20 -0
  7. data/.github/workflows/specs-in-docker.yml +27 -0
  8. data/.gitignore +3 -0
  9. data/.rspec +1 -0
  10. data/.rubocop.yml +10 -80
  11. data/.rubocop_todo.yml +23 -40
  12. data/.ruby-version +1 -1
  13. data/Changelog-0.x.md +512 -0
  14. data/Changelog.md +12 -0
  15. data/Dockerfile.gdal2 +110 -0
  16. data/Dockerfile.gdal3 +73 -0
  17. data/README.md +25 -14
  18. data/Rakefile +0 -8
  19. data/Tiltfile +91 -0
  20. data/bin/bundle +123 -0
  21. data/bin/docker-clean +8 -0
  22. data/bin/rake +29 -0
  23. data/bin/rspec +29 -0
  24. data/bin/rubocop +29 -0
  25. data/docker-compose.yml +25 -0
  26. data/examples/extract_and_colorize.rb +0 -13
  27. data/examples/geometries.rb +14 -14
  28. data/examples/ogr_layer_to_layer.rb +1 -3
  29. data/examples/raster_erasing.rb +1 -0
  30. data/examples/remove_small_polygons.rb +1 -1
  31. data/examples/testing_gdal.rb +20 -17
  32. data/examples/warping.rb +9 -7
  33. data/ffi-gdal.gemspec +12 -6
  34. data/lib/ext/ffi_library_function_checks.rb +2 -2
  35. data/lib/ext/to_bool.rb +5 -3
  36. data/lib/ffi/cpl/conv.rb +27 -25
  37. data/lib/ffi/cpl/error.rb +19 -20
  38. data/lib/ffi/cpl/hash_set.rb +4 -4
  39. data/lib/ffi/cpl/http.rb +3 -3
  40. data/lib/ffi/cpl/http_result.rb +8 -8
  41. data/lib/ffi/cpl/list.rb +1 -1
  42. data/lib/ffi/cpl/mime_part.rb +2 -2
  43. data/lib/ffi/cpl/minixml.rb +7 -7
  44. data/lib/ffi/cpl/progress.rb +8 -8
  45. data/lib/ffi/cpl/quad_tree.rb +14 -14
  46. data/lib/ffi/cpl/rect_obj.rb +3 -3
  47. data/lib/ffi/cpl/string.rb +17 -20
  48. data/lib/ffi/cpl/vsi.rb +13 -13
  49. data/lib/ffi/cpl/xml_node.rb +3 -3
  50. data/lib/ffi/extensions/gdal/extensions/all.rb +4 -0
  51. data/lib/ffi/extensions/gdal/extensions/version.rb +9 -0
  52. data/lib/ffi/extensions/gdal/extensions.rb +12 -0
  53. data/lib/ffi/extensions/rttopo/gbox.rb +19 -0
  54. data/lib/ffi/extensions/rttopo/geom.rb +16 -0
  55. data/lib/ffi/extensions/rttopo.rb +41 -0
  56. data/lib/ffi/gdal/alg.rb +277 -277
  57. data/lib/ffi/gdal/color_entry.rb +3 -3
  58. data/lib/ffi/gdal/gcp.rb +6 -6
  59. data/lib/ffi/gdal/gdal.rb +349 -349
  60. data/lib/ffi/gdal/grid.rb +134 -134
  61. data/lib/ffi/gdal/grid_data_metrics_options.rb +4 -4
  62. data/lib/ffi/gdal/grid_inverse_distance_to_a_power_options.rb +9 -9
  63. data/lib/ffi/gdal/grid_moving_average_options.rb +4 -4
  64. data/lib/ffi/gdal/grid_nearest_neighbor_options.rb +3 -3
  65. data/lib/ffi/gdal/matching.rb +3 -3
  66. data/lib/ffi/gdal/rpc_info.rb +17 -17
  67. data/lib/ffi/gdal/transformer_info.rb +4 -4
  68. data/lib/ffi/gdal/version.rb +1 -1
  69. data/lib/ffi/gdal/vrt.rb +39 -39
  70. data/lib/ffi/gdal/warp_options.rb +34 -34
  71. data/lib/ffi/gdal/warper.rb +90 -90
  72. data/lib/ffi/gdal.rb +2 -31
  73. data/lib/ffi/ogr/api.rb +175 -167
  74. data/lib/ffi/ogr/contour_writer_info.rb +4 -4
  75. data/lib/ffi/ogr/core.rb +107 -107
  76. data/lib/ffi/ogr/envelope.rb +3 -3
  77. data/lib/ffi/ogr/envelope_3d.rb +5 -5
  78. data/lib/ffi/ogr/featurestyle.rb +3 -3
  79. data/lib/ffi/ogr/field.rb +22 -22
  80. data/lib/ffi/ogr/geocoding.rb +4 -4
  81. data/lib/ffi/ogr/srs_api.rb +154 -155
  82. data/lib/ffi/ogr/style_param.rb +3 -3
  83. data/lib/ffi/ogr/style_value.rb +4 -4
  84. data/lib/gdal/color_entry.rb +1 -5
  85. data/lib/gdal/color_interpretation.rb +7 -3
  86. data/lib/gdal/color_table.rb +46 -27
  87. data/lib/gdal/cpl_error_handler.rb +26 -6
  88. data/lib/gdal/data_type.rb +10 -3
  89. data/lib/gdal/dataset.rb +171 -85
  90. data/lib/gdal/dataset_mixins/algorithm_methods.rb +44 -44
  91. data/lib/gdal/dataset_mixins/matching.rb +1 -1
  92. data/lib/gdal/dataset_mixins/warp_methods.rb +4 -2
  93. data/lib/gdal/driver.rb +38 -21
  94. data/lib/gdal/environment_methods.rb +6 -6
  95. data/lib/gdal/extensions/all.rb +3 -0
  96. data/lib/gdal/{color_entry_mixins → extensions/color_entry}/extensions.rb +4 -1
  97. data/lib/gdal/{color_table_mixins → extensions/color_table}/extensions.rb +3 -0
  98. data/lib/gdal/extensions/dataset/extensions.rb +205 -0
  99. data/lib/gdal/{driver_mixins → extensions/driver}/extensions.rb +6 -2
  100. data/lib/gdal/{geo_transform_mixins → extensions/geo_transform}/extensions.rb +10 -8
  101. data/lib/gdal/{gridder → extensions/gridder}/point_extracting.rb +7 -5
  102. data/lib/gdal/{gridder.rb → extensions/gridder.rb} +33 -33
  103. data/lib/gdal/{gridder_options.rb → extensions/gridder_options.rb} +13 -14
  104. data/lib/gdal/{raster_attribute_table_mixins → extensions/raster_attribute_table}/extensions.rb +8 -6
  105. data/lib/gdal/{raster_band_mixins → extensions/raster_band}/algorithm_extensions.rb +8 -6
  106. data/lib/gdal/{raster_band_mixins → extensions/raster_band}/coloring_extensions.rb +6 -4
  107. data/lib/gdal/{raster_band_mixins → extensions/raster_band}/extensions.rb +9 -5
  108. data/lib/gdal/{raster_band_mixins → extensions/raster_band}/io_extensions.rb +18 -14
  109. data/lib/gdal/{raster_band_classifier.rb → extensions/raster_band_classifier.rb} +3 -5
  110. data/lib/gdal/geo_transform.rb +1 -6
  111. data/lib/gdal/grid.rb +3 -2
  112. data/lib/gdal/grid_algorithms.rb +9 -9
  113. data/lib/gdal/internal_helpers.rb +46 -9
  114. data/lib/gdal/major_object.rb +11 -3
  115. data/lib/gdal/options.rb +26 -32
  116. data/lib/gdal/raster_attribute_table.rb +63 -37
  117. data/lib/gdal/raster_band.rb +164 -116
  118. data/lib/gdal/raster_band_mixins/algorithm_methods.rb +26 -25
  119. data/lib/gdal/rpc_info.rb +3 -2
  120. data/lib/gdal/transformers/approximate_transformer.rb +12 -3
  121. data/lib/gdal/transformers/base_general_image_projection_transformer.rb +15 -2
  122. data/lib/gdal/transformers/gcp_transformer.rb +27 -19
  123. data/lib/gdal/transformers/general_image_projection_transformer.rb +8 -6
  124. data/lib/gdal/transformers/general_image_projection_transformer2.rb +9 -6
  125. data/lib/gdal/transformers/general_image_projection_transformer3.rb +6 -2
  126. data/lib/gdal/transformers/geolocation_transformer.rb +12 -4
  127. data/lib/gdal/transformers/reprojection_transformer.rb +11 -3
  128. data/lib/gdal/transformers/rpc_transformer.rb +11 -2
  129. data/lib/gdal/transformers/tps_transformer.rb +12 -4
  130. data/lib/gdal/version_info.rb +2 -2
  131. data/lib/gdal/virtual_dataset.rb +2 -0
  132. data/lib/gdal/warp_operation.rb +65 -54
  133. data/lib/gdal/warp_options.rb +9 -11
  134. data/lib/ogr/coordinate_transformation.rb +23 -9
  135. data/lib/ogr/data_source.rb +68 -37
  136. data/lib/ogr/driver.rb +18 -17
  137. data/lib/ogr/envelope.rb +0 -3
  138. data/lib/ogr/error_handling.rb +22 -24
  139. data/lib/ogr/extensions/all.rb +3 -0
  140. data/lib/ogr/{data_source_mixins → extensions/data_source}/capability_methods.rb +2 -0
  141. data/lib/ogr/extensions/data_source/data_source_extensions.rb +16 -0
  142. data/lib/ogr/{driver_mixins → extensions/driver}/capability_methods.rb +5 -1
  143. data/lib/ogr/extensions/envelope/extensions.rb +114 -0
  144. data/lib/ogr/extensions/feature/extensions.rb +87 -0
  145. data/lib/ogr/extensions/feature_definition/extensions.rb +43 -0
  146. data/lib/ogr/extensions/geometries/point/extensions.rb +19 -0
  147. data/lib/ogr/extensions/geometry/container_mixins.rb +56 -0
  148. data/lib/ogr/extensions/geometry/ewkb_io_extensions.rb +44 -0
  149. data/lib/ogr/extensions/geometry/ewkb_record.rb +94 -0
  150. data/lib/ogr/{geometry_mixins → extensions/geometry}/extensions.rb +16 -9
  151. data/lib/ogr/extensions/geometry/rttopo_extensions.rb +48 -0
  152. data/lib/ogr/extensions/geometry/wkb_record.rb +63 -0
  153. data/lib/ogr/extensions/geometry_types/curve/extensions.rb +68 -0
  154. data/lib/ogr/{layer_mixins → extensions/layer}/capability_methods.rb +4 -0
  155. data/lib/ogr/{layer_mixins → extensions/layer}/extensions.rb +11 -6
  156. data/lib/ogr/extensions/spatial_reference/extensions.rb +38 -0
  157. data/lib/ogr/extensions/spatial_reference/initializers.rb +138 -0
  158. data/lib/ogr/extensions/style_table/extensions.rb +31 -0
  159. data/lib/ogr/feature.rb +173 -88
  160. data/lib/ogr/feature_definition.rb +53 -45
  161. data/lib/ogr/field.rb +17 -19
  162. data/lib/ogr/field_definition.rb +30 -18
  163. data/lib/ogr/geocoder.rb +11 -4
  164. data/lib/ogr/geometries/line_string.rb +1 -0
  165. data/lib/ogr/geometries/line_string_25d.rb +0 -9
  166. data/lib/ogr/geometries/linear_ring.rb +2 -2
  167. data/lib/ogr/geometries/point.rb +0 -9
  168. data/lib/ogr/geometry.rb +116 -49
  169. data/lib/ogr/geometry_field_definition.rb +31 -15
  170. data/lib/ogr/geometry_types/container.rb +26 -28
  171. data/lib/ogr/geometry_types/curve.rb +5 -61
  172. data/lib/ogr/geometry_types/surface.rb +1 -1
  173. data/lib/ogr/internal_helpers.rb +2 -2
  174. data/lib/ogr/layer.rb +12 -10
  175. data/lib/ogr/layer_mixins/ogr_feature_methods.rb +39 -27
  176. data/lib/ogr/layer_mixins/ogr_field_methods.rb +66 -50
  177. data/lib/ogr/layer_mixins/ogr_layer_method_methods.rb +17 -8
  178. data/lib/ogr/layer_mixins/ogr_query_filter_methods.rb +7 -6
  179. data/lib/ogr/layer_mixins/ogr_sql_methods.rb +15 -7
  180. data/lib/ogr/spatial_reference.rb +79 -42
  181. data/lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb +149 -118
  182. data/lib/ogr/spatial_reference_mixins/exporters.rb +87 -51
  183. data/lib/ogr/spatial_reference_mixins/importers.rb +88 -43
  184. data/lib/ogr/spatial_reference_mixins/morphers.rb +12 -8
  185. data/lib/ogr/spatial_reference_mixins/parameter_getter_setters.rb +27 -13
  186. data/lib/ogr/style_table.rb +15 -5
  187. data/lib/ogr/style_tool.rb +29 -15
  188. data/lib/ogr.rb +1 -0
  189. data/rakelib/docker.rake +10 -0
  190. data/sorbet/rbi/hidden-definitions/errors.txt +21790 -0
  191. data/tilt/gdal2.yml +22 -0
  192. data/tilt/gdal3.yml +22 -0
  193. metadata +116 -280
  194. data/History.md +0 -360
  195. data/lib/ext/error_symbols.rb +0 -7
  196. data/lib/gdal/dataset_mixins/extensions.rb +0 -380
  197. data/lib/gdal/merger.rb +0 -132
  198. data/lib/ogr/data_source_extensions.rb +0 -10
  199. data/lib/ogr/envelope_extensions.rb +0 -110
  200. data/lib/ogr/feature_definition_extensions.rb +0 -39
  201. data/lib/ogr/feature_extensions.rb +0 -87
  202. data/lib/ogr/geometry_mixins/container_mixins.rb +0 -25
  203. data/lib/ogr/spatial_reference_extensions.rb +0 -34
  204. data/lib/ogr/style_table_extensions.rb +0 -26
  205. data/spec/ffi-gdal_spec.rb +0 -24
  206. data/spec/integration/gdal/color_table_info_spec.rb +0 -78
  207. data/spec/integration/gdal/dataset_info_spec.rb +0 -342
  208. data/spec/integration/gdal/driver_info_spec.rb +0 -170
  209. data/spec/integration/gdal/geo_transform_info_spec.rb +0 -226
  210. data/spec/integration/gdal/gridder_spec.rb +0 -331
  211. data/spec/integration/gdal/raster_attribute_table_info_spec.rb +0 -229
  212. data/spec/integration/gdal/raster_band_algorithms_spec.rb +0 -35
  213. data/spec/integration/gdal/raster_band_info_spec.rb +0 -320
  214. data/spec/integration/ogr/layer_spec.rb +0 -95
  215. data/spec/spec_helper.rb +0 -116
  216. data/spec/support/images/123.tiff +0 -0
  217. data/spec/support/images/osgeo/gdal/data/hfa/float-rle.img +0 -0
  218. data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.lgo +0 -31
  219. data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.tif +0 -0
  220. data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.tif.msk +0 -0
  221. data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.txt +0 -10
  222. data/spec/support/images/osgeo/geotiff/gdal_eg/cea.tif +0 -0
  223. data/spec/support/images/osgeo/geotiff/gdal_eg/cea.txt +0 -84
  224. data/spec/support/images/osgeo/geotiff/zi_imaging/image0.lgo +0 -45
  225. data/spec/support/images/osgeo/geotiff/zi_imaging/image0.tif +0 -0
  226. data/spec/support/integration_help.rb +0 -34
  227. data/spec/support/shapefiles/states_21basic/states.dbf +0 -0
  228. data/spec/support/shapefiles/states_21basic/states.prj +0 -1
  229. data/spec/support/shapefiles/states_21basic/states.sbn +0 -0
  230. data/spec/support/shapefiles/states_21basic/states.sbx +0 -0
  231. data/spec/support/shapefiles/states_21basic/states.shp +0 -0
  232. data/spec/support/shapefiles/states_21basic/states.shp.xml +0 -3
  233. data/spec/support/shapefiles/states_21basic/states.shx +0 -0
  234. data/spec/support/shared_contexts.rb +0 -28
  235. data/spec/support/shared_examples/gdal/major_object_examples.rb +0 -55
  236. data/spec/support/shared_examples/ogr/a_25d_geometry.rb +0 -9
  237. data/spec/support/shared_examples/ogr/a_container_geometry.rb +0 -49
  238. data/spec/support/shared_examples/ogr/a_geometry.rb +0 -406
  239. data/spec/support/shared_examples/ogr/a_line_string.rb +0 -18
  240. data/spec/support/test_style_table.txt +0 -3
  241. data/spec/support/worldfiles/SR_50M/SR_50M.VERSION.txt +0 -1
  242. data/spec/support/worldfiles/SR_50M/SR_50M.prj +0 -1
  243. data/spec/support/worldfiles/SR_50M/SR_50M.tfw +0 -6
  244. data/spec/support/worldfiles/SR_50M/SR_50M.tif +0 -0
  245. data/spec/unit/ext/error_symbols_spec.rb +0 -69
  246. data/spec/unit/ext/numeric_as_data_type_spec.rb +0 -115
  247. data/spec/unit/ffi/gdal_spec.rb +0 -73
  248. data/spec/unit/gdal/color_entry_spec.rb +0 -8
  249. data/spec/unit/gdal/color_interpretation_spec.rb +0 -8
  250. data/spec/unit/gdal/color_table_mixins/extensions_spec.rb +0 -62
  251. data/spec/unit/gdal/color_table_spec.rb +0 -146
  252. data/spec/unit/gdal/data_type_spec.rb +0 -74
  253. data/spec/unit/gdal/dataset_mixins/warp_methods_spec.rb +0 -55
  254. data/spec/unit/gdal/dataset_spec.rb +0 -148
  255. data/spec/unit/gdal/driver_mixins/extensions_spec.rb +0 -24
  256. data/spec/unit/gdal/driver_spec.rb +0 -51
  257. data/spec/unit/gdal/environment_methods_spec.rb +0 -8
  258. data/spec/unit/gdal/geo_transform_mixins/extensions_spec.rb +0 -69
  259. data/spec/unit/gdal/geo_transform_spec.rb +0 -265
  260. data/spec/unit/gdal/grid_spec.rb +0 -98
  261. data/spec/unit/gdal/gridder/point_extracting_spec.rb +0 -101
  262. data/spec/unit/gdal/gridder_options_spec.rb +0 -185
  263. data/spec/unit/gdal/gridder_spec.rb +0 -182
  264. data/spec/unit/gdal/internal_helpers_spec.rb +0 -278
  265. data/spec/unit/gdal/major_object_spec.rb +0 -10
  266. data/spec/unit/gdal/options_spec.rb +0 -33
  267. data/spec/unit/gdal/raster_attribute_table_spec.rb +0 -7
  268. data/spec/unit/gdal/raster_band_classifier_spec.rb +0 -260
  269. data/spec/unit/gdal/raster_band_mixins/extensions_spec.rb +0 -73
  270. data/spec/unit/gdal/raster_band_mixins/io_extensions_spec.rb +0 -135
  271. data/spec/unit/gdal/raster_band_spec.rb +0 -8
  272. data/spec/unit/gdal/rpc_info_spec.rb +0 -8
  273. data/spec/unit/gdal/version_info_spec.rb +0 -10
  274. data/spec/unit/gdal/virtual_dataset_spec.rb +0 -34
  275. data/spec/unit/gdal/warp_operation_spec.rb +0 -8
  276. data/spec/unit/gdal/warp_options_spec.rb +0 -338
  277. data/spec/unit/ogr/coordinate_transformation_spec.rb +0 -104
  278. data/spec/unit/ogr/data_source_mixins/capability_methods_spec.rb +0 -32
  279. data/spec/unit/ogr/data_source_spec.rb +0 -223
  280. data/spec/unit/ogr/driver_mixins/capability_methods_spec.rb +0 -20
  281. data/spec/unit/ogr/driver_spec.rb +0 -152
  282. data/spec/unit/ogr/envelope_spec.rb +0 -324
  283. data/spec/unit/ogr/feature_definition_spec.rb +0 -296
  284. data/spec/unit/ogr/feature_extensions_spec.rb +0 -90
  285. data/spec/unit/ogr/feature_spec.rb +0 -363
  286. data/spec/unit/ogr/field_definition_spec.rb +0 -118
  287. data/spec/unit/ogr/field_spec.rb +0 -195
  288. data/spec/unit/ogr/geometries/geometry_collection_25d_spec.rb +0 -25
  289. data/spec/unit/ogr/geometries/geometry_collection_spec.rb +0 -188
  290. data/spec/unit/ogr/geometries/line_string_25d_spec.rb +0 -25
  291. data/spec/unit/ogr/geometries/line_string_spec.rb +0 -107
  292. data/spec/unit/ogr/geometries/linear_ring_spec.rb +0 -92
  293. data/spec/unit/ogr/geometries/multi_line_string_25d_spec.rb +0 -25
  294. data/spec/unit/ogr/geometries/multi_line_string_spec.rb +0 -16
  295. data/spec/unit/ogr/geometries/multi_point_25d_spec.rb +0 -25
  296. data/spec/unit/ogr/geometries/multi_point_spec.rb +0 -16
  297. data/spec/unit/ogr/geometries/multi_polygon_25d_spec.rb +0 -25
  298. data/spec/unit/ogr/geometries/multi_polygon_spec.rb +0 -43
  299. data/spec/unit/ogr/geometries/none_geometry_spec.rb +0 -14
  300. data/spec/unit/ogr/geometries/point_25d_spec.rb +0 -25
  301. data/spec/unit/ogr/geometries/point_spec.rb +0 -307
  302. data/spec/unit/ogr/geometries/polygon_25d_spec.rb +0 -25
  303. data/spec/unit/ogr/geometries/polygon_spec.rb +0 -19
  304. data/spec/unit/ogr/geometries/unknown_geometry_spec.rb +0 -12
  305. data/spec/unit/ogr/geometry_field_definition_spec.rb +0 -73
  306. data/spec/unit/ogr/geometry_spec.rb +0 -711
  307. data/spec/unit/ogr/internal_helpers_spec.rb +0 -70
  308. data/spec/unit/ogr/layer_mixins/capability_methods_spec.rb +0 -90
  309. data/spec/unit/ogr/layer_mixins/ogr_feature_methods_spec.rb +0 -155
  310. data/spec/unit/ogr/layer_mixins/ogr_field_methods_spec.rb +0 -434
  311. data/spec/unit/ogr/layer_mixins/ogr_layer_method_methods_spec.rb +0 -22
  312. data/spec/unit/ogr/layer_mixins/ogr_query_filter_methods_spec.rb +0 -44
  313. data/spec/unit/ogr/layer_mixins/ogr_sql_methods_spec.rb +0 -14
  314. data/spec/unit/ogr/layer_spec.rb +0 -98
  315. data/spec/unit/ogr/spatial_reference_mixins/coordinate_system_getter_setters_spec.rb +0 -48
  316. data/spec/unit/ogr/spatial_reference_mixins/exporters_spec.rb +0 -151
  317. data/spec/unit/ogr/spatial_reference_mixins/importers_spec.rb +0 -40
  318. data/spec/unit/ogr/spatial_reference_mixins/morphers_spec.rb +0 -38
  319. data/spec/unit/ogr/spatial_reference_mixins/parameter_getter_setters_spec.rb +0 -105
  320. data/spec/unit/ogr/spatial_reference_mixins/type_checks_spec.rb +0 -159
  321. data/spec/unit/ogr/spatial_reference_spec.rb +0 -44
  322. data/spec/unit/ogr/style_table_spec.rb +0 -108
  323. data/spec/unit/ogr/style_tool_spec.rb +0 -159
  324. data/spec/unit/version_info_spec.rb +0 -50
@@ -20,7 +20,7 @@ module GDAL
20
20
  # @param warp_options [GDAL::WarpOptions] Warp options, normally empty.
21
21
  def reproject_image(destination_dataset, resample_algorithm, destination_projection: nil,
22
22
  warp_memory_limit: 0.0, max_error: 0.0, progress_function: nil, progress_arg: nil, warp_options: nil)
23
- warp_options_struct = warp_options ? warp_options.c_struct : nil
23
+ warp_options_struct = warp_options&.c_struct
24
24
 
25
25
  FFI::GDAL::Warper.GDALReprojectImage(
26
26
  @c_pointer, # hSrcDS
@@ -55,13 +55,14 @@ module GDAL
55
55
  # @param progress_arg [FFI::Pointer] Argument to be passed to
56
56
  # +progress_function+.
57
57
  # @param warp_options [GDAL::WarpOptions] Warp options, normally empty.
58
+ # rubocop:disable Metrics/ParameterLists
58
59
  def create_and_reproject_image(destination_file_name, resample_algorithm, destination_projection,
59
60
  destination_driver, creation_options: {},
60
61
  warp_memory_limit: 0.0, max_error: 0.0,
61
62
  progress_function: nil, progress_arg: nil,
62
63
  warp_options: nil)
63
64
  creation_options_ptr = GDAL::Options.pointer(creation_options)
64
- warp_options_struct = warp_options ? warp_options.c_struct : nil
65
+ warp_options_struct = warp_options&.c_struct
65
66
 
66
67
  FFI::GDAL::Warper.GDALCreateAndReprojectImage(
67
68
  @c_pointer, # hSrcDS
@@ -78,6 +79,7 @@ module GDAL
78
79
  warp_options_struct # psOptions
79
80
  )
80
81
  end
82
+ # rubocop:enable Metrics/ParameterLists
81
83
  end
82
84
  end
83
85
  end
data/lib/gdal/driver.rb CHANGED
@@ -3,7 +3,6 @@
3
3
  require 'multi_xml'
4
4
  require_relative '../gdal'
5
5
  require_relative 'major_object'
6
- require_relative 'driver_mixins/extensions'
7
6
 
8
7
  module GDAL
9
8
  # Wrapper for GDAL drivers (aka "formats"). Useful for opening and working
@@ -11,11 +10,10 @@ module GDAL
11
10
  class Driver
12
11
  include MajorObject
13
12
  include GDAL::Logger
14
- include DriverMixins::Extensions
15
13
 
16
14
  GDAL_DOCS_URL = 'http://gdal.org'
17
15
 
18
- # @return [Fixnum]
16
+ # @return [Integer]
19
17
  def self.count
20
18
  FFI::GDAL::GDAL.GDALGetDriverCount
21
19
  end
@@ -32,7 +30,7 @@ module GDAL
32
30
  new(driver_ptr)
33
31
  end
34
32
 
35
- # @param index [Fixnum] Index of the registered driver. Must be less than
33
+ # @param index [Integer] Index of the registered driver. Must be less than
36
34
  # GDAL::Driver.count.
37
35
  # @return [GDAL::Driver]
38
36
  # @raise [GDAL::InvalidDriverIndex] If driver at +index+ does not exist.
@@ -57,22 +55,34 @@ module GDAL
57
55
 
58
56
  # @param driver [GDAL::Driver, FFI::Pointer]
59
57
  def initialize(driver)
60
- @c_pointer = GDAL._pointer(GDAL::Driver, driver)
58
+ @c_pointer = GDAL._pointer(GDAL::Driver, driver, autorelease: false)
61
59
  end
62
60
 
63
61
  # @return [String]
64
62
  def short_name
65
- FFI::GDAL::GDAL.GDALGetDriverShortName(@c_pointer)
63
+ # The returned string should not be freed and is owned by the driver.
64
+ name, ptr = FFI::GDAL::GDAL.GDALGetDriverShortName(@c_pointer)
65
+ ptr.autorelease = false
66
+
67
+ name
66
68
  end
67
69
 
68
70
  # @return [String]
69
71
  def long_name
70
- FFI::GDAL::GDAL.GDALGetDriverLongName(@c_pointer)
72
+ # The returned string should not be freed and is owned by the driver.
73
+ name, ptr = FFI::GDAL::GDAL.GDALGetDriverLongName(@c_pointer)
74
+ ptr.autorelease = false
75
+
76
+ name
71
77
  end
72
78
 
73
79
  # @return [String]
74
80
  def help_topic
75
- "#{GDAL_DOCS_URL}/#{FFI::GDAL::GDAL.GDALGetDriverHelpTopic(@c_pointer)}"
81
+ # The returned string should not be freed and is owned by the driver.
82
+ url, ptr = FFI::GDAL::GDAL.GDALGetDriverHelpTopic(@c_pointer)
83
+ ptr.autorelease = false
84
+
85
+ "#{GDAL_DOCS_URL}/#{url}"
76
86
  end
77
87
 
78
88
  # Lists and describes the options that can be used when calling
@@ -82,8 +92,11 @@ module GDAL
82
92
  def creation_option_list
83
93
  return [] unless @c_pointer
84
94
 
85
- creation_option_list_xml = FFI::GDAL::GDAL.GDALGetDriverCreationOptionList(@c_pointer)
95
+ # The returned string should not be freed and is owned by the driver.
96
+ creation_option_list_xml, ptr = FFI::GDAL::GDAL.GDALGetDriverCreationOptionList(@c_pointer)
97
+ ptr.autorelease = false
86
98
  root = MultiXml.parse(creation_option_list_xml)
99
+
87
100
  return [] if root.nil? || root.empty?
88
101
 
89
102
  list = root['CreationOptionList']
@@ -109,9 +122,11 @@ module GDAL
109
122
  # @param new_name [String]
110
123
  # @param old_name [String]
111
124
  # @return true on success, false on warning.
112
- # @raise [GDAL::CPLErrFailure] If failures.
125
+ # @raise [GDAL::Error] If failures.
113
126
  def copy_dataset_files(old_name, new_name)
114
- FFI::GDAL::GDAL.GDALCopyDatasetFiles(@c_pointer, new_name, old_name)
127
+ GDAL::CPLErrorHandler.manually_handle("Unable to copy dataset files: '#{old_name}' -> '#{new_name}'") do
128
+ FFI::GDAL::GDAL.GDALCopyDatasetFiles(@c_pointer, new_name, old_name)
129
+ end
115
130
  end
116
131
 
117
132
  # Create a new Dataset with this driver. Legal arguments depend on the
@@ -119,9 +134,9 @@ module GDAL
119
134
  # out all data to the destination, you must call #close on the dataset!
120
135
  #
121
136
  # @param filename [String]
122
- # @param x_size [Fixnum] Width of created raster in pixels.
123
- # @param y_size [Fixnum] Height of created raster in pixels.
124
- # @param band_count [Fixnum]
137
+ # @param x_size [Integer] Width of created raster in pixels.
138
+ # @param y_size [Integer] Height of created raster in pixels.
139
+ # @param band_count [Integer]
125
140
  # @param data_type [FFI::GDAL::GDAL::DataType]
126
141
  # @return [GDAL::Dataset] If no block is given, returns the *open*
127
142
  # (writable) dataset; you'll need to close it. If a block is given,
@@ -201,18 +216,20 @@ module GDAL
201
216
  # this could mean deleting associated files, database objects, etc.
202
217
  #
203
218
  # @param file_name [String]
204
- # @return true on success, false on warning.
205
- # @raise [GDAL::CPLErrFailure] If failures.
219
+ # @raise [GDAL::Error] If failures.
206
220
  def delete_dataset(file_name)
207
- FFI::GDAL::GDAL.GDALDeleteDataset(@c_pointer, file_name)
221
+ GDAL::CPLErrorHandler.manually_handle("Unable to delete dataset: #{file_name}") do
222
+ FFI::GDAL::GDAL.GDALDeleteDataset(@c_pointer, file_name)
223
+ end
208
224
  end
209
225
 
210
226
  # @param old_name [String]
211
227
  # @param new_name [String]
212
- # @return true on success, false on warning.
213
- # @raise [GDAL::CPLErrFailure] If failures.
228
+ # @raise [GDAL::Error] If failures.
214
229
  def rename_dataset(old_name, new_name)
215
- FFI::GDAL::GDAL.GDALRenameDataset(@c_pointer, new_name, old_name)
230
+ GDAL::CPLErrorHandler.manually_handle("Unable to rename dataset: #{old_name}") do
231
+ FFI::GDAL::GDAL.GDALRenameDataset(@c_pointer, new_name, old_name)
232
+ end
216
233
  end
217
234
 
218
235
  private
@@ -224,7 +241,7 @@ module GDAL
224
241
  if dataset.is_a? String
225
242
  GDAL::Dataset.open(dataset, 'r').c_pointer
226
243
  else
227
- GDAL._pointer(GDAL::Dataset, dataset)
244
+ GDAL._pointer(GDAL::Dataset, dataset, autorelease: false)
228
245
  end
229
246
  end
230
247
  end
@@ -3,32 +3,32 @@
3
3
  module GDAL
4
4
  # Getters and setters for the GDAL environment.
5
5
  module EnvironmentMethods
6
- # @return [Fixnum] The maximum cache memory.
6
+ # @return [Integer] The maximum cache memory.
7
7
  def cache_max
8
8
  FFI::GDAL::GDAL.GDALGetCacheMax
9
9
  end
10
10
 
11
- # @param bytes [Fixnum]
11
+ # @param bytes [Integer]
12
12
  def cache_max=(bytes)
13
13
  FFI::GDAL::GDAL.GDALSetCacheMax(bytes)
14
14
  end
15
15
 
16
- # @return [Fixnum] The maximum cache memory.
16
+ # @return [Integer] The maximum cache memory.
17
17
  def cache_max64
18
18
  FFI::GDAL::GDAL.GDALGetCacheMax64
19
19
  end
20
20
 
21
- # @param bytes [Fixnum]
21
+ # @param bytes [Integer]
22
22
  def cache_max64=(bytes)
23
23
  FFI::GDAL::GDAL.GDALSetCacheMax64(bytes)
24
24
  end
25
25
 
26
- # @return [Fixnum] The amount of used cache memory.
26
+ # @return [Integer] The amount of used cache memory.
27
27
  def cache_used
28
28
  FFI::GDAL::GDAL.GDALGetCacheUsed
29
29
  end
30
30
 
31
- # @return [Fixnum] The amount of used cache memory.
31
+ # @return [Integer] The amount of used cache memory.
32
32
  def cache_used64
33
33
  FFI::GDAL::GDAL.GDALGetCacheUsed64
34
34
  end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ Dir[File.join(__dir__, '**/extensions/**/*.rb')].sort.each { |f| require f }
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
+ require 'gdal/color_entry'
4
5
 
5
6
  module GDAL
6
7
  module ColorEntryMixins
@@ -8,7 +9,7 @@ module GDAL
8
9
  # @param include_fourth [Boolean] Turn off in case you don't want the fourth
9
10
  # color in the array.
10
11
  # @return [Array]
11
- def to_a(include_fourth = true)
12
+ def to_a(include_fourth: true)
12
13
  if include_fourth
13
14
  [color1, color2, color3, color4]
14
15
  else
@@ -18,3 +19,5 @@ module GDAL
18
19
  end
19
20
  end
20
21
  end
22
+
23
+ GDAL::ColorEntry.include(GDAL::ColorEntryMixins::Extensions)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'json'
4
+ require 'gdal/color_table'
4
5
 
5
6
  module GDAL
6
7
  module ColorTableMixins
@@ -32,3 +33,5 @@ module GDAL
32
33
  end
33
34
  end
34
35
  end
36
+
37
+ GDAL::ColorTable.include(GDAL::ColorTableMixins::Extensions)
@@ -0,0 +1,205 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'narray'
4
+ require 'ffi-gdal'
5
+ require 'gdal/dataset'
6
+ require 'gdal/raster_band'
7
+ require 'gdal/warp_operation'
8
+ require 'ogr/driver'
9
+ require 'ogr/layer'
10
+ require 'ogr/spatial_reference'
11
+ require 'ogr/coordinate_transformation'
12
+
13
+ module GDAL
14
+ class Dataset
15
+ # Methods not originally supplied with GDAL, but enhance it.
16
+ module Extensions
17
+ # @return [Array<GDAL::RasterBand>]
18
+ def raster_bands
19
+ 1.upto(raster_count).map do |i|
20
+ raster_band(i)
21
+ end
22
+ end
23
+
24
+ # Iterates raster bands from 1 to #raster_count and yields them to the given
25
+ # block.
26
+ def each_band
27
+ 1.upto(raster_count) do |i|
28
+ yield(raster_band(i))
29
+ end
30
+ end
31
+
32
+ # Returns the first raster band for which the block returns true.
33
+ #
34
+ # @example
35
+ #
36
+ # dataset.find_band do |band|
37
+ # band.color_interpretation == :GCI_RedBand
38
+ # end
39
+ #
40
+ # @return [GDAL::RasterBand]
41
+ def find_band
42
+ each_band do |band|
43
+ result = yield(band)
44
+ return band if result
45
+ end
46
+ end
47
+
48
+ # @return [GDAL::RasterBand, nil]
49
+ def red_band
50
+ band = find_band do |b|
51
+ b.color_interpretation == :GCI_RedBand
52
+ end
53
+
54
+ band.is_a?(GDAL::RasterBand) ? band : nil
55
+ end
56
+
57
+ # @return [GDAL::RasterBand, nil]
58
+ def green_band
59
+ band = find_band do |b|
60
+ b.color_interpretation == :GCI_GreenBand
61
+ end
62
+
63
+ band.is_a?(GDAL::RasterBand) ? band : nil
64
+ end
65
+
66
+ # @return [GDAL::RasterBand, nil]
67
+ def blue_band
68
+ band = find_band do |b|
69
+ b.color_interpretation == :GCI_BlueBand
70
+ end
71
+
72
+ band.is_a?(GDAL::RasterBand) ? band : nil
73
+ end
74
+
75
+ # @return [GDAL::RasterBand, nil]
76
+ def undefined_band
77
+ band = find_band do |b|
78
+ b.color_interpretation == :GCI_Undefined
79
+ end
80
+
81
+ band.is_a?(GDAL::RasterBand) ? band : nil
82
+ end
83
+
84
+ # Converts raster band number +band_number+ to the vector format
85
+ # +vector_driver_name+. Similar to gdal_polygonize.py. If block format is
86
+ # used, the new DataSource will be closed/flushed when the block returns. If
87
+ # the non-block format is used, you need to call #close on the DataSource.
88
+ #
89
+ # @param file_name [String] Path to write the vector file to.
90
+ # @param vector_driver_name [String] One of OGR::Driver.names.
91
+ # @param geometry_type [FFI::GDAL::OGRwkbGeometryType] The type of geometry
92
+ # to use when turning the raster into a vector image.
93
+ # @param layer_name_prefix [String] Prefix of the name to give the new
94
+ # vector layer.
95
+ # @param band_numbers [Array<Integer>,Integer] Number of the raster band or
96
+ # bands from this dataset to vectorize. Can be a single Integer or array
97
+ # of Integers.
98
+ # @return [OGR::DataSource]
99
+ def to_vector(file_name, vector_driver_name, geometry_type: :wkbUnknown,
100
+ layer_name_prefix: 'band_number', band_numbers: [1],
101
+ field_name_prefix: 'field', use_band_masks: true)
102
+ band_numbers = [band_numbers] unless band_numbers.is_a?(Array)
103
+ ogr_driver = OGR::Driver.by_name(vector_driver_name)
104
+
105
+ if projection.empty?
106
+ spatial_ref = nil
107
+ else
108
+ spatial_ref = OGR::SpatialReference.new(projection)
109
+ begin
110
+ spatial_ref.auto_identify_epsg!
111
+ rescue StandardError
112
+ OGR::UnsupportedSRS
113
+ end
114
+ end
115
+
116
+ data_source = ogr_driver.create_data_source(file_name)
117
+
118
+ # TODO: fasterer: each_with_index is slower than loop
119
+ band_numbers.each_with_index do |band_number, i|
120
+ log "Starting to polygonize raster band #{band_number}..."
121
+ layer_name = "#{layer_name_prefix}-#{band_number}"
122
+ layer = data_source.create_layer(layer_name, geometry_type: geometry_type,
123
+ spatial_reference: spatial_ref)
124
+
125
+ field_name = "#{field_name_prefix}#{i}"
126
+ layer.create_field(OGR::FieldDefinition.new(field_name, :OFTInteger))
127
+ band = raster_band(band_number)
128
+
129
+ raise GDAL::InvalidBandNumber, "Unknown band number: #{band_number}" unless band
130
+
131
+ pixel_value_field = layer.feature_definition.field_index(field_name)
132
+ options = { pixel_value_field: pixel_value_field }
133
+ options[:mask_band] = band.mask_band if use_band_masks
134
+ band.polygonize(layer, **options)
135
+ end
136
+
137
+ if block_given?
138
+ yield data_source
139
+ data_source.close
140
+ end
141
+
142
+ data_source
143
+ end
144
+
145
+ # Gets the OGR::Geometry that represents the extent of the dataset.
146
+ #
147
+ # @return [OGR::Polygon]
148
+ # TODO: This should return an OGR::Envelope.
149
+ def extent
150
+ ul = geo_transform.apply_geo_transform(0, 0)
151
+ ur = geo_transform.apply_geo_transform(raster_x_size, 0)
152
+ lr = geo_transform.apply_geo_transform(raster_x_size, raster_y_size)
153
+ ll = geo_transform.apply_geo_transform(0, raster_y_size)
154
+
155
+ ring = OGR::LinearRing.new
156
+ ring.point_count = 5
157
+ ring.set_point(0, ul[:x_geo], ul[:y_geo])
158
+ ring.set_point(1, ur[:x_geo], ur[:y_geo])
159
+ ring.set_point(2, lr[:x_geo], lr[:y_geo])
160
+ ring.set_point(3, ll[:x_geo], ll[:y_geo])
161
+ ring.set_point(4, ul[:x_geo], ul[:y_geo])
162
+
163
+ polygon = OGR::Polygon.new
164
+ polygon.add_geometry(ring)
165
+ polygon.spatial_reference = spatial_reference
166
+
167
+ polygon
168
+ end
169
+
170
+ # @param wkt_geometry_string [String]
171
+ # @param wkt_srid [Integer]
172
+ # @return [Boolean]
173
+ def contains_geometry?(wkt_geometry_string, wkt_srid = 4326)
174
+ source_srs = OGR::SpatialReference.new_from_epsg(wkt_srid)
175
+ source_geometry = OGR::Geometry.create_from_wkt(wkt_geometry_string, source_srs)
176
+ @raster_geometry ||= extent
177
+
178
+ coordinate_transformation = OGR::CoordinateTransformation.new(source_srs,
179
+ @raster_geometry.spatial_reference)
180
+ source_geometry.transform!(coordinate_transformation)
181
+
182
+ @raster_geometry.contains? source_geometry
183
+ end
184
+
185
+ # Retrieves pixels from each raster band and converts this to an array of
186
+ # points per pixel. For example:
187
+ #
188
+ # # If the arrays for each band look like:
189
+ # red_band_array = [0, 0, 0]
190
+ # green_band_array = [10, 10, 10]
191
+ # blue_band_array = [99, 99, 99]
192
+ # alpha_band_array = [250, 150, 2]
193
+ #
194
+ # # This array would look like:
195
+ # [[0, 10, 99, 2], [0, 10, 99, 150], [0, 10, 99, 250]]
196
+ # @return NArray
197
+ def to_na(to_data_type = nil)
198
+ na = NMatrix.to_na(raster_bands.map { |r| r.to_na(to_data_type) })
199
+
200
+ NArray[*na.transpose]
201
+ end
202
+ end
203
+ end
204
+ end
205
+ GDAL::Dataset.include(GDAL::Dataset::Extensions)
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'gdal/driver'
4
+
3
5
  module GDAL
4
- module DriverMixins
6
+ class Driver
5
7
  module Extensions
6
8
  def self.included(base)
7
9
  base.extend(ClassMethods)
@@ -30,7 +32,7 @@ module GDAL
30
32
  obj[driver.short_name] = driver.long_name
31
33
  end
32
34
 
33
- Hash[names.sort]
35
+ names.sort.to_h
34
36
  end
35
37
  end
36
38
 
@@ -88,3 +90,5 @@ module GDAL
88
90
  end
89
91
  end
90
92
  end
93
+
94
+ GDAL::Driver.include(GDAL::Driver::Extensions)
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
4
- require_relative '../exceptions'
3
+ require 'gdal/exceptions'
4
+ require 'gdal/geo_transform'
5
5
 
6
6
  module GDAL
7
- module GeoTransformMixins
7
+ class GeoTransform
8
8
  module Extensions
9
9
  # @param base [Class,Module]
10
10
  def self.included(base)
@@ -17,8 +17,8 @@ module GDAL
17
17
  # pixel dimensions. Assumes north-up.
18
18
  #
19
19
  # @param envelope [OGR::Envelope]
20
- # @param raster_width [Fixnum]
21
- # @param raster_height [Fixnum]
20
+ # @param raster_width [Integer]
21
+ # @param raster_height [Integer]
22
22
  def new_from_envelope(envelope, raster_width, raster_height)
23
23
  gt = GDAL::GeoTransform.new
24
24
  gt.x_origin = envelope.x_min
@@ -35,7 +35,7 @@ module GDAL
35
35
  #
36
36
  # @param x_geo [Number]
37
37
  # @param y_geo [Number]
38
- # @return [Hash{pixel => Fixnum, line Fixnum}]
38
+ # @return [Hash{pixel => Integer, line Integer}]
39
39
  def world_to_pixel(x_geo, y_geo)
40
40
  pixel = world_to_x_pixel(x_geo)
41
41
  line = world_to_y_pixel(y_geo)
@@ -47,7 +47,7 @@ module GDAL
47
47
  # +x_geo+ coordinate.
48
48
  #
49
49
  # @param x_geo [Number]
50
- # @return [Fixnum]
50
+ # @return [Integer]
51
51
  # @raise [GDAL::InvalidGeoTransform] if {GDAL::GeoTransform#pixel_width}
52
52
  # is 0.
53
53
  def world_to_x_pixel(x_geo)
@@ -62,7 +62,7 @@ module GDAL
62
62
  # coordinate.
63
63
  #
64
64
  # @param y_geo [Number]
65
- # @return [Fixnum]
65
+ # @return [Integer]
66
66
  # @raise [GDAL::InvalidGeoTransform] if {GDAL::GeoTransform#pixel_height}
67
67
  # is 0.
68
68
  def world_to_y_pixel(y_geo)
@@ -95,3 +95,5 @@ module GDAL
95
95
  end
96
96
  end
97
97
  end
98
+
99
+ GDAL::GeoTransform.include(GDAL::GeoTransform::Extensions)
@@ -10,7 +10,7 @@ module GDAL
10
10
  # really just indented for internal use, but is being left public just in
11
11
  # case it serves some benefit for debugging.
12
12
  #
13
- # @return [NArray]
13
+ # @return [Array<Array>]
14
14
  def points
15
15
  return @points if @points
16
16
 
@@ -30,7 +30,7 @@ module GDAL
30
30
 
31
31
  private
32
32
 
33
- # Checks to make sure that a) if an input_field_name option was give, that
33
+ # Checks to make sure that a) if an input_field_name option was given, that
34
34
  # the layer actually has that field, or b) that the layer has Z values set.
35
35
  # Without one of these two things, there's no values to pass along to
36
36
  # interpolate.
@@ -42,10 +42,12 @@ module GDAL
42
42
  def ensure_z_values
43
43
  if layer_missing_specified_field?
44
44
  raise OGR::InvalidFieldName, "Field name not found in layer: '#{@options.input_field_name}'"
45
- elsif !@options.input_field_name && !@source_layer.any_geometries_with_z?
46
- raise GDAL::NoValuesToGrid,
47
- "No input_field_name option given and source layer #{@source_layer.name} has no Z values."
48
45
  end
46
+
47
+ return unless !@options.input_field_name && !@source_layer.any_geometries_with_z?
48
+
49
+ raise GDAL::NoValuesToGrid,
50
+ "No input_field_name option given and source layer #{@source_layer.name} has no Z values."
49
51
  end
50
52
 
51
53
  # @param layer [OGR::Layer] The layer from which to extract point values.