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.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/Dockerfile +9 -0
  3. data/.devcontainer/devcontainer.json +98 -0
  4. data/.github/CODEOWNERS +1 -0
  5. data/.github/workflows/codacy.yml +3 -3
  6. data/.github/workflows/codeql.yml +4 -4
  7. data/.github/workflows/continuous-integration.yml +30 -19
  8. data/.github/workflows/dependency-review.yml +2 -2
  9. data/.github/workflows/specs-in-docker.yml +12 -6
  10. data/.gitignore +4 -1
  11. data/Changelog.md +40 -5
  12. data/Gemfile +4 -2
  13. data/README.md +35 -0
  14. data/lib/ext/numeric_as_data_type.rb +1 -1
  15. data/lib/ffi/cpl/vsi.rb +10 -0
  16. data/lib/ffi/gdal/gdal.rb +9 -2
  17. data/lib/ffi/gdal/grid_data_metrics_options.rb +27 -5
  18. data/lib/ffi/gdal/grid_inverse_distance_to_a_power_options.rb +30 -10
  19. data/lib/ffi/gdal/grid_moving_average_options.rb +30 -5
  20. data/lib/ffi/gdal/grid_nearest_neighbor_options.rb +24 -4
  21. data/lib/ffi/gdal/internal_helpers/gdal_version.rb +15 -0
  22. data/lib/ffi/gdal/internal_helpers/layout_version.rb +9 -0
  23. data/lib/ffi/gdal/internal_helpers/layout_version_resolver.rb +24 -0
  24. data/lib/ffi/gdal/internal_helpers.rb +11 -0
  25. data/lib/ffi/gdal/utils.rb +984 -0
  26. data/lib/ffi/gdal/version.rb +1 -1
  27. data/lib/ffi/gdal.rb +3 -1
  28. data/lib/ffi/ogr/core.rb +1 -1
  29. data/lib/ffi/ogr/srs_api.rb +17 -0
  30. data/lib/gdal/cpl_error_handler.rb +30 -15
  31. data/lib/gdal/exceptions.rb +35 -16
  32. data/lib/gdal/extensions/color_table/extensions.rb +1 -1
  33. data/lib/gdal/extensions/gridder.rb +4 -0
  34. data/lib/gdal/geo_transform.rb +13 -0
  35. data/lib/gdal/grid_algorithms/algorithm_base.rb +35 -0
  36. data/lib/gdal/grid_algorithms/inverse_distance_to_a_power.rb +3 -7
  37. data/lib/gdal/grid_algorithms/metric_average_distance.rb +5 -4
  38. data/lib/gdal/grid_algorithms/metric_average_distance_pts.rb +5 -4
  39. data/lib/gdal/grid_algorithms/metric_count.rb +5 -4
  40. data/lib/gdal/grid_algorithms/metric_maximum.rb +5 -4
  41. data/lib/gdal/grid_algorithms/metric_minimum.rb +5 -4
  42. data/lib/gdal/grid_algorithms/metric_range.rb +5 -4
  43. data/lib/gdal/grid_algorithms/moving_average.rb +3 -7
  44. data/lib/gdal/grid_algorithms/nearest_neighbor.rb +3 -7
  45. data/lib/gdal/grid_algorithms.rb +2 -0
  46. data/lib/gdal/internal_helpers.rb +8 -5
  47. data/lib/gdal/major_object.rb +6 -0
  48. data/lib/gdal/raster_band.rb +16 -12
  49. data/lib/gdal/utils/dem/options.rb +52 -0
  50. data/lib/gdal/utils/dem.rb +108 -0
  51. data/lib/gdal/utils/grid/options.rb +52 -0
  52. data/lib/gdal/utils/grid.rb +72 -0
  53. data/lib/gdal/utils/helpers/dataset_list.rb +43 -0
  54. data/lib/gdal/utils/helpers/string_list.rb +47 -0
  55. data/lib/gdal/utils/helpers.rb +11 -0
  56. data/lib/gdal/utils/info/options.rb +52 -0
  57. data/lib/gdal/utils/info.rb +40 -0
  58. data/lib/gdal/utils/nearblack/options.rb +52 -0
  59. data/lib/gdal/utils/nearblack.rb +119 -0
  60. data/lib/gdal/utils/rasterize/options.rb +52 -0
  61. data/lib/gdal/utils/rasterize.rb +108 -0
  62. data/lib/gdal/utils/translate/options.rb +52 -0
  63. data/lib/gdal/utils/translate.rb +72 -0
  64. data/lib/gdal/utils/vector_translate/options.rb +52 -0
  65. data/lib/gdal/utils/vector_translate.rb +132 -0
  66. data/lib/gdal/utils/warp/options.rb +52 -0
  67. data/lib/gdal/utils/warp.rb +118 -0
  68. data/lib/gdal/utils.rb +22 -0
  69. data/lib/gdal/warp_options.rb +11 -2
  70. data/lib/gdal.rb +1 -0
  71. data/lib/ogr/extensions/layer/extensions.rb +1 -1
  72. data/lib/ogr/extensions/spatial_reference/extensions.rb +4 -4
  73. data/lib/ogr/geometry.rb +1 -6
  74. data/lib/ogr/layer.rb +1 -1
  75. data/lib/ogr/spatial_reference.rb +27 -2
  76. metadata +32 -5
  77. data/.ruby-version +0 -1
  78. data/lib/gdal/grid_algorithms/data_metrics_base.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5687af49ac85e98515af311f02534829272c66d86c1d6b94446a8cb5e29870f7
4
- data.tar.gz: e92e6bb4adc98c2d2dbbaba15d33e2ba15cf186efc0204b9645918f251cbb9be
3
+ metadata.gz: 8fca9f1c2bf76cee230d16796e3b8bc40e6c70316fdede5d3c8d8b7579acdb02
4
+ data.tar.gz: ecc6546df2d668dc6acb63a0b4fd927448d8b1b517fd2ea125b71b328cf8f5f3
5
5
  SHA512:
6
- metadata.gz: d1d0340ac0e2e58bc9972a95980b337f3f47c8f148fbb9e9a40b5bdb7b64de91b77afda82760c737a0894a8f09f88612148efbf5e6430720c4535163472f39ed
7
- data.tar.gz: '02245493a040172999137d0876710500c5453ead4e208bd8157525890410e320f782ef7fa13d000c9c74bd3e41d67f5aef6bbd1a93d3484df932a690797f9906'
6
+ metadata.gz: 797597b14f486516715e7997eae6b465ce7c1246f01db0b4687b369e82febf6100d0787f0f4096eb216bb6752d22fd58ced4b353eb143622c39136385fad3813
7
+ data.tar.gz: fbc4a452c6c95ccba8aa3a272419638702af8174d6b93f86b87dbeca92c9016cfe0ec7d35019f1146d4cbd5677e560afe0a09f97a6c6b2060450eefc0f00b0fc
@@ -0,0 +1,9 @@
1
+ FROM mcr.microsoft.com/devcontainers/ruby:1-3.3-bookworm
2
+
3
+ RUN ( \
4
+ export DEBIAN_FRONTEND=noninteractive \
5
+ && apt-get update \
6
+ && apt-get -y install --no-install-recommends \
7
+ libgdal-dev \
8
+ librttopo-dev \
9
+ )
@@ -0,0 +1,98 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/ruby
3
+ {
4
+ "name": "ffi-gdal dev container",
5
+
6
+ // Use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
7
+ "build": {
8
+ "dockerfile": "Dockerfile"
9
+ },
10
+
11
+ // Features to add to the dev container. More info: https://containers.dev/features.
12
+ // "features": {},
13
+
14
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
15
+ // "forwardPorts": [],
16
+
17
+ // Use 'postCreateCommand' to run commands after the container is created.
18
+ // "postCreateCommand": "ruby --version",
19
+
20
+ // Configure tool-specific properties.
21
+ "customizations": {
22
+ "vscode": {
23
+ // Basic settings config.
24
+ // Fine-tune inside the project with `.vscode/settings.json` file.
25
+
26
+ // Use 'settings' to set *default* container specific settings.json values on container create.
27
+ // You can edit these settings after create using File > Preferences > Settings > Remote.
28
+ "settings": {
29
+ // You could redefine this settings with .vscode/settings.json file
30
+ // inside workspace folder.
31
+
32
+ // Controls the maximum amount of lines the terminal keeps in its buffer.
33
+ // Increase to 50000. Default 1000 is too low.
34
+ "terminal.integrated.scrollback": 50000,
35
+
36
+ // Basic formatting settings.
37
+ "files.insertFinalNewline": true,
38
+ "files.trimTrailingWhitespace": true,
39
+
40
+ // Colorize and highlight bracket pairs.
41
+ "editor.guides.bracketPairs": true,
42
+ "editor.bracketPairColorization.enabled": true,
43
+
44
+ // Ruby LSP settings
45
+ "rubyLsp.formatter": "rubocop",
46
+ "rubyLsp.enableExperimentalFeatures": true,
47
+
48
+ // Ruby LSP advanced semantic highlighting.
49
+ "workbench.colorTheme": "Spinel",
50
+
51
+ "[ruby]": {
52
+ "editor.formatOnSave": true,
53
+ "editor.formatOnType": true,
54
+ "editor.defaultFormatter": "Shopify.ruby-lsp",
55
+ "editor.rulers": [
56
+ 120
57
+ ],
58
+ "editor.tabSize": 2,
59
+ "editor.insertSpaces": true,
60
+ "editor.semanticHighlighting.enabled": true,
61
+ "files.trimFinalNewlines": true
62
+ },
63
+
64
+ // Basic launch config for Run and Debug.
65
+ // Fine-tune inside the project with `.vscode/launch.json` file.
66
+ "launch": {
67
+ // Use IntelliSense to learn about possible attributes.
68
+ // Hover to view descriptions of existing attributes.
69
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
70
+ "version": "0.2.0",
71
+ "configurations": [
72
+ {
73
+ "type": "ruby_lsp",
74
+ "name": "Run specs with debugger",
75
+ "request": "launch",
76
+ "program": "bin/rspec"
77
+ },
78
+ {
79
+ "type": "ruby_lsp",
80
+ "name": "Run current spec line with debugger",
81
+ "request": "launch",
82
+ "program": "bin/rspec ${file}:${lineNumber}"
83
+ }
84
+ ]
85
+ }
86
+ },
87
+
88
+ // Add the IDs of extensions you want installed when the container is created in the array below.
89
+ "extensions": [
90
+ "Shopify.ruby-extensions-pack",
91
+ "eamodio.gitlens"
92
+ ]
93
+ }
94
+ }
95
+
96
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
97
+ // "remoteUser": "root"
98
+ }
@@ -0,0 +1 @@
1
+ * @turboladen @tindron
@@ -36,11 +36,11 @@ jobs:
36
36
  steps:
37
37
  # Checkout the repository to the GitHub Actions runner
38
38
  - name: Checkout code
39
- uses: actions/checkout@v3
39
+ uses: actions/checkout@v4
40
40
 
41
41
  # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
42
42
  - name: Run Codacy Analysis CLI
43
- uses: codacy/codacy-analysis-cli-action@d43127fe38d20c527dc1951ae5aea23148bab738
43
+ uses: codacy/codacy-analysis-cli-action@97bf5df3c09e75f5bcd72695998f96ebd701846e
44
44
  with:
45
45
  # Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
46
46
  # You can also omit the token and run the tools that support default configurations
@@ -56,6 +56,6 @@ jobs:
56
56
 
57
57
  # Upload the SARIF file generated in the previous step
58
58
  - name: Upload SARIF results file
59
- uses: github/codeql-action/upload-sarif@v2
59
+ uses: github/codeql-action/upload-sarif@v3
60
60
  with:
61
61
  sarif_file: results.sarif
@@ -38,11 +38,11 @@ jobs:
38
38
 
39
39
  steps:
40
40
  - name: Checkout repository
41
- uses: actions/checkout@v3
41
+ uses: actions/checkout@v4
42
42
 
43
43
  # Initializes the CodeQL tools for scanning.
44
44
  - name: Initialize CodeQL
45
- uses: github/codeql-action/init@v2
45
+ uses: github/codeql-action/init@v3
46
46
  with:
47
47
  languages: ${{ matrix.language }}
48
48
  # If you wish to specify custom queries, you can do so here or in a config file.
@@ -56,7 +56,7 @@ jobs:
56
56
  # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57
57
  # If this step fails, then you should remove it and run the build manually (see below)
58
58
  - name: Autobuild
59
- uses: github/codeql-action/autobuild@v2
59
+ uses: github/codeql-action/autobuild@v3
60
60
 
61
61
  # ℹ️ Command-line programs to run using the OS shell.
62
62
  # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -69,6 +69,6 @@ jobs:
69
69
  # ./location_of_script_within_repo/buildscript.sh
70
70
 
71
71
  - name: Perform CodeQL Analysis
72
- uses: github/codeql-action/analyze@v2
72
+ uses: github/codeql-action/analyze@v3
73
73
  with:
74
74
  category: "/language:${{matrix.language}}"
@@ -1,36 +1,47 @@
1
1
  name: Continuous Integration
2
2
 
3
3
  on:
4
+ pull_request:
4
5
  push:
5
6
 
6
7
  jobs:
7
- test:
8
- name: Test
9
- runs-on: ubuntu-18.04
8
+ static_analysis:
9
+ name: Rubocop
10
+ runs-on: ubuntu-latest
10
11
  steps:
11
- - uses: actions/checkout@v2
12
+ - uses: actions/checkout@v4
12
13
  - name: Set up Ruby
13
14
  uses: ruby/setup-ruby@v1
14
15
  with:
16
+ ruby-version: "3.3"
15
17
  bundler-cache: true
16
- - name: Install dependencies
17
- run: |
18
- sudo apt-get update
19
- sudo apt-get install -y libgdal-dev librttopo-dev
20
- bundle install --jobs 4 --retry 3
21
- - name: Run specs
22
- run: bundle exec rspec spec --format RSpec::Github::Formatter --format progress
18
+ - name: Rubocop
19
+ run: bundle exec rubocop --format github --parallel
23
20
 
24
- static_analysis:
25
- name: Rubocop
26
- runs-on: ubuntu-18.04
21
+ test:
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ # NOTE:
26
+ # - ubuntu-20.04 has GDAL 3.0.4, PROJ 6.3.1, GEOS 3.8.0
27
+ # - ubuntu-22.04 has GDAL 3.4.1, PROJ 8.2.1, GEOS 3.10.2
28
+ # - ubuntu-24.04 has GDAL 3.8.4, PROJ 9.4.0, GEOS 3.12.1
29
+ os: ["ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04"]
30
+ ruby-version: ["2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
31
+ name: "Test on Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}"
32
+ runs-on: ${{ matrix.os }}
27
33
  steps:
28
- - uses: actions/checkout@v2
34
+ - name: Install GDAL
35
+ run:
36
+ sudo apt-get install -y --no-install-recommends libgdal-dev
37
+ librttopo-dev
38
+ - uses: actions/checkout@v4
29
39
  - name: Set up Ruby
30
40
  uses: ruby/setup-ruby@v1
31
41
  with:
42
+ ruby-version: ${{ matrix.ruby-version }}
32
43
  bundler-cache: true
33
- - name: Install dependencies
34
- run: bundle install --jobs 4 --retry 3
35
- - name: Rubocop
36
- run: bundle exec rubocop --format github --parallel
44
+ - name: Run specs
45
+ run:
46
+ bundle exec rspec spec --format RSpec::Github::Formatter --format
47
+ progress
@@ -15,6 +15,6 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  steps:
17
17
  - name: 'Checkout Repository'
18
- uses: actions/checkout@v3
18
+ uses: actions/checkout@v4
19
19
  - name: 'Dependency Review'
20
- uses: actions/dependency-review-action@v3
20
+ uses: actions/dependency-review-action@v4
@@ -1,29 +1,35 @@
1
1
  name: Specs in Docker
2
2
 
3
3
  on:
4
+ pull_request:
4
5
  push:
5
6
 
6
7
  jobs:
7
- test:
8
- name: Test
8
+ docker_test:
9
+ name: Docker Test (GDAL2)
9
10
  runs-on: ubuntu-latest
10
11
  steps:
11
- - uses: actions/checkout@v2
12
+ - uses: actions/checkout@v4
12
13
  - name: Set up Docker Buildx
13
14
  id: buildx
14
15
  uses: docker/setup-buildx-action@master
15
16
  - name: Cache Docker layers
16
- uses: actions/cache@v3
17
+ uses: actions/cache@v4
17
18
  with:
18
19
  path: /tmp/.buildx-cache
19
20
  key: ${{ runner.os }}-buildx-${{ github.sha }}
20
21
  restore-keys: |
21
22
  ${{ runner.os }}-buildx-
22
23
  - name: Log in to registry
23
- run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
24
+ run:
25
+ echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $
26
+ --password-stdin
24
27
  - name: Build gdal2 image
25
28
  run: |
26
29
  docker compose version
27
30
  docker compose build gdal2
28
31
  - name: Run specs
29
- run: docker compose run --rm gdal2 bundle exec rspec spec --format RSpec::Github::Formatter --format progress
32
+ run:
33
+ docker compose run --rm gdal2 bundle exec rspec spec --format
34
+ RSpec::Github::Formatter --format progress
35
+
data/.gitignore CHANGED
@@ -15,10 +15,13 @@
15
15
  .byebug_history
16
16
  .config
17
17
  .idea/
18
+ .vscode/
18
19
  .rake_tasks
19
20
  .tags
20
21
  .yardoc
21
22
 
23
+ .ruby-version
24
+
22
25
  Gemfile.lock
23
26
  InstalledFiles
24
27
  _yardoc
@@ -39,4 +42,4 @@ valgrind_output.log
39
42
  vendor/bundle
40
43
  vendor/sigs
41
44
 
42
- .odo
45
+ .odo
data/Changelog.md CHANGED
@@ -6,26 +6,61 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to
7
7
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
- ## [1.0.4] - 2023-02-06
9
+ ## [1.1.0] 2024-08-16
10
+
11
+ ### Added
12
+
13
+ - [gh-76](https://github.com/telus-agcg/ffi-gdal/issues/76): Add VSI
14
+ `PathSpecificOptions` and `VSI` Credentials.
15
+ - [gh-78](https://github.com/telus-agcg/ffi-gdal/issues/78): Add basic support
16
+ for Ractors.
17
+ - [gh-79](https://github.com/telus-agcg/ffi-gdal/issues/79): Initial GDAL Utils
18
+ support.
19
+ - [gh-81](https://github.com/telus-agcg/ffi-gdal/issues/81): Improve support for
20
+ GDAL 3.
21
+ - [gh-84](https://github.com/telus-agcg/ffi-gdal/issues/84): Improve raster band
22
+ offset/scaling handling.
23
+ - [gh-86](https://github.com/telus-agcg/ffi-gdal/issues/86): Add
24
+ `GDAL::GeoTransform#==`.
25
+ - [gh-91](https://github.com/telus-agcg/ffi-gdal/issues/91): Add
26
+ `GDAL::MajorObject#description=`.
27
+ - [gh-100](https://github.com/telus-agcg/ffi-gdal/issues/100): Add support for
28
+ `GDT_Int8`, `GDT_UInt64`, `GDT_Int64`.
29
+ - [gh-103](https://github.com/telus-agcg/ffi-gdal/issues/103): Add support for
30
+ GDAL 3.6, 3.8.
31
+
32
+ ### Changed
33
+
34
+ - [gh-102](https://github.com/telus-agcg/ffi-gdal/issues/102): Add support for
35
+ new CPLE error codes.
36
+
37
+ ### Fixed
38
+
39
+ - [gh-74](https://github.com/telus-agcg/ffi-gdal/issues/74): Add
40
+ `/opt/homebrew/include` to header file search paths (fix for macOS).
41
+ - [gh-77](https://github.com/telus-agcg/ffi-gdal/issues/77): Fix logging for
42
+ debug messages.
43
+
44
+ ## [1.0.4] — 2023-02-06
10
45
 
11
46
  ### Fixed
12
47
 
13
48
  - Move `OGR::GeometryMixins::Extensions#is_3d?` to `OGR::Geometry`.
14
49
 
15
- ## [1.0.3] - 2023-01-27
50
+ ## [1.0.3] 2023-01-27
16
51
 
17
52
  ### Fixed
18
53
 
19
54
  - Fix nil return value from `OGR::GeometryMixins::Extensions#utm_zone` when
20
- spatial_reference is not 4326.
55
+ `spatial_reference` is not 4326.
21
56
 
22
- ## [1.0.2] - 2023-01-13
57
+ ## [1.0.2] 2023-01-13
23
58
 
24
59
  ### Fixed
25
60
 
26
61
  - Fix requires for lib/\*/extensions/all.rb.
27
62
 
28
- ## [1.0.1] - 2023-01-13
63
+ ## [1.0.1] 2023-01-13
29
64
 
30
65
  ### Fixed
31
66
 
data/Gemfile CHANGED
@@ -12,7 +12,9 @@ gem "fakefs"
12
12
  gem "rake"
13
13
  gem "rspec", "~> 3.0"
14
14
  gem "rspec-github"
15
- gem "rubocop", ">= 1.0"
16
- gem "rubocop-performance"
15
+ # NOTE: Current versions of rubocop and rubocop-performance do not support Ruby 2.6.
16
+ # Allow some flexibility in the versions to avoid breaking the CI.
17
+ gem "rubocop", "<= 1.63.1"
18
+ gem "rubocop-performance", "<= 1.21.0"
17
19
  gem "simplecov", "~> 0.9"
18
20
  gem "thor"
data/README.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  Ruby wrapper around GDAL, using FFI, along with some helper methods.
4
4
 
5
+ ## Status
6
+
7
+ [![Gem Version](https://badge.fury.io/rb/ffi-gdal.svg)](https://badge.fury.io/rb/ffi-gdal)
8
+ [![Github Actions CI](https://github.com/telus-agcg/ffi-gdal/actions/workflows/continuous-integration.yml/badge.svg?branch=develop)](https://github.com/telus-agcg/ffi-gdal/actions/workflows/continuous-integration.yml)
9
+ [![Github CodeQL](https://github.com/telus-agcg/ffi-gdal/actions/workflows/codeql.yml/badge.svg?branch=develop)](https://github.com/telus-agcg/ffi-gdal/actions/workflows/codeql.yml)
10
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)
11
+
12
+ - **GDAL 2.4** and **GDAL 3+** are supported.
13
+ - Ruby **2.6+** supported.
14
+
5
15
  ## Installation
6
16
 
7
17
  Add this line to your application's Gemfile:
@@ -44,6 +54,31 @@ For classes that are enabled with logging capabilities, you can turn logging on
44
54
  and off like `GDAL::RasterBand.logging_enabled = true`. If you're using ffi-gdal
45
55
  in Rails, you can `GDAL::Logger.logger = Rails.logger`.
46
56
 
57
+ ### Debugging
58
+
59
+ Additional error logging can be enabled through GDAL's [global configuration options](https://gdal.org/user/configoptions.html).
60
+
61
+ ```ruby
62
+ FFI::CPL::Conv.CPLSetConfigOption('CPL_DEBUG', 'ON')
63
+ FFI::CPL::Conv.CPLSetConfigOption('CPL_LOG_ERRORS', 'ON')
64
+ ```
65
+
66
+ ## Compatibility
67
+
68
+ CI is run against:
69
+ - Ruby 2.6, 2.7, 3.0, 3.1, 3.2, 3.3 for Ubuntu 24.04
70
+ (**GDAL 3.8.4**, PROJ 9.4.0, GEOS 3.12.1)
71
+ - Ruby 2.6, 2.7, 3.0, 3.1, 3.2, 3.3 for Ubuntu 22.04
72
+ (**GDAL 3.4.1**, PROJ 8.2.1, GEOS 3.10.2)
73
+ - Ruby 2.6, 2.7, 3.0, 3.1, 3.2, 3.3 for Ubuntu 20.04
74
+ (**GDAL 3.0.4**, PROJ 6.3.1, GEOS 3.8.0)
75
+ - Ruby 3.2 with **GDAL 2.4.4**
76
+
77
+ > GDAL itself has differences in behaviour between versions. This means that
78
+ > upgrading your project to a newer version of GDAL may introduce some
79
+ > breaking changes to your project due to changes in GDAL internal logic.
80
+ > We document these differences in the specs when possible.
81
+
47
82
  ## Contributing
48
83
 
49
84
  1. Fork it ( https://github.com/telus-agcg/ffi-gdal/fork )
@@ -4,7 +4,7 @@ module NumericAsDataType
4
4
  # @param data_type [FFI::GDAL::GDAL::DataType]
5
5
  def to_data_type(data_type)
6
6
  case data_type
7
- when :GDT_Byte, :GDT_UInt16, :GDT_Int16, :GDT_UInt32, :GDT_Int32
7
+ when :GDT_Byte, :GDT_Int8, :GDT_UInt16, :GDT_Int16, :GDT_UInt32, :GDT_Int32, :GDT_UInt64, :GDT_Int64
8
8
  to_i
9
9
  when :GDT_Float32, :GDT_Float64
10
10
  to_f
data/lib/ffi/cpl/vsi.rb CHANGED
@@ -111,6 +111,16 @@ module FFI
111
111
  attach_function :VSICTime, %i[ulong], :strptr
112
112
  attach_function :VSIGMTime, %i[pointer pointer], :pointer
113
113
  attach_function :VSILocalTime, %i[pointer pointer], :pointer
114
+
115
+ # GDAL 3.5+ VSI Credentials (legacy, VSI PathSpecificOptions should be used instead in GDAL 3.6+)
116
+ attach_function :VSISetCredential, %i[string string string], :void
117
+ attach_function :VSIClearCredentials, %i[string], :void
118
+ attach_function :VSIGetCredential, %i[string string string], :string
119
+
120
+ # GDAL 3.6+ VSI PathSpecificOptions
121
+ attach_function :VSISetPathSpecificOption, %i[string string string], :void
122
+ attach_function :VSIClearPathSpecificOptions, %i[string], :void
123
+ attach_function :VSIGetPathSpecificOption, %i[string string string], :string
114
124
  end
115
125
  end
116
126
  end
data/lib/ffi/gdal/gdal.rb CHANGED
@@ -6,6 +6,7 @@ require_relative "color_entry"
6
6
 
7
7
  module FFI
8
8
  module GDAL
9
+ # rubocop:disable Metrics/ModuleLength
9
10
  module GDAL
10
11
  extend ::FFI::Library
11
12
  ffi_lib [::FFI::CURRENT_PROCESS, ::FFI::GDAL.gdal_library_path]
@@ -13,19 +14,24 @@ module FFI
13
14
  # ----------------------------------------------------------------
14
15
  # Enums
15
16
  # ----------------------------------------------------------------
16
- DataType = enum :GDT_Unknown, 0,
17
+ # https://gdal.org/doxygen/gdal_8h_source.html
18
+ # NOTE: GDT_TypeCount is maximum type # + 1.
19
+ DataType = enum :GDT_Unknown, 0,
17
20
  :GDT_Byte, 1,
21
+ :GDT_Int8, 14,
18
22
  :GDT_UInt16, 2,
19
23
  :GDT_Int16, 3,
20
24
  :GDT_UInt32, 4,
21
25
  :GDT_Int32, 5,
26
+ :GDT_UInt64, 12,
27
+ :GDT_Int64, 13,
22
28
  :GDT_Float32, 6,
23
29
  :GDT_Float64, 7,
24
30
  :GDT_CInt16, 8,
25
31
  :GDT_CInt32, 9,
26
32
  :GDT_CFloat32, 10,
27
33
  :GDT_CFloat64, 11,
28
- :GDT_TypeCount, 12
34
+ :GDT_TypeCount, 15
29
35
 
30
36
  AsyncStatusType = enum :GARIO_PENDING, 0,
31
37
  :GARIO_UPDATE, 1,
@@ -679,5 +685,6 @@ module FFI
679
685
  %i[pointer int int pointer int int int int],
680
686
  :void
681
687
  end
688
+ # rubocop:enable Metrics/ModuleLength
682
689
  end
683
690
  end
@@ -4,12 +4,34 @@ require "ffi"
4
4
 
5
5
  module FFI
6
6
  module GDAL
7
+ # FFI structure for GDALGridDataMetricsOptions.
8
+ # @see https://gdal.org/api/gdal_alg.html#_CPPv426GDALGridDataMetricsOptions
7
9
  class GridDataMetricsOptions < FFI::Struct
8
- layout :radius1, :double,
9
- :radius2, :double,
10
- :angle, :double,
11
- :min_points, CPL::Port.find_type(:GUInt32),
12
- :no_data_value, :double
10
+ DEFAULT_LAYOUT = [
11
+ :radius1, :double,
12
+ :radius2, :double,
13
+ :angle, :double,
14
+ :min_points, CPL::Port.find_type(:GUInt32),
15
+ :no_data_value, :double
16
+ ].freeze
17
+
18
+ LAYOUT_VERSIONS = [
19
+ InternalHelpers::LayoutVersion.new(
20
+ version: "0000000", # Any old GDAL
21
+ layout: DEFAULT_LAYOUT
22
+ ),
23
+ InternalHelpers::LayoutVersion.new(
24
+ version: "3060000", # GDAL 3.6.0
25
+ layout: [
26
+ :n_size_of_structure, :size_t,
27
+ *DEFAULT_LAYOUT,
28
+ :max_points_per_quadrant, CPL::Port.find_type(:GUInt32),
29
+ :min_points_per_quadrant, CPL::Port.find_type(:GUInt32)
30
+ ]
31
+ )
32
+ ].freeze
33
+
34
+ layout(*InternalHelpers::LayoutVersionResolver.resolve(versions: LAYOUT_VERSIONS))
13
35
  end
14
36
  end
15
37
  end
@@ -4,17 +4,37 @@ require "ffi"
4
4
 
5
5
  module FFI
6
6
  module GDAL
7
+ # FFI structure for GDALGridInverseDistanceToAPowerOptions.
8
+ # @see https://gdal.org/api/gdal_alg.html#_CPPv438GDALGridInverseDistanceToAPowerOptions
7
9
  class GridInverseDistanceToAPowerOptions < FFI::Struct
8
- layout :power, :double,
9
- :smoothing, :double,
10
- :anisotropy_ratio, :double,
11
- :anisotropy_angle, :double,
12
- :radius1, :double,
13
- :radius2, :double,
14
- :angle, :double,
15
- :max_points, CPL::Port.find_type(:GUInt32),
16
- :min_points, CPL::Port.find_type(:GUInt32),
17
- :no_data_value, :double
10
+ DEFAULT_LAYOUT = [
11
+ :power, :double,
12
+ :smoothing, :double,
13
+ :anisotropy_ratio, :double,
14
+ :anisotropy_angle, :double,
15
+ :radius1, :double,
16
+ :radius2, :double,
17
+ :angle, :double,
18
+ :max_points, CPL::Port.find_type(:GUInt32),
19
+ :min_points, CPL::Port.find_type(:GUInt32),
20
+ :no_data_value, :double
21
+ ].freeze
22
+
23
+ LAYOUT_VERSIONS = [
24
+ InternalHelpers::LayoutVersion.new(
25
+ version: "0000000", # Any old GDAL
26
+ layout: DEFAULT_LAYOUT
27
+ ),
28
+ InternalHelpers::LayoutVersion.new(
29
+ version: "3060000", # GDAL 3.6.0
30
+ layout: [
31
+ :n_size_of_structure, :size_t,
32
+ *DEFAULT_LAYOUT
33
+ ]
34
+ )
35
+ ].freeze
36
+
37
+ layout(*InternalHelpers::LayoutVersionResolver.resolve(versions: LAYOUT_VERSIONS))
18
38
  end
19
39
  end
20
40
  end
@@ -4,12 +4,37 @@ require "ffi"
4
4
 
5
5
  module FFI
6
6
  module GDAL
7
+ # FFI structure for GDALGridMovingAverageOptions.
8
+ # @see https://gdal.org/api/gdal_alg.html#_CPPv428GDALGridMovingAverageOptions
7
9
  class GridMovingAverageOptions < FFI::Struct
8
- layout :radius1, :double,
9
- :radius2, :double,
10
- :angle, :double,
11
- :min_points, CPL::Port.find_type(:GUInt32),
12
- :no_data_value, :double
10
+ LAYOUT_VERSIONS = [
11
+ InternalHelpers::LayoutVersion.new(
12
+ version: "0000000", # Any old GDAL
13
+ layout: [
14
+ :radius1, :double,
15
+ :radius2, :double,
16
+ :angle, :double,
17
+ :min_points, CPL::Port.find_type(:GUInt32),
18
+ :no_data_value, :double
19
+ ]
20
+ ),
21
+ InternalHelpers::LayoutVersion.new(
22
+ version: "3060000", # GDAL 3.6.0
23
+ layout: [
24
+ :n_size_of_structure, :size_t,
25
+ :radius1, :double,
26
+ :radius2, :double,
27
+ :angle, :double,
28
+ :max_points, CPL::Port.find_type(:GUInt32),
29
+ :min_points, CPL::Port.find_type(:GUInt32),
30
+ :no_data_value, :double,
31
+ :max_points_per_quadrant, CPL::Port.find_type(:GUInt32),
32
+ :min_points_per_quadrant, CPL::Port.find_type(:GUInt32)
33
+ ]
34
+ )
35
+ ].freeze
36
+
37
+ layout(*InternalHelpers::LayoutVersionResolver.resolve(versions: LAYOUT_VERSIONS))
13
38
  end
14
39
  end
15
40
  end