geoblacklight 6.0.0.pre.beta.2 → 6.0.0.pre.beta.3
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 +4 -4
- data/app/assets/stylesheets/geoblacklight/record.css +1 -2
- data/app/assets/stylesheets/geoblacklight/search.css +3 -4
- data/app/assets/stylesheets/geoblacklight.css +0 -1
- data/app/components/geoblacklight/document/download_link_component.html.erb +1 -1
- data/app/components/geoblacklight/document/download_links_component.html.erb +1 -1
- data/app/components/geoblacklight/document/download_links_component.rb +1 -1
- data/app/components/geoblacklight/document/preview_component.html.erb +1 -1
- data/app/components/geoblacklight/document/preview_component.rb +45 -0
- data/app/components/geoblacklight/iiif_drag_drop_component.rb +1 -1
- data/app/components/geoblacklight/metadata_description_markdown_component.rb +1 -1
- data/app/components/geoblacklight/relations/relation_component.html.erb +2 -4
- data/app/components/geoblacklight/relations/relation_component.rb +0 -4
- data/app/components/geoblacklight/search_result_component.html.erb +2 -4
- data/app/components/geoblacklight/search_result_component.rb +0 -3
- data/app/components/geoblacklight/static_map_component.rb +2 -3
- data/app/helpers/geoblacklight_helper.rb +0 -18
- data/app/javascript/geoblacklight/controllers/overview_map_controller.js +4 -3
- data/app/javascript/geoblacklight/initializers/field_truncation.js +1 -4
- data/app/models/concerns/geoblacklight/bbox_filter_field.rb +0 -13
- data/app/models/concerns/geoblacklight/solr_document/preview.rb +58 -0
- data/app/models/concerns/geoblacklight/solr_document.rb +20 -23
- data/app/views/catalog/_document_split.html.erb +1 -1
- data/config/importmap.rb +5 -6
- data/geoblacklight.gemspec +1 -1
- data/lib/generators/geoblacklight/templates/assets/customizations.css +13 -4
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +4 -6
- data/lib/geoblacklight/constants.rb +1 -0
- data/lib/geoblacklight/references.rb +0 -9
- data/lib/geoblacklight/version.rb +1 -1
- data/spec/components/geoblacklight/citation_component_spec.rb +2 -2
- data/spec/components/geoblacklight/{item_map_viewer_component_spec.rb → document/preview_component_spec.rb} +6 -1
- data/spec/components/geoblacklight/download_links_component_spec.rb +1 -1
- data/spec/components/geoblacklight/iiif_drag_drop_component_spec.rb +7 -7
- data/spec/components/geoblacklight/relations/relation_component_spec.rb +3 -11
- data/spec/components/geoblacklight/search_result_component_spec.rb +4 -12
- data/spec/components/geoblacklight/static_map_component_spec.rb +19 -10
- data/spec/features/search_results_map_spec.rb +13 -0
- data/spec/features/search_spec.rb +1 -1
- data/spec/features/truncated_metadata_spec.rb +0 -5
- data/spec/fixtures/solr_documents/README.md +63 -57
- data/spec/fixtures/solr_documents/b1g_iiif_manifest.json +1 -1
- data/spec/fixtures/solr_documents/baruch_documentation_download.json +1 -0
- data/spec/fixtures/solr_documents/bbox-spans-180.json +3 -3
- data/spec/fixtures/solr_documents/bluemarble.json +28 -0
- data/spec/fixtures/solr_documents/complex-geom.json +3 -3
- data/spec/fixtures/solr_documents/cornell-roads-fgdc.json +19 -0
- data/spec/fixtures/solr_documents/dalian.json +38 -0
- data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +2 -2
- data/spec/fixtures/solr_documents/metadata_no_provider.json +0 -1
- data/spec/fixtures/solr_documents/modis-ndvi.json +36 -0
- data/spec/fixtures/solr_documents/panama.json +37 -0
- data/spec/fixtures/solr_documents/public_cog_princeton.json +0 -2
- data/spec/fixtures/solr_documents/stanford-geojson.json +39 -0
- data/spec/fixtures/solr_documents/usgs-htmc-index-ca-24000.json +36 -0
- data/spec/fixtures/solr_documents/usgs-tnm-index-dem1.json +28 -0
- data/spec/helpers/geoblacklight_helper_spec.rb +0 -32
- data/spec/lib/geoblacklight/references_spec.rb +8 -14
- data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +0 -24
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +30 -23
- data/spec/requests/catalog_search_spec.rb +1 -1
- data/spec/requests/catalog_show_spec.rb +2 -2
- data/spec/requests/index_view_spec.rb +6 -6
- data/spec/requests/metadata_spec.rb +1 -1
- data/spec/requests/missing_metadata_spec.rb +13 -13
- data/spec/requests/search_results_spec.rb +4 -3
- data/spec/spec_helper.rb +5 -0
- metadata +13 -16
- data/app/assets/stylesheets/geoblacklight/index_maps.css +0 -29
- data/app/components/geoblacklight/item_map_viewer_component.html.erb +0 -1
- data/app/components/geoblacklight/item_map_viewer_component.rb +0 -52
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +0 -17
- data/lib/geoblacklight/geometry.rb +0 -86
- data/lib/geoblacklight/item_viewer.rb +0 -84
- data/spec/fixtures/solr_documents/no_locn_geometry.json +0 -17
- data/spec/fixtures/solr_documents/no_spatial.json +0 -28
- data/spec/javascripts/metadata_download_button_spec.js +0 -17
- data/spec/lib/geoblacklight/geometry_spec.rb +0 -60
- data/spec/lib/geoblacklight/item_viewer_spec.rb +0 -77
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +0 -19
|
@@ -43,6 +43,7 @@ RSpec.describe "Search results", type: :request do
|
|
|
43
43
|
expect(result_ids).to start_with(
|
|
44
44
|
"e9c71086-6b25-4950-8e1c-84c2794e3382",
|
|
45
45
|
"2eddde2f-c222-41ca-bd07-2fd74a21f4de",
|
|
46
|
+
"31567cf1-bad8-4bc5-8d57-44b96c207ecc",
|
|
46
47
|
"02236876-9c21-42f6-9870-d2562da8e44f"
|
|
47
48
|
)
|
|
48
49
|
end
|
|
@@ -55,8 +56,8 @@ RSpec.describe "Search results", type: :request do
|
|
|
55
56
|
f: {Geoblacklight.configuration.fields.provider => ["Cornell"]}
|
|
56
57
|
)
|
|
57
58
|
|
|
58
|
-
expect(result_ids.
|
|
59
|
-
expect(result_ids.index("cugir-008186
|
|
60
|
-
expect(result_ids.index("cugir-
|
|
59
|
+
expect(result_ids.last).to eq("cugir-007741")
|
|
60
|
+
expect(result_ids.index("cugir-008186")).to be < result_ids.index("cugir-007741")
|
|
61
|
+
expect(result_ids.index("cugir-008186-no-downloadurl")).to be < result_ids.index("cugir-007741")
|
|
61
62
|
end
|
|
62
63
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -59,6 +59,11 @@ Capybara.register_driver :chrome_headless do |app|
|
|
|
59
59
|
# layers from external hosts; in CI those requests can hang and prevent
|
|
60
60
|
# `load` from ever firing, causing Net::ReadTimeout on #visit.
|
|
61
61
|
options.page_load_strategy = :eager
|
|
62
|
+
# Don't check the password the specs sign in with against Google's list of breached passwords.
|
|
63
|
+
# It is on that list ("password"), so a moment after a sign-in Chrome puts its "Change your
|
|
64
|
+
# password" dialog over the tab. Nothing on screen shows it in headless Chrome, but it
|
|
65
|
+
# steals clicks from other elements in the page, which makes specs intermittently fail.
|
|
66
|
+
options.add_preference("profile.password_manager_leak_detection", false)
|
|
62
67
|
|
|
63
68
|
# Allow longer TCP reads to prevent timeout in the case of loading fixture
|
|
64
69
|
# eee6150b-ce2f-4837-9d17-ce72a0c1c26f, as part of relations_spec.rb
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: geoblacklight
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.0.pre.beta.
|
|
4
|
+
version: 6.0.0.pre.beta.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Graves
|
|
@@ -142,14 +142,14 @@ dependencies:
|
|
|
142
142
|
requirements:
|
|
143
143
|
- - "~>"
|
|
144
144
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: '0.
|
|
145
|
+
version: '0.12'
|
|
146
146
|
type: :runtime
|
|
147
147
|
prerelease: false
|
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
149
|
requirements:
|
|
150
150
|
- - "~>"
|
|
151
151
|
- !ruby/object:Gem::Version
|
|
152
|
-
version: '0.
|
|
152
|
+
version: '0.12'
|
|
153
153
|
- !ruby/object:Gem::Dependency
|
|
154
154
|
name: mime-types
|
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -379,7 +379,6 @@ files:
|
|
|
379
379
|
- app/assets/stylesheets/geoblacklight.css
|
|
380
380
|
- app/assets/stylesheets/geoblacklight/global.css
|
|
381
381
|
- app/assets/stylesheets/geoblacklight/home.css
|
|
382
|
-
- app/assets/stylesheets/geoblacklight/index_maps.css
|
|
383
382
|
- app/assets/stylesheets/geoblacklight/record.css
|
|
384
383
|
- app/assets/stylesheets/geoblacklight/search.css
|
|
385
384
|
- app/assets/stylesheets/geoblacklight/viewers.css
|
|
@@ -459,8 +458,6 @@ files:
|
|
|
459
458
|
- app/components/geoblacklight/homepage_feature_facet_component.rb
|
|
460
459
|
- app/components/geoblacklight/iiif_drag_drop_component.html.erb
|
|
461
460
|
- app/components/geoblacklight/iiif_drag_drop_component.rb
|
|
462
|
-
- app/components/geoblacklight/item_map_viewer_component.html.erb
|
|
463
|
-
- app/components/geoblacklight/item_map_viewer_component.rb
|
|
464
461
|
- app/components/geoblacklight/locator_map_component.html.erb
|
|
465
462
|
- app/components/geoblacklight/locator_map_component.rb
|
|
466
463
|
- app/components/geoblacklight/login_link_component.html.erb
|
|
@@ -509,7 +506,7 @@ files:
|
|
|
509
506
|
- app/models/concerns/geoblacklight/solr_document/arcgis.rb
|
|
510
507
|
- app/models/concerns/geoblacklight/solr_document/citation.rb
|
|
511
508
|
- app/models/concerns/geoblacklight/solr_document/finder.rb
|
|
512
|
-
- app/models/concerns/geoblacklight/solr_document/
|
|
509
|
+
- app/models/concerns/geoblacklight/solr_document/preview.rb
|
|
513
510
|
- app/models/concerns/geoblacklight/solr_document/thumbnail.rb
|
|
514
511
|
- app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb
|
|
515
512
|
- app/presenters/geoblacklight/bbox_item_presenter.rb
|
|
@@ -549,8 +546,6 @@ files:
|
|
|
549
546
|
- lib/geoblacklight/deprecation.rb
|
|
550
547
|
- lib/geoblacklight/engine.rb
|
|
551
548
|
- lib/geoblacklight/exceptions.rb
|
|
552
|
-
- lib/geoblacklight/geometry.rb
|
|
553
|
-
- lib/geoblacklight/item_viewer.rb
|
|
554
549
|
- lib/geoblacklight/metadata.rb
|
|
555
550
|
- lib/geoblacklight/metadata/base.rb
|
|
556
551
|
- lib/geoblacklight/metadata/fgdc.rb
|
|
@@ -592,13 +587,13 @@ files:
|
|
|
592
587
|
- spec/components/geoblacklight/arcgis_component_spec.rb
|
|
593
588
|
- spec/components/geoblacklight/citation_component_spec.rb
|
|
594
589
|
- spec/components/geoblacklight/display_note_component_spec.rb
|
|
590
|
+
- spec/components/geoblacklight/document/preview_component_spec.rb
|
|
595
591
|
- spec/components/geoblacklight/document/sidebar_component_spec.rb
|
|
596
592
|
- spec/components/geoblacklight/document_component_spec.rb
|
|
597
593
|
- spec/components/geoblacklight/download_links_component_spec.rb
|
|
598
594
|
- spec/components/geoblacklight/header_badges_component_spec.rb
|
|
599
595
|
- spec/components/geoblacklight/homepage_feature_facet_component_spec.rb
|
|
600
596
|
- spec/components/geoblacklight/iiif_drag_drop_component_spec.rb
|
|
601
|
-
- spec/components/geoblacklight/item_map_viewer_component_spec.rb
|
|
602
597
|
- spec/components/geoblacklight/locator_map_component_spec.rb
|
|
603
598
|
- spec/components/geoblacklight/login_link_component_spec.rb
|
|
604
599
|
- spec/components/geoblacklight/metadata_component_spec.rb
|
|
@@ -665,8 +660,11 @@ files:
|
|
|
665
660
|
- spec/fixtures/solr_documents/baruch_ancestor2.json
|
|
666
661
|
- spec/fixtures/solr_documents/baruch_documentation_download.json
|
|
667
662
|
- spec/fixtures/solr_documents/bbox-spans-180.json
|
|
663
|
+
- spec/fixtures/solr_documents/bluemarble.json
|
|
668
664
|
- spec/fixtures/solr_documents/complex-geom.json
|
|
665
|
+
- spec/fixtures/solr_documents/cornell-roads-fgdc.json
|
|
669
666
|
- spec/fixtures/solr_documents/cornell_html_metadata.json
|
|
667
|
+
- spec/fixtures/solr_documents/dalian.json
|
|
670
668
|
- spec/fixtures/solr_documents/display-note.json
|
|
671
669
|
- spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json
|
|
672
670
|
- spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json
|
|
@@ -682,10 +680,10 @@ files:
|
|
|
682
680
|
- spec/fixtures/solr_documents/index_map_point.json
|
|
683
681
|
- spec/fixtures/solr_documents/metadata_no_geom.json
|
|
684
682
|
- spec/fixtures/solr_documents/metadata_no_provider.json
|
|
683
|
+
- spec/fixtures/solr_documents/modis-ndvi.json
|
|
685
684
|
- spec/fixtures/solr_documents/multiple-downloads.json
|
|
686
|
-
- spec/fixtures/solr_documents/no_locn_geometry.json
|
|
687
|
-
- spec/fixtures/solr_documents/no_spatial.json
|
|
688
685
|
- spec/fixtures/solr_documents/oembed.json
|
|
686
|
+
- spec/fixtures/solr_documents/panama.json
|
|
689
687
|
- spec/fixtures/solr_documents/princeton-child1.json
|
|
690
688
|
- spec/fixtures/solr_documents/princeton-child2.json
|
|
691
689
|
- spec/fixtures/solr_documents/princeton-child3.json
|
|
@@ -696,24 +694,24 @@ files:
|
|
|
696
694
|
- spec/fixtures/solr_documents/public_pmtiles_princeton.json
|
|
697
695
|
- spec/fixtures/solr_documents/public_polygon.json
|
|
698
696
|
- spec/fixtures/solr_documents/restricted-line.json
|
|
697
|
+
- spec/fixtures/solr_documents/stanford-geojson.json
|
|
699
698
|
- spec/fixtures/solr_documents/the-related-record.json
|
|
700
699
|
- spec/fixtures/solr_documents/tilejson.json
|
|
701
700
|
- spec/fixtures/solr_documents/tms.json
|
|
702
701
|
- spec/fixtures/solr_documents/umn_metro_result1.json
|
|
703
702
|
- spec/fixtures/solr_documents/umn_state_result1.json
|
|
704
703
|
- spec/fixtures/solr_documents/umn_state_result2.json
|
|
704
|
+
- spec/fixtures/solr_documents/usgs-htmc-index-ca-24000.json
|
|
705
|
+
- spec/fixtures/solr_documents/usgs-tnm-index-dem1.json
|
|
705
706
|
- spec/fixtures/solr_documents/wmts-multiple.json
|
|
706
707
|
- spec/fixtures/solr_documents/wmts-single-layer.json
|
|
707
708
|
- spec/fixtures/solr_documents/xyz.json
|
|
708
709
|
- spec/helpers/geoblacklight_helper_spec.rb
|
|
709
|
-
- spec/javascripts/metadata_download_button_spec.js
|
|
710
710
|
- spec/lib/geoblacklight/bounding_box_spec.rb
|
|
711
711
|
- spec/lib/geoblacklight/configuration/default_settings_builder_spec.rb
|
|
712
712
|
- spec/lib/geoblacklight/configuration/relationships_config_spec.rb
|
|
713
713
|
- spec/lib/geoblacklight/configuration/settings_attributes_spec.rb
|
|
714
714
|
- spec/lib/geoblacklight/configuration/settings_builder_spec.rb
|
|
715
|
-
- spec/lib/geoblacklight/geometry_spec.rb
|
|
716
|
-
- spec/lib/geoblacklight/item_viewer_spec.rb
|
|
717
715
|
- spec/lib/geoblacklight/metadata/base_spec.rb
|
|
718
716
|
- spec/lib/geoblacklight/metadata/html_spec.rb
|
|
719
717
|
- spec/lib/geoblacklight/metadata_spec.rb
|
|
@@ -731,7 +729,6 @@ files:
|
|
|
731
729
|
- spec/models/concerns/geoblacklight/bbox_filter_query_spec.rb
|
|
732
730
|
- spec/models/concerns/geoblacklight/solr_document/citation_spec.rb
|
|
733
731
|
- spec/models/concerns/geoblacklight/solr_document/finder_spec.rb
|
|
734
|
-
- spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb
|
|
735
732
|
- spec/models/concerns/geoblacklight/solr_document/thumbnail_spec.rb
|
|
736
733
|
- spec/models/concerns/geoblacklight/solr_document_spec.rb
|
|
737
734
|
- spec/models/concerns/geoblacklight/suppressed_records_search_behavior_spec.rb
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/* Styles for index maps */
|
|
2
|
-
|
|
3
|
-
/* Index map legend */
|
|
4
|
-
.index-map-legend {
|
|
5
|
-
margin-bottom: 0.5em;
|
|
6
|
-
display: flex;
|
|
7
|
-
flex-direction: column;
|
|
8
|
-
justify-content: flex-start;
|
|
9
|
-
align-items: flex-start;
|
|
10
|
-
gap: 0.5em;
|
|
11
|
-
|
|
12
|
-
@media (min-width: 992px) {
|
|
13
|
-
flex-direction: row;
|
|
14
|
-
gap: 1em;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.index-map-legend-info {
|
|
19
|
-
display: flex;
|
|
20
|
-
flex: 0 0 auto;
|
|
21
|
-
gap: 0.5em;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.index-map-legend-swatch {
|
|
25
|
-
display: inline-block;
|
|
26
|
-
border: var(--bs-border-width) solid var(--bs-border-color);
|
|
27
|
-
width: 1.5em;
|
|
28
|
-
height: 1.5em;
|
|
29
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<%= display_tag %>
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Geoblacklight
|
|
4
|
-
class ItemMapViewerComponent < ViewComponent::Base
|
|
5
|
-
def initialize(document:)
|
|
6
|
-
super()
|
|
7
|
-
@document = document
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
# Use the appropriate viewer based on the protocol of the document
|
|
11
|
-
def display_tag
|
|
12
|
-
return oembed_tag if @document.viewer_protocol == "oembed"
|
|
13
|
-
ogm_viewer_tag
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def render?
|
|
17
|
-
@document
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
private
|
|
21
|
-
|
|
22
|
-
def oembed_tag
|
|
23
|
-
tag.div(nil,
|
|
24
|
-
id: "oembed-viewer",
|
|
25
|
-
class: "viewer oembed-viewer",
|
|
26
|
-
data: {
|
|
27
|
-
controller: "oembed-viewer",
|
|
28
|
-
oembed_viewer_url_value: @document.viewer_endpoint
|
|
29
|
-
})
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def ogm_viewer_tag
|
|
33
|
-
tag.ogm_viewer(nil,
|
|
34
|
-
:class => "viewer ogm-viewer",
|
|
35
|
-
"hide-title" => true,
|
|
36
|
-
"theme" => helpers.geoblacklight_viewer_theme,
|
|
37
|
-
"light-basemap" => Geoblacklight.configuration.light_basemap_url,
|
|
38
|
-
"dark-basemap" => Geoblacklight.configuration.dark_basemap_url,
|
|
39
|
-
"record-url" => helpers.viewer_solr_document_path(@document),
|
|
40
|
-
:data => {restricted_origins: restricted_origins})
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# URLs where the viewer will send credentials (cookies) to, in order to try
|
|
44
|
-
# to preview restricted data
|
|
45
|
-
def restricted_origins
|
|
46
|
-
origins = Geoblacklight.configuration.restricted_origins
|
|
47
|
-
return if origins.blank? || !@document.restricted? || !helpers.document_available?(@document)
|
|
48
|
-
|
|
49
|
-
origins.to_json
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Geoblacklight
|
|
4
|
-
module SolrDocument
|
|
5
|
-
##
|
|
6
|
-
# Module to provide inspection logic for solr document
|
|
7
|
-
module Inspection
|
|
8
|
-
##
|
|
9
|
-
# Returns boolean about whether document viewer protocol is inspectable
|
|
10
|
-
# @return [Boolean]
|
|
11
|
-
def inspectable?
|
|
12
|
-
%w[wms feature_layer dynamic_map_layer tiled_map_layer pmtiles]
|
|
13
|
-
.include? viewer_protocol
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "rgeo"
|
|
4
|
-
require "rgeo-geojson"
|
|
5
|
-
|
|
6
|
-
module Geoblacklight
|
|
7
|
-
# Transforms and parses geometry expressed in WKT or CSW WKT ENVELOPE syntax
|
|
8
|
-
class Geometry
|
|
9
|
-
attr_reader :geom
|
|
10
|
-
|
|
11
|
-
# @param [String] geom WKT or WKT ENVELOPE syntax formatted string
|
|
12
|
-
def initialize(geom)
|
|
13
|
-
@geom = geom
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Convert geometry to GeoJSON
|
|
17
|
-
# @return [String]
|
|
18
|
-
def geojson
|
|
19
|
-
obj = factory.parse_wkt(geometry_as_wkt)
|
|
20
|
-
RGeo::GeoJSON.encode(obj).to_json
|
|
21
|
-
rescue
|
|
22
|
-
Geoblacklight.logger.warn "Geometry is not valid: #{geom}"
|
|
23
|
-
default_extent
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Generate a wsen bounding box from the geometry
|
|
27
|
-
# @return [String] bounding box as comma delimited wsen "w, s, e, n"
|
|
28
|
-
def bounding_box
|
|
29
|
-
obj = factory.parse_wkt(geometry_as_wkt)
|
|
30
|
-
|
|
31
|
-
# Get the minimum bounding box for the geometry as a Polygon
|
|
32
|
-
bbox = obj.envelope
|
|
33
|
-
|
|
34
|
-
# Return as wsen string
|
|
35
|
-
minx = bbox.coordinates[0][0][0]
|
|
36
|
-
miny = bbox.coordinates[0][0][1]
|
|
37
|
-
maxx = bbox.coordinates[0][1][0]
|
|
38
|
-
maxy = bbox.coordinates[0][2][1]
|
|
39
|
-
"#{minx}, #{miny}, #{maxx}, #{maxy}"
|
|
40
|
-
rescue RGeo::Error::ParseError
|
|
41
|
-
Geoblacklight.logger.warn "Error parsing geometry: #{geom}"
|
|
42
|
-
default_extent
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
private
|
|
46
|
-
|
|
47
|
-
# Default extent as GeoJSON
|
|
48
|
-
# @return [String]
|
|
49
|
-
def default_extent
|
|
50
|
-
{
|
|
51
|
-
"type" => "Polygon",
|
|
52
|
-
"coordinates" => [
|
|
53
|
-
[
|
|
54
|
-
[-180.0, 90.0], [-180.0, -90.0], [180.0, -90.0], [180.0, 90.0], [-180.0, 90.0]
|
|
55
|
-
]
|
|
56
|
-
]
|
|
57
|
-
}.to_json
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
# Convert WKT ENVELOPE string to WKT POLYGON string
|
|
61
|
-
# @return [String]
|
|
62
|
-
def envelope_to_polygon
|
|
63
|
-
exp = /^\s*ENVELOPE\(
|
|
64
|
-
\s*([-.\d]+)\s*,
|
|
65
|
-
\s*([-.\d]+)\s*,
|
|
66
|
-
\s*([-.\d]+)\s*,
|
|
67
|
-
\s*([-.\d]+)\s*
|
|
68
|
-
\)\s*$/x # uses 'x' option for free-spacing mode
|
|
69
|
-
bbox_match = exp.match(geom)
|
|
70
|
-
minx, maxx, maxy, miny = bbox_match.captures
|
|
71
|
-
"POLYGON ((#{minx} #{maxy}, #{minx} #{miny}, #{maxx} #{miny}, #{maxx} #{maxy}, #{minx} #{maxy}))"
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def factory
|
|
75
|
-
@factory ||= RGeo::Cartesian.factory
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
# Return geometry as valid WKT string
|
|
79
|
-
# @return [String]
|
|
80
|
-
def geometry_as_wkt
|
|
81
|
-
return geom unless geom.match?(/ENVELOPE/)
|
|
82
|
-
|
|
83
|
-
envelope_to_polygon
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Geoblacklight
|
|
4
|
-
class ItemViewer
|
|
5
|
-
def initialize(references)
|
|
6
|
-
@references = references
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def viewer_protocol
|
|
10
|
-
return if viewer_preference.nil?
|
|
11
|
-
viewer_preference.keys.first.to_s
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def viewer_endpoint
|
|
15
|
-
return "" if viewer_preference.nil?
|
|
16
|
-
viewer_preference.values.first.to_s
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def wms
|
|
20
|
-
@references.wms
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def iiif
|
|
24
|
-
@references.iiif
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def iiif_manifest
|
|
28
|
-
@references.iiif_manifest
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def tiled_map_layer
|
|
32
|
-
@references.tiled_map_layer
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def dynamic_map_layer
|
|
36
|
-
@references.dynamic_map_layer
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def feature_layer
|
|
40
|
-
@references.feature_layer
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def image_map_layer
|
|
44
|
-
@references.image_map_layer
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def index_map
|
|
48
|
-
@references.index_map
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def oembed
|
|
52
|
-
@references.oembed
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def tms
|
|
56
|
-
@references.tms
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def xyz
|
|
60
|
-
@references.xyz
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def tilejson
|
|
64
|
-
@references.tilejson
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def wmts
|
|
68
|
-
@references.wmts
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def cog
|
|
72
|
-
@references.cog
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def pmtiles
|
|
76
|
-
@references.pmtiles
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def viewer_preference
|
|
80
|
-
[oembed, cog, pmtiles, index_map, tilejson, xyz, wmts, tms, wms, iiif_manifest, iiif, tiled_map_layer, dynamic_map_layer,
|
|
81
|
-
image_map_layer, feature_layer].compact.map(&:to_hash).first
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"dct_title_s": "University of Minnesota Digital Conservancy DRUM",
|
|
3
|
-
"dct_alternative_sm": ["no_locn_geometry"],
|
|
4
|
-
"dct_description_sm": [
|
|
5
|
-
"This is a collection level record without spatial coordinates or a Geometry Type (GBL Metadata 1.0). ",
|
|
6
|
-
"DRUM is a publicly available collection of digital research data generated by University of Minnesota researchers, students, and staff. Anyone can search and download the data housed in the repository, instantly or by request."
|
|
7
|
-
],
|
|
8
|
-
"dct_publisher_sm": ["University of Minnesota Digital Conservancy"],
|
|
9
|
-
"schema_provider_s": "University of Minnesota",
|
|
10
|
-
"gbl_resourceClass_sm": ["Collections"],
|
|
11
|
-
"dcat_keyword_sm": ["GBL Fixture records"],
|
|
12
|
-
"dct_accessRights_s": "Public",
|
|
13
|
-
"dct_references_s": "{\"http://schema.org/url\":\"https://conservancy.umn.edu/handle/11299/166578\"}",
|
|
14
|
-
"id": "05d-03-noGeomType",
|
|
15
|
-
"gbl_mdModified_dt": "2021-06-11T18:36:48Z",
|
|
16
|
-
"gbl_mdVersion_s": "Aardvark"
|
|
17
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"dct_title_s": "ASTER Global Emissivity Dataset 1-kilometer V003 - AG1KM",
|
|
3
|
-
"dct_alternative_sm": ["no_spatial"],
|
|
4
|
-
"dct_description_sm": [
|
|
5
|
-
"File without geometry type or locn_geometry (will cause error). ",
|
|
6
|
-
"The Advanced Spaceborne Thermal Emission and Reflection radiometer Global Emissivity Database (ASTER GED) was developed by the National Aeronautics and Space Administration's (NASA) Jet Propulsion Laboratory (JPL), California Institute of Technology. The North America portion of this collection was formerly called the North American ASTER Land Surface Emissivity Database (NAALSED) - a seasonal dataset consisting of mean summer (J-A-S) and winter (J-F-M) products. ASTER GED products are output on 1degree x 1 degree grids at 100-meter or 1-kilometer spatial resolution (nominal) and include the mean emissivity and standard deviation for all 5 ASTER thermal infrared bands, mean land surface temperature (LST) and standard deviation, a re-sampled ASTER GDEM (not included in the North America Winter products), land-water mask, mean Normalized Difference Vegetation Index (NDVI) and standard deviation, latitude, longitude, and observation count. Additional ASTER GED product information is available at https://lpdaac.usgs.gov/products/community_products_table. Product tiles are available in HDF and binary format and may be downloaded via HTTP by visiting the following data clients: NASA Reverb (http://reverb.echo.nasa.gov), LP DAAC Data Pool (http://e4ftl01.cr.usgs.gov/ASTT/), or EarthExplorer (http://earthexplorer.usgs.gov)."
|
|
7
|
-
],
|
|
8
|
-
"schema_provider_s": "U.S. Geological Survey, Department of the Interior",
|
|
9
|
-
"gbl_resourceClass_sm": ["Imagery"],
|
|
10
|
-
"dct_subject_sm": [
|
|
11
|
-
"Land surface temperature",
|
|
12
|
-
"U.S. Geological survey (USGS)",
|
|
13
|
-
"Earth observing system",
|
|
14
|
-
"Land processes distributed active archive center (LPDAAC)",
|
|
15
|
-
"Aster",
|
|
16
|
-
"Normalized difference vegetation index",
|
|
17
|
-
"Terra",
|
|
18
|
-
"Image map",
|
|
19
|
-
"Emissivity"
|
|
20
|
-
],
|
|
21
|
-
"dcat_keyword_sm": ["GBL Fixture records"],
|
|
22
|
-
"dct_accessRights_s": "Public",
|
|
23
|
-
"dct_references_s": "{}",
|
|
24
|
-
"id": "aster-global-emissivity-dataset-1-kilometer-v003-ag1kmcad20",
|
|
25
|
-
"dct_identifier_sm": ["c0515c4e-97dc-4fff-82cb-f65144482631"],
|
|
26
|
-
"gbl_mdModified_dt": "2021-06-01T22:14:16Z",
|
|
27
|
-
"gbl_mdVersion_s": "Aardvark"
|
|
28
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const MetadataDownloadButton = require("../../app/assets/javascripts/geoblacklight/modules/metadata_download_button")
|
|
2
|
-
|
|
3
|
-
describe("MetadataDownloadButton", function () {
|
|
4
|
-
describe("initialize", function () {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
document.body.innerHTML =
|
|
7
|
-
'<button id="foo" data-ref-endpoint="http://testdomain" data-ref-download="#bar">test element</button><a href="http://testdomain" id="bar">another test element</a>'
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
it("creates a new instance and sets the download button @href value", function () {
|
|
11
|
-
var button = new MetadataDownloadButton("#foo")
|
|
12
|
-
expect(button.$el.attr("id")).toBe("foo")
|
|
13
|
-
expect(button.$download.attr("id")).toBe("bar")
|
|
14
|
-
expect(button.$download.attr("href")).toBe("http://testdomain")
|
|
15
|
-
})
|
|
16
|
-
})
|
|
17
|
-
})
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "spec_helper"
|
|
4
|
-
|
|
5
|
-
RSpec.describe Geoblacklight::Geometry do
|
|
6
|
-
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)))" }
|
|
7
|
-
let(:envelope_geom) { "ENVELOPE(25, -168.35, 81.66, -12.93)" }
|
|
8
|
-
let(:invalid_geom) { "INVALID" }
|
|
9
|
-
let(:non_polygon_geom) { "ENVELOPE(130, 130, 33, 33)" }
|
|
10
|
-
|
|
11
|
-
describe "#geojson" do
|
|
12
|
-
context "with standard WKT geometry" do
|
|
13
|
-
it "returns geojson" do
|
|
14
|
-
expect(described_class.new(wkt_geom).geojson).to include("MultiPolygon", "coordinates", "[[[[-180.0,81.66]")
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context "with envelope syntax geometry" do
|
|
19
|
-
it "returns geojson" do
|
|
20
|
-
expect(described_class.new(envelope_geom).geojson).to include("Polygon", "coordinates", "[[[25.0,81.66]")
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
context "with an invalid geometry" do
|
|
25
|
-
it "returns a default GeoJSON extent" do
|
|
26
|
-
expect(described_class.new(invalid_geom).geojson).to include("coordinates", "-180.0,90.0")
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
context "with a non-polygon geometry" do
|
|
31
|
-
before do
|
|
32
|
-
allow(RGeo::GeoJSON).to receive(:encode).and_raise(RGeo::Error::InvalidGeometry)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
it "returns a default GeoJSON extent" do
|
|
36
|
-
expect(described_class.new(non_polygon_geom).geojson).to include("coordinates", "-180.0,90.0")
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
describe "#bounding_box" do
|
|
42
|
-
context "with standard WKT geometry" do
|
|
43
|
-
it "returns a bounding_box" do
|
|
44
|
-
expect(described_class.new(wkt_geom).bounding_box).to eq "-180.0, -12.93, 180.0, 81.66"
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
context "with envelope syntax geometry" do
|
|
49
|
-
it "returns a bounding_box" do
|
|
50
|
-
expect(described_class.new(envelope_geom).bounding_box).to eq "-168.35, -12.93, 25.0, 81.66"
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
context "with an invalid geometry" do
|
|
55
|
-
it "returns a default GeoJSON extent" do
|
|
56
|
-
expect(described_class.new(invalid_geom).bounding_box).to include("coordinates", "-180.0,90.0")
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "spec_helper"
|
|
4
|
-
|
|
5
|
-
RSpec.describe Geoblacklight::ItemViewer do
|
|
6
|
-
let(:document) { SolrDocument.new(document_attributes) }
|
|
7
|
-
let(:document_attributes) { {} }
|
|
8
|
-
let(:references) { document.references }
|
|
9
|
-
let(:references_field) { Geoblacklight.configuration.fields.references }
|
|
10
|
-
let(:item_viewer) { described_class.new(references) }
|
|
11
|
-
describe "viewer_preference" do
|
|
12
|
-
describe "for no references" do
|
|
13
|
-
it "returns nil" do
|
|
14
|
-
expect(item_viewer.viewer_preference).to be_nil
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
describe "for wms reference" do
|
|
18
|
-
let(:document_attributes) do
|
|
19
|
-
{
|
|
20
|
-
references_field => {
|
|
21
|
-
"http://www.opengis.net/def/serviceType/ogc/wms" => "http://www.example.com/wms",
|
|
22
|
-
"http://iiif.io/api/image" => "http://www.example.com/iiif"
|
|
23
|
-
}.to_json
|
|
24
|
-
}
|
|
25
|
-
end
|
|
26
|
-
it "wms if wms is present" do
|
|
27
|
-
expect(item_viewer.viewer_preference).to eq wms: "http://www.example.com/wms"
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
describe "for tms reference" do
|
|
31
|
-
let(:document_attributes) do
|
|
32
|
-
{
|
|
33
|
-
references_field => {
|
|
34
|
-
"https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification" => "http://www.example.com/tms"
|
|
35
|
-
}.to_json
|
|
36
|
-
}
|
|
37
|
-
end
|
|
38
|
-
it "tms if tms is present" do
|
|
39
|
-
expect(item_viewer.viewer_preference).to eq tms: "http://www.example.com/tms"
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
describe "for iiif only reference" do
|
|
43
|
-
let(:document_attributes) do
|
|
44
|
-
{
|
|
45
|
-
references_field => {
|
|
46
|
-
"http://iiif.io/api/image" => "http://www.example.com/iiif"
|
|
47
|
-
}.to_json
|
|
48
|
-
}
|
|
49
|
-
end
|
|
50
|
-
it "returns iiif" do
|
|
51
|
-
expect(item_viewer.viewer_preference).to eq iiif: "http://www.example.com/iiif"
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
describe "for tiled map layer reference" do
|
|
55
|
-
let(:document_attributes) do
|
|
56
|
-
{
|
|
57
|
-
references_field => {
|
|
58
|
-
"urn:x-esri:serviceType:ArcGIS#TiledMapLayer" => "http://www.example.com/MapServer"
|
|
59
|
-
}.to_json
|
|
60
|
-
}
|
|
61
|
-
end
|
|
62
|
-
it "returns mapservice" do
|
|
63
|
-
expect(item_viewer.viewer_preference).to eq tiled_map_layer: "http://www.example.com/MapServer"
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
context "index map" do
|
|
67
|
-
let(:document_attributes) do
|
|
68
|
-
{
|
|
69
|
-
references_field => {
|
|
70
|
-
"https://openindexmaps.org" => "http://www.example.com/index_map"
|
|
71
|
-
}.to_json
|
|
72
|
-
}
|
|
73
|
-
end
|
|
74
|
-
it { expect(item_viewer.viewer_preference).to eq index_map: "http://www.example.com/index_map" }
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "spec_helper"
|
|
4
|
-
|
|
5
|
-
RSpec.describe Geoblacklight::SolrDocument::Inspection do
|
|
6
|
-
subject { SolrDocument.new }
|
|
7
|
-
|
|
8
|
-
describe "#inspectable?" do
|
|
9
|
-
it "returns true for wms viewer protocol" do
|
|
10
|
-
expect(subject).to receive(:viewer_protocol).and_return("wms")
|
|
11
|
-
expect(subject.inspectable?).to be_truthy
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it "returns false for iiif viewer protocol" do
|
|
15
|
-
expect(subject).to receive(:viewer_protocol).and_return("iiif")
|
|
16
|
-
expect(subject.inspectable?).to be_falsy
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|