geoblacklight 3.4.0 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +28 -75
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +1 -0
  5. data/.solr_wrapper +1 -0
  6. data/app/assets/images/blacklight/michigan-state-university.svg +0 -1
  7. data/app/assets/images/blacklight/pennsylvania-state-university.svg +0 -1
  8. data/app/assets/images/blacklight/purdue-university.svg +0 -1
  9. data/app/assets/images/blacklight/the-ohio-state-university.svg +0 -1
  10. data/app/assets/images/blacklight/university-of-chicago.svg +0 -1
  11. data/app/assets/images/blacklight/university-of-illinois-urbana-champaign.svg +0 -1
  12. data/app/assets/images/blacklight/university-of-iowa.svg +0 -1
  13. data/app/assets/images/blacklight/university-of-maryland.svg +0 -1
  14. data/app/assets/images/blacklight/university-of-michigan.svg +0 -1
  15. data/app/assets/images/blacklight/university-of-minnesota.svg +0 -1
  16. data/app/assets/images/blacklight/university-of-nebraska-lincoln.svg +0 -1
  17. data/app/assets/images/blacklight/university-of-wisconsin-madison.svg +0 -1
  18. data/app/assets/javascripts/geoblacklight/viewers/tilejson.js +33 -0
  19. data/app/assets/javascripts/geoblacklight/viewers/tms.js +2 -2
  20. data/app/assets/javascripts/geoblacklight/viewers/wms.js +2 -2
  21. data/app/assets/javascripts/geoblacklight/viewers/wmts.js +85 -0
  22. data/app/assets/javascripts/geoblacklight/viewers/xyz.js +10 -0
  23. data/config/locales/geoblacklight.en.yml +3 -0
  24. data/geoblacklight.gemspec +2 -1
  25. data/lib/generators/geoblacklight/assets_generator.rb +1 -1
  26. data/lib/generators/geoblacklight/templates/settings.yml +3 -0
  27. data/lib/geoblacklight/constants.rb +3 -0
  28. data/lib/geoblacklight/engine.rb +4 -2
  29. data/lib/geoblacklight/item_viewer.rb +13 -1
  30. data/lib/geoblacklight/version.rb +1 -1
  31. data/solr/conf/solrconfig.xml +3 -3
  32. data/spec/features/home_page_spec.rb +2 -2
  33. data/spec/features/split_view.html.erb_spec.rb +1 -1
  34. data/spec/features/tilejson_spec.rb +22 -0
  35. data/spec/features/tms_spec.rb +1 -1
  36. data/spec/features/web_services_modal_spec.rb +33 -0
  37. data/spec/features/wmts_spec.rb +34 -0
  38. data/spec/features/xyz_spec.rb +10 -0
  39. data/spec/fixtures/manifests/tilejson.json +21 -0
  40. data/spec/fixtures/manifests/wmts-multiple.xml +813 -0
  41. data/spec/fixtures/manifests/wmts-single.xml +126 -0
  42. data/spec/fixtures/solr_documents/tilejson.json +38 -0
  43. data/spec/fixtures/solr_documents/tms.json +2 -2
  44. data/spec/fixtures/solr_documents/wmts-multiple.json +32 -0
  45. data/spec/fixtures/solr_documents/wmts-single-layer.json +38 -0
  46. data/spec/fixtures/solr_documents/xyz.json +29 -0
  47. data/spec/spec_helper.rb +4 -0
  48. data/spec/views/catalog/_results_pagination.html.erb_spec.rb +1 -1
  49. data/spec/views/catalog/_show_downloads.html.erb_spec.rb +1 -1
  50. metadata +45 -8
@@ -16,7 +16,10 @@ module Geoblacklight
16
16
  wcs: 'http://www.opengis.net/def/serviceType/ogc/wcs',
17
17
  wfs: 'http://www.opengis.net/def/serviceType/ogc/wfs',
18
18
  wms: 'http://www.opengis.net/def/serviceType/ogc/wms',
19
+ wmts: 'http://www.opengis.net/def/serviceType/ogc/wmts',
19
20
  tms: 'https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification',
21
+ tilejson: 'https://github.com/mapbox/tilejson-spec',
22
+ xyz: 'https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames',
20
23
  hgl: 'http://schema.org/DownloadAction',
21
24
  feature_layer: 'urn:x-esri:serviceType:ArcGIS#FeatureLayer',
22
25
  tiled_map_layer: 'urn:x-esri:serviceType:ArcGIS#TiledMapLayer',
@@ -16,8 +16,10 @@ module Geoblacklight
16
16
  # GeoblacklightHelper is needed by all helpers, so we inject it
17
17
  # into action view base here.
18
18
  initializer 'geoblacklight.helpers' do
19
- ActionView::Base.send :include, GeoblacklightHelper
20
- ActionView::Base.send :include, CartoHelper
19
+ config.after_initialize do
20
+ ActionView::Base.send :include, GeoblacklightHelper
21
+ ActionView::Base.send :include, CartoHelper
22
+ end
21
23
  end
22
24
 
23
25
  config.to_prepare do
@@ -51,8 +51,20 @@ module Geoblacklight
51
51
  @references.tms
52
52
  end
53
53
 
54
+ def xyz
55
+ @references.xyz
56
+ end
57
+
58
+ def tilejson
59
+ @references.tilejson
60
+ end
61
+
62
+ def wmts
63
+ @references.wmts
64
+ end
65
+
54
66
  def viewer_preference
55
- [oembed, index_map, tms, wms, iiif, tiled_map_layer, dynamic_map_layer,
67
+ [oembed, index_map, tilejson, xyz, wmts, tms, wms, iiif, tiled_map_layer, dynamic_map_layer,
56
68
  image_map_layer, feature_layer].compact.map(&:to_hash).first
57
69
  end
58
70
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Geoblacklight
3
- VERSION = '3.4.0'
3
+ VERSION = '3.7.0'
4
4
  end
@@ -70,9 +70,9 @@
70
70
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
71
71
  <query>
72
72
  <maxBooleanClauses>1024</maxBooleanClauses>
73
- <filterCache class="solr.FastLRUCache" size="512" initialSize="512" autowarmCount="0"/>
74
- <queryResultCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0"/>
75
- <documentCache class="solr.LRUCache" size="512" initialSize="512" autowarmCount="0"/>
73
+ <filterCache class="solr.CaffeineCache" size="512" initialSize="512" autowarmCount="0" async="true"/>
74
+ <queryResultCache class="solr.CaffeineCache" size="512" initialSize="512" autowarmCount="0" async="true"/>
75
+ <documentCache class="solr.CaffeineCache" size="512" initialSize="512" autowarmCount="0" async="true"/>
76
76
  <enableLazyFieldLoading>true</enableLazyFieldLoading>
77
77
  <queryResultWindowSize>20</queryResultWindowSize>
78
78
  <queryResultMaxDocsCached>200</queryResultMaxDocsCached>
@@ -21,9 +21,9 @@ feature 'Home page', js: true do # use js: true for tests which require js, but
21
21
  expect(page).to have_css '.category-block', count: 4
22
22
  expect(page).to have_css '.home-facet-link', count: 36
23
23
  expect(page).to have_css 'a.more_facets_link', count: 4
24
- click_link 'Elevation'
24
+ click_link 'Transportation'
25
25
  expect(page).to have_css '.filter-name', text: 'Subject'
26
- expect(page).to have_css '.filter-value', text: 'Elevation'
26
+ expect(page).to have_css '.filter-value', text: 'Transportation'
27
27
  end
28
28
  scenario 'map should be visible' do
29
29
  within '#main-container' do
@@ -10,7 +10,7 @@ feature 'Index view', js: true do
10
10
  scenario 'should have documents and map on page' do
11
11
  visit search_catalog_path(f: { Settings.FIELDS.PROVENANCE => ['Stanford'] })
12
12
  expect(page).to have_css('#documents')
13
- expect(page).to have_css('.document', count: 6)
13
+ expect(page).to have_css('.document', count: 7)
14
14
  expect(page).to have_css('#map')
15
15
  end
16
16
 
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ feature 'tilejson layer' do
5
+ before do
6
+ WebMock.disable_net_connect!(allow_localhost: true, allow: 'chromedriver.storage.googleapis.com')
7
+ end
8
+
9
+ after do
10
+ WebMock.allow_net_connect!
11
+ end
12
+
13
+ scenario 'displays tilejson layer', js: true do
14
+ # Mock tilejson manifest url
15
+ stub_request(:get, 'https://map-tiles-staging.princeton.edu/mosaicjson/tilejson.json?id=2a91d82c541c426cb787cc62afe8f248')
16
+ .to_return(status: 200, body: read_fixture('manifests/tilejson.json'))
17
+
18
+ visit solr_document_path('princeton-fk4544658v-tilejson')
19
+ expect(page).to have_css '.leaflet-control-zoom', visible: :visible
20
+ expect(page).to have_css "img[src*='https://map-tiles-staging.princeton.edu/mosaicjson/tiles/WebMercatorQuad']"
21
+ end
22
+ end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
 
4
4
  feature 'tms layer' do
5
5
  scenario 'displays tms layer', js: true do
6
- visit solr_document_path('6f47b103-9955-4bbe-a364-387039623106')
6
+ visit solr_document_path('6f47b103-9955-4bbe-a364-387039623106-tms')
7
7
  expect(page).to have_css '.leaflet-control-zoom', visible: true
8
8
  expect(page).to have_css "img[src*='earthquake.usgs.gov']"
9
9
  end
@@ -23,4 +23,37 @@ feature 'web services tools' do
23
23
  expect(page).not_to have_css 'li.web_services a', text: 'Web services'
24
24
  end
25
25
  end
26
+ feature 'when xyz tile reference is provided', js: true do
27
+ scenario 'shows up in tools' do
28
+ visit solr_document_path '6f47b103-9955-4bbe-a364-387039623106-xyz'
29
+ expect(page).to have_css 'li.web_services a', text: 'Web services'
30
+ click_link 'Web services'
31
+ within '.modal-body' do
32
+ expect(page).to have_css 'label', text: 'XYZ Tiles'
33
+ expect(page).to have_css 'input[value="https://earthquake.usgs.gov/basemap/tiles/faults/{z}/{x}/{y}.png"]'
34
+ end
35
+ end
36
+ end
37
+ feature 'when wmts tile reference is provided', js: true do
38
+ scenario 'shows up in tools' do
39
+ visit solr_document_path 'princeton-fk4544658v-wmts'
40
+ expect(page).to have_css 'li.web_services a', text: 'Web services'
41
+ click_link 'Web services'
42
+ within '.modal-body' do
43
+ expect(page).to have_css 'label', text: 'Web Map Tile Service'
44
+ expect(page).to have_css 'input[value="https://map-tiles-staging.princeton.edu/mosaicjson/WMTSCapabilities.xml?id=2a91d82c541c426cb787cc62afe8f248"]'
45
+ end
46
+ end
47
+ end
48
+ feature 'when tilejson reference is provided', js: true do
49
+ scenario 'shows up in tools' do
50
+ visit solr_document_path 'princeton-fk4544658v-tilejson'
51
+ expect(page).to have_css 'li.web_services a', text: 'Web services'
52
+ click_link 'Web services'
53
+ within '.modal-body' do
54
+ expect(page).to have_css 'label', text: 'TileJSON Document'
55
+ expect(page).to have_css 'input[value="https://map-tiles-staging.princeton.edu/mosaicjson/tilejson.json?id=2a91d82c541c426cb787cc62afe8f248"]'
56
+ end
57
+ end
58
+ end
26
59
  end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ feature 'wmts layer' do
5
+ before do
6
+ WebMock.disable_net_connect!(allow_localhost: true, allow: 'chromedriver.storage.googleapis.com')
7
+ end
8
+
9
+ after do
10
+ WebMock.allow_net_connect!
11
+ end
12
+
13
+ context 'when referencing a WMTSCapabilities document with a single layer' do
14
+ scenario 'displays the layer', js: true do
15
+ # Mock wmts manifest url
16
+ stub_request(:get, 'https://map-tiles-staging.princeton.edu/mosaicjson/WMTSCapabilities.xml?id=2a91d82c541c426cb787cc62afe8f248')
17
+ .to_return(status: 200, body: read_fixture('manifests/wmts-single.xml'))
18
+
19
+ visit solr_document_path('princeton-fk4544658v-wmts')
20
+ expect(page).to have_css '.leaflet-control-zoom', visible: :visible
21
+ expect(page).to have_css "img[src*='map-tiles-staging.princeton.edu/mosaicjson/tiles/WebMercatorQuad']"
22
+ end
23
+ end
24
+ context 'when referencing a WMTSCapabilities document with a multiple layers' do
25
+ scenario 'displays the layer referenced in the layer_id field', js: true do
26
+ # Mock wmts manifest url
27
+ stub_request(:get, 'https://maps.wien.gv.at/wmts/1.0.0/WMTSCapabilities.xml')
28
+ .to_return(status: 200, body: read_fixture('manifests/wmts-multiple.xml'))
29
+ visit solr_document_path('princeton-fk4db9hn29')
30
+ expect(page).to have_css '.leaflet-control-zoom', visible: :visible
31
+ expect(page).to have_css "img[src*='http://maps1.wien.gv.at/wmts/lb2016/farbe/google3857']"
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ feature 'xyz layer' do
5
+ scenario 'displays tms layer', js: true do
6
+ visit solr_document_path('6f47b103-9955-4bbe-a364-387039623106-xyz')
7
+ expect(page).to have_css '.leaflet-control-zoom', visible: :visible
8
+ expect(page).to have_css "img[src*='earthquake.usgs.gov']"
9
+ end
10
+ end
@@ -0,0 +1,21 @@
1
+ {
2
+ "tilejson": "2.2.0",
3
+ "version": "1.0.0",
4
+ "scheme": "xyz",
5
+ "tiles": [
6
+ "https://map-tiles-staging.princeton.edu/mosaicjson/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?url=s3%3A%2F%2Ffiggy-geo-staging%2F2a%2F91%2Fd8%2F2a91d82c541c426cb787cc62afe8f248%2Fmosaic-6c5b32bfe4cb8e4fb07d32cd6656d024.json&rescale=0%2C255"
7
+ ],
8
+ "minzoom": 8,
9
+ "maxzoom": 13,
10
+ "bounds": [
11
+ 19.22222222200001,
12
+ 39.74997750505241,
13
+ 29.356941715411907,
14
+ 43.083333000050004
15
+ ],
16
+ "center": [
17
+ 24.28958196870596,
18
+ 41.41665525255121,
19
+ 8
20
+ ]
21
+ }