ffi-gdal 1.0.0.beta11 → 1.0.0.beta12

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: c68052761a1e7169e0827a611d99b825c0922bad173fc449133522d27e53d2bc
4
- data.tar.gz: 307f6323e07aa67f3232b9bb2ce4ad3c8aff4722498344cfeb2c3db9dfdc31da
3
+ metadata.gz: cc64c019c4788ab096e473970c65eb1b029766810a9383d8790d55ea12aa83b0
4
+ data.tar.gz: 7b20ce76aed3a133996e1c7fcd72dc1b6285ce9dbba37041710ee6f25e63eb8a
5
5
  SHA512:
6
- metadata.gz: 96bb0bbd71290fc05806883cce455c8000ee494644db02b3c8203f305dea236272713ef02b2c10ef0912e28dd5c4916580b2b33efff2ee67c5ac253004cec2d5
7
- data.tar.gz: d8371066d7e1ab28235b1d42397864aade41d2921b7149dd23c2fc3574c0c8c4ac4bc42c663949929adf90f418e7bdcd7e1f4c948a6c6ea11dcf11359ac78d14
6
+ metadata.gz: 2aa9515c30fe4ce19a8776b8347265bef5d308a705c8bbe944b1a3cc1c9972b895c14ce108d3337f8e874566b12a153d732e41c3994108d5f2429166ce1cc06f
7
+ data.tar.gz: 283356042e8bc70d17caa1a59f2fe5238c9884e1d007a21729f5961111d122ac966c0c6e9f8f08e0df298cf9c43fdf79ece7617ee02dc175a050dd1b9e80d3e0
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,17 @@
2
2
 
3
3
  Format for this file derived from [http://keepachangelog.com](http://keepachangelog.com).
4
4
 
5
+ ## 1.0.0.beta12 / 2021-06-07
6
+
7
+ ### Removed
8
+
9
+ * Removed `GDAL::MajorObject#description=`, as this shouldn't be called and
10
+ causes problems.
11
+
12
+ ### Bug Fixes
13
+
14
+ * [DEV-15804] Remove data that is outside all ranges when classifying.
15
+
5
16
  ## 1.0.0.beta11 / 2020-06-02
6
17
 
7
18
  ### Bug Fixes
@@ -2,6 +2,6 @@
2
2
 
3
3
  module FFI
4
4
  module GDAL
5
- VERSION = '1.0.0.beta11'
5
+ VERSION = '1.0.0.beta12'
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
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
@@ -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
@@ -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.beta11
4
+ version: 1.0.0.beta12
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: 2020-06-02 00:00:00.000000000 Z
11
+ date: 2021-06-07 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.1.2
547
- signing_key:
546
+ rubygems_version: 3.1.6
547
+ signing_key:
548
548
  specification_version: 4
549
549
  summary: FFI wrapper for GDAL/OGR.
550
550
  test_files: