ffi-gdal 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +9 -0
- data/.devcontainer/devcontainer.json +98 -0
- data/.github/CODEOWNERS +1 -0
- data/.github/workflows/codacy.yml +3 -3
- data/.github/workflows/codeql.yml +4 -4
- data/.github/workflows/continuous-integration.yml +30 -19
- data/.github/workflows/dependency-review.yml +2 -2
- data/.github/workflows/specs-in-docker.yml +12 -6
- data/.gitignore +4 -1
- data/Changelog.md +40 -5
- data/Gemfile +4 -2
- data/README.md +35 -0
- data/lib/ext/numeric_as_data_type.rb +1 -1
- data/lib/ffi/cpl/vsi.rb +10 -0
- data/lib/ffi/gdal/gdal.rb +9 -2
- data/lib/ffi/gdal/grid_data_metrics_options.rb +27 -5
- data/lib/ffi/gdal/grid_inverse_distance_to_a_power_options.rb +30 -10
- data/lib/ffi/gdal/grid_moving_average_options.rb +30 -5
- data/lib/ffi/gdal/grid_nearest_neighbor_options.rb +24 -4
- data/lib/ffi/gdal/internal_helpers/gdal_version.rb +15 -0
- data/lib/ffi/gdal/internal_helpers/layout_version.rb +9 -0
- data/lib/ffi/gdal/internal_helpers/layout_version_resolver.rb +24 -0
- data/lib/ffi/gdal/internal_helpers.rb +11 -0
- data/lib/ffi/gdal/utils.rb +984 -0
- data/lib/ffi/gdal/version.rb +1 -1
- data/lib/ffi/gdal.rb +3 -1
- data/lib/ffi/ogr/core.rb +1 -1
- data/lib/ffi/ogr/srs_api.rb +17 -0
- data/lib/gdal/cpl_error_handler.rb +30 -15
- data/lib/gdal/exceptions.rb +35 -16
- data/lib/gdal/extensions/color_table/extensions.rb +1 -1
- data/lib/gdal/extensions/gridder.rb +4 -0
- data/lib/gdal/geo_transform.rb +13 -0
- data/lib/gdal/grid_algorithms/algorithm_base.rb +35 -0
- data/lib/gdal/grid_algorithms/inverse_distance_to_a_power.rb +3 -7
- data/lib/gdal/grid_algorithms/metric_average_distance.rb +5 -4
- data/lib/gdal/grid_algorithms/metric_average_distance_pts.rb +5 -4
- data/lib/gdal/grid_algorithms/metric_count.rb +5 -4
- data/lib/gdal/grid_algorithms/metric_maximum.rb +5 -4
- data/lib/gdal/grid_algorithms/metric_minimum.rb +5 -4
- data/lib/gdal/grid_algorithms/metric_range.rb +5 -4
- data/lib/gdal/grid_algorithms/moving_average.rb +3 -7
- data/lib/gdal/grid_algorithms/nearest_neighbor.rb +3 -7
- data/lib/gdal/grid_algorithms.rb +2 -0
- data/lib/gdal/internal_helpers.rb +8 -5
- data/lib/gdal/major_object.rb +6 -0
- data/lib/gdal/raster_band.rb +16 -12
- data/lib/gdal/utils/dem/options.rb +52 -0
- data/lib/gdal/utils/dem.rb +108 -0
- data/lib/gdal/utils/grid/options.rb +52 -0
- data/lib/gdal/utils/grid.rb +72 -0
- data/lib/gdal/utils/helpers/dataset_list.rb +43 -0
- data/lib/gdal/utils/helpers/string_list.rb +47 -0
- data/lib/gdal/utils/helpers.rb +11 -0
- data/lib/gdal/utils/info/options.rb +52 -0
- data/lib/gdal/utils/info.rb +40 -0
- data/lib/gdal/utils/nearblack/options.rb +52 -0
- data/lib/gdal/utils/nearblack.rb +119 -0
- data/lib/gdal/utils/rasterize/options.rb +52 -0
- data/lib/gdal/utils/rasterize.rb +108 -0
- data/lib/gdal/utils/translate/options.rb +52 -0
- data/lib/gdal/utils/translate.rb +72 -0
- data/lib/gdal/utils/vector_translate/options.rb +52 -0
- data/lib/gdal/utils/vector_translate.rb +132 -0
- data/lib/gdal/utils/warp/options.rb +52 -0
- data/lib/gdal/utils/warp.rb +118 -0
- data/lib/gdal/utils.rb +22 -0
- data/lib/gdal/warp_options.rb +11 -2
- data/lib/gdal.rb +1 -0
- data/lib/ogr/extensions/layer/extensions.rb +1 -1
- data/lib/ogr/extensions/spatial_reference/extensions.rb +4 -4
- data/lib/ogr/geometry.rb +1 -6
- data/lib/ogr/layer.rb +1 -1
- data/lib/ogr/spatial_reference.rb +27 -2
- metadata +32 -5
- data/.ruby-version +0 -1
- data/lib/gdal/grid_algorithms/data_metrics_base.rb +0 -14
@@ -4,11 +4,31 @@ require "ffi"
|
|
4
4
|
|
5
5
|
module FFI
|
6
6
|
module GDAL
|
7
|
+
# FFI structure for GDALGridNearestNeighborOptions.
|
8
|
+
# @see https://gdal.org/api/gdal_alg.html#_CPPv430GDALGridNearestNeighborOptions
|
7
9
|
class GridNearestNeighborOptions < FFI::Struct
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
DEFAULT_LAYOUT = %i[
|
11
|
+
radius1 double
|
12
|
+
radius2 double
|
13
|
+
angle double
|
14
|
+
no_data_value double
|
15
|
+
].freeze
|
16
|
+
|
17
|
+
LAYOUT_VERSIONS = [
|
18
|
+
InternalHelpers::LayoutVersion.new(
|
19
|
+
version: "0000000", # Any old GDAL
|
20
|
+
layout: DEFAULT_LAYOUT
|
21
|
+
),
|
22
|
+
InternalHelpers::LayoutVersion.new(
|
23
|
+
version: "3060000", # GDAL 3.6.0
|
24
|
+
layout: [
|
25
|
+
:n_size_of_structure, :size_t,
|
26
|
+
*DEFAULT_LAYOUT
|
27
|
+
]
|
28
|
+
)
|
29
|
+
].freeze
|
30
|
+
|
31
|
+
layout(*InternalHelpers::LayoutVersionResolver.resolve(versions: LAYOUT_VERSIONS))
|
12
32
|
end
|
13
33
|
end
|
14
34
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FFI
|
4
|
+
module GDAL
|
5
|
+
module InternalHelpers
|
6
|
+
# Version information for GDAL.
|
7
|
+
class GDALVersion
|
8
|
+
# @return [String] GDAL Version.
|
9
|
+
def self.version
|
10
|
+
::FFI::GDAL.GDALVersionInfo("VERSION_NUM")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FFI
|
4
|
+
module GDAL
|
5
|
+
module InternalHelpers
|
6
|
+
# Resolve the layout version based on the GDAL version.
|
7
|
+
class LayoutVersionResolver
|
8
|
+
# Resolve the layout version based on the GDAL version.
|
9
|
+
# @param versions [Array<InternalHelpers::LayoutVersion>] The versions to resolve.
|
10
|
+
# @return [Array<Symbol, Integer>] The resolved layout.
|
11
|
+
def self.resolve(versions: [])
|
12
|
+
gdal_version = GDALVersion.version
|
13
|
+
|
14
|
+
versions
|
15
|
+
.sort_by(&:version)
|
16
|
+
.reverse_each
|
17
|
+
.find { |layout_version| gdal_version >= layout_version.version }
|
18
|
+
.layout
|
19
|
+
.freeze
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FFI
|
4
|
+
module GDAL
|
5
|
+
module InternalHelpers
|
6
|
+
autoload :GDALVersion, File.expand_path("internal_helpers/gdal_version", __dir__)
|
7
|
+
autoload :LayoutVersion, File.expand_path("internal_helpers/layout_version", __dir__)
|
8
|
+
autoload :LayoutVersionResolver, File.expand_path("internal_helpers/layout_version_resolver", __dir__)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|