ffi-gdal 1.0.0.beta10 → 1.0.0.beta13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 659c94d48e012adfd48d62dc168b1ac0a16a6275d022d7ed4f799ffab7074d6c
4
- data.tar.gz: 52069e3dc0bddb8a6b60b6a257fa8d33bf69831af98e5f4c7a37a2b88f528fe6
3
+ metadata.gz: 3a7da9b47c629fe9a1b116f1c12175858e4c259d01b1f1b87027e3060656a06b
4
+ data.tar.gz: 13275d69e24bda923196ac121ddc55ea61fa61351c7ea5245b91991a2266d5a3
5
5
  SHA512:
6
- metadata.gz: df7d823f92a3e4ce6fef0b660736b719f1e3989f5c89d76b20af5256f7269ee142ad0c6ff1ea5fb78386a945a312e43e7115248379860816a12ca550036edcca
7
- data.tar.gz: 5851ec8e10e7497b797a64542de4612ad1e22109dfcc4855a1752f49d4ec4d619e812e680469eddecc91b37e0b0760edde1e5368be7778229b3d10eef039c595
6
+ metadata.gz: a46c6f0b1c318ff9ce7c0cb44d6f863cd8903194271bf9e5b93c0581b2dbd5129235829d97e64f725a561741933eadeb959d421fff09f562508097311afe0379
7
+ data.tar.gz: a3efb551a19524168ffc9540854e3d99860018a062ed026621de787875576a1f6df74f3ca5f3eb0f34c31571be21b087a1262d16fbcd2e7b692da34671eefb2a
data/.gitignore CHANGED
@@ -1,38 +1,39 @@
1
+ *.a
2
+ *.bundle
3
+ *.dbf
1
4
  *.gem
5
+ *.o
2
6
  *.rbc
7
+ *.shx
8
+ *.so
9
+ *.sqlite
10
+ *.swp
11
+ *.xml
12
+ *.xsd
13
+
3
14
  .bundle
15
+ .byebug_history
4
16
  .config
17
+ .idea/
18
+ .rake_tasks
19
+ .tags
5
20
  .yardoc
21
+
6
22
  Gemfile.lock
7
23
  InstalledFiles
8
24
  _yardoc
9
25
  coverage
10
26
  doc/
11
27
  lib/bundler/man
28
+ mkmf.log
29
+ open-datasets-dump
12
30
  pkg
13
31
  rdoc
32
+ spec/examples.txt
14
33
  spec/reports
34
+ tags
15
35
  test/tmp
16
36
  test/version_tmp
17
37
  tmp/*
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
23
- .idea/
24
- tags
25
- *.sqlite
26
- vendor/bundle
27
- *.xml
28
- *.dbf
29
- *.shx
30
- .rake_tasks
31
38
  valgrind_output.log
32
- *.xsd
33
-
34
- *.swp
35
-
36
- .byebug_history
37
-
38
- .tags
39
+ vendor/bundle
data/History.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  Format for this file derived from [http://keepachangelog.com](http://keepachangelog.com).
4
4
 
5
+ ## 1.0.0.beta13 / 2022-04-20
6
+
7
+ ### Bug Fixes
8
+
9
+ * [DEV-20247] Fix return value for `OGR::LayerMixins::Extensions#point_values` when no features are found.
10
+
11
+ ## 1.0.0.beta12 / 2021-06-07
12
+
13
+ ### Removed
14
+
15
+ * Removed `GDAL::MajorObject#description=`, as this shouldn't be called and
16
+ causes problems.
17
+
18
+ ### Bug Fixes
19
+
20
+ * [DEV-15804] Remove data that is outside all ranges when classifying.
21
+
22
+ ## 1.0.0.beta11 / 2020-06-02
23
+
24
+ ### Bug Fixes
25
+
26
+ * Change CPLFileFinder callback return type to pointer.
27
+
5
28
  ## 1.0.0.beta10 / 2019-08-28
6
29
 
7
30
  ### Bug Fixes
data/lib/ffi/cpl/conv.rb CHANGED
@@ -12,7 +12,7 @@ module FFI
12
12
  #-------------------------------------------------------------------------
13
13
  # Functions
14
14
  #-------------------------------------------------------------------------
15
- callback :CPLFileFinder, %i[string string], :string
15
+ callback :CPLFileFinder, %i[string string], :pointer
16
16
 
17
17
  #---------
18
18
  # Config
@@ -49,7 +49,7 @@ module FFI
49
49
  attach_function :CPLScanString, %i[string int int int], :string
50
50
  attach_function :CPLScanDouble, %i[string int], :double
51
51
  attach_function :CPLScanLong, %i[string int], :long
52
- attach_function :CPLScanLong, %i[string int], :ulong
52
+ attach_function :CPLScanULong, %i[string int], :ulong
53
53
  attach_function :CPLScanUIntBig, %i[string int], Port.find_type(:GUIntBig)
54
54
  attach_function :CPLScanPointer, %i[string int], :pointer
55
55
  attach_function :CPLPrintString, %i[string string int], :int
@@ -2,6 +2,6 @@
2
2
 
3
3
  module FFI
4
4
  module GDAL
5
- VERSION = '1.0.0.beta10'
5
+ VERSION = '1.0.0.beta13'
6
6
  end
7
7
  end
data/lib/ffi/ogr/api.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'ffi'
4
+ require_relative '../gdal'
3
5
  require_relative '../../ext/ffi_library_function_checks'
4
6
 
5
7
  module FFI
data/lib/ffi/ogr/core.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'ffi'
4
+ require_relative '../gdal'
4
5
  require_relative '../../ext/ffi_library_function_checks'
5
6
  require_relative 'field'
6
7
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'ffi'
4
+ require_relative '../gdal'
3
5
  require_relative '../../ext/ffi_library_function_checks'
4
6
 
5
7
  module FFI
@@ -166,7 +168,7 @@ module FFI
166
168
  attach_function :OSRExportToXML, %i[OGRSpatialReferenceH pointer buffer_out], FFI::OGR::Core::Err
167
169
  attach_function :OSRExportToMICoordSys, %i[OGRSpatialReferenceH pointer], FFI::OGR::Core::Err
168
170
  attach_function :OSRExportToERM,
169
- %i[OGRSpatialReferenceH buffer_out buffer_out buffer_out],
171
+ %i[OGRSpatialReferenceH pointer pointer pointer],
170
172
  FFI::OGR::Core::Err
171
173
  attach_function :OSRMorphToESRI, %i[OGRSpatialReferenceH], FFI::OGR::Core::Err
172
174
  attach_function :OSRMorphFromESRI, %i[OGRSpatialReferenceH], FFI::OGR::Core::Err
@@ -281,7 +281,7 @@ module GDAL
281
281
  pixel_value_field = layer.feature_definition.field_index(field_name)
282
282
  options = { pixel_value_field: pixel_value_field }
283
283
  options[:mask_band] = band.mask_band if use_band_masks
284
- band.polygonize(layer, options)
284
+ band.polygonize(layer, **options)
285
285
  end
286
286
 
287
287
  if block_given?
@@ -67,11 +67,6 @@ module GDAL
67
67
  FFI::GDAL::GDAL.GDALGetDescription(@c_pointer)
68
68
  end
69
69
 
70
- # @param new_description [String]
71
- def description=(new_description)
72
- FFI::GDAL::GDAL.GDALSetDescription(@c_pointer, new_description.to_s)
73
- end
74
-
75
70
  def null?
76
71
  @c_pointer.null?
77
72
  end
@@ -99,6 +99,9 @@ module GDAL
99
99
  new_band_pixels[data_pixels & band_pixels.le(r[:range].max) & band_pixels.ge(r[:range].min)] = r[:map_to]
100
100
  end
101
101
 
102
+ in_range = @ranges.map { |r| band_pixels.le(r[:range].max) & band_pixels.ge(r[:range].min) }.reduce(:|)
103
+ new_band_pixels[data_pixels & ~in_range] = 0 if in_range
104
+
102
105
  mask_nan(new_band_pixels, data_pixels) if nodata_is_nan?
103
106
  @raster_band.write_xy_narray(new_band_pixels)
104
107
  end
data/lib/gdal.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'ffi-gdal'
4
+ require_relative 'ffi/gdal'
4
5
 
5
6
  module GDAL
6
7
  class << self
@@ -112,7 +112,7 @@ module OGR
112
112
  # encountered that the method doesn't know how to extract point values
113
113
  # from.
114
114
  def point_values(with_attributes = {})
115
- return [[]] if feature_count.zero?
115
+ return [] if feature_count.zero?
116
116
 
117
117
  field_indices = with_attributes.keys.map { |field_name| find_field_index(field_name) }
118
118
  values = Array.new(feature_count) { Array.new(2 + with_attributes.size) }
@@ -6,9 +6,9 @@ module OGR
6
6
  # @return [Hash]
7
7
  # @raise [OGR::NotEnoughData] If name, datum name, and units are not set.
8
8
  def to_erm
9
- projection_name = FFI::MemoryPointer.new(:string)
10
- datum_name = FFI::MemoryPointer.new(:string)
11
- units = FFI::MemoryPointer.new(:string)
9
+ projection_name = FFI::MemoryPointer.new(:string, 32)
10
+ datum_name = FFI::MemoryPointer.new(:string, 32)
11
+ units = FFI::MemoryPointer.new(:string, 32)
12
12
 
13
13
  ogr_err = FFI::OGR::SRSAPI.OSRExportToERM(@c_pointer, projection_name, datum_name, units)
14
14
  ogr_err.handle_result 'Required parameters (name, datum name, units) are not defined'
@@ -36,7 +36,7 @@ RSpec.describe 'Driver Info', type: :integration do
36
36
 
37
37
  describe '#short_name' do
38
38
  it 'is GTiff' do
39
- expect(subject.short_name).to eq 'GTiff'
39
+ expect(subject.short_name).to eq('GTiff')
40
40
  end
41
41
  end
42
42
 
@@ -49,15 +49,6 @@ RSpec.shared_examples 'a major object' do
49
49
  end
50
50
  end
51
51
 
52
- describe '#description=' do
53
- context 'new description is a string' do
54
- it 'sets the items description' do
55
- subject.description = 'a test description'
56
- expect(subject.description).to eq 'a test description'
57
- end
58
- end
59
- end
60
-
61
52
  describe '#null?' do
62
53
  it { is_expected.to_not be_null }
63
54
  end
@@ -26,7 +26,7 @@ RSpec.describe OGR::DataSource do
26
26
 
27
27
  describe '#supports_curve_geometries?' do
28
28
  subject { data_source.supports_curve_geometries? }
29
- it { is_expected.to eq false }
29
+ it { is_expected.to eq true }
30
30
  end
31
31
  end
32
32
  end
@@ -210,10 +210,10 @@ RSpec.describe OGR::Feature do
210
210
  end
211
211
  end
212
212
 
213
- context 'value is not an array of strings' do
214
- it 'returns an empty Array' do
215
- subject.set_field_integer_list(5, [1, 2, 3])
216
- expect(subject.field_as_string_list(5)).to eq []
213
+ context 'value is an Array of Integers' do
214
+ it 'returns an Array of Strings' do
215
+ subject.set_field_string_list(5, [1, 2, 3])
216
+ expect(subject.field_as_string_list(5)).to eq %w[1 2 3]
217
217
  end
218
218
  end
219
219
  end
@@ -237,7 +237,7 @@ RSpec.describe OGR::Point do
237
237
  let(:wkt) { 'POINT EMPTY' }
238
238
 
239
239
  describe '#coordinate_dimension' do
240
- specify { expect(subject.coordinate_dimension).to eq 0 }
240
+ specify { expect(subject.coordinate_dimension).to eq 2 }
241
241
  end
242
242
 
243
243
  describe '#geometry_count' do
@@ -299,8 +299,8 @@ RSpec.describe OGR::Point do
299
299
  end
300
300
 
301
301
  describe '#envelope' do
302
- it 'returns nil' do
303
- expect(subject.envelope).to be_nil
302
+ it 'returns an OGR::Envelope' do
303
+ expect(subject.envelope).to be_a OGR::Envelope
304
304
  end
305
305
  end
306
306
  end
@@ -673,7 +673,8 @@ RSpec.describe OGR::Geometry do
673
673
 
674
674
  context 'wkbLinearRing' do
675
675
  subject { described_class.type_to_name(:wkbLinearRing) }
676
- it { is_expected.to eq 'Unrecognised: 101' }
676
+ # Per GDAL docs, LinearRing is only used for geometry creation.
677
+ it { is_expected.to eq 'Unrecognized: 101' }
677
678
  end
678
679
  end
679
680
 
@@ -84,7 +84,7 @@ RSpec.describe OGR::Layer do
84
84
 
85
85
  describe '#supports_curve_geometries?' do
86
86
  subject { layer.supports_curve_geometries? }
87
- it { is_expected.to eq false }
87
+ it { is_expected.to eq true }
88
88
  end
89
89
  end
90
90
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-gdal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta10
4
+ version: 1.0.0.beta13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Loveless
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-17 00:00:00.000000000 Z
11
+ date: 2022-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -192,7 +192,7 @@ dependencies:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0.9'
195
- description:
195
+ description:
196
196
  email:
197
197
  - steve@agrian.com
198
198
  executables: []
@@ -528,7 +528,7 @@ homepage: http://bitbucket.org/agrian/ffi-gdal
528
528
  licenses:
529
529
  - MIT
530
530
  metadata: {}
531
- post_install_message:
531
+ post_install_message:
532
532
  rdoc_options: []
533
533
  require_paths:
534
534
  - lib
@@ -543,8 +543,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
543
543
  - !ruby/object:Gem::Version
544
544
  version: 1.3.1
545
545
  requirements: []
546
- rubygems_version: 3.0.3
547
- signing_key:
546
+ rubygems_version: 3.0.9
547
+ signing_key:
548
548
  specification_version: 4
549
549
  summary: FFI wrapper for GDAL/OGR.
550
550
  test_files: