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.
- checksums.yaml +4 -4
- data/.dockerignore +17 -0
- data/.github/workflows/codacy.yml +61 -0
- data/.github/workflows/codeql.yml +74 -0
- data/.github/workflows/continuous-integration.yml +36 -0
- data/.github/workflows/dependency-review.yml +20 -0
- data/.github/workflows/specs-in-docker.yml +27 -0
- data/.gitignore +3 -0
- data/.rspec +1 -0
- data/.rubocop.yml +10 -80
- data/.rubocop_todo.yml +23 -40
- data/.ruby-version +1 -1
- data/Changelog-0.x.md +512 -0
- data/Changelog.md +12 -0
- data/Dockerfile.gdal2 +110 -0
- data/Dockerfile.gdal3 +73 -0
- data/README.md +25 -14
- data/Rakefile +0 -8
- data/Tiltfile +91 -0
- data/bin/bundle +123 -0
- data/bin/docker-clean +8 -0
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/bin/rubocop +29 -0
- data/docker-compose.yml +25 -0
- data/examples/extract_and_colorize.rb +0 -13
- data/examples/geometries.rb +14 -14
- data/examples/ogr_layer_to_layer.rb +1 -3
- data/examples/raster_erasing.rb +1 -0
- data/examples/remove_small_polygons.rb +1 -1
- data/examples/testing_gdal.rb +20 -17
- data/examples/warping.rb +9 -7
- data/ffi-gdal.gemspec +12 -6
- data/lib/ext/ffi_library_function_checks.rb +2 -2
- data/lib/ext/to_bool.rb +5 -3
- data/lib/ffi/cpl/conv.rb +27 -25
- data/lib/ffi/cpl/error.rb +19 -20
- data/lib/ffi/cpl/hash_set.rb +4 -4
- data/lib/ffi/cpl/http.rb +3 -3
- data/lib/ffi/cpl/http_result.rb +8 -8
- data/lib/ffi/cpl/list.rb +1 -1
- data/lib/ffi/cpl/mime_part.rb +2 -2
- data/lib/ffi/cpl/minixml.rb +7 -7
- data/lib/ffi/cpl/progress.rb +8 -8
- data/lib/ffi/cpl/quad_tree.rb +14 -14
- data/lib/ffi/cpl/rect_obj.rb +3 -3
- data/lib/ffi/cpl/string.rb +17 -20
- data/lib/ffi/cpl/vsi.rb +13 -13
- data/lib/ffi/cpl/xml_node.rb +3 -3
- data/lib/ffi/extensions/gdal/extensions/all.rb +4 -0
- data/lib/ffi/extensions/gdal/extensions/version.rb +9 -0
- data/lib/ffi/extensions/gdal/extensions.rb +12 -0
- data/lib/ffi/extensions/rttopo/gbox.rb +19 -0
- data/lib/ffi/extensions/rttopo/geom.rb +16 -0
- data/lib/ffi/extensions/rttopo.rb +41 -0
- data/lib/ffi/gdal/alg.rb +277 -277
- data/lib/ffi/gdal/color_entry.rb +3 -3
- data/lib/ffi/gdal/gcp.rb +6 -6
- data/lib/ffi/gdal/gdal.rb +349 -349
- data/lib/ffi/gdal/grid.rb +134 -134
- data/lib/ffi/gdal/grid_data_metrics_options.rb +4 -4
- data/lib/ffi/gdal/grid_inverse_distance_to_a_power_options.rb +9 -9
- data/lib/ffi/gdal/grid_moving_average_options.rb +4 -4
- data/lib/ffi/gdal/grid_nearest_neighbor_options.rb +3 -3
- data/lib/ffi/gdal/matching.rb +3 -3
- data/lib/ffi/gdal/rpc_info.rb +17 -17
- data/lib/ffi/gdal/transformer_info.rb +4 -4
- data/lib/ffi/gdal/version.rb +1 -1
- data/lib/ffi/gdal/vrt.rb +39 -39
- data/lib/ffi/gdal/warp_options.rb +34 -34
- data/lib/ffi/gdal/warper.rb +90 -90
- data/lib/ffi/gdal.rb +2 -31
- data/lib/ffi/ogr/api.rb +175 -167
- data/lib/ffi/ogr/contour_writer_info.rb +4 -4
- data/lib/ffi/ogr/core.rb +107 -107
- data/lib/ffi/ogr/envelope.rb +3 -3
- data/lib/ffi/ogr/envelope_3d.rb +5 -5
- data/lib/ffi/ogr/featurestyle.rb +3 -3
- data/lib/ffi/ogr/field.rb +22 -22
- data/lib/ffi/ogr/geocoding.rb +4 -4
- data/lib/ffi/ogr/srs_api.rb +154 -155
- data/lib/ffi/ogr/style_param.rb +3 -3
- data/lib/ffi/ogr/style_value.rb +4 -4
- data/lib/gdal/color_entry.rb +1 -5
- data/lib/gdal/color_interpretation.rb +7 -3
- data/lib/gdal/color_table.rb +46 -27
- data/lib/gdal/cpl_error_handler.rb +26 -6
- data/lib/gdal/data_type.rb +10 -3
- data/lib/gdal/dataset.rb +171 -85
- data/lib/gdal/dataset_mixins/algorithm_methods.rb +44 -44
- data/lib/gdal/dataset_mixins/matching.rb +1 -1
- data/lib/gdal/dataset_mixins/warp_methods.rb +4 -2
- data/lib/gdal/driver.rb +38 -21
- data/lib/gdal/environment_methods.rb +6 -6
- data/lib/gdal/extensions/all.rb +3 -0
- data/lib/gdal/{color_entry_mixins → extensions/color_entry}/extensions.rb +4 -1
- data/lib/gdal/{color_table_mixins → extensions/color_table}/extensions.rb +3 -0
- data/lib/gdal/extensions/dataset/extensions.rb +205 -0
- data/lib/gdal/{driver_mixins → extensions/driver}/extensions.rb +6 -2
- data/lib/gdal/{geo_transform_mixins → extensions/geo_transform}/extensions.rb +10 -8
- data/lib/gdal/{gridder → extensions/gridder}/point_extracting.rb +7 -5
- data/lib/gdal/{gridder.rb → extensions/gridder.rb} +33 -33
- data/lib/gdal/{gridder_options.rb → extensions/gridder_options.rb} +13 -14
- data/lib/gdal/{raster_attribute_table_mixins → extensions/raster_attribute_table}/extensions.rb +8 -6
- data/lib/gdal/{raster_band_mixins → extensions/raster_band}/algorithm_extensions.rb +8 -6
- data/lib/gdal/{raster_band_mixins → extensions/raster_band}/coloring_extensions.rb +6 -4
- data/lib/gdal/{raster_band_mixins → extensions/raster_band}/extensions.rb +9 -5
- data/lib/gdal/{raster_band_mixins → extensions/raster_band}/io_extensions.rb +18 -14
- data/lib/gdal/{raster_band_classifier.rb → extensions/raster_band_classifier.rb} +3 -5
- data/lib/gdal/geo_transform.rb +1 -6
- data/lib/gdal/grid.rb +3 -2
- data/lib/gdal/grid_algorithms.rb +9 -9
- data/lib/gdal/internal_helpers.rb +46 -9
- data/lib/gdal/major_object.rb +11 -3
- data/lib/gdal/options.rb +26 -32
- data/lib/gdal/raster_attribute_table.rb +63 -37
- data/lib/gdal/raster_band.rb +164 -116
- data/lib/gdal/raster_band_mixins/algorithm_methods.rb +26 -25
- data/lib/gdal/rpc_info.rb +3 -2
- data/lib/gdal/transformers/approximate_transformer.rb +12 -3
- data/lib/gdal/transformers/base_general_image_projection_transformer.rb +15 -2
- data/lib/gdal/transformers/gcp_transformer.rb +27 -19
- data/lib/gdal/transformers/general_image_projection_transformer.rb +8 -6
- data/lib/gdal/transformers/general_image_projection_transformer2.rb +9 -6
- data/lib/gdal/transformers/general_image_projection_transformer3.rb +6 -2
- data/lib/gdal/transformers/geolocation_transformer.rb +12 -4
- data/lib/gdal/transformers/reprojection_transformer.rb +11 -3
- data/lib/gdal/transformers/rpc_transformer.rb +11 -2
- data/lib/gdal/transformers/tps_transformer.rb +12 -4
- data/lib/gdal/version_info.rb +2 -2
- data/lib/gdal/virtual_dataset.rb +2 -0
- data/lib/gdal/warp_operation.rb +65 -54
- data/lib/gdal/warp_options.rb +9 -11
- data/lib/ogr/coordinate_transformation.rb +23 -9
- data/lib/ogr/data_source.rb +68 -37
- data/lib/ogr/driver.rb +18 -17
- data/lib/ogr/envelope.rb +0 -3
- data/lib/ogr/error_handling.rb +22 -24
- data/lib/ogr/extensions/all.rb +3 -0
- data/lib/ogr/{data_source_mixins → extensions/data_source}/capability_methods.rb +2 -0
- data/lib/ogr/extensions/data_source/data_source_extensions.rb +16 -0
- data/lib/ogr/{driver_mixins → extensions/driver}/capability_methods.rb +5 -1
- data/lib/ogr/extensions/envelope/extensions.rb +114 -0
- data/lib/ogr/extensions/feature/extensions.rb +87 -0
- data/lib/ogr/extensions/feature_definition/extensions.rb +43 -0
- data/lib/ogr/extensions/geometries/point/extensions.rb +19 -0
- data/lib/ogr/extensions/geometry/container_mixins.rb +56 -0
- data/lib/ogr/extensions/geometry/ewkb_io_extensions.rb +44 -0
- data/lib/ogr/extensions/geometry/ewkb_record.rb +94 -0
- data/lib/ogr/{geometry_mixins → extensions/geometry}/extensions.rb +16 -9
- data/lib/ogr/extensions/geometry/rttopo_extensions.rb +48 -0
- data/lib/ogr/extensions/geometry/wkb_record.rb +63 -0
- data/lib/ogr/extensions/geometry_types/curve/extensions.rb +68 -0
- data/lib/ogr/{layer_mixins → extensions/layer}/capability_methods.rb +4 -0
- data/lib/ogr/{layer_mixins → extensions/layer}/extensions.rb +11 -6
- data/lib/ogr/extensions/spatial_reference/extensions.rb +38 -0
- data/lib/ogr/extensions/spatial_reference/initializers.rb +138 -0
- data/lib/ogr/extensions/style_table/extensions.rb +31 -0
- data/lib/ogr/feature.rb +173 -88
- data/lib/ogr/feature_definition.rb +53 -45
- data/lib/ogr/field.rb +17 -19
- data/lib/ogr/field_definition.rb +30 -18
- data/lib/ogr/geocoder.rb +11 -4
- data/lib/ogr/geometries/line_string.rb +1 -0
- data/lib/ogr/geometries/line_string_25d.rb +0 -9
- data/lib/ogr/geometries/linear_ring.rb +2 -2
- data/lib/ogr/geometries/point.rb +0 -9
- data/lib/ogr/geometry.rb +116 -49
- data/lib/ogr/geometry_field_definition.rb +31 -15
- data/lib/ogr/geometry_types/container.rb +26 -28
- data/lib/ogr/geometry_types/curve.rb +5 -61
- data/lib/ogr/geometry_types/surface.rb +1 -1
- data/lib/ogr/internal_helpers.rb +2 -2
- data/lib/ogr/layer.rb +12 -10
- data/lib/ogr/layer_mixins/ogr_feature_methods.rb +39 -27
- data/lib/ogr/layer_mixins/ogr_field_methods.rb +66 -50
- data/lib/ogr/layer_mixins/ogr_layer_method_methods.rb +17 -8
- data/lib/ogr/layer_mixins/ogr_query_filter_methods.rb +7 -6
- data/lib/ogr/layer_mixins/ogr_sql_methods.rb +15 -7
- data/lib/ogr/spatial_reference.rb +79 -42
- data/lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb +149 -118
- data/lib/ogr/spatial_reference_mixins/exporters.rb +87 -51
- data/lib/ogr/spatial_reference_mixins/importers.rb +88 -43
- data/lib/ogr/spatial_reference_mixins/morphers.rb +12 -8
- data/lib/ogr/spatial_reference_mixins/parameter_getter_setters.rb +27 -13
- data/lib/ogr/style_table.rb +15 -5
- data/lib/ogr/style_tool.rb +29 -15
- data/lib/ogr.rb +1 -0
- data/rakelib/docker.rake +10 -0
- data/sorbet/rbi/hidden-definitions/errors.txt +21790 -0
- data/tilt/gdal2.yml +22 -0
- data/tilt/gdal3.yml +22 -0
- metadata +116 -280
- data/History.md +0 -360
- data/lib/ext/error_symbols.rb +0 -7
- data/lib/gdal/dataset_mixins/extensions.rb +0 -380
- data/lib/gdal/merger.rb +0 -132
- data/lib/ogr/data_source_extensions.rb +0 -10
- data/lib/ogr/envelope_extensions.rb +0 -110
- data/lib/ogr/feature_definition_extensions.rb +0 -39
- data/lib/ogr/feature_extensions.rb +0 -87
- data/lib/ogr/geometry_mixins/container_mixins.rb +0 -25
- data/lib/ogr/spatial_reference_extensions.rb +0 -34
- data/lib/ogr/style_table_extensions.rb +0 -26
- data/spec/ffi-gdal_spec.rb +0 -24
- data/spec/integration/gdal/color_table_info_spec.rb +0 -78
- data/spec/integration/gdal/dataset_info_spec.rb +0 -342
- data/spec/integration/gdal/driver_info_spec.rb +0 -170
- data/spec/integration/gdal/geo_transform_info_spec.rb +0 -226
- data/spec/integration/gdal/gridder_spec.rb +0 -331
- data/spec/integration/gdal/raster_attribute_table_info_spec.rb +0 -229
- data/spec/integration/gdal/raster_band_algorithms_spec.rb +0 -35
- data/spec/integration/gdal/raster_band_info_spec.rb +0 -320
- data/spec/integration/ogr/layer_spec.rb +0 -95
- data/spec/spec_helper.rb +0 -116
- data/spec/support/images/123.tiff +0 -0
- data/spec/support/images/osgeo/gdal/data/hfa/float-rle.img +0 -0
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.lgo +0 -31
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.tif +0 -0
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.tif.msk +0 -0
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.txt +0 -10
- data/spec/support/images/osgeo/geotiff/gdal_eg/cea.tif +0 -0
- data/spec/support/images/osgeo/geotiff/gdal_eg/cea.txt +0 -84
- data/spec/support/images/osgeo/geotiff/zi_imaging/image0.lgo +0 -45
- data/spec/support/images/osgeo/geotiff/zi_imaging/image0.tif +0 -0
- data/spec/support/integration_help.rb +0 -34
- data/spec/support/shapefiles/states_21basic/states.dbf +0 -0
- data/spec/support/shapefiles/states_21basic/states.prj +0 -1
- data/spec/support/shapefiles/states_21basic/states.sbn +0 -0
- data/spec/support/shapefiles/states_21basic/states.sbx +0 -0
- data/spec/support/shapefiles/states_21basic/states.shp +0 -0
- data/spec/support/shapefiles/states_21basic/states.shp.xml +0 -3
- data/spec/support/shapefiles/states_21basic/states.shx +0 -0
- data/spec/support/shared_contexts.rb +0 -28
- data/spec/support/shared_examples/gdal/major_object_examples.rb +0 -55
- data/spec/support/shared_examples/ogr/a_25d_geometry.rb +0 -9
- data/spec/support/shared_examples/ogr/a_container_geometry.rb +0 -49
- data/spec/support/shared_examples/ogr/a_geometry.rb +0 -406
- data/spec/support/shared_examples/ogr/a_line_string.rb +0 -18
- data/spec/support/test_style_table.txt +0 -3
- data/spec/support/worldfiles/SR_50M/SR_50M.VERSION.txt +0 -1
- data/spec/support/worldfiles/SR_50M/SR_50M.prj +0 -1
- data/spec/support/worldfiles/SR_50M/SR_50M.tfw +0 -6
- data/spec/support/worldfiles/SR_50M/SR_50M.tif +0 -0
- data/spec/unit/ext/error_symbols_spec.rb +0 -69
- data/spec/unit/ext/numeric_as_data_type_spec.rb +0 -115
- data/spec/unit/ffi/gdal_spec.rb +0 -73
- data/spec/unit/gdal/color_entry_spec.rb +0 -8
- data/spec/unit/gdal/color_interpretation_spec.rb +0 -8
- data/spec/unit/gdal/color_table_mixins/extensions_spec.rb +0 -62
- data/spec/unit/gdal/color_table_spec.rb +0 -146
- data/spec/unit/gdal/data_type_spec.rb +0 -74
- data/spec/unit/gdal/dataset_mixins/warp_methods_spec.rb +0 -55
- data/spec/unit/gdal/dataset_spec.rb +0 -148
- data/spec/unit/gdal/driver_mixins/extensions_spec.rb +0 -24
- data/spec/unit/gdal/driver_spec.rb +0 -51
- data/spec/unit/gdal/environment_methods_spec.rb +0 -8
- data/spec/unit/gdal/geo_transform_mixins/extensions_spec.rb +0 -69
- data/spec/unit/gdal/geo_transform_spec.rb +0 -265
- data/spec/unit/gdal/grid_spec.rb +0 -98
- data/spec/unit/gdal/gridder/point_extracting_spec.rb +0 -101
- data/spec/unit/gdal/gridder_options_spec.rb +0 -185
- data/spec/unit/gdal/gridder_spec.rb +0 -182
- data/spec/unit/gdal/internal_helpers_spec.rb +0 -278
- data/spec/unit/gdal/major_object_spec.rb +0 -10
- data/spec/unit/gdal/options_spec.rb +0 -33
- data/spec/unit/gdal/raster_attribute_table_spec.rb +0 -7
- data/spec/unit/gdal/raster_band_classifier_spec.rb +0 -260
- data/spec/unit/gdal/raster_band_mixins/extensions_spec.rb +0 -73
- data/spec/unit/gdal/raster_band_mixins/io_extensions_spec.rb +0 -135
- data/spec/unit/gdal/raster_band_spec.rb +0 -8
- data/spec/unit/gdal/rpc_info_spec.rb +0 -8
- data/spec/unit/gdal/version_info_spec.rb +0 -10
- data/spec/unit/gdal/virtual_dataset_spec.rb +0 -34
- data/spec/unit/gdal/warp_operation_spec.rb +0 -8
- data/spec/unit/gdal/warp_options_spec.rb +0 -338
- data/spec/unit/ogr/coordinate_transformation_spec.rb +0 -104
- data/spec/unit/ogr/data_source_mixins/capability_methods_spec.rb +0 -32
- data/spec/unit/ogr/data_source_spec.rb +0 -223
- data/spec/unit/ogr/driver_mixins/capability_methods_spec.rb +0 -20
- data/spec/unit/ogr/driver_spec.rb +0 -152
- data/spec/unit/ogr/envelope_spec.rb +0 -324
- data/spec/unit/ogr/feature_definition_spec.rb +0 -296
- data/spec/unit/ogr/feature_extensions_spec.rb +0 -90
- data/spec/unit/ogr/feature_spec.rb +0 -363
- data/spec/unit/ogr/field_definition_spec.rb +0 -118
- data/spec/unit/ogr/field_spec.rb +0 -195
- data/spec/unit/ogr/geometries/geometry_collection_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/geometry_collection_spec.rb +0 -188
- data/spec/unit/ogr/geometries/line_string_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/line_string_spec.rb +0 -107
- data/spec/unit/ogr/geometries/linear_ring_spec.rb +0 -92
- data/spec/unit/ogr/geometries/multi_line_string_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/multi_line_string_spec.rb +0 -16
- data/spec/unit/ogr/geometries/multi_point_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/multi_point_spec.rb +0 -16
- data/spec/unit/ogr/geometries/multi_polygon_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/multi_polygon_spec.rb +0 -43
- data/spec/unit/ogr/geometries/none_geometry_spec.rb +0 -14
- data/spec/unit/ogr/geometries/point_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/point_spec.rb +0 -307
- data/spec/unit/ogr/geometries/polygon_25d_spec.rb +0 -25
- data/spec/unit/ogr/geometries/polygon_spec.rb +0 -19
- data/spec/unit/ogr/geometries/unknown_geometry_spec.rb +0 -12
- data/spec/unit/ogr/geometry_field_definition_spec.rb +0 -73
- data/spec/unit/ogr/geometry_spec.rb +0 -711
- data/spec/unit/ogr/internal_helpers_spec.rb +0 -70
- data/spec/unit/ogr/layer_mixins/capability_methods_spec.rb +0 -90
- data/spec/unit/ogr/layer_mixins/ogr_feature_methods_spec.rb +0 -155
- data/spec/unit/ogr/layer_mixins/ogr_field_methods_spec.rb +0 -434
- data/spec/unit/ogr/layer_mixins/ogr_layer_method_methods_spec.rb +0 -22
- data/spec/unit/ogr/layer_mixins/ogr_query_filter_methods_spec.rb +0 -44
- data/spec/unit/ogr/layer_mixins/ogr_sql_methods_spec.rb +0 -14
- data/spec/unit/ogr/layer_spec.rb +0 -98
- data/spec/unit/ogr/spatial_reference_mixins/coordinate_system_getter_setters_spec.rb +0 -48
- data/spec/unit/ogr/spatial_reference_mixins/exporters_spec.rb +0 -151
- data/spec/unit/ogr/spatial_reference_mixins/importers_spec.rb +0 -40
- data/spec/unit/ogr/spatial_reference_mixins/morphers_spec.rb +0 -38
- data/spec/unit/ogr/spatial_reference_mixins/parameter_getter_setters_spec.rb +0 -105
- data/spec/unit/ogr/spatial_reference_mixins/type_checks_spec.rb +0 -159
- data/spec/unit/ogr/spatial_reference_spec.rb +0 -44
- data/spec/unit/ogr/style_table_spec.rb +0 -108
- data/spec/unit/ogr/style_tool_spec.rb +0 -159
- data/spec/unit/version_info_spec.rb +0 -50
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'narray'
|
4
|
-
|
4
|
+
require 'gdal'
|
5
|
+
require 'gdal/options'
|
6
|
+
require 'ogr'
|
5
7
|
require_relative 'gridder_options'
|
6
8
|
require_relative 'gridder/point_extracting'
|
7
|
-
require_relative 'options'
|
8
|
-
require_relative '../ogr'
|
9
9
|
|
10
10
|
module GDAL
|
11
11
|
# Somewhat analogous to the gdal_grid utility.
|
@@ -46,9 +46,9 @@ module GDAL
|
|
46
46
|
# points, and writes out the newly gridder raster.
|
47
47
|
def grid!
|
48
48
|
dataset = build_dataset(@options.output_driver,
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
@dest_file_name,
|
50
|
+
@options.output_data_type,
|
51
|
+
@options.output_creation_options)
|
52
52
|
|
53
53
|
grid_and_write(dataset.raster_band(1), dataset.geo_transform)
|
54
54
|
|
@@ -74,10 +74,10 @@ module GDAL
|
|
74
74
|
# @return [GDAL::Dataset]
|
75
75
|
def build_dataset(driver, dest_file_name, data_type, creation_options = {})
|
76
76
|
dataset = driver.create_dataset(dest_file_name,
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
77
|
+
output_width,
|
78
|
+
output_height,
|
79
|
+
data_type: data_type,
|
80
|
+
**creation_options)
|
81
81
|
|
82
82
|
dataset.projection = build_output_spatial_reference
|
83
83
|
dataset.geo_transform = build_output_geo_transform
|
@@ -146,12 +146,12 @@ module GDAL
|
|
146
146
|
@y_max ||= @options.output_y_extent.fetch(:max) { @source_layer.extent.y_max }
|
147
147
|
end
|
148
148
|
|
149
|
-
# @return [
|
149
|
+
# @return [Integer]
|
150
150
|
def output_width
|
151
151
|
@options.output_size[:width]
|
152
152
|
end
|
153
153
|
|
154
|
-
# @return [
|
154
|
+
# @return [Integer]
|
155
155
|
def output_height
|
156
156
|
@options.output_size[:height]
|
157
157
|
end
|
@@ -159,7 +159,7 @@ module GDAL
|
|
159
159
|
# Figures out the proper block sizes to use for iterating over layer pixels,
|
160
160
|
# gridding them, and writing them to the raster file.
|
161
161
|
#
|
162
|
-
# @param raster_band_block_size [
|
162
|
+
# @param raster_band_block_size [Integer]
|
163
163
|
def each_block(raster_band_block_size)
|
164
164
|
data_type_size = @options.output_data_type_size
|
165
165
|
block_size = build_block_sizes(raster_band_block_size, data_type_size)
|
@@ -202,7 +202,7 @@ module GDAL
|
|
202
202
|
extents = { x_min: grid_x_min, x_max: grid_x_max, y_min: grid_y_min, y_max: grid_y_max }
|
203
203
|
|
204
204
|
@options.grid.create(points, extents, data_ptr, output_size,
|
205
|
-
|
205
|
+
progress_arg, scaled_progress_ptr)
|
206
206
|
|
207
207
|
raster_band.raster_io('w', data_ptr, x_offset: x_offset, y_offset: y_offset,
|
208
208
|
x_size: x_request, y_size: y_request,
|
@@ -210,9 +210,9 @@ module GDAL
|
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
213
|
-
# @param raster_band_block_size [Hash{x:
|
214
|
-
# @param data_type_size [
|
215
|
-
# @return [Hash{x:
|
213
|
+
# @param raster_band_block_size [Hash{x: Integer, y: Integer}]
|
214
|
+
# @param data_type_size [Integer]
|
215
|
+
# @return [Hash{x: Integer, y: Integer}]
|
216
216
|
def build_block_sizes(raster_band_block_size, data_type_size)
|
217
217
|
block_x_size = raster_band_block_size[:x]
|
218
218
|
block_y_size = raster_band_block_size[:y]
|
@@ -241,8 +241,8 @@ module GDAL
|
|
241
241
|
# blocks.
|
242
242
|
#
|
243
243
|
# @see http://gdal.sourcearchive.com/documentation/1.7.2/gdal_8h_904fbbb050e16c9d0ac028dc5113ef27.html
|
244
|
-
# @param block_number [
|
245
|
-
# @param block_count [
|
244
|
+
# @param block_number [Integer]
|
245
|
+
# @param block_count [Integer]
|
246
246
|
# @return [FFI::Pointer]
|
247
247
|
def build_scaled_progress_pointer(block_number, block_count)
|
248
248
|
return unless @options.progress_formatter
|
@@ -257,9 +257,9 @@ module GDAL
|
|
257
257
|
|
258
258
|
# Determines how large of a chunk of data to grid and rasterize.
|
259
259
|
#
|
260
|
-
# @param block_size [
|
261
|
-
# @param raster_border [
|
262
|
-
# @return [
|
260
|
+
# @param block_size [Integer]
|
261
|
+
# @param raster_border [Integer]
|
262
|
+
# @return [Integer]
|
263
263
|
def build_data_request_size(block_size, offset, raster_border)
|
264
264
|
request = block_size
|
265
265
|
|
@@ -273,28 +273,28 @@ module GDAL
|
|
273
273
|
# @param min [Float]
|
274
274
|
# @param pixel_size [Float]
|
275
275
|
# @param offset [Float]
|
276
|
-
# @param request_size [
|
277
|
-
# @return [Array<
|
276
|
+
# @param request_size [Integer]
|
277
|
+
# @return [Array<Integer, Integer>] The min and max values based on the given
|
278
278
|
# parameters.
|
279
279
|
def build_grid_extents(min, pixel_size, offset, request_size)
|
280
|
-
grid_min = min + pixel_size * offset
|
281
|
-
grid_max = min + pixel_size * (offset + request_size)
|
280
|
+
grid_min = min + (pixel_size * offset)
|
281
|
+
grid_max = min + (pixel_size * (offset + request_size))
|
282
282
|
|
283
283
|
[grid_min, grid_max]
|
284
284
|
end
|
285
285
|
|
286
|
-
# @param block_x_size [
|
287
|
-
# @param block_y_size [
|
288
|
-
# @param raster_width [
|
289
|
-
# @param raster_height [
|
290
|
-
# @return [
|
286
|
+
# @param block_x_size [Integer]
|
287
|
+
# @param block_y_size [Integer]
|
288
|
+
# @param raster_width [Integer]
|
289
|
+
# @param raster_height [Integer]
|
290
|
+
# @return [Integer] The total number of blocks that should be iterated
|
291
291
|
# through during the grid+rasterize process.
|
292
292
|
def build_block_count(block_x_size, block_y_size, raster_width, raster_height)
|
293
293
|
build_block_size(raster_width, block_x_size) * build_block_size(raster_height, block_y_size)
|
294
294
|
end
|
295
295
|
|
296
|
-
# @param total_pixels [
|
297
|
-
# @param block_size [
|
296
|
+
# @param total_pixels [Integer] Number of pixels in the width or height.
|
297
|
+
# @param block_size [Integer] Size of the reported block.
|
298
298
|
def build_block_size(total_pixels, block_size)
|
299
299
|
(total_pixels + block_size - 1) / block_size
|
300
300
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
require 'gdal/grid'
|
4
|
+
require 'gdal/options'
|
5
|
+
require 'ogr/exceptions'
|
6
|
+
require 'ogr/geometry'
|
7
|
+
require 'ogr/spatial_reference'
|
6
8
|
|
7
9
|
module GDAL
|
8
10
|
# Object to be used with a {GDAL::Gridder}.
|
@@ -140,7 +142,7 @@ module GDAL
|
|
140
142
|
def input_clipping_geometry=(geometry)
|
141
143
|
unless geometry.is_a?(OGR::Geometry)
|
142
144
|
raise OGR::InvalidGeometry,
|
143
|
-
|
145
|
+
"Clipping geometry must be a OGR::Geometry type, but was a #{geometry.class}"
|
144
146
|
end
|
145
147
|
|
146
148
|
@input_clipping_geometry = geometry
|
@@ -151,14 +153,13 @@ module GDAL
|
|
151
153
|
data_types = FFI::GDAL::GDAL::DataType.symbols
|
152
154
|
|
153
155
|
unless data_types.include?(type)
|
154
|
-
raise GDAL::InvalidDataType,
|
155
|
-
"output_data_type must be one of #{data_types} but was #{type}"
|
156
|
+
raise GDAL::InvalidDataType, "output_data_type must be one of #{data_types} but was #{type}"
|
156
157
|
end
|
157
158
|
|
158
159
|
@grid.data_type = @output_data_type = type
|
159
160
|
end
|
160
161
|
|
161
|
-
# @return [
|
162
|
+
# @return [Integer]
|
162
163
|
def output_data_type_size
|
163
164
|
GDAL::DataType.size(@output_data_type) / 8
|
164
165
|
end
|
@@ -168,8 +169,7 @@ module GDAL
|
|
168
169
|
driver_names = GDAL::Driver.short_names
|
169
170
|
|
170
171
|
unless driver_names.include?(format)
|
171
|
-
raise GDAL::InvalidDriverName,
|
172
|
-
"output_form must be one of #{driver_names} but was #{format}"
|
172
|
+
raise GDAL::InvalidDriverName, "output_form must be one of #{driver_names} but was #{format}"
|
173
173
|
end
|
174
174
|
|
175
175
|
@output_format = format
|
@@ -183,14 +183,14 @@ module GDAL
|
|
183
183
|
@output_driver ||= GDAL::Driver.by_name(@output_format)
|
184
184
|
end
|
185
185
|
|
186
|
-
# @param min_max [Array<
|
186
|
+
# @param min_max [Array<Integer>, Hash{min => Number, max => Number}]
|
187
187
|
def output_x_extent=(min_max)
|
188
188
|
min, max = extract_min_max(min_max, :min, :max)
|
189
189
|
|
190
190
|
@output_x_extent = { min: min, max: max }
|
191
191
|
end
|
192
192
|
|
193
|
-
# @param min_max [Array<
|
193
|
+
# @param min_max [Array<Integer>, Hash{min => Number, max => Number}]
|
194
194
|
def output_y_extent=(min_max)
|
195
195
|
min, max = extract_min_max(min_max, :min, :max)
|
196
196
|
|
@@ -213,7 +213,7 @@ module GDAL
|
|
213
213
|
def output_projection=(spatial_reference)
|
214
214
|
unless spatial_reference.is_a?(OGR::SpatialReference)
|
215
215
|
raise OGR::InvalidSpatialReference,
|
216
|
-
|
216
|
+
"output_projection must be an OGR::SpatialReference but was a #{spatial_reference.class}"
|
217
217
|
end
|
218
218
|
|
219
219
|
@output_projection = spatial_reference
|
@@ -250,8 +250,7 @@ module GDAL
|
|
250
250
|
# @return [Array<Number>]
|
251
251
|
def extract_min_max_from_array(content, min_name, max_name)
|
252
252
|
unless content.length == 2
|
253
|
-
raise ArgumentError,
|
254
|
-
"Please supply only 2 elements, one for #{min_name}, one for #{max_name}"
|
253
|
+
raise ArgumentError, "Please supply only 2 elements, one for #{min_name}, one for #{max_name}"
|
255
254
|
end
|
256
255
|
|
257
256
|
[content[0], content[1]]
|
data/lib/gdal/{raster_attribute_table_mixins → extensions/raster_attribute_table}/extensions.rb
RENAMED
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'gdal/raster_attribute_table'
|
4
4
|
|
5
5
|
module GDAL
|
6
|
-
|
6
|
+
class RasterAttributeTable
|
7
7
|
module Extensions
|
8
|
-
# @param row [
|
9
|
-
# @param field [
|
10
|
-
# @param value [String, Float,
|
8
|
+
# @param row [Integer]
|
9
|
+
# @param field [Integer]
|
10
|
+
# @param value [String, Float, Integer]
|
11
11
|
def set_value(row, field, value)
|
12
12
|
case value.class
|
13
13
|
when String then set_value_as_string(row, field, value)
|
@@ -19,7 +19,7 @@ module GDAL
|
|
19
19
|
|
20
20
|
# Get +column_name+, +column_usage+, +column_type+ as a Hash.
|
21
21
|
#
|
22
|
-
# @param index [
|
22
|
+
# @param index [Integer]
|
23
23
|
# @return [Hash]
|
24
24
|
def column(index)
|
25
25
|
{
|
@@ -44,3 +44,5 @@ module GDAL
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
GDAL::RasterAttributeTable.include(GDAL::RasterAttributeTable::Extensions)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require 'gdal/raster_band'
|
4
4
|
|
5
5
|
module GDAL
|
6
|
-
|
6
|
+
class RasterBand
|
7
7
|
# RasterBand methods for doing warp-like things, but not using GDAL's Warp
|
8
8
|
# API.
|
9
9
|
module AlgorithmExtensions
|
@@ -51,14 +51,14 @@ module GDAL
|
|
51
51
|
# raster_band = dataset.raster_band(1)
|
52
52
|
#
|
53
53
|
# raster_band.simple_erase! do |x, y, value|
|
54
|
-
# if x < (raster_band.x_size / 2) && y < (raster_band.y_size / 2) && value
|
54
|
+
# if x < (raster_band.x_size / 2) && y < (raster_band.y_size / 2) && value.negative?
|
55
55
|
# false
|
56
56
|
# else
|
57
57
|
# true
|
58
58
|
# end
|
59
59
|
# end
|
60
60
|
#
|
61
|
-
# @return [
|
61
|
+
# @return [Integer] The number of pixels that were erased.
|
62
62
|
def simple_erase!
|
63
63
|
erase_value = no_data_value[:value]
|
64
64
|
write_buffer = GDAL._buffer_from_data_type(data_type, x_size)
|
@@ -66,7 +66,7 @@ module GDAL
|
|
66
66
|
|
67
67
|
unless erase_value
|
68
68
|
raise GDAL::NoRasterEraseValue,
|
69
|
-
|
69
|
+
'Cannot erase values, RasterBand does not have a NODATA value set'
|
70
70
|
end
|
71
71
|
|
72
72
|
y_size.times do |line_num|
|
@@ -98,7 +98,7 @@ module GDAL
|
|
98
98
|
|
99
99
|
# @param write_buffer [FFI::Buffer]
|
100
100
|
# @param pixel_values [Array<Number>]
|
101
|
-
# @param line_number [
|
101
|
+
# @param line_number [Integer]
|
102
102
|
def rewrite_pixel_row(write_buffer, pixel_values, line_number)
|
103
103
|
GDAL._write_pointer(write_buffer, data_type, pixel_values)
|
104
104
|
raster_io('w', write_buffer, x_size: x_size, y_size: 1, y_offset: line_number)
|
@@ -107,3 +107,5 @@ module GDAL
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
110
|
+
|
111
|
+
GDAL::RasterBand.include(GDAL::RasterBand::AlgorithmExtensions)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module GDAL
|
4
|
-
|
4
|
+
class RasterBand
|
5
5
|
# RasterBand methods added for dealing with colorizing.
|
6
6
|
module ColoringExtensions
|
7
7
|
# Sets the band to be a Palette band, then applies an RGB color table using
|
@@ -9,7 +9,7 @@ module GDAL
|
|
9
9
|
# on the number of colors given. Note that this will overwrite any existing
|
10
10
|
# color table that may be set on this band.
|
11
11
|
#
|
12
|
-
# @param colors [Array<
|
12
|
+
# @param colors [Array<Integer, String>, Integer, String] Can be a single or
|
13
13
|
# many colors, given as either R, G, and B integers (0-255) or as strings
|
14
14
|
# of Hex.
|
15
15
|
#
|
@@ -45,7 +45,7 @@ module GDAL
|
|
45
45
|
# TODO: Fix possible uninitialized rgb_array
|
46
46
|
rgb_array = hex_to_rgb(color) unless color.is_a?(Array)
|
47
47
|
table.add_color_entry(color_entry_index,
|
48
|
-
|
48
|
+
rgb_array[0], rgb_array[1], rgb_array[2], 255)
|
49
49
|
end
|
50
50
|
|
51
51
|
self.color_table = table
|
@@ -54,7 +54,7 @@ module GDAL
|
|
54
54
|
# Gets the colors from the associated ColorTable and returns an Array of
|
55
55
|
# those, where each ColorEntry is [R, G, B, A].
|
56
56
|
#
|
57
|
-
# @return [Array<Array<
|
57
|
+
# @return [Array<Array<Integer>>]
|
58
58
|
def colors_as_rgb
|
59
59
|
return [] unless color_table
|
60
60
|
|
@@ -84,3 +84,5 @@ module GDAL
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
87
|
+
|
88
|
+
GDAL::RasterBand.include(GDAL::RasterBand::ColoringExtensions)
|
@@ -1,9 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'gdal/raster_band'
|
4
|
+
require 'numo/narray'
|
5
|
+
require_relative 'io_extensions'
|
4
6
|
|
5
7
|
module GDAL
|
6
|
-
|
8
|
+
class RasterBand
|
7
9
|
module Extensions
|
8
10
|
# @return [Enumerator]
|
9
11
|
def each_overview
|
@@ -16,7 +18,7 @@ module GDAL
|
|
16
18
|
|
17
19
|
# @return [Array]
|
18
20
|
def overviews
|
19
|
-
|
21
|
+
each_overview.to_a
|
20
22
|
end
|
21
23
|
|
22
24
|
# @return [Array]
|
@@ -44,7 +46,7 @@ module GDAL
|
|
44
46
|
# Each pixel of the raster projected using the dataset's geo_transform.
|
45
47
|
# The output NArray is a 3D array where the inner-most array is a the
|
46
48
|
# lat an lon, those are contained in an array per pixel line, and finally
|
47
|
-
# the
|
49
|
+
# the outer array contains each of the pixel lines.
|
48
50
|
#
|
49
51
|
# @return [NArray]
|
50
52
|
def projected_points
|
@@ -64,10 +66,12 @@ module GDAL
|
|
64
66
|
|
65
67
|
# The total number of pixels in the raster band.
|
66
68
|
#
|
67
|
-
# @return [
|
69
|
+
# @return [Integer]
|
68
70
|
def pixel_count
|
69
71
|
x_size * y_size
|
70
72
|
end
|
71
73
|
end
|
72
74
|
end
|
73
75
|
end
|
76
|
+
|
77
|
+
GDAL::RasterBand.include(GDAL::RasterBand::Extensions)
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'gdal/raster_band'
|
4
|
+
|
3
5
|
module GDAL
|
4
|
-
|
6
|
+
class RasterBand
|
5
7
|
# Methods for reading & writing RasterBands that didn't come from GDAL.
|
6
8
|
module IOExtensions
|
7
9
|
# Reads the raster line-by-line and returns as an NArray. Will yield each
|
@@ -48,8 +50,8 @@ module GDAL
|
|
48
50
|
|
49
51
|
# Convenience method for directly setting a single pixel value.
|
50
52
|
#
|
51
|
-
# @param x [
|
52
|
-
# @param y [
|
53
|
+
# @param x [Integer] Pixel number in the row to set.
|
54
|
+
# @param y [Integer] Row number of the pixel to set.
|
53
55
|
# @param new_value [Number] The value to set the pixel to.
|
54
56
|
def set_pixel_value(x, y, new_value)
|
55
57
|
data_pointer = GDAL._pointer_from_data_type(data_type)
|
@@ -60,8 +62,8 @@ module GDAL
|
|
60
62
|
|
61
63
|
# Convenience method for directly getting a single pixel value.
|
62
64
|
#
|
63
|
-
# @param x [
|
64
|
-
# @param y [
|
65
|
+
# @param x [Integer] Pixel number in the row to get.
|
66
|
+
# @param y [Integer] Row number of the pixel to get.
|
65
67
|
# @return [Number]
|
66
68
|
def pixel_value(x, y)
|
67
69
|
output = raster_io('r', x_size: 1, y_size: 1, x_offset: x, y_offset: y, buffer_x_size: 1, buffer_y_size: 1)
|
@@ -74,8 +76,8 @@ module GDAL
|
|
74
76
|
# x and y counts for when the total number of pixels and lines does not
|
75
77
|
# divide evenly using GDAL's block count.
|
76
78
|
#
|
77
|
-
# @return [Hash{x =>
|
78
|
-
# y_remainder =>
|
79
|
+
# @return [Hash{x => Integer, x_remainder => Integer, y => Integer,
|
80
|
+
# y_remainder => Integer}]
|
79
81
|
# @see http://www.gdal.org/classGDALRasterBand.html#a09e1d83971ddff0b43deffd54ef25eef
|
80
82
|
def block_count
|
81
83
|
x_size_plus_block_size = x_size + block_size[:x]
|
@@ -91,7 +93,7 @@ module GDAL
|
|
91
93
|
|
92
94
|
# The buffer size to use for block-based IO, based on #block_size.
|
93
95
|
#
|
94
|
-
# @return [
|
96
|
+
# @return [Integer]
|
95
97
|
def block_buffer_size
|
96
98
|
block_size[:x] * block_size[:y]
|
97
99
|
end
|
@@ -120,10 +122,10 @@ module GDAL
|
|
120
122
|
#
|
121
123
|
# @yieldparam pixels [Array<Number>] An Array the same size as
|
122
124
|
# {#block_buffer_size} containing all pixel values in the current block.
|
123
|
-
# @yieldparam x_block_size [
|
125
|
+
# @yieldparam x_block_size [Integer] Instead of using only #{RasterBand#block_size},
|
124
126
|
# it will tell you the size of each block--handy for when the last block
|
125
127
|
# is smaller than the rest.
|
126
|
-
# @yieldparam y_block_size [
|
128
|
+
# @yieldparam y_block_size [Integer] Same as +x_block_siz+ but for y.
|
127
129
|
# @return [Enumerator, nil]
|
128
130
|
def read_blocks_by_block
|
129
131
|
return enum_for(:read_blocks_by_block) unless block_given?
|
@@ -150,9 +152,9 @@ module GDAL
|
|
150
152
|
# GDAL reports that the block size to read is 60, we still need to know
|
151
153
|
# to read those last 5 lines when using block-related methods.
|
152
154
|
#
|
153
|
-
# @param block_number [
|
155
|
+
# @param block_number [Integer] The number of the y block when iterating
|
154
156
|
# through y blocks.
|
155
|
-
# @return [
|
157
|
+
# @return [Integer] The number of lines to read as part of the block.
|
156
158
|
def calculate_y_block_size(block_number)
|
157
159
|
# If it's the last block...
|
158
160
|
if block_number == (block_count[:y] - 1)
|
@@ -167,9 +169,9 @@ module GDAL
|
|
167
169
|
# and GDAL reports that the block size to read is 60, we still need to
|
168
170
|
# know to read those last 5 pixels when using block-related methods.
|
169
171
|
#
|
170
|
-
# @param block_number [
|
172
|
+
# @param block_number [Integer] The number of the x block when iterating
|
171
173
|
# through x blocks.
|
172
|
-
# @return [
|
174
|
+
# @return [Integer] The number of pixels to read as part of the block.
|
173
175
|
def calculate_x_block_size(block_number)
|
174
176
|
# If it's the last block...
|
175
177
|
if block_number == (block_count[:x] - 1)
|
@@ -181,3 +183,5 @@ module GDAL
|
|
181
183
|
end
|
182
184
|
end
|
183
185
|
end
|
186
|
+
|
187
|
+
GDAL::RasterBand.include(GDAL::RasterBand::IOExtensions)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require 'gdal'
|
4
|
+
require 'numo/narray'
|
4
5
|
|
5
6
|
module GDAL
|
6
7
|
# Takes a list of Ranges of color values and remaps them. Note that these
|
@@ -50,7 +51,7 @@ module GDAL
|
|
50
51
|
# calculate evenly-weighted ranges. If there are remainder values at the
|
51
52
|
# max end of the values, those get lumped in with the last range.
|
52
53
|
#
|
53
|
-
# @param range_count [
|
54
|
+
# @param range_count [Integer] The number of ranges to create.
|
54
55
|
# @return [Array<Hash>, nil]
|
55
56
|
def equal_count_ranges(range_count)
|
56
57
|
pixels = @raster_band.to_nna
|
@@ -103,9 +104,6 @@ module GDAL
|
|
103
104
|
new_band_pixels[data_pixels & band_pixels.le(r[:range].max) & band_pixels.ge(r[:range].min)] = r[:map_to]
|
104
105
|
end
|
105
106
|
|
106
|
-
in_range = @ranges.map { |r| band_pixels.le(r[:range].max) & band_pixels.ge(r[:range].min) }.reduce(:|)
|
107
|
-
new_band_pixels[data_pixels & ~in_range] = 0 if in_range
|
108
|
-
|
109
107
|
mask_nan(new_band_pixels, data_pixels) if nodata_is_nan?
|
110
108
|
@raster_band.write_xy_narray(new_band_pixels)
|
111
109
|
end
|
data/lib/gdal/geo_transform.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../gdal'
|
4
|
-
require_relative 'geo_transform_mixins/extensions'
|
5
4
|
|
6
5
|
module GDAL
|
7
6
|
class GeoTransform
|
8
|
-
|
9
|
-
|
10
|
-
# @return [FFI::Pointer] A pointer that can be used to hold a GeoTransform.
|
7
|
+
# @return [FFI::MemoryPointer] A pointer that can be used to hold a GeoTransform.
|
11
8
|
def self.new_pointer
|
12
9
|
FFI::MemoryPointer.new(:double, 6)
|
13
10
|
end
|
@@ -41,8 +38,6 @@ module GDAL
|
|
41
38
|
self.pixel_height ||= 1.0
|
42
39
|
self.x_rotation ||= 0.0
|
43
40
|
self.y_rotation ||= 0.0
|
44
|
-
|
45
|
-
to_a
|
46
41
|
end
|
47
42
|
|
48
43
|
def null?
|
data/lib/gdal/grid.rb
CHANGED
@@ -25,10 +25,10 @@ module GDAL
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# @param points [Array,NArray] An Array containing all x, y, and z points.
|
28
|
-
# @param extents [Hash{x_min:
|
28
|
+
# @param extents [Hash{x_min: Integer, y_min: Integer, x_max: Integer, y_max: Integer}]
|
29
29
|
# @param data_pointer [FFI::Pointer] Pointer that will contain the gridded
|
30
30
|
# data (after this method is done).
|
31
|
-
# @param output_size [Hash{x:
|
31
|
+
# @param output_size [Hash{x: Integer, y: Integer}] Overall dimensions of the
|
32
32
|
# area of the output raster to grid.
|
33
33
|
# @param progress_block [Proc]
|
34
34
|
# @param progress_arg [FFI::Pointer]
|
@@ -74,6 +74,7 @@ module GDAL
|
|
74
74
|
# @param points [Array]
|
75
75
|
def make_points_pointer(points)
|
76
76
|
raise GDAL::Error, 'No points to make pointer for' if points.compact.empty?
|
77
|
+
|
77
78
|
input_coordinates_ptr = FFI::MemoryPointer.new(:double, points.length)
|
78
79
|
input_coordinates_ptr.write_array_of_double(points)
|
79
80
|
|
data/lib/gdal/grid_algorithms.rb
CHANGED
@@ -3,22 +3,22 @@
|
|
3
3
|
module GDAL
|
4
4
|
module GridAlgorithms
|
5
5
|
autoload :InverseDistanceToAPower,
|
6
|
-
|
6
|
+
File.expand_path('grid_algorithms/inverse_distance_to_a_power', __dir__)
|
7
7
|
autoload :MetricAverageDistance,
|
8
|
-
|
8
|
+
File.expand_path('grid_algorithms/metric_average_distance', __dir__)
|
9
9
|
autoload :MetricAverageDistancePts,
|
10
|
-
|
10
|
+
File.expand_path('grid_algorithms/metric_average_distance_pts', __dir__)
|
11
11
|
autoload :MetricCount,
|
12
|
-
|
12
|
+
File.expand_path('grid_algorithms/metric_count', __dir__)
|
13
13
|
autoload :MetricMaximum,
|
14
|
-
|
14
|
+
File.expand_path('grid_algorithms/metric_maximum', __dir__)
|
15
15
|
autoload :MetricMinimum,
|
16
|
-
|
16
|
+
File.expand_path('grid_algorithms/metric_minimum', __dir__)
|
17
17
|
autoload :MetricRange,
|
18
|
-
|
18
|
+
File.expand_path('grid_algorithms/metric_range', __dir__)
|
19
19
|
autoload :MovingAverage,
|
20
|
-
|
20
|
+
File.expand_path('grid_algorithms/moving_average', __dir__)
|
21
21
|
autoload :NearestNeighbor,
|
22
|
-
|
22
|
+
File.expand_path('grid_algorithms/nearest_neighbor', __dir__)
|
23
23
|
end
|
24
24
|
end
|