ffi-gdal 1.0.0.beta5 → 1.0.0.beta6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -3
- data/.rubocop.yml +7 -0
- data/.ruby-version +1 -0
- data/Gemfile +1 -1
- data/History.md +143 -1
- data/README.md +5 -11
- data/Rakefile +2 -60
- data/TODO.md +10 -0
- data/examples/geometries.rb +4 -6
- data/examples/gridding.rb +99 -98
- data/examples/ogr_layer_to_layer.rb +0 -2
- data/examples/raster_erasing.rb +47 -0
- data/examples/remove_small_polygons.rb +62 -0
- data/examples/testing_gdal.rb +0 -3
- data/examples/warping.rb +140 -0
- data/ffi-gdal.gemspec +5 -2
- data/lib/ext/error_symbols.rb +1 -1
- data/lib/ext/ffi_library_function_checks.rb +3 -2
- data/lib/ext/float_ext.rb +2 -2
- data/lib/ext/narray_ext.rb +1 -1
- data/lib/ext/numeric_as_data_type.rb +1 -1
- data/lib/ext/to_bool.rb +2 -2
- data/lib/ffi/cpl/conv.rb +1 -3
- data/lib/ffi/cpl/error.rb +0 -3
- data/lib/ffi/cpl/minixml.rb +17 -21
- data/lib/ffi/cpl/progress.rb +27 -0
- data/lib/ffi/cpl/string.rb +0 -8
- data/lib/ffi/cpl/vsi.rb +0 -1
- data/lib/ffi/cpl/xml_node.rb +0 -1
- data/lib/ffi/cpl.rb +15 -0
- data/lib/ffi/gdal/alg.rb +72 -54
- data/lib/ffi/gdal/gdal.rb +669 -672
- data/lib/ffi/gdal/grid.rb +141 -24
- data/lib/ffi/gdal/grid_data_metrics_options.rb +1 -1
- data/lib/ffi/gdal/grid_moving_average_options.rb +1 -1
- data/lib/ffi/gdal/matching.rb +0 -2
- data/lib/ffi/gdal/transformer_info.rb +1 -1
- data/lib/ffi/gdal/version.rb +1 -1
- data/lib/ffi/gdal/vrt.rb +0 -2
- data/lib/ffi/gdal/warp_options.rb +12 -14
- data/lib/ffi/gdal/warper.rb +61 -6
- data/lib/ffi/gdal.rb +18 -3
- data/lib/ffi/ogr/api.rb +10 -21
- data/lib/ffi/ogr/core.rb +9 -12
- data/lib/ffi/ogr/featurestyle.rb +0 -5
- data/lib/ffi/ogr/geocoding.rb +0 -1
- data/lib/ffi/ogr/srs_api.rb +0 -4
- data/lib/ffi/ogr/style_value.rb +1 -2
- data/lib/ffi/ogr.rb +15 -12
- data/lib/ffi-gdal.rb +5 -3
- data/lib/gdal/color_entry.rb +1 -0
- data/lib/gdal/color_interpretation.rb +2 -2
- data/lib/gdal/color_table.rb +14 -14
- data/lib/gdal/color_table_mixins/extensions.rb +4 -4
- data/lib/gdal/cpl_error_handler.rb +12 -14
- data/lib/gdal/data_type.rb +13 -12
- data/lib/gdal/dataset.rb +170 -94
- data/lib/gdal/dataset_mixins/algorithm_methods.rb +47 -21
- data/lib/gdal/dataset_mixins/extensions.rb +32 -61
- data/lib/gdal/dataset_mixins/matching.rb +0 -2
- data/lib/gdal/dataset_mixins/warp_methods.rb +42 -0
- data/lib/gdal/driver.rb +62 -47
- data/lib/gdal/driver_mixins/extensions.rb +2 -7
- data/lib/gdal/environment_methods.rb +13 -10
- data/lib/gdal/exceptions.rb +24 -2
- data/lib/gdal/geo_transform.rb +10 -16
- data/lib/gdal/geo_transform_mixins/extensions.rb +58 -3
- data/lib/gdal/grid.rb +62 -109
- data/lib/gdal/{grid_types → grid_algorithms}/data_metrics_base.rb +1 -3
- data/lib/gdal/{grid_types → grid_algorithms}/inverse_distance_to_a_power.rb +2 -4
- data/lib/gdal/{grid_types → grid_algorithms}/metric_average_distance.rb +2 -2
- data/lib/gdal/{grid_types → grid_algorithms}/metric_average_distance_pts.rb +2 -2
- data/lib/gdal/{grid_types → grid_algorithms}/metric_count.rb +2 -2
- data/lib/gdal/{grid_types → grid_algorithms}/metric_maximum.rb +2 -2
- data/lib/gdal/{grid_types → grid_algorithms}/metric_minimum.rb +2 -2
- data/lib/gdal/{grid_types → grid_algorithms}/metric_range.rb +2 -2
- data/lib/gdal/{grid_types → grid_algorithms}/moving_average.rb +2 -4
- data/lib/gdal/{grid_types → grid_algorithms}/nearest_neighbor.rb +2 -4
- data/lib/gdal/grid_algorithms.rb +22 -0
- data/lib/gdal/gridder/point_extracting.rb +89 -0
- data/lib/gdal/gridder.rb +294 -0
- data/lib/gdal/gridder_options.rb +273 -0
- data/lib/gdal/internal_helpers.rb +132 -23
- data/lib/gdal/major_object.rb +13 -10
- data/lib/gdal/merger.rb +130 -0
- data/lib/gdal/options.rb +3 -2
- data/lib/gdal/raster_attribute_table.rb +74 -51
- data/lib/gdal/raster_attribute_table_mixins/extensions.rb +21 -3
- data/lib/gdal/raster_band.rb +139 -167
- data/lib/gdal/raster_band_classifier.rb +19 -18
- data/lib/gdal/raster_band_mixins/algorithm_extensions.rb +107 -0
- data/lib/gdal/raster_band_mixins/algorithm_methods.rb +79 -40
- data/lib/gdal/raster_band_mixins/coloring_extensions.rb +84 -0
- data/lib/gdal/raster_band_mixins/extensions.rb +34 -169
- data/lib/gdal/raster_band_mixins/io_extensions.rb +180 -0
- data/lib/gdal/rpc_info.rb +1 -2
- data/lib/gdal/transformer.rb +1 -6
- data/lib/gdal/transformers/approximate_transformer.rb +0 -4
- data/lib/gdal/transformers/base_general_image_projection_transformer.rb +0 -6
- data/lib/gdal/transformers/gcp_transformer.rb +2 -6
- data/lib/gdal/transformers/general_image_projection_transformer.rb +8 -7
- data/lib/gdal/transformers/general_image_projection_transformer2.rb +1 -1
- data/lib/gdal/transformers/geolocation_transformer.rb +0 -4
- data/lib/gdal/transformers/reprojection_transformer.rb +0 -8
- data/lib/gdal/transformers/rpc_transformer.rb +0 -4
- data/lib/gdal/transformers/tps_transformer.rb +1 -3
- data/lib/gdal/version_info.rb +7 -8
- data/lib/gdal/virtual_dataset.rb +2 -4
- data/lib/gdal/warp_operation.rb +17 -14
- data/lib/gdal/warp_options.rb +132 -0
- data/lib/gdal.rb +41 -2
- data/lib/ogr/coordinate_transformation.rb +79 -32
- data/lib/ogr/data_source.rb +17 -14
- data/lib/ogr/data_source_extensions.rb +1 -5
- data/lib/ogr/driver.rb +11 -14
- data/lib/ogr/envelope.rb +1 -1
- data/lib/ogr/envelope_extensions.rb +23 -6
- data/lib/ogr/error_handling.rb +3 -3
- data/lib/ogr/exceptions.rb +6 -0
- data/lib/ogr/feature.rb +25 -38
- data/lib/ogr/feature_definition.rb +6 -8
- data/lib/ogr/feature_definition_extensions.rb +2 -6
- data/lib/ogr/feature_extensions.rb +71 -41
- data/lib/ogr/field.rb +16 -15
- data/lib/ogr/field_definition.rb +4 -4
- data/lib/ogr/geocoder.rb +5 -5
- data/lib/ogr/geometries/geometry_collection.rb +4 -1
- data/lib/ogr/geometries/geometry_collection_25d.rb +12 -0
- data/lib/ogr/geometries/line_string.rb +30 -8
- data/lib/ogr/geometries/line_string_25d.rb +21 -0
- data/lib/ogr/geometries/linear_ring.rb +10 -1
- data/lib/ogr/geometries/multi_line_string.rb +2 -1
- data/lib/ogr/geometries/multi_line_string_25d.rb +13 -0
- data/lib/ogr/geometries/multi_point.rb +2 -1
- data/lib/ogr/geometries/multi_point_25d.rb +14 -0
- data/lib/ogr/geometries/multi_polygon.rb +3 -2
- data/lib/ogr/geometries/multi_polygon_25d.rb +13 -0
- data/lib/ogr/geometries/point.rb +20 -23
- data/lib/ogr/geometries/point_25d.rb +48 -0
- data/lib/ogr/geometries/polygon.rb +4 -1
- data/lib/ogr/geometries/polygon_25d.rb +14 -0
- data/lib/ogr/geometry.rb +125 -93
- data/lib/ogr/geometry_field_definition.rb +7 -5
- data/lib/ogr/geometry_mixins/container_mixins.rb +23 -0
- data/lib/ogr/geometry_mixins/extensions.rb +111 -0
- data/lib/ogr/geometry_types/container.rb +10 -3
- data/lib/ogr/geometry_types/curve.rb +68 -23
- data/lib/ogr/geometry_types/surface.rb +0 -9
- data/lib/ogr/internal_helpers.rb +3 -3
- data/lib/ogr/layer.rb +4 -5
- data/lib/ogr/layer_mixins/extensions.rb +242 -17
- data/lib/ogr/layer_mixins/ogr_feature_methods.rb +11 -11
- data/lib/ogr/layer_mixins/ogr_field_methods.rb +6 -11
- data/lib/ogr/layer_mixins/ogr_layer_method_methods.rb +18 -18
- data/lib/ogr/layer_mixins/ogr_query_filter_methods.rb +0 -2
- data/lib/ogr/layer_mixins/ogr_sql_methods.rb +1 -1
- data/lib/ogr/spatial_reference.rb +12 -37
- data/lib/ogr/spatial_reference_mixins/coordinate_system_getter_setters.rb +53 -55
- data/lib/ogr/spatial_reference_mixins/exporters.rb +18 -49
- data/lib/ogr/spatial_reference_mixins/parameter_getter_setters.rb +10 -29
- data/lib/ogr/style_table.rb +2 -2
- data/lib/ogr/style_table_extensions.rb +3 -1
- data/lib/ogr/style_tool.rb +8 -14
- data/lib/ogr.rb +39 -1
- data/spec/ffi-gdal_spec.rb +18 -1
- data/spec/integration/gdal/color_table_info_spec.rb +49 -33
- data/spec/integration/gdal/dataset_info_spec.rb +294 -45
- data/spec/integration/gdal/driver_info_spec.rb +139 -31
- data/spec/integration/gdal/geo_transform_info_spec.rb +197 -26
- data/spec/integration/gdal/gridder_spec.rb +329 -0
- data/spec/integration/gdal/raster_attribute_table_info_spec.rb +216 -11
- data/spec/integration/gdal/raster_band_algorithms_spec.rb +33 -0
- data/spec/integration/gdal/raster_band_info_spec.rb +240 -271
- data/spec/integration/ogr/layer_spec.rb +3 -1
- data/spec/spec_helper.rb +15 -6
- data/spec/support/images/osgeo/gdal/data/hfa/float-rle.img +0 -0
- data/spec/support/images/osgeo/geotiff/GeogToWGS84GeoKey/GeogToWGS84GeoKey5.lgo +31 -0
- 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 +10 -0
- data/spec/support/images/osgeo/geotiff/gdal_eg/cea.tif +0 -0
- data/spec/support/images/osgeo/geotiff/gdal_eg/cea.txt +84 -0
- data/spec/support/images/osgeo/geotiff/zi_imaging/image0.lgo +45 -0
- data/spec/support/images/osgeo/geotiff/zi_imaging/image0.tif +0 -0
- data/spec/support/integration_help.rb +32 -2
- data/spec/support/shared_examples/gdal/major_object_examples.rb +0 -6
- data/spec/support/shared_examples/ogr/a_geometry.rb +1 -1
- data/spec/unit/ffi/gdal_spec.rb +1 -1
- data/spec/unit/gdal/color_entry_spec.rb +1 -0
- data/spec/unit/gdal/color_interpretation_spec.rb +1 -0
- data/spec/unit/gdal/dataset_spec.rb +53 -2
- data/spec/unit/gdal/geo_transform_mixins/extensions_spec.rb +67 -0
- data/spec/unit/gdal/geo_transform_spec.rb +1 -1
- data/spec/unit/gdal/grid_spec.rb +83 -0
- data/spec/unit/gdal/gridder/point_extracting_spec.rb +99 -0
- data/spec/unit/gdal/gridder_options_spec.rb +183 -0
- data/spec/unit/gdal/gridder_spec.rb +140 -0
- data/spec/unit/gdal/internal_helpers_spec.rb +166 -2
- data/spec/unit/gdal/major_object_spec.rb +2 -0
- data/spec/unit/gdal/options_spec.rb +1 -0
- data/spec/unit/gdal/raster_band_classifier_spec.rb +70 -12
- data/spec/unit/gdal/raster_band_mixins/extensions_spec.rb +71 -0
- data/spec/unit/gdal/raster_band_mixins/io_extensions_spec.rb +133 -0
- data/spec/unit/gdal/raster_band_spec.rb +1 -0
- data/spec/unit/gdal/rpc_info_spec.rb +1 -0
- data/spec/unit/gdal/version_info_spec.rb +2 -0
- data/spec/unit/gdal/warp_operation_spec.rb +1 -0
- data/spec/unit/ogr/coordinate_transformation_spec.rb +102 -0
- data/spec/unit/ogr/data_source_spec.rb +12 -0
- data/spec/unit/ogr/feature_extensions_spec.rb +88 -0
- data/spec/unit/ogr/feature_spec.rb +30 -46
- data/spec/unit/ogr/geometries/geometry_collection_25d_spec.rb +23 -0
- data/spec/unit/ogr/geometries/geometry_collection_spec.rb +3 -3
- data/spec/unit/ogr/geometries/line_string_25d_spec.rb +23 -0
- data/spec/unit/ogr/geometries/line_string_spec.rb +2 -2
- data/spec/unit/ogr/geometries/linear_ring_spec.rb +2 -2
- data/spec/unit/ogr/geometries/multi_line_string_25d_spec.rb +23 -0
- data/spec/unit/ogr/geometries/multi_point_25d_spec.rb +23 -0
- data/spec/unit/ogr/geometries/multi_polygon_25d_spec.rb +23 -0
- data/spec/unit/ogr/geometries/point_25d_spec.rb +23 -0
- data/spec/unit/ogr/geometries/point_spec.rb +14 -24
- data/spec/unit/ogr/geometries/polygon_25d_spec.rb +23 -0
- data/spec/unit/ogr/geometries/polygon_spec.rb +1 -1
- data/spec/unit/ogr/geometry_field_definition_spec.rb +1 -1
- data/spec/unit/ogr/geometry_spec.rb +196 -30
- data/spec/unit/ogr/internal_helpers_spec.rb +20 -9
- data/spec/unit/ogr/layer_mixins/ogr_feature_methods_spec.rb +14 -6
- data/spec/unit/ogr/spatial_reference_mixins/exporters_spec.rb +9 -1
- data/spec/unit/ogr/spatial_reference_mixins/parameter_getter_setters_spec.rb +2 -1
- data/spec/unit/ogr/style_table_spec.rb +1 -1
- data/tmp/.keep +0 -0
- metadata +121 -19
- data/examples/points.txt +0 -127
- data/lib/gdal/grid_types.rb +0 -22
- data/lib/ogr/geometries/point_extensions.rb +0 -32
- data/lib/ogr/geometry_extensions.rb +0 -59
@@ -3,201 +3,66 @@ require 'json'
|
|
3
3
|
module GDAL
|
4
4
|
module RasterBandMixins
|
5
5
|
module Extensions
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
# @return [Hash{x => Fixnum, y => Fixnum}]
|
13
|
-
def block_count
|
14
|
-
x_blocks = (x_size + block_size[:x]).divmod(block_size[:x])
|
15
|
-
y_blocks = (y_size + block_size[:y]).divmod(block_size[:y])
|
6
|
+
# @return [Enumerator]
|
7
|
+
def each_overview
|
8
|
+
return enum_for(:each_overview) unless block_given?
|
16
9
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
y: y_blocks.first - 1,
|
21
|
-
y_remainder: y_blocks.last
|
22
|
-
}
|
10
|
+
overview_count.times do |i|
|
11
|
+
yield overview(i)
|
12
|
+
end
|
23
13
|
end
|
24
14
|
|
25
|
-
#
|
26
|
-
|
27
|
-
|
28
|
-
def block_buffer_size
|
29
|
-
block_size[:x] * block_size[:y]
|
15
|
+
# @return [Array]
|
16
|
+
def overviews
|
17
|
+
eaach_overview.to_a
|
30
18
|
end
|
31
19
|
|
32
|
-
#
|
33
|
-
|
34
|
-
|
35
|
-
# @param to_data_type [FFI::GDAL::DataType]
|
36
|
-
# @return [Enumerator, nil] Returns an Enumerable if no block is given,
|
37
|
-
# allowing to chain with other Enumerable methods. Returns nil if a
|
38
|
-
# block is given.
|
39
|
-
def each_by_block(to_data_type = nil)
|
40
|
-
return enum_for(:each_by_block) unless block_given?
|
41
|
-
|
42
|
-
data_type = to_data_type || self.data_type
|
43
|
-
data_pointer = GDAL._pointer_from_data_type(data_type, block_buffer_size)
|
44
|
-
|
45
|
-
0.upto(block_count[:y]).each do |y_block_number|
|
46
|
-
0.upto(block_count[:x] - 1).each do |x_block_number|
|
47
|
-
y_block_size = if y_block_number == block_count[:y] && !block_count[:y_remainder].zero?
|
48
|
-
block_count[:y_remainder]
|
49
|
-
elsif y_block_number == block_count[:y]
|
50
|
-
0
|
51
|
-
else
|
52
|
-
block_size[:y]
|
53
|
-
end
|
54
|
-
|
55
|
-
next if y_block_size.zero?
|
56
|
-
|
57
|
-
read_block(x_block_number, y_block_number, data_pointer)
|
58
|
-
|
59
|
-
0.upto(y_block_size - 1).each do |block_index|
|
60
|
-
x_read_offset = block_size[:x] * block_index
|
61
|
-
|
62
|
-
pixels = if data_type == :GDT_Byte
|
63
|
-
data_pointer.get_array_of_uint8(x_read_offset, block_size[:x])
|
64
|
-
elsif data_type == :GDT_UInt16
|
65
|
-
data_pointer.get_array_of_uint16(x_read_offset, block_size[:x])
|
66
|
-
else
|
67
|
-
data_pointer.get_array_of_float(x_read_offset, block_size[:x])
|
68
|
-
end
|
69
|
-
|
70
|
-
yield(pixels)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
20
|
+
# @return [Array]
|
21
|
+
def to_a
|
22
|
+
read_lines_by_block.to_a
|
74
23
|
end
|
75
24
|
|
76
25
|
# Iterates through all lines and builds an NArray of pixels.
|
77
26
|
#
|
78
27
|
# @return [NArray]
|
79
28
|
def to_na(to_data_type = nil)
|
80
|
-
|
81
|
-
pixels
|
82
|
-
end
|
29
|
+
narray = NArray.to_na(to_a)
|
83
30
|
|
84
|
-
|
85
|
-
case to_data_type
|
86
|
-
when :GDT_Byte then NArray.to_na(values).to_type(NArray::BYTE)
|
87
|
-
when :GDT_Int16 then NArray.to_na(values).to_type(NArray::SINT)
|
88
|
-
when :GDT_UInt16 then NArray.to_na(values).to_type(NArray::INT)
|
89
|
-
when :GDT_Int32 then NArray.to_na(values).to_type(NArray::INT)
|
90
|
-
when :GDT_UInt32 then NArray.to_na(values).to_type(NArray::INT)
|
91
|
-
when :GDT_Float32 then NArray.to_na(values).to_type(NArray::SFLOAT)
|
92
|
-
when :GDT_Float64 then NArray.to_na(values).to_type(NArray::DFLOAT)
|
93
|
-
when :GDT_CInt16 then NArray.to_na(values).to_type(NArray::SCOMPLEX)
|
94
|
-
when :GDT_CInt32 then NArray.to_na(values).to_type(NArray::DCOMPLEX)
|
95
|
-
when :GDT_CFloat32 then NArray.to_na(values).to_type(NArray::SCOMPLEX)
|
96
|
-
when :GDT_CFloat64 then NArray.to_na(values).to_type(NArray::DCOMPLEX)
|
97
|
-
else
|
98
|
-
fail "Unknown data type: #{to_data_type}"
|
99
|
-
end
|
100
|
-
else
|
101
|
-
NArray.to_na(values)
|
102
|
-
end
|
103
|
-
end
|
31
|
+
return narray unless to_data_type
|
104
32
|
|
105
|
-
|
106
|
-
# the given colors. Colors are distributed evenly across the table based
|
107
|
-
# on the number of colors given. Note that this will overwrite any existing
|
108
|
-
# color table that may be set on this band.
|
109
|
-
#
|
110
|
-
# @param colors [Array<Fixnum, String>, Fixnum, String] Can be a single or
|
111
|
-
# many colors, given as either R, G, and B integers (0-255) or as strings
|
112
|
-
# of Hex.
|
113
|
-
#
|
114
|
-
# @example Colors as RGB values
|
115
|
-
# # This will make the first 128 values black, and the last 128, red.
|
116
|
-
# my_band.colorize!([[0, 0, 0], [255, 0, 0]])
|
117
|
-
#
|
118
|
-
# @example Colors as Hex values
|
119
|
-
# # Same as above...
|
120
|
-
# my_band.colorize!(%w[#000000 #FF0000])
|
121
|
-
def colorize!(*colors)
|
122
|
-
return if colors.empty?
|
123
|
-
|
124
|
-
self.color_interpretation ||= :GCI_PaletteIndex
|
125
|
-
table = GDAL::ColorTable.new(:GPI_RGB)
|
126
|
-
table.add_color_entry(0, 0, 0, 0, 255)
|
127
|
-
|
128
|
-
# Start at 1 instead of 0 because we manually set the first color entry
|
129
|
-
# to white.
|
130
|
-
color_entry_index_range =
|
131
|
-
if data_type == :GDT_Byte then 1..255
|
132
|
-
elsif data_type == :GDT_UInt16 then 1..65_535
|
133
|
-
else fail "Can't colorize a #{data_type} band--must be :GDT_Byte or :GDT_UInt16"
|
134
|
-
end
|
33
|
+
narray_type = GDAL._gdal_data_type_to_narray_type_constant(to_data_type)
|
135
34
|
|
136
|
-
|
137
|
-
|
138
|
-
color_entry_index_range.step do |color_entry_index|
|
139
|
-
color_number = (color_entry_index / bin_count).floor.to_i
|
140
|
-
color = colors[color_number]
|
141
|
-
|
142
|
-
# TODO: Fix possible uninitialized rgb_array
|
143
|
-
rgb_array = hex_to_rgb(color) unless color.is_a?(Array)
|
144
|
-
table.add_color_entry(color_entry_index,
|
145
|
-
rgb_array[0], rgb_array[1], rgb_array[2], 255)
|
146
|
-
end
|
147
|
-
|
148
|
-
self.color_table = table
|
149
|
-
end
|
150
|
-
|
151
|
-
# Gets the colors from the associated ColorTable and returns an Array of
|
152
|
-
# those, where each ColorEntry is [R, G, B, A].
|
153
|
-
#
|
154
|
-
# @return [Array<Array<Fixnum>>]
|
155
|
-
def colors_as_rgb
|
156
|
-
return [] unless color_table
|
157
|
-
|
158
|
-
color_table.color_entries_as_rgb.map(&:to_a)
|
159
|
-
end
|
160
|
-
|
161
|
-
# Gets the colors from the associated ColorTable and returns an Array of
|
162
|
-
# Strings, where the RGB color for each ColorEntry has been converted to
|
163
|
-
# Hex.
|
164
|
-
#
|
165
|
-
# @return [Array<String>]
|
166
|
-
def colors_as_hex
|
167
|
-
colors_as_rgb.map do |rgba|
|
168
|
-
rgb = rgba.to_a[0..2]
|
169
|
-
|
170
|
-
"##{rgb[0].to_s(16)}#{rgb[1].to_s(16)}#{rgb[2].to_s(16)}"
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
# @param hex [String]
|
175
|
-
def hex_to_rgb(hex)
|
176
|
-
hex.sub!(/^#/, '')
|
177
|
-
matches = hex.match(/(?<red>[a-zA-Z0-9]{2})(?<green>[a-zA-Z0-9]{2})(?<blue>[a-zA-Z0-9]{2})/)
|
178
|
-
|
179
|
-
[matches[:red].to_i(16), matches[:green].to_i(16), matches[:blue].to_i(16)]
|
35
|
+
narray.to_type(narray_type)
|
180
36
|
end
|
181
37
|
|
182
38
|
# Each pixel of the raster projected using the dataset's geo_transform.
|
39
|
+
# The output NArray is a 3D array where the inner-most array is a the
|
40
|
+
# lat an lon, those are contained in an array per pixel line, and finally
|
41
|
+
# the outter array contains each of the pixel lines.
|
183
42
|
#
|
184
43
|
# @return [NArray]
|
185
44
|
def projected_points
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
narray[
|
194
|
-
narray[1, point_number] = hash[:x_geo] || 0
|
45
|
+
narray = GDAL._narray_from_data_type(data_type, 2, x_size, y_size)
|
46
|
+
geo_transform = dataset.geo_transform
|
47
|
+
|
48
|
+
y_size.times do |y_point|
|
49
|
+
x_size.times do |x_point|
|
50
|
+
coords = geo_transform.apply_geo_transform(x_point, y_point)
|
51
|
+
narray[0, x_point, y_point] = coords[:x_geo] || 0
|
52
|
+
narray[1, x_point, y_point] = coords[:y_geo] || 0
|
195
53
|
end
|
196
54
|
end
|
197
55
|
|
198
56
|
narray
|
199
57
|
end
|
200
58
|
|
59
|
+
# The total number of pixels in the raster band.
|
60
|
+
#
|
61
|
+
# @return [Fixnum]
|
62
|
+
def pixel_count
|
63
|
+
x_size * y_size
|
64
|
+
end
|
65
|
+
|
201
66
|
# @return [Hash]
|
202
67
|
def as_json(_options = nil)
|
203
68
|
{
|
@@ -0,0 +1,180 @@
|
|
1
|
+
module GDAL
|
2
|
+
module RasterBandMixins
|
3
|
+
# Methods for reading & writing RasterBands that didn't come from GDAL.
|
4
|
+
module IOExtensions
|
5
|
+
# Reads the raster line-by-line and returns as an NArray. Will yield each
|
6
|
+
# line and the line number if a block is given.
|
7
|
+
#
|
8
|
+
# @yieldparam pixel_line [Array]
|
9
|
+
def readlines
|
10
|
+
return enum_for(:readlines) unless block_given?
|
11
|
+
|
12
|
+
y_size.times do |row_number|
|
13
|
+
scan_line = raster_io('r', x_size: x_size, y_size: 1, y_offset: row_number)
|
14
|
+
line_array = GDAL._read_pointer(scan_line, data_type, x_size)
|
15
|
+
|
16
|
+
yield line_array
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Writes a 2-dimensional NArray of (x, y) pixels to the raster band using
|
21
|
+
# {GDAL::RasterBand#raster_io}. It determines +x_size+ and +y_size+ for
|
22
|
+
# the {GDAL::RasterBand#raster_io} call using the dimensions of the array.
|
23
|
+
#
|
24
|
+
# @param pixel_array [NArray] The 2d list of pixels.
|
25
|
+
def write_xy_narray(pixel_array)
|
26
|
+
data_pointer = FFI::MemoryPointer.new(:buffer_out, block_buffer_size)
|
27
|
+
|
28
|
+
block_count[:y].times do |y_block_number|
|
29
|
+
block_count[:x].times do |x_block_number|
|
30
|
+
y_block_size = calculate_y_block_size(y_block_number)
|
31
|
+
x_block_size = calculate_x_block_size(x_block_number)
|
32
|
+
|
33
|
+
pixel_count_per_block = x_block_size * y_block_size
|
34
|
+
read_offset = (y_block_number + 1) * (x_block_number + 1)
|
35
|
+
read_range = ((read_offset - 1) * pixel_count_per_block)...(read_offset * pixel_count_per_block)
|
36
|
+
pixels = pixel_array[read_range]
|
37
|
+
GDAL._write_pointer(data_pointer, data_type, pixels.to_a)
|
38
|
+
|
39
|
+
write_block(x_block_number, y_block_number, data_pointer)
|
40
|
+
|
41
|
+
data_pointer.clear
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Convenience method for directly setting a single pixel value.
|
47
|
+
#
|
48
|
+
# @param x [Fixnum] Pixel number in the row to set.
|
49
|
+
# @param y [Fixnum] Row number of the pixel to set.
|
50
|
+
# @param new_value [Number] The value to set the pixel to.
|
51
|
+
def set_pixel_value(x, y, new_value)
|
52
|
+
data_pointer = GDAL._pointer_from_data_type(data_type)
|
53
|
+
GDAL._write_pointer(data_pointer, data_type, new_value)
|
54
|
+
|
55
|
+
raster_io('w', data_pointer, x_size: 1, y_size: 1, x_offset: x, y_offset: y, buffer_x_size: 1, buffer_y_size: 1)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Convenience method for directly getting a single pixel value.
|
59
|
+
#
|
60
|
+
# @param x [Fixnum] Pixel number in the row to get.
|
61
|
+
# @param y [Fixnum] Row number of the pixel to get.
|
62
|
+
# @return [Number]
|
63
|
+
def pixel_value(x, y)
|
64
|
+
output = raster_io('r', x_size: 1, y_size: 1, x_offset: x, y_offset: y, buffer_x_size: 1, buffer_y_size: 1)
|
65
|
+
|
66
|
+
GDAL._read_pointer(output, data_type)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Determines not only x and y block counts (how many blocks there are in
|
70
|
+
# the raster band when using GDAL's suggested block size), but remainder
|
71
|
+
# x and y counts for when the total number of pixels and lines does not
|
72
|
+
# divide evently using GDAL's block count.
|
73
|
+
#
|
74
|
+
# @return [Hash{x => Fixnum, x_remainder => Fixnum, y => Fixnum,
|
75
|
+
# y_remainder => Fixnum}]
|
76
|
+
# @see http://www.gdal.org/classGDALRasterBand.html#a09e1d83971ddff0b43deffd54ef25eef
|
77
|
+
def block_count
|
78
|
+
x_size_plus_block_size = x_size + block_size[:x]
|
79
|
+
y_size_plus_block_size = y_size + block_size[:y]
|
80
|
+
|
81
|
+
{
|
82
|
+
x: ((x_size_plus_block_size - 1) / block_size[:x]).to_i,
|
83
|
+
x_remainder: x_size_plus_block_size.modulo(block_size[:x]),
|
84
|
+
y: ((y_size_plus_block_size - 1) / block_size[:y]).to_i,
|
85
|
+
y_remainder: y_size_plus_block_size.modulo(block_size[:y])
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
# The buffer size to use for block-based IO, based on #block_size.
|
90
|
+
#
|
91
|
+
# @return [Fixnum]
|
92
|
+
def block_buffer_size
|
93
|
+
block_size[:x] * block_size[:y]
|
94
|
+
end
|
95
|
+
|
96
|
+
# Reads through the raster, block-by-block then line-by-line and yields
|
97
|
+
# the pixel data that it gathered.
|
98
|
+
#
|
99
|
+
# @yieldparam row [Array<Number>] The Array of pixels for the current
|
100
|
+
# line.
|
101
|
+
# @return [Enumerator, nil] Returns an Enumerable if no block is given,
|
102
|
+
# allowing to chain with other Enumerable methods. Returns nil if a
|
103
|
+
# block is given.
|
104
|
+
def read_lines_by_block
|
105
|
+
return enum_for(:read_lines_by_block) unless block_given?
|
106
|
+
|
107
|
+
read_blocks_by_block do |pixels, x_block_size, y_block_size|
|
108
|
+
pixels.each_slice(x_block_size).with_index do |row, block_row_number|
|
109
|
+
yield row
|
110
|
+
break if block_row_number == y_block_size - 1
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Reads through the raster block-by-block and yields all pixel values for
|
116
|
+
# the block.
|
117
|
+
#
|
118
|
+
# @yieldparam pixels [Array<Number>] An Array the same size as
|
119
|
+
# {#block_buffer_size} containing all pixel values in the current block.
|
120
|
+
# @yieldparam x_block_size [Fixnum] Instead of using only #{RasterBand#block_size},
|
121
|
+
# it will tell you the size of each block--handy for when the last block
|
122
|
+
# is smaller than the rest.
|
123
|
+
# @yieldparam y_block_size [Fixnum] Same as +x_block_siz+ but for y.
|
124
|
+
# @return [Enumerator, nil]
|
125
|
+
def read_blocks_by_block
|
126
|
+
return enum_for(:read_blocks_by_block) unless block_given?
|
127
|
+
|
128
|
+
data_pointer = FFI::MemoryPointer.new(:buffer_in, block_buffer_size)
|
129
|
+
|
130
|
+
block_count[:y].times do |y_block_number|
|
131
|
+
block_count[:x].times do |x_block_number|
|
132
|
+
y_block_size = calculate_y_block_size(y_block_number)
|
133
|
+
x_block_size = calculate_x_block_size(x_block_number)
|
134
|
+
|
135
|
+
read_block(x_block_number, y_block_number, data_pointer)
|
136
|
+
pixels = GDAL._read_pointer(data_pointer, data_type, block_buffer_size)
|
137
|
+
|
138
|
+
yield(pixels, x_block_size, y_block_size)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
private
|
144
|
+
|
145
|
+
# Determines how many lines to read for the block, considering that not
|
146
|
+
# all blocks can be of equal size. For example, if there are 125 lines and
|
147
|
+
# GDAL reports that the block size to read is 60, we still need to know
|
148
|
+
# to read those last 5 lines when using block-related methods.
|
149
|
+
#
|
150
|
+
# @param block_number [Fixnum] The number of the y block when iterating
|
151
|
+
# through y blocks.
|
152
|
+
# @return [Fixnum] The number of lines to read as part of the block.
|
153
|
+
def calculate_y_block_size(block_number)
|
154
|
+
# If it's the last block...
|
155
|
+
if block_number == (block_count[:y] - 1)
|
156
|
+
block_count[:y_remainder].zero? ? block_size[:y] : block_count[:y_remainder]
|
157
|
+
else
|
158
|
+
block_size[:y]
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
# Determines how many pixels to read for the block, considering that not
|
163
|
+
# all blocks can be of equal size. For example, if there are 125 pixels
|
164
|
+
# and GDAL reports that the block size to read is 60, we still need to
|
165
|
+
# know to read those last 5 pixels when using block-related methods.
|
166
|
+
#
|
167
|
+
# @param block_number [Fixnum] The number of the x block when iterating
|
168
|
+
# through x blocks.
|
169
|
+
# @return [Fixnum] The number of pixels to read as part of the block.
|
170
|
+
def calculate_x_block_size(block_number)
|
171
|
+
# If it's the last block...
|
172
|
+
if block_number == (block_count[:x] - 1)
|
173
|
+
block_count[:x_remainder].zero? ? block_size[:x] : block_count[:x_remainder]
|
174
|
+
else
|
175
|
+
block_size[:x]
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
data/lib/gdal/rpc_info.rb
CHANGED
data/lib/gdal/transformer.rb
CHANGED
@@ -1,12 +1,7 @@
|
|
1
|
-
require_relative '../
|
1
|
+
require_relative '../gdal'
|
2
2
|
|
3
3
|
module GDAL
|
4
4
|
class Transformer
|
5
|
-
# @return [FFI::Pointer]
|
6
|
-
def self.create_similar_transformer(transformer_arg_ptr, source_ratio_x, source_ratio_y)
|
7
|
-
FFI::GDAL::Alg.GDALCreateSimilarTransformer(transformer_arg_ptr, source_ratio_x, source_ratio_y)
|
8
|
-
end
|
9
|
-
|
10
5
|
# @param transformer_arg [FFI::Pointer]
|
11
6
|
def self.destroy_transformer(transformer_arg)
|
12
7
|
FFI::GDAL::Alg.GDALDestroyTransformer(transformer_arg)
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require_relative '../../ffi/gdal/alg'
|
2
|
-
|
3
1
|
module GDAL
|
4
2
|
module Transformers
|
5
3
|
class ApproximateTransformer
|
@@ -21,8 +19,6 @@ module GDAL
|
|
21
19
|
base_transformer_function,
|
22
20
|
transformer_arg_ptr,
|
23
21
|
max_error)
|
24
|
-
|
25
|
-
ObjectSpace.define_finalizer self, -> { destroy! }
|
26
22
|
end
|
27
23
|
|
28
24
|
def destroy!
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require_relative '../../ffi/gdal/alg'
|
2
|
-
|
3
1
|
module GDAL
|
4
2
|
module Transformers
|
5
3
|
class BaseGeneralImageProjectionTransformer
|
@@ -10,10 +8,6 @@ module GDAL
|
|
10
8
|
|
11
9
|
attr_reader :c_pointer
|
12
10
|
|
13
|
-
def initialize
|
14
|
-
# ObjectSpace.define_finalizer self, -> { destroy! }
|
15
|
-
end
|
16
|
-
|
17
11
|
def destroy!
|
18
12
|
return unless @c_pointer
|
19
13
|
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require_relative '../../ffi/gdal/alg'
|
2
|
-
|
3
1
|
module GDAL
|
4
2
|
module Transformers
|
5
3
|
class GCPTransformer
|
@@ -14,10 +12,10 @@ module GDAL
|
|
14
12
|
# @param gcp_list [Array<FFI::GDAL::GCP>]
|
15
13
|
# @param requested_polynomial_order [Fixnum] 1, 2, or 3.
|
16
14
|
# @param reversed [Boolean]
|
17
|
-
def initialize(gcp_list, requested_polynomial_order, reversed = false,
|
18
|
-
tolerance: nil, minimum_gcps: nil)
|
15
|
+
def initialize(gcp_list, requested_polynomial_order, reversed = false, tolerance: nil, minimum_gcps: nil)
|
19
16
|
gcp_list_ptr = FFI::MemoryPointer.new(:pointer, gcp_list.size)
|
20
17
|
|
18
|
+
# TODO: fasterer: each_with_index is slower than loop
|
21
19
|
gcp_list.each_with_index do |gcp, i|
|
22
20
|
gcp_list_ptr[i].put_pointer(0, gcp.to_ptr)
|
23
21
|
end
|
@@ -35,8 +33,6 @@ module GDAL
|
|
35
33
|
requested_polynomial_order,
|
36
34
|
reversed)
|
37
35
|
end
|
38
|
-
|
39
|
-
ObjectSpace.define_finalizer self, -> { destroy! }
|
40
36
|
end
|
41
37
|
|
42
38
|
def destroy!
|
@@ -4,14 +4,15 @@ module GDAL
|
|
4
4
|
module Transformers
|
5
5
|
class GeneralImageProjectionTransformer < BaseGeneralImageProjectionTransformer
|
6
6
|
# @param source_dataset [GDAL::Dataset, FFI::Pointer]
|
7
|
-
# @param source_wkt [String]
|
8
7
|
# @param destination_dataset [GDAL::Dataset, FFI::Pointer]
|
8
|
+
# @param source_wkt [String]
|
9
9
|
# @param destination_wkt [String]
|
10
|
-
# @
|
11
|
-
|
12
|
-
|
10
|
+
# @param gcp_use_ok [Boolean]
|
11
|
+
# @param order [Fixnum]
|
12
|
+
def initialize(source_dataset, destination_dataset: nil, source_wkt: nil, destination_wkt: nil,
|
13
|
+
gcp_use_ok: false, order: 0)
|
13
14
|
source_ptr = GDAL._pointer(GDAL::Dataset, source_dataset)
|
14
|
-
dest_ptr = GDAL._pointer(GDAL::Dataset, destination_dataset)
|
15
|
+
dest_ptr = GDAL._pointer(GDAL::Dataset, destination_dataset, false)
|
15
16
|
|
16
17
|
@c_pointer = FFI::GDAL::Alg.GDALCreateGenImgProjTransformer(
|
17
18
|
source_ptr,
|
@@ -19,10 +20,10 @@ module GDAL
|
|
19
20
|
dest_ptr,
|
20
21
|
destination_wkt,
|
21
22
|
gcp_use_ok,
|
22
|
-
|
23
|
+
0.0,
|
23
24
|
order
|
24
25
|
)
|
25
|
-
|
26
|
+
raise if @c_pointer.null?
|
26
27
|
|
27
28
|
super()
|
28
29
|
end
|
@@ -35,7 +35,7 @@ module GDAL
|
|
35
35
|
# @option options [Boolean] insert_center_long (true) False disables setting
|
36
36
|
# up a CENTER_LONG value on the coordinate system to rewrap things around
|
37
37
|
# the center of the image.
|
38
|
-
def initialize(source_dataset, destination_dataset, **options)
|
38
|
+
def initialize(source_dataset, destination_dataset: nil, **options)
|
39
39
|
source_ptr = GDAL._pointer(GDAL::Dataset, source_dataset)
|
40
40
|
destination_ptr = GDAL._pointer(GDAL::Dataset, destination_dataset, false)
|
41
41
|
options_ptr = GDAL::Options.pointer(options)
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require_relative '../../ffi/gdal/alg'
|
2
|
-
|
3
1
|
module GDAL
|
4
2
|
module Transformers
|
5
3
|
class GeolocationTransformer
|
@@ -22,8 +20,6 @@ module GDAL
|
|
22
20
|
base_dataset_ptr,
|
23
21
|
geolocation_info_ptr,
|
24
22
|
reversed)
|
25
|
-
|
26
|
-
ObjectSpace.define_finalizer self, -> { destroy! }
|
27
23
|
end
|
28
24
|
|
29
25
|
def destroy!
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require_relative '../../ffi/gdal/alg'
|
2
|
-
|
3
1
|
module GDAL
|
4
2
|
module Transformers
|
5
3
|
class ReprojectionTransformer
|
@@ -15,12 +13,6 @@ module GDAL
|
|
15
13
|
# @param destination_wkt [String]
|
16
14
|
def initialize(source_wkt, destination_wkt)
|
17
15
|
@c_pointer = FFI::GDAL::Alg.GDALCreateReprojectionTransformer(source_wkt, destination_wkt)
|
18
|
-
|
19
|
-
ObjectSpace.define_finalizer(transformer_ptr) do
|
20
|
-
destroy_reprojection_transformer(transformer_ptr)
|
21
|
-
end
|
22
|
-
|
23
|
-
transformer_ptr
|
24
16
|
end
|
25
17
|
|
26
18
|
def destroy!
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require_relative '../../ffi/gdal/alg'
|
2
|
-
|
3
1
|
module GDAL
|
4
2
|
module Transformers
|
5
3
|
class RPCTransformer
|
@@ -36,8 +34,6 @@ module GDAL
|
|
36
34
|
reversed,
|
37
35
|
pixel_error_threshold,
|
38
36
|
options_ptr)
|
39
|
-
|
40
|
-
ObjectSpace.define_finalizer self, -> { destroy! }
|
41
37
|
end
|
42
38
|
|
43
39
|
def destroy!
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require_relative '../../ffi/gdal/alg'
|
2
|
-
|
3
1
|
module GDAL
|
4
2
|
module Transformers
|
5
3
|
class TPSTransformer
|
@@ -16,12 +14,12 @@ module GDAL
|
|
16
14
|
def initialize(gcp_list, reversed = false)
|
17
15
|
gcp_list_ptr = FFI::MemoryPointer.new(:pointer, gcp_list.size)
|
18
16
|
|
17
|
+
# TODO: fasterer: each_with_index is slower than loop
|
19
18
|
gcp_list.each_with_index do |gcp, i|
|
20
19
|
gcp_list_ptr[i].put_pointer(0, gcp.to_ptr)
|
21
20
|
end
|
22
21
|
|
23
22
|
@c_pointer = FFI::GDAL::Alg.GDALCreateTPSTransformer(gcp_list.size, gcp_list_ptr, reversed)
|
24
|
-
ObjectSpace.define_finalizer self, -> { destroy! }
|
25
23
|
end
|
26
24
|
|
27
25
|
def destroy!
|
data/lib/gdal/version_info.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require_relative '../ffi/gdal'
|
2
1
|
require 'date'
|
3
2
|
|
4
3
|
module GDAL
|
@@ -7,33 +6,33 @@ module GDAL
|
|
7
6
|
#
|
8
7
|
# @return [String]
|
9
8
|
def version_num
|
10
|
-
FFI::GDAL.GDALVersionInfo('VERSION_NUM')
|
9
|
+
FFI::GDAL.GDALVersionInfo('VERSION_NUM'.freeze)
|
11
10
|
end
|
12
11
|
|
13
12
|
# @return [Date]
|
14
13
|
def release_date
|
15
|
-
Date.parse(FFI::GDAL.GDALVersionInfo('RELEASE_DATE'))
|
14
|
+
Date.parse(FFI::GDAL.GDALVersionInfo('RELEASE_DATE'.freeze))
|
16
15
|
end
|
17
16
|
|
18
17
|
# Version in the form "1.1.7".
|
19
18
|
#
|
20
19
|
# @return [String]
|
21
20
|
def release_name
|
22
|
-
FFI::GDAL.GDALVersionInfo('RELEASE_NAME')
|
21
|
+
FFI::GDAL.GDALVersionInfo('RELEASE_NAME'.freeze)
|
23
22
|
end
|
24
23
|
|
25
24
|
# The long licensing info.
|
26
25
|
#
|
27
26
|
# @return [String]
|
28
27
|
def license
|
29
|
-
FFI::GDAL.GDALVersionInfo('LICENSE')
|
28
|
+
FFI::GDAL.GDALVersionInfo('LICENSE'.freeze)
|
30
29
|
end
|
31
30
|
|
32
31
|
# Options used when building GDAL.
|
33
32
|
#
|
34
33
|
# @return [Hash{String => String}]
|
35
34
|
def build_info
|
36
|
-
key_value_pairs = FFI::GDAL.GDALVersionInfo('BUILD_INFO')
|
35
|
+
key_value_pairs = FFI::GDAL.GDALVersionInfo('BUILD_INFO'.freeze)
|
37
36
|
key_value_pairs.split.each_with_object({}) do |kv, obj|
|
38
37
|
key, value = kv.split('=', 2)
|
39
38
|
obj[key] = value
|
@@ -42,7 +41,7 @@ module GDAL
|
|
42
41
|
|
43
42
|
# @return [String]
|
44
43
|
def long_version
|
45
|
-
FFI::GDAL.GDALVersionInfo('--version')
|
44
|
+
FFI::GDAL.GDALVersionInfo('--version'.freeze)
|
46
45
|
end
|
47
46
|
|
48
47
|
# @param major [Fixnum]
|
@@ -50,7 +49,7 @@ module GDAL
|
|
50
49
|
# @return [Boolean] +true+ if the runtime GDAL library matches the given
|
51
50
|
# version params.
|
52
51
|
def check_version(major, minor)
|
53
|
-
FFI::GDAL.GDALCheckVersion(major, minor, 'FFI::GDAL')
|
52
|
+
FFI::GDAL.GDALCheckVersion(major, minor, 'FFI::GDAL'.freeze)
|
54
53
|
end
|
55
54
|
end
|
56
55
|
end
|