geoblacklight 6.0.0.pre.alpha.4 → 6.0.0.pre.alpha.5
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/Rakefile +0 -1
- data/app/assets/stylesheets/geoblacklight/record.css +37 -1
- data/app/components/geoblacklight/document/download_link_component.html.erb +6 -0
- data/app/components/geoblacklight/document/download_link_component.rb +66 -0
- data/app/components/geoblacklight/document/download_links_component.html.erb +8 -0
- data/app/components/geoblacklight/document/download_links_component.rb +59 -0
- data/app/components/geoblacklight/document/sidebar_component.html.erb +3 -9
- data/app/components/geoblacklight/document/sidebar_component.rb +6 -11
- data/app/components/geoblacklight/login_link_component.html.erb +3 -5
- data/app/javascript/geoblacklight/core.js +0 -2
- data/app/javascript/geoblacklight/index.js +0 -2
- data/app/javascript/geoblacklight/leaflet/inspection.js +5 -4
- data/app/models/concerns/geoblacklight/solr_document.rb +1 -2
- data/config/locales/geoblacklight.en.yml +5 -14
- data/lib/generators/geoblacklight/install_generator.rb +4 -9
- data/lib/generators/geoblacklight/templates/settings.yml +1 -15
- data/lib/geoblacklight/configuration/settings_builder.rb +0 -3
- data/lib/geoblacklight/configuration.rb +0 -10
- data/lib/geoblacklight/exceptions.rb +0 -23
- data/lib/geoblacklight/references.rb +0 -80
- data/lib/geoblacklight/version.rb +1 -1
- data/lib/geoblacklight.rb +0 -1
- data/lib/tasks/geoblacklight.rake +0 -30
- data/spec/components/geoblacklight/document/sidebar_component_spec.rb +1 -1
- data/spec/components/geoblacklight/download_links_component_spec.rb +59 -85
- data/spec/features/index_view_spec.rb +0 -33
- data/spec/features/layer_inspection_spec.rb +0 -10
- data/spec/features/layer_opacity_spec.rb +0 -7
- data/spec/lib/geoblacklight/configuration/settings_builder_spec.rb +0 -2
- data/spec/lib/geoblacklight/references_spec.rb +1 -57
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +0 -7
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- data/template.rb +1 -1
- metadata +6 -28
- data/app/components/geoblacklight/download_links_component.html.erb +0 -31
- data/app/components/geoblacklight/download_links_component.rb +0 -87
- data/app/controllers/download_controller.rb +0 -76
- data/app/javascript/geoblacklight/controllers/downloads_controller.js +0 -64
- data/lib/geoblacklight/download/csv_download.rb +0 -22
- data/lib/geoblacklight/download/geojson_download.rb +0 -24
- data/lib/geoblacklight/download/geotiff_download.rb +0 -22
- data/lib/geoblacklight/download/kmz_download.rb +0 -24
- data/lib/geoblacklight/download/shapefile_download.rb +0 -22
- data/lib/geoblacklight/download.rb +0 -110
- data/lib/geoblacklight/routes/downloadable.rb +0 -15
- data/spec/controllers/download_controller_spec.rb +0 -99
- data/spec/features/download_layer_spec.rb +0 -96
- data/spec/features/esri_viewer_spec.rb +0 -43
- data/spec/features/index_map_spec.rb +0 -40
- data/spec/features/layer_with_no_references_spec.rb +0 -10
- data/spec/features/linkified_attribute_table_spec.rb +0 -13
- data/spec/features/multiple_downloads_spec.rb +0 -17
- data/spec/features/show_page_download_spec.rb +0 -22
- data/spec/lib/geoblacklight/download/csv_download_spec.rb +0 -21
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +0 -22
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +0 -25
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +0 -22
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +0 -21
- data/spec/lib/geoblacklight/download_spec.rb +0 -188
- data/spec/tasks/geoblacklight_spec.rb +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8694955d2e5e0482fdb3da16e55b5fe2b7aaa49d4d2d7bb9f1125cfdabc5ab25
|
|
4
|
+
data.tar.gz: 21165fb729027815df18f5c038d63600b603bbec571e00c9298af245af793612
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 247f475b99b5ac95cf7f4578034b54112a82fedcc82ddb92916a7876e8e5daae7144d46b4c7a13c2d1b03588446e91dfb33ffed5a3da0fd25ef688f9d2d8b53b
|
|
7
|
+
data.tar.gz: 6ad85ca5ef899d7b706854ea3255f01f87e7adfa694bbf42edc0ed56838c0819c79698727c022adebdd9d68f094e6bbf5562e4a7eb4dab32af476f3800c20553
|
data/Rakefile
CHANGED
|
@@ -33,11 +33,47 @@
|
|
|
33
33
|
|
|
34
34
|
/* Sidebar */
|
|
35
35
|
.page-sidebar {
|
|
36
|
-
.card + .card
|
|
36
|
+
.card + .card,
|
|
37
|
+
turbo-frame .card {
|
|
37
38
|
margin-top: 1rem;
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
.card ul {
|
|
42
|
+
margin-bottom: 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
40
45
|
.card-header {
|
|
41
46
|
font-weight: 500;
|
|
42
47
|
}
|
|
43
48
|
}
|
|
49
|
+
|
|
50
|
+
/* Login button */
|
|
51
|
+
.login-btn {
|
|
52
|
+
--gbl-login-btn-bg: rgba(var(--bs-body-color-rgb), 0.03);
|
|
53
|
+
|
|
54
|
+
--bs-btn-color: var(--gbl-login-btn-color);
|
|
55
|
+
--bs-btn-bg: var(--gbl-login-btn-bg);
|
|
56
|
+
--bs-btn-border-color: var(--bs-border-color-translucent);
|
|
57
|
+
--bs-btn-hover-color: var(--gbl-login-btn-color);
|
|
58
|
+
--bs-btn-hover-bg: var(--gbl-login-btn-bg);
|
|
59
|
+
--bs-btn-hover-border-color: var(--bs-border-color-translucent);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Downloads */
|
|
63
|
+
.download a {
|
|
64
|
+
display: block;
|
|
65
|
+
|
|
66
|
+
.title {
|
|
67
|
+
margin: 0;
|
|
68
|
+
display: inline;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.badge {
|
|
72
|
+
float: inline-end;
|
|
73
|
+
margin-top: 0.1em;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.badge + .title {
|
|
77
|
+
word-break: break-all;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<li class="download list-group-item list-group-item-action">
|
|
2
|
+
<%= link_to url, class: 'nav-link', data: @data do %>
|
|
3
|
+
<% if file_type.present? %><span class="badge text-bg-secondary"><%= file_type %></span><% end %>
|
|
4
|
+
<p class="title"><%= title %></p>
|
|
5
|
+
<% end %>
|
|
6
|
+
</li>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Geoblacklight
|
|
4
|
+
module Document
|
|
5
|
+
# A single resource available for download on a record
|
|
6
|
+
class DownloadLinkComponent < ViewComponent::Base
|
|
7
|
+
attr_reader :url
|
|
8
|
+
|
|
9
|
+
# @param url [String] the URL of the download link
|
|
10
|
+
# @param title [String, nil] the title of the download link
|
|
11
|
+
# @param file_type [String, nil] file type for what will be downloaded (e.g. zip)
|
|
12
|
+
# @param data_file_type [String, nil] file type for the actual data (e.g. Shapefile)
|
|
13
|
+
def initialize(url:, title: nil, file_type: nil, data_file_type: nil)
|
|
14
|
+
@url = url
|
|
15
|
+
@title = title
|
|
16
|
+
@file_type = file_type
|
|
17
|
+
@data_file_type = data_file_type
|
|
18
|
+
super()
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Use format to label the download if no title is provided
|
|
22
|
+
def title
|
|
23
|
+
@title || generated_title_from_format || title_from_format
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Infer the file type from the URL if not provided
|
|
27
|
+
def file_type
|
|
28
|
+
@file_type || wfs_file_type || requested_file_type || file_extension
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def format_label
|
|
34
|
+
t(@data_file_type&.downcase || file_type, scope: "geoblacklight.formats", default: @data_file_type || file_type)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def title_from_format
|
|
38
|
+
t("geoblacklight.download.original_link", download_format: format_label)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def generated_title_from_format
|
|
42
|
+
t("geoblacklight.download.generated_link", download_format: format_label) if generated?
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def file_extension
|
|
46
|
+
File.extname(url).delete(".").upcase
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def requested_file_type
|
|
50
|
+
url.match(/format=([^&]+)/)&.captures&.first&.upcase
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def wfs_file_type
|
|
54
|
+
url.match(/outputFormat=([^&]+)/)&.captures&.first&.upcase if generated_via_wfs?
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def generated?
|
|
58
|
+
url.match?(/format=([^&]+)/) || generated_via_wfs?
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def generated_via_wfs?
|
|
62
|
+
url.match?(/service=WFS/i)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Geoblacklight
|
|
4
|
+
module Document
|
|
5
|
+
# Display expandable file download links in sidebar
|
|
6
|
+
class DownloadLinksComponent < ViewComponent::Base
|
|
7
|
+
attr_reader :document
|
|
8
|
+
|
|
9
|
+
def initialize(document:)
|
|
10
|
+
@document = document
|
|
11
|
+
super()
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def render?
|
|
15
|
+
download_links.any? && helpers.document_available?(document)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def download_links
|
|
19
|
+
(direct_download_links + iiif_download_links).compact
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Direct download links to files
|
|
23
|
+
def direct_download_links
|
|
24
|
+
direct_downloads = Array(document.direct_download&.dig(:download))
|
|
25
|
+
return [] unless direct_downloads.present?
|
|
26
|
+
|
|
27
|
+
# Use label and url for multiple downloads; use format to label otherwise
|
|
28
|
+
direct_downloads.map do |entry|
|
|
29
|
+
if entry.is_a?(Hash)
|
|
30
|
+
Geoblacklight::Document::DownloadLinkComponent.new(
|
|
31
|
+
title: entry["label"],
|
|
32
|
+
url: entry["url"]
|
|
33
|
+
)
|
|
34
|
+
else
|
|
35
|
+
Geoblacklight::Document::DownloadLinkComponent.new(
|
|
36
|
+
url: entry,
|
|
37
|
+
data_file_type: document.file_format
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Links to IIIF image and manifest downloads
|
|
44
|
+
def iiif_download_links
|
|
45
|
+
[
|
|
46
|
+
document.iiif_download.present? && Geoblacklight::Document::DownloadLinkComponent.new(
|
|
47
|
+
title: t("geoblacklight.download.iiif_image_link"),
|
|
48
|
+
url: document.iiif_download[:iiif].sub(/\/info\.json$/, "/full/full/0/default.jpg")
|
|
49
|
+
),
|
|
50
|
+
document.references.iiif_manifest.present? && Geoblacklight::Document::DownloadLinkComponent.new(
|
|
51
|
+
title: t("geoblacklight.download.iiif_manifest_link"),
|
|
52
|
+
url: document.references.iiif_manifest.endpoint,
|
|
53
|
+
file_type: "JSON"
|
|
54
|
+
)
|
|
55
|
+
].compact_blank
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
<%= render_static_map_component %>
|
|
2
1
|
<%= render_show_tools %>
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<% end %>
|
|
8
|
-
</div>
|
|
9
|
-
|
|
10
|
-
<%= render_more_like_this %>
|
|
11
|
-
<%= render Geoblacklight::Document::RelationsContainerComponent.new(document: document) %>
|
|
3
|
+
<% panels.each do |panel| %>
|
|
4
|
+
<%= render panel %>
|
|
5
|
+
<% end %>
|
|
@@ -3,20 +3,15 @@
|
|
|
3
3
|
module Geoblacklight
|
|
4
4
|
module Document
|
|
5
5
|
class SidebarComponent < Blacklight::Document::SidebarComponent
|
|
6
|
-
def
|
|
7
|
-
render Geoblacklight::StaticMapComponent.new(document:)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def sidebar_buttons
|
|
6
|
+
def panels
|
|
11
7
|
[
|
|
12
|
-
Geoblacklight::
|
|
13
|
-
Geoblacklight::
|
|
8
|
+
Geoblacklight::StaticMapComponent.new(document:),
|
|
9
|
+
Geoblacklight::Document::DownloadLinksComponent.new(document:),
|
|
10
|
+
Geoblacklight::LoginLinkComponent.new(document:),
|
|
11
|
+
Geoblacklight::Document::RelationsContainerComponent.new(document: document),
|
|
12
|
+
Blacklight::Document::MoreLikeThisComponent.new(document:)
|
|
14
13
|
]
|
|
15
14
|
end
|
|
16
|
-
|
|
17
|
-
def render_more_like_this
|
|
18
|
-
render Blacklight::Document::MoreLikeThisComponent.new(document:)
|
|
19
|
-
end
|
|
20
15
|
end
|
|
21
16
|
end
|
|
22
17
|
end
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
</div>
|
|
5
|
-
</div>
|
|
1
|
+
<%= link_to t('geoblacklight.tools.login_to_view'),
|
|
2
|
+
new_user_session_path(referrer: request.original_url),
|
|
3
|
+
class: ['btn', 'login-btn', 'd-block'] %>
|
|
@@ -6,7 +6,6 @@ import initializeMetadataDownload from "geoblacklight/initializers/metadata_down
|
|
|
6
6
|
|
|
7
7
|
// Stimulus controllers
|
|
8
8
|
import ClipboardController from "geoblacklight/controllers/clipboard_controller"
|
|
9
|
-
import DownloadsController from "geoblacklight/controllers/downloads_controller"
|
|
10
9
|
import LeafletViewerController from "geoblacklight/controllers/leaflet_viewer_controller"
|
|
11
10
|
import OembedViewerController from "geoblacklight/controllers/oembed_viewer_controller"
|
|
12
11
|
import OpenlayersViewerController from "geoblacklight/controllers/openlayers_viewer_controller"
|
|
@@ -53,7 +52,6 @@ if (typeof Stimulus !== "undefined") {
|
|
|
53
52
|
Stimulus.register("oembed-viewer", OembedViewerController)
|
|
54
53
|
Stimulus.register("leaflet-viewer", LeafletViewerController)
|
|
55
54
|
Stimulus.register("search-results", SearchResultsController)
|
|
56
|
-
Stimulus.register("downloads", DownloadsController)
|
|
57
55
|
Stimulus.register("clipboard", ClipboardController)
|
|
58
56
|
} else {
|
|
59
57
|
console.error(
|
|
@@ -3,7 +3,6 @@ import OpenlayersViewerController from "geoblacklight/controllers/openlayers_vie
|
|
|
3
3
|
import OembedViewerController from "geoblacklight/controllers/oembed_viewer_controller"
|
|
4
4
|
import LeafletViewerController from "geoblacklight/controllers/leaflet_viewer_controller"
|
|
5
5
|
import SearchResultsController from "geoblacklight/controllers/search_results_controller"
|
|
6
|
-
import DownloadsController from "geoblacklight/controllers/downloads_controller"
|
|
7
6
|
import ClipboardController from "geoblacklight/controllers/clipboard_controller"
|
|
8
7
|
|
|
9
8
|
// GBL core
|
|
@@ -18,7 +17,6 @@ export default {
|
|
|
18
17
|
OembedViewerController,
|
|
19
18
|
LeafletViewerController,
|
|
20
19
|
SearchResultsController,
|
|
21
|
-
DownloadsController,
|
|
22
20
|
ClipboardController,
|
|
23
21
|
openLayersBasemaps,
|
|
24
22
|
leafletBasemaps,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { identifyFeatures } from "esri-leaflet"
|
|
2
|
+
import { polygon, geoJSON, circleMarker, layerGroup } from "leaflet"
|
|
2
3
|
import {
|
|
3
4
|
appendErrorMessage,
|
|
4
5
|
appendLoadingMessage,
|
|
@@ -73,7 +74,7 @@ export const overlayLayer = (map, data, layer) => {
|
|
|
73
74
|
const color = map.options.selected_color
|
|
74
75
|
|
|
75
76
|
if (data._latlngs) {
|
|
76
|
-
overlayLayer =
|
|
77
|
+
overlayLayer = polygon(data._latlngs, {
|
|
77
78
|
color: color,
|
|
78
79
|
weight: 2,
|
|
79
80
|
layer: true,
|
|
@@ -82,13 +83,13 @@ export const overlayLayer = (map, data, layer) => {
|
|
|
82
83
|
highlightLayer: true,
|
|
83
84
|
})
|
|
84
85
|
} else {
|
|
85
|
-
overlayLayer =
|
|
86
|
+
overlayLayer = geoJSON(data, {
|
|
86
87
|
color: color,
|
|
87
88
|
opacity: opacity,
|
|
88
89
|
addToOpacitySlider: true,
|
|
89
90
|
highlightLayer: true,
|
|
90
91
|
pointToLayer: function (feature, latlng) {
|
|
91
|
-
return
|
|
92
|
+
return circleMarker(latlng, {
|
|
92
93
|
radius: 8,
|
|
93
94
|
fillColor: color,
|
|
94
95
|
color: color,
|
|
@@ -99,7 +100,7 @@ export const overlayLayer = (map, data, layer) => {
|
|
|
99
100
|
},
|
|
100
101
|
})
|
|
101
102
|
}
|
|
102
|
-
|
|
103
|
+
layerGroup([overlayLayer]).addTo(map)
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
export const tiledMapLayerInspection = (map, layer) => {
|
|
@@ -10,7 +10,6 @@ module Geoblacklight
|
|
|
10
10
|
include Geoblacklight::SolrDocument::Arcgis
|
|
11
11
|
include Geoblacklight::SolrDocument::Citation
|
|
12
12
|
|
|
13
|
-
delegate :download_types, to: :references
|
|
14
13
|
delegate :viewer_protocol, to: :item_viewer
|
|
15
14
|
delegate :viewer_endpoint, to: :item_viewer
|
|
16
15
|
|
|
@@ -45,7 +44,7 @@ module Geoblacklight
|
|
|
45
44
|
end
|
|
46
45
|
|
|
47
46
|
def downloadable?
|
|
48
|
-
(direct_download ||
|
|
47
|
+
(direct_download || iiif_download) && available?
|
|
49
48
|
end
|
|
50
49
|
|
|
51
50
|
def references
|
|
@@ -6,20 +6,11 @@ en:
|
|
|
6
6
|
citation: Citation copied to clipboard
|
|
7
7
|
web_service: Web service copied to clipboard
|
|
8
8
|
download:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export_link: "Export %{download_format}"
|
|
15
|
-
export_shapefile_link: "Shapefile"
|
|
16
|
-
export_kmz_link: "KMZ"
|
|
17
|
-
export_geojson_link: "GeoJSON"
|
|
18
|
-
export_geotiff_link: "GeoTIFF"
|
|
19
|
-
export_csv_link: "CSV"
|
|
20
|
-
preparing: "Preparing download..."
|
|
21
|
-
ready: "Download ready (%{type})"
|
|
22
|
-
failed: "Download failed (%{type})"
|
|
9
|
+
downloads: "Downloads"
|
|
10
|
+
original_link: "Original %{download_format}"
|
|
11
|
+
generated_link: "Generated %{download_format}"
|
|
12
|
+
iiif_image_link: "Full-size image"
|
|
13
|
+
iiif_manifest_link: "IIIF manifest"
|
|
23
14
|
home:
|
|
24
15
|
headline: "Explore and discover..."
|
|
25
16
|
search_heading: "Find the maps and data you need"
|
|
@@ -39,11 +39,6 @@ module Geoblacklight
|
|
|
39
39
|
namespace :wms do
|
|
40
40
|
concerns :gbl_wms
|
|
41
41
|
end
|
|
42
|
-
concern :gbl_downloadable, Geoblacklight::Routes::Downloadable.new
|
|
43
|
-
namespace :download do
|
|
44
|
-
concerns :gbl_downloadable
|
|
45
|
-
end
|
|
46
|
-
resources :download, only: [:show]
|
|
47
42
|
ROUTES
|
|
48
43
|
|
|
49
44
|
inject_into_file "config/routes.rb", routes, before: /^end/
|
|
@@ -62,6 +57,10 @@ module Geoblacklight
|
|
|
62
57
|
directory "../../../../solr", "solr"
|
|
63
58
|
end
|
|
64
59
|
|
|
60
|
+
def add_rsolr_gem
|
|
61
|
+
gem "rsolr", ">= 1.0", "< 3"
|
|
62
|
+
end
|
|
63
|
+
|
|
65
64
|
def docker_compose
|
|
66
65
|
copy_file "../../../../compose.yml", "compose.yml"
|
|
67
66
|
end
|
|
@@ -84,10 +83,6 @@ module Geoblacklight
|
|
|
84
83
|
end
|
|
85
84
|
end
|
|
86
85
|
|
|
87
|
-
def create_downloads_directory
|
|
88
|
-
FileUtils.mkdir_p("tmp/cache/downloads") unless File.directory?("tmp/cache/downloads")
|
|
89
|
-
end
|
|
90
|
-
|
|
91
86
|
def update_application_name
|
|
92
87
|
gsub_file("config/locales/blacklight.en.yml", "Blacklight", "GeoBlacklight")
|
|
93
88
|
end
|
|
@@ -7,14 +7,11 @@
|
|
|
7
7
|
# example:
|
|
8
8
|
# # config/initializers/geoblacklight.rb
|
|
9
9
|
# config = GeoBlacklight.configuration
|
|
10
|
-
# config.
|
|
10
|
+
# config.bbox_within_boost = "10"
|
|
11
11
|
|
|
12
12
|
# # ArcGIS Online Base URL
|
|
13
13
|
# arcgis_base_url: "https://www.arcgis.com/apps/mapviewer/index.html"
|
|
14
14
|
|
|
15
|
-
# # File path for downloads
|
|
16
|
-
# download_path: "<%= Rails.root.join('tmp', 'cache', 'downloads') %>"
|
|
17
|
-
|
|
18
15
|
# # The bq boost value for spatial search matches within a bounding box
|
|
19
16
|
# bbox_within_boost: "10"
|
|
20
17
|
|
|
@@ -103,9 +100,6 @@
|
|
|
103
100
|
# - "iso19139"
|
|
104
101
|
# - "html"
|
|
105
102
|
|
|
106
|
-
# # (For external Download) timeout and open_timeout parameters for Faraday
|
|
107
|
-
# timeout_download: 180
|
|
108
|
-
|
|
109
103
|
# # (For WMS inspection) timeout and open_timeout parameters for Faraday
|
|
110
104
|
# timeout_wms: 4
|
|
111
105
|
|
|
@@ -219,14 +213,6 @@
|
|
|
219
213
|
# label: geoblacklight.relations.version_of_descendants
|
|
220
214
|
# query_type: descendants
|
|
221
215
|
|
|
222
|
-
# # Vector data download formats to be displayed
|
|
223
|
-
# download_formats:
|
|
224
|
-
# vector:
|
|
225
|
-
# - "Shapefile"
|
|
226
|
-
# - "KMZ"
|
|
227
|
-
# - "GeoJSON"
|
|
228
|
-
# - "CSV"
|
|
229
|
-
|
|
230
216
|
# # WMS Parameters. Keys are OGC WMS request parameter names and are sent to
|
|
231
217
|
# # remote WMS servers, so they are intentionally left uppercase.
|
|
232
218
|
# wms_params:
|
|
@@ -22,12 +22,9 @@ module Geoblacklight
|
|
|
22
22
|
assign(config, :sidebar_static_map, settings.SIDEBAR_STATIC_MAP)
|
|
23
23
|
assign(config, :iiif_drag_drop_link, settings.IIIF_DRAG_DROP_LINK)
|
|
24
24
|
assign(config, :homepage_map_geom, settings.HOMEPAGE_MAP_GEOM)
|
|
25
|
-
assign(config, :vector_download_formats, settings.DOWNLOAD_FORMATS&.VECTOR)
|
|
26
25
|
assign(config, :metadata_shown, settings.METADATA_SHOWN)
|
|
27
26
|
assign(config, :webservices_shown, settings.WEBSERVICES_SHOWN)
|
|
28
27
|
assign(config, :relationships_shown, build_relationships)
|
|
29
|
-
assign(config, :timeout_download, settings.TIMEOUT_DOWNLOAD)
|
|
30
|
-
assign(config, :download_path, settings.DOWNLOAD_PATH)
|
|
31
28
|
assign(config, :gbl_params, settings.GBL_PARAMS)
|
|
32
29
|
assign(config, :wms_params, settings.WMS_PARAMS&.to_h)
|
|
33
30
|
assign(config, :timeout_wms, settings.TIMEOUT_WMS)
|
|
@@ -15,9 +15,6 @@ module Geoblacklight
|
|
|
15
15
|
# Institution deployed at
|
|
16
16
|
attribute :institution, :string, default: "Stanford"
|
|
17
17
|
|
|
18
|
-
# (For external Download) timeout and open_timeout parameters for Faraday
|
|
19
|
-
attribute :timeout_download, :integer, default: 180
|
|
20
|
-
|
|
21
18
|
# (For WMS inspection) timeout and open_timeout parameters for Faraday
|
|
22
19
|
attribute :timeout_wms, :integer, default: 4
|
|
23
20
|
|
|
@@ -44,9 +41,6 @@ module Geoblacklight
|
|
|
44
41
|
# config.homepage_map_geom = '{"type":"Polygon","coordinates":[[[-73.58,42.93],[-73.58,41.20],[-69.90,41.20],[-69.90,42.93]]]}'
|
|
45
42
|
attribute :homepage_map_geom, :string
|
|
46
43
|
|
|
47
|
-
# Vector data download formats to be displayed
|
|
48
|
-
attr_accessor :vector_download_formats # typed as Array
|
|
49
|
-
|
|
50
44
|
# Metadata shown in tool panel
|
|
51
45
|
attr_accessor :metadata_shown # typed as Array
|
|
52
46
|
|
|
@@ -56,11 +50,8 @@ module Geoblacklight
|
|
|
56
50
|
# Relationships to display
|
|
57
51
|
attr_accessor :relationships_shown # typed as RelationshipsConfig
|
|
58
52
|
|
|
59
|
-
attribute :download_path, :string
|
|
60
|
-
|
|
61
53
|
def initialize
|
|
62
54
|
super
|
|
63
|
-
self.download_path ||= Rails.root.join("tmp", "cache", "downloads")
|
|
64
55
|
@relationships_shown = RelationshipsConfig.new
|
|
65
56
|
@gbl_params = [
|
|
66
57
|
:bbox, :email, :file, :format, :id, :logo, :provider, :type,
|
|
@@ -95,7 +86,6 @@ module Geoblacklight
|
|
|
95
86
|
]
|
|
96
87
|
}
|
|
97
88
|
|
|
98
|
-
@vector_download_formats = ["Shapefile", "KMZ", "GeoJSON", "CSV"]
|
|
99
89
|
@metadata_shown = ["mods", "fgdc", "iso19139", "html"]
|
|
100
90
|
@webservices_shown = %w[
|
|
101
91
|
wms
|
|
@@ -2,29 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
module Geoblacklight
|
|
4
4
|
module Exceptions
|
|
5
|
-
class ExternalDownloadFailed < StandardError
|
|
6
|
-
def initialize(options = {})
|
|
7
|
-
@options = options
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
##
|
|
11
|
-
# URL tried from failed download
|
|
12
|
-
# @return [String]
|
|
13
|
-
def url
|
|
14
|
-
@options[:url].to_s
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
##
|
|
18
|
-
# Message passed from a failed download
|
|
19
|
-
# @return [String]
|
|
20
|
-
def message
|
|
21
|
-
@options[:message].to_s
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
class WrongDownloadFormat < StandardError
|
|
26
|
-
end
|
|
27
|
-
|
|
28
5
|
class WrongBoundingBoxFormat < StandardError
|
|
29
6
|
end
|
|
30
7
|
end
|
|
@@ -43,34 +43,6 @@ module Geoblacklight
|
|
|
43
43
|
@refs.find { |reference| reference.type == ref_type }
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
##
|
|
47
|
-
# Preferred download (should be a file download)
|
|
48
|
-
# @return [Hash, nil]
|
|
49
|
-
def preferred_download
|
|
50
|
-
file_download if download.present?
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
##
|
|
54
|
-
# Download hash based off of format type
|
|
55
|
-
# @return [Hash, nil]
|
|
56
|
-
def downloads_by_format
|
|
57
|
-
case format
|
|
58
|
-
when "Shapefile"
|
|
59
|
-
vector_download_formats
|
|
60
|
-
when "GeoTIFF"
|
|
61
|
-
geotiff_download_formats
|
|
62
|
-
when "ArcGRID"
|
|
63
|
-
arcgrid_download_formats
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
##
|
|
68
|
-
# Generated download types from wxs services
|
|
69
|
-
# @return (see #downloads_by_format)
|
|
70
|
-
def download_types
|
|
71
|
-
downloads_by_format
|
|
72
|
-
end
|
|
73
|
-
|
|
74
46
|
##
|
|
75
47
|
# Returns all of the Esri webservices for given set of references
|
|
76
48
|
def esri_webservices
|
|
@@ -92,58 +64,6 @@ module Geoblacklight
|
|
|
92
64
|
end
|
|
93
65
|
end
|
|
94
66
|
|
|
95
|
-
##
|
|
96
|
-
# Download hash for a static file download
|
|
97
|
-
# @return (see #downloads_by_format)
|
|
98
|
-
def file_download
|
|
99
|
-
{file_download: download.to_hash}
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
##
|
|
103
|
-
# Download hash for a Shapefile file (currently only vector) with a wms and wfs reference
|
|
104
|
-
# present
|
|
105
|
-
# @return (see #downloads_by_format)
|
|
106
|
-
def vector_download_formats
|
|
107
|
-
return unless wms.present? && wfs.present?
|
|
108
|
-
|
|
109
|
-
download_formats = {}
|
|
110
|
-
format_list.each { |format| download_formats.merge!(web_service_hash(format)) }
|
|
111
|
-
download_formats
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def format_list
|
|
115
|
-
Geoblacklight.configuration.vector_download_formats || []
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
def web_service_hash(format)
|
|
119
|
-
case format
|
|
120
|
-
when "Shapefile"
|
|
121
|
-
{shapefile: wfs.to_hash}
|
|
122
|
-
when "KMZ"
|
|
123
|
-
{kmz: wms.to_hash}
|
|
124
|
-
when "GeoJSON"
|
|
125
|
-
{geojson: wfs.to_hash}
|
|
126
|
-
when "CSV"
|
|
127
|
-
{csv: wfs.to_hash}
|
|
128
|
-
else
|
|
129
|
-
{}
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
##
|
|
134
|
-
# Download hash for a GeoTiff file with a WMS reference present
|
|
135
|
-
# @return (see #downloads_by_format)
|
|
136
|
-
def geotiff_download_formats
|
|
137
|
-
{geotiff: wms.to_hash} if wms.present?
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
##
|
|
141
|
-
# Download hash for an ArcGRID file with a WMS reference present
|
|
142
|
-
# @return (see #downloads_by_format)
|
|
143
|
-
def arcgrid_download_formats
|
|
144
|
-
{geotiff: wms.to_hash} if wms.present?
|
|
145
|
-
end
|
|
146
|
-
|
|
147
67
|
##
|
|
148
68
|
# Adds a call to references for defined URI keys
|
|
149
69
|
def method_missing(m, *args, &b)
|
data/lib/geoblacklight.rb
CHANGED