geoblacklight 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ab9ad53c121ecb11786eda411ef17204fc5583f0509163d1d67410d71c200a4
4
- data.tar.gz: 5e42344b9e36065ff2fd1e3016d660dd16e0c96c76926a2fd7dc46cbea2839a0
3
+ metadata.gz: 4021ce4380619064571c6145cf452e1096dad3f6961202a0b921cd979c2343ed
4
+ data.tar.gz: aa8c3ccd3014fe2b881118ac476d59c800fec65936d9acf135c10c7174a3ccc4
5
5
  SHA512:
6
- metadata.gz: 3eccb9b116840387fbcb0fa90b5f54026804b15ecee88d02732dc24cf39295c51ffc9b434f6a92c0c2d090265ea59a9d554a96b5d58ea350fbfb258bf4eea6c2
7
- data.tar.gz: 6f1506bcd876c7977f717a6bbd04a7abc4aad119bb76051bce22c984f10376649aa2f11a3c36000d001e94c63c10207fe8abc9e4f3dcb87fae184e9b355dce76
6
+ metadata.gz: 843bf563f8093e054e41ce5d3557d6144453a486aec7500f42eac3a9faa41adee5ad55afb1d2c5736f3257c6242eb9ba5d0bd0631627393875226051ac37f674
7
+ data.tar.gz: 744948cad3dcf288fb3e2506ec70deec999c7a7a6c820f71bea5cbeacdfa4b54b6f709b0c55c0cfc3f6debdeaa13b3d4142eaac0adb26a5bd683fdf0185c6349
@@ -46,7 +46,7 @@ jobs:
46
46
  runs-on: ubuntu-latest
47
47
  strategy:
48
48
  matrix:
49
- ruby: [2.7]
49
+ ruby: [2.7, 3.0]
50
50
  steps:
51
51
  - uses: actions/checkout@v2
52
52
 
@@ -113,7 +113,7 @@ jobs:
113
113
  runs-on: ubuntu-latest
114
114
  strategy:
115
115
  matrix:
116
- ruby: [2.5]
116
+ ruby: [2.6]
117
117
  steps:
118
118
  - uses: actions/checkout@v2
119
119
 
@@ -133,10 +133,10 @@ jobs:
133
133
  - name: Install dependencies
134
134
  run: bundle install
135
135
  env:
136
- RAILS_VERSION: 5.2.4.2
136
+ RAILS_VERSION: 5.2.6
137
137
 
138
138
  - name: Run tests
139
139
  run: bundle exec rake ci
140
140
  env:
141
- RAILS_VERSION: 5.2.4.2
141
+ RAILS_VERSION: 5.2.6
142
142
  ENGINE_CART_RAILS_OPTIONS: '--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
@@ -280,7 +280,7 @@ module GeoblacklightHelper
280
280
  icon_name = icon if icon_name.blank?
281
281
  icon_options = {}
282
282
  icon_options = { classes: 'svg_tooltip' } if Settings.USE_GEOM_FOR_RELATIONS_ICON
283
- geoblacklight_icon(icon_name, icon_options)
283
+ geoblacklight_icon(icon_name, **icon_options)
284
284
  end
285
285
 
286
286
  ## Returns the data-map attribute value used as the JS map selector
@@ -17,8 +17,9 @@ module Geoblacklight
17
17
  def geojson
18
18
  obj = factory.parse_wkt(geometry_as_wkt)
19
19
  RGeo::GeoJSON.encode(obj).to_json
20
- rescue RGeo::Error::ParseError
21
- ''
20
+ rescue StandardError
21
+ Geoblacklight.logger.warn "Geometry is not valid: #{geom}"
22
+ default_extent
22
23
  end
23
24
 
24
25
  # Generate a wsen bounding box from the geometry
@@ -36,11 +37,25 @@ module Geoblacklight
36
37
  maxy = bbox.coordinates[0][2][1]
37
38
  "#{minx}, #{miny}, #{maxx}, #{maxy}"
38
39
  rescue RGeo::Error::ParseError
39
- ''
40
+ Geoblacklight.logger.warn "Error parsing geometry: #{geom}"
41
+ default_extent
40
42
  end
41
43
 
42
44
  private
43
45
 
46
+ # Default extent as GeoJSON
47
+ # @return [String]
48
+ def default_extent
49
+ {
50
+ 'type' => 'Polygon',
51
+ 'coordinates' => [
52
+ [
53
+ [-180.0, 90.0], [-180.0, -90.0], [180.0, -90.0], [180.0, 90.0], [-180.0, 90.0]
54
+ ]
55
+ ]
56
+ }.to_json
57
+ end
58
+
44
59
  # Convert WKT ENVELOPE string to WKT POLYGON string
45
60
  # @return [String]
46
61
  def envelope_to_polygon
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Geoblacklight
3
- VERSION = '3.3.0'
3
+ VERSION = '3.3.1'
4
4
  end
@@ -5,6 +5,7 @@ describe Geoblacklight::Geometry do
5
5
  let(:wkt_geom) { 'MULTIPOLYGON(((-180 81.66, -180 -12.93, -168.35 -12.93, -168.35 81.66, -180 81.66)), ((180 81.66, 25 81.66, 25 -12.93, 180 -12.93, 180 81.66)))' }
6
6
  let(:envelope_geom) { 'ENVELOPE(25, -168.35, 81.66, -12.93)' }
7
7
  let(:invalid_geom) { 'INVALID' }
8
+ let(:non_polygon_geom) { 'ENVELOPE(130, 130, 33, 33)' }
8
9
 
9
10
  describe '#geojson' do
10
11
  context 'with standard WKT geometry' do
@@ -20,8 +21,18 @@ describe Geoblacklight::Geometry do
20
21
  end
21
22
 
22
23
  context 'with an invalid geometry' do
23
- it 'returns an empty string' do
24
- expect(described_class.new(invalid_geom).geojson).to eq ''
24
+ it 'returns a default GeoJSON extent' do
25
+ expect(described_class.new(invalid_geom).geojson).to include('coordinates', '-180.0,90.0')
26
+ end
27
+ end
28
+
29
+ context 'with a non-polygon geometry' do
30
+ before do
31
+ allow(RGeo::GeoJSON).to receive(:encode).and_raise(RGeo::Error::InvalidGeometry)
32
+ end
33
+
34
+ it 'returns a default GeoJSON extent' do
35
+ expect(described_class.new(non_polygon_geom).geojson).to include('coordinates', '-180.0,90.0')
25
36
  end
26
37
  end
27
38
  end
@@ -40,8 +51,8 @@ describe Geoblacklight::Geometry do
40
51
  end
41
52
 
42
53
  context 'with an invalid geometry' do
43
- it 'returns an empty string' do
44
- expect(described_class.new(invalid_geom).bounding_box).to eq ''
54
+ it 'returns a default GeoJSON extent' do
55
+ expect(described_class.new(invalid_geom).bounding_box).to include('coordinates', '-180.0,90.0')
45
56
  end
46
57
  end
47
58
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoblacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Graves
8
8
  - Darren Hardy
9
9
  - Eliot Jordan
10
10
  - Jack Reed
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-03-08 00:00:00.000000000 Z
14
+ date: 2021-05-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -809,7 +809,7 @@ homepage: http://github.com/geoblacklight/geoblacklight
809
809
  licenses:
810
810
  - Apache 2.0
811
811
  metadata: {}
812
- post_install_message:
812
+ post_install_message:
813
813
  rdoc_options: []
814
814
  require_paths:
815
815
  - lib
@@ -824,8 +824,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
824
824
  - !ruby/object:Gem::Version
825
825
  version: 2.5.2
826
826
  requirements: []
827
- rubygems_version: 3.2.3
828
- signing_key:
827
+ rubygems_version: 3.0.3
828
+ signing_key:
829
829
  specification_version: 4
830
830
  summary: A discovery platform for geospatial holdings
831
831
  test_files: