geoblacklight 4.0.0 → 4.1.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 +4 -4
- data/.github/workflows/ruby.yml +23 -8
- data/.gitignore +3 -0
- data/.standard.yml +1 -0
- data/Gemfile +13 -11
- data/README.md +1 -1
- data/Rakefile +42 -50
- data/app/assets/images/blacklight/american-geographical-society-library-uwm-libraries.svg +26 -0
- data/app/assets/images/blacklight/arizona.svg +4 -0
- data/app/assets/images/blacklight/circle-info-solid.svg +1 -0
- data/app/assets/images/blacklight/fire-solid.svg +1 -0
- data/app/assets/images/blacklight/lightbulb-solid.svg +1 -0
- data/app/assets/images/blacklight/nebraska.svg +4 -0
- data/app/assets/images/blacklight/rutgers.svg +5 -0
- data/app/assets/images/blacklight/triangle-exclamation-solid.svg +1 -0
- data/app/assets/javascripts/geoblacklight/basemaps.js +1 -1
- data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +8 -0
- data/app/components/geoblacklight/display_note_component.html.erb +1 -0
- data/app/components/geoblacklight/display_note_component.rb +47 -0
- data/app/components/geoblacklight/icon_facet_item_component.rb +2 -2
- data/app/controllers/download_controller.rb +36 -37
- data/app/controllers/relation_controller.rb +1 -0
- data/app/controllers/wms_controller.rb +1 -0
- data/app/helpers/arcgis_helper.rb +2 -1
- data/app/helpers/blacklight_helper.rb +2 -1
- data/app/helpers/carto_helper.rb +3 -2
- data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +2 -1
- data/app/helpers/geoblacklight_helper.rb +47 -36
- data/app/models/concerns/geoblacklight/bbox_filter_query.rb +1 -1
- data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/citation.rb +3 -2
- data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -0
- data/app/models/concerns/geoblacklight/solr_document.rb +17 -9
- data/app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb +2 -1
- data/app/presenters/geoblacklight/document_presenter.rb +3 -2
- data/app/views/catalog/_citation.html.erb +35 -10
- data/app/views/catalog/_show_default_display_note.html.erb +7 -0
- data/app/views/catalog/_show_sidebar.html.erb +1 -0
- data/app/views/catalog/_show_sidebar_static_map.html.erb +10 -0
- data/app/views/relation/index.json.jbuilder +1 -1
- data/config/initializers/new_gbl_settings_defaults_4.1.yml +104 -0
- data/config/initializers/rails_config.rb +5 -1
- data/config/locales/geoblacklight.en.yml +18 -10
- data/geoblacklight.gemspec +36 -40
- data/lib/generators/geoblacklight/assets_generator.rb +15 -15
- data/lib/generators/geoblacklight/install_generator.rb +24 -23
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +66 -71
- data/lib/generators/geoblacklight/templates/settings.gbl_v1.yml +2 -2
- data/lib/generators/geoblacklight/templates/settings.yml +76 -24
- data/lib/geoblacklight/bounding_box.rb +1 -0
- data/lib/geoblacklight/constants.rb +26 -25
- data/lib/geoblacklight/download/geojson_download.rb +10 -9
- data/lib/geoblacklight/download/geotiff_download.rb +6 -5
- data/lib/geoblacklight/download/hgl_download.rb +4 -3
- data/lib/geoblacklight/download/kmz_download.rb +11 -10
- data/lib/geoblacklight/download/shapefile_download.rb +10 -9
- data/lib/geoblacklight/download.rb +12 -11
- data/lib/geoblacklight/engine.rb +10 -9
- data/lib/geoblacklight/exceptions.rb +3 -0
- data/lib/geoblacklight/faraday_middleware/follow_redirects.rb +14 -11
- data/lib/geoblacklight/geometry.rb +6 -5
- data/lib/geoblacklight/item_viewer.rb +4 -3
- data/lib/geoblacklight/metadata/base.rb +4 -3
- data/lib/geoblacklight/metadata/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata/html.rb +5 -4
- data/lib/geoblacklight/metadata/iso19139.rb +1 -0
- data/lib/geoblacklight/metadata.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/base.rb +5 -4
- data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
- data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
- data/lib/geoblacklight/metadata_transformer.rb +6 -2
- data/lib/geoblacklight/reference.rb +3 -2
- data/lib/geoblacklight/references.rb +12 -7
- data/lib/geoblacklight/relation/ancestors.rb +4 -3
- data/lib/geoblacklight/relation/descendants.rb +4 -3
- data/lib/geoblacklight/relation/relation_response.rb +3 -2
- data/lib/geoblacklight/routes/downloadable.rb +3 -2
- data/lib/geoblacklight/routes/exportable.rb +4 -3
- data/lib/geoblacklight/routes/wms.rb +2 -1
- data/lib/geoblacklight/routes.rb +4 -3
- data/lib/geoblacklight/version.rb +2 -1
- data/lib/geoblacklight/view_helper_override.rb +3 -2
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +5 -4
- data/lib/geoblacklight/wms_layer.rb +4 -3
- data/lib/geoblacklight.rb +32 -31
- data/lib/tasks/geoblacklight.rake +45 -44
- data/schema/geoblacklight-schema-aardvark.json +6 -0
- data/spec/components/geoblacklight/display_note_component_spec.rb +27 -0
- data/spec/components/geoblacklight/homepage_feature_facet_component_spec.rb +11 -10
- data/spec/components/geoblacklight/icon_facet_item_component_spec.rb +8 -7
- data/spec/config/initializers/rails_config_spec.rb +10 -9
- data/spec/controllers/catalog_controller_spec.rb +27 -26
- data/spec/controllers/download_controller_spec.rb +50 -49
- data/spec/controllers/relation_controller_spec.rb +5 -4
- data/spec/controllers/wms_controller_spec.rb +10 -9
- data/spec/factories/user.rb +3 -2
- data/spec/features/bookmarks_spec.rb +7 -6
- data/spec/features/citations_spec.rb +12 -0
- data/spec/features/configurable_basemap_spec.rb +12 -11
- data/spec/features/data_dictionary_download_spec.rb +11 -10
- data/spec/features/download_layer_spec.rb +64 -63
- data/spec/features/empty_search_spec.rb +6 -5
- data/spec/features/esri_viewer_spec.rb +33 -32
- data/spec/features/exports_spec.rb +18 -17
- data/spec/features/full_screen_controll_spec.rb +8 -8
- data/spec/features/help_text_spec.rb +6 -5
- data/spec/features/home_page_spec.rb +30 -29
- data/spec/features/iiif_viewer_spec.rb +6 -5
- data/spec/features/index_map_spec.rb +17 -16
- data/spec/features/layer_inspection_spec.rb +8 -7
- data/spec/features/layer_opacity_spec.rb +15 -14
- data/spec/features/layer_preview_spec.rb +11 -10
- data/spec/features/layer_with_no_references_spec.rb +5 -4
- data/spec/features/linkified_attribute_table_spec.rb +8 -7
- data/spec/features/metadata_panel_spec.rb +32 -31
- data/spec/features/missing_metadata_spec.rb +18 -17
- data/spec/features/multiple_downloads_spec.rb +11 -10
- data/spec/features/oembed_spec.rb +6 -5
- data/spec/features/relations_spec.rb +51 -26
- data/spec/features/saved_searches_spec.rb +7 -6
- data/spec/features/search_bar_spec.rb +9 -8
- data/spec/features/search_results_complex_geometry_spec.rb +12 -11
- data/spec/features/search_results_icons_spec.rb +10 -9
- data/spec/features/search_results_map_spec.rb +21 -20
- data/spec/features/search_results_overlap_ratio_spec.rb +17 -16
- data/spec/features/search_spec.rb +19 -18
- data/spec/features/show_page_download_spec.rb +15 -14
- data/spec/features/show_page_metadata_spec.rb +9 -8
- data/spec/features/show_page_sidebar_static_map_spec.rb +21 -0
- data/spec/features/sms_spec.rb +12 -11
- data/spec/features/split_view.html.erb_spec.rb +56 -55
- data/spec/features/suppressed_records_spec.rb +10 -9
- data/spec/features/tilejson_spec.rb +12 -9
- data/spec/features/tms_spec.rb +6 -5
- data/spec/features/web_services_modal_spec.rb +39 -38
- data/spec/features/wmts_spec.rb +20 -17
- data/spec/features/xyz_spec.rb +6 -5
- data/spec/fixtures/manifests/tilejson.json +1 -1
- data/spec/fixtures/manifests/wmts-single.xml +5 -5
- data/spec/fixtures/solr_documents/actual-papermap1.json +1 -1
- data/spec/fixtures/solr_documents/actual-point1.json +1 -1
- data/spec/fixtures/solr_documents/actual-polygon1.json +1 -1
- data/spec/fixtures/solr_documents/actual-raster1.json +1 -1
- data/spec/fixtures/solr_documents/baruch_ancestor1.json +1 -1
- data/spec/fixtures/solr_documents/baruch_ancestor2.json +1 -1
- data/spec/fixtures/solr_documents/baruch_documentation_download.json +2 -2
- data/spec/fixtures/solr_documents/cornell_html_metadata.json +1 -1
- data/spec/fixtures/solr_documents/display-note.json +52 -0
- data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +1 -1
- data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +1 -1
- data/spec/fixtures/solr_documents/esri-feature-layer.json +1 -1
- data/spec/fixtures/solr_documents/esri-image-map-layer.json +1 -1
- data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
- data/spec/fixtures/solr_documents/esri-wms-layer.json +1 -1
- data/spec/fixtures/solr_documents/harvard_raster.json +1 -1
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +1 -1
- data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +1 -1
- data/spec/fixtures/solr_documents/index-map-polygon.json +1 -1
- data/spec/fixtures/solr_documents/index-map-stanford.json +1 -1
- data/spec/fixtures/solr_documents/index_map_point.json +1 -1
- data/spec/fixtures/solr_documents/princeton-parent.json +1 -1
- data/spec/fixtures/solr_documents/public_direct_download.json +1 -1
- data/spec/fixtures/solr_documents/public_iiif_princeton.json +1 -1
- data/spec/fixtures/solr_documents/restricted-line.json +1 -1
- data/spec/fixtures/solr_documents/tilejson.json +3 -3
- data/spec/fixtures/solr_documents/umn_metro_result1.json +2 -2
- data/spec/fixtures/solr_documents/umn_state_result1.json +1 -1
- data/spec/fixtures/solr_documents/umn_state_result2.json +1 -1
- data/spec/fixtures/solr_documents/uva_slug_colon.json +1 -1
- data/spec/fixtures/solr_documents/wmts-multiple.json +1 -1
- data/spec/fixtures/solr_documents/wmts-single-layer.json +7 -7
- data/spec/fixtures/solr_documents/xyz.json +3 -3
- data/spec/helpers/arcgis_helper_spec.rb +8 -7
- data/spec/helpers/carto_helper_spec.rb +6 -5
- data/spec/helpers/geoblacklight/geoblacklight_helper_behavior_spec.rb +10 -15
- data/spec/helpers/geoblacklight_helper_spec.rb +139 -138
- data/spec/lib/geoblacklight/bounding_box_spec.rb +14 -13
- data/spec/lib/geoblacklight/document_presenter_spec.rb +26 -25
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +8 -7
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +8 -7
- data/spec/lib/geoblacklight/download/hgl_download_spec.rb +16 -15
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +9 -8
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +8 -7
- data/spec/lib/geoblacklight/download_spec.rb +61 -60
- data/spec/lib/geoblacklight/geometry_spec.rb +29 -28
- data/spec/lib/geoblacklight/item_viewer_spec.rb +25 -24
- data/spec/lib/geoblacklight/metadata/base_spec.rb +44 -43
- data/spec/lib/geoblacklight/metadata/html_spec.rb +7 -6
- data/spec/lib/geoblacklight/metadata_spec.rb +15 -14
- data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +13 -12
- data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +8 -7
- data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +8 -7
- data/spec/lib/geoblacklight/metadata_transformer_spec.rb +15 -14
- data/spec/lib/geoblacklight/reference_spec.rb +28 -27
- data/spec/lib/geoblacklight/references_spec.rb +89 -76
- data/spec/lib/geoblacklight/relation/ancestors_spec.rb +17 -16
- data/spec/lib/geoblacklight/relation/descendants_spec.rb +17 -16
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +29 -28
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +14 -13
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +19 -18
- data/spec/lib/geoblacklight/wms_layer_spec.rb +31 -30
- data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +31 -31
- data/spec/models/concerns/geoblacklight/bbox_filter_query_spec.rb +32 -32
- data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +16 -15
- data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +7 -6
- data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +16 -17
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +7 -6
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +121 -107
- data/spec/models/concerns/geoblacklight/suppressed_records_search_behavior_spec.rb +8 -7
- data/spec/presenters/geoblacklight/bbox_item_presenter_spec.rb +10 -10
- data/spec/routing/catalog_routing_spec.rb +4 -3
- data/spec/spec_helper.rb +35 -38
- data/spec/support/backport_test_helpers.rb +6 -5
- data/spec/support/features/session_helpers.rb +8 -7
- data/spec/support/features.rb +2 -1
- data/spec/support/fixtures.rb +2 -1
- data/spec/tasks/geoblacklight_spec.rb +10 -9
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +16 -15
- data/spec/views/catalog/_document_split.html.erb_spec.rb +3 -2
- data/spec/views/catalog/_index_split.html.erb_spec.rb +3 -2
- data/spec/views/catalog/_results_pagination.html.erb_spec.rb +5 -4
- data/spec/views/catalog/_show_downloads.html.erb_spec.rb +11 -10
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +13 -12
- data/template.rb +9 -8
- metadata +40 -216
- data/.gitmodules +0 -0
- data/.rubocop.yml +0 -111
- data/.rubocop_todo.yml +0 -437
- data/config/initializers/new_gbl_settings_defaults_3_4.yml +0 -6
- /data/app/assets/images/blacklight/{berkeley.svg → university-of-california-berkeley.svg} +0 -0
@@ -1,12 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
module Metadata
|
4
5
|
class Html < Base
|
5
6
|
def transform
|
6
|
-
ActionController::Base.helpers.tag.iframe(
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
ActionController::Base.helpers.tag.iframe("",
|
8
|
+
src: @reference.endpoint,
|
9
|
+
scrolling: "yes",
|
10
|
+
frameborder: 0)
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
module MetadataTransformer
|
4
5
|
##
|
@@ -10,7 +11,7 @@ module Geoblacklight
|
|
10
11
|
def initialize(metadata)
|
11
12
|
@metadata = metadata
|
12
13
|
# Access the Nokogiri::XML Document from the metadata Object
|
13
|
-
fail EmptyMetadataError,
|
14
|
+
fail EmptyMetadataError, "Failed to retrieve the metadata" if @metadata.blank?
|
14
15
|
end
|
15
16
|
|
16
17
|
##
|
@@ -30,11 +31,11 @@ module Geoblacklight
|
|
30
31
|
# @return [Nokogiri::XML::Document] the Nokogiri XML Document for the cleaned HTML
|
31
32
|
def cleaned_metadata
|
32
33
|
transformed_doc = Nokogiri::XML(@metadata.to_html)
|
33
|
-
if transformed_doc.xpath(
|
34
|
+
if transformed_doc.xpath("//body").children.empty?
|
34
35
|
fail TransformError, \
|
35
|
-
|
36
|
+
"Failed to extract the <body> child elements from the transformed metadata"
|
36
37
|
end
|
37
|
-
transformed_doc.xpath(
|
38
|
+
transformed_doc.xpath("//body").children
|
38
39
|
rescue => e
|
39
40
|
raise TransformError, e.message
|
40
41
|
end
|
@@ -1,17 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "geo_combine"
|
3
4
|
|
4
5
|
module Geoblacklight
|
5
6
|
module MetadataTransformer
|
6
7
|
##
|
7
8
|
# Exceptions raised for the types of geospatial metadata
|
8
9
|
class TypeError < EncodingError; end
|
10
|
+
|
9
11
|
##
|
10
12
|
# Exceptions raised when parsing geospatial metadata in the XML
|
11
13
|
class ParseError < EncodingError; end
|
14
|
+
|
12
15
|
##
|
13
16
|
# Exception raised when the geospatial metadata content is empty
|
14
17
|
class EmptyMetadataError < ParseError; end
|
18
|
+
|
15
19
|
##
|
16
20
|
# Exceptions raised when transforming the metadata into the HTML
|
17
21
|
class TransformError < EncodingError; end
|
@@ -21,7 +25,7 @@ module Geoblacklight
|
|
21
25
|
# @param [Geoblacklight::Metadata::Base] metadata string or File path to the raw metadata
|
22
26
|
# @return [Geoblacklight::MetadataTransformer::BaseTransformer]
|
23
27
|
def self.instance(metadata)
|
24
|
-
type = metadata.class.name.split(
|
28
|
+
type = metadata.class.name.split("::").last
|
25
29
|
begin
|
26
30
|
klass = "Geoblacklight::MetadataTransformer::#{type.capitalize}".constantize
|
27
31
|
rescue
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
##
|
4
5
|
# Parses an array of dct_references to create useful reference information
|
@@ -30,7 +31,7 @@ module Geoblacklight
|
|
30
31
|
# Creates a hash, using its type as key and endpoint as value
|
31
32
|
# @return [Hash]
|
32
33
|
def to_hash
|
33
|
-
{
|
34
|
+
{type => endpoint}
|
34
35
|
end
|
35
36
|
|
36
37
|
private
|
@@ -40,7 +41,7 @@ module Geoblacklight
|
|
40
41
|
# Remove any trailing slashes
|
41
42
|
# @return [String]
|
42
43
|
def uri
|
43
|
-
@reference[0].sub(/(\/)+$/,
|
44
|
+
@reference[0].sub(/(\/)+$/, "") if @reference[0].present?
|
44
45
|
end
|
45
46
|
end
|
46
47
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
# References is a geoblacklight-schema dct:references parser
|
4
5
|
class References
|
@@ -44,7 +45,7 @@ module Geoblacklight
|
|
44
45
|
# Preferred download (should be a file download)
|
45
46
|
# @return [Hash, nil]
|
46
47
|
def preferred_download
|
47
|
-
|
48
|
+
file_download if download.present?
|
48
49
|
end
|
49
50
|
|
50
51
|
##
|
@@ -52,11 +53,11 @@ module Geoblacklight
|
|
52
53
|
# @return [Hash, nil]
|
53
54
|
def downloads_by_format
|
54
55
|
case format
|
55
|
-
when
|
56
|
+
when "Shapefile"
|
56
57
|
vector_download_formats
|
57
|
-
when
|
58
|
+
when "GeoTIFF"
|
58
59
|
geotiff_download_formats
|
59
|
-
when
|
60
|
+
when "ArcGRID"
|
60
61
|
arcgrid_download_formats
|
61
62
|
end
|
62
63
|
end
|
@@ -93,7 +94,7 @@ module Geoblacklight
|
|
93
94
|
# Download hash for a static file download
|
94
95
|
# @return (see #downloads_by_format)
|
95
96
|
def file_download
|
96
|
-
{
|
97
|
+
{file_download: download.to_hash}
|
97
98
|
end
|
98
99
|
|
99
100
|
##
|
@@ -113,14 +114,14 @@ module Geoblacklight
|
|
113
114
|
# Download hash for a GeoTiff file with a WMS reference present
|
114
115
|
# @return (see #downloads_by_format)
|
115
116
|
def geotiff_download_formats
|
116
|
-
{
|
117
|
+
{geotiff: wms.to_hash} if wms.present?
|
117
118
|
end
|
118
119
|
|
119
120
|
##
|
120
121
|
# Download hash for an ArcGRID file with a WMS reference present
|
121
122
|
# @return (see #downloads_by_format)
|
122
123
|
def arcgrid_download_formats
|
123
|
-
{
|
124
|
+
{geotiff: wms.to_hash} if wms.present?
|
124
125
|
end
|
125
126
|
|
126
127
|
##
|
@@ -132,5 +133,9 @@ module Geoblacklight
|
|
132
133
|
super
|
133
134
|
end
|
134
135
|
end
|
136
|
+
|
137
|
+
def respond_to_missing?(m, *args, &b)
|
138
|
+
Geoblacklight::Constants::URI.key?(m) || super
|
139
|
+
end
|
135
140
|
end
|
136
141
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
module Relation
|
4
5
|
class Ancestors
|
@@ -9,8 +10,8 @@ module Geoblacklight
|
|
9
10
|
end
|
10
11
|
|
11
12
|
def create_search_params
|
12
|
-
{
|
13
|
-
|
13
|
+
{fq: ["{!join from=#{@field} to=#{Settings.FIELDS.ID}}#{Settings.FIELDS.ID}:#{@search_id}"],
|
14
|
+
fl: [Settings.FIELDS.TITLE, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE]}
|
14
15
|
end
|
15
16
|
|
16
17
|
def execute_query
|
@@ -22,7 +23,7 @@ module Geoblacklight
|
|
22
23
|
|
23
24
|
def results
|
24
25
|
response = execute_query
|
25
|
-
response[
|
26
|
+
response["response"]
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
module Relation
|
4
5
|
class Descendants
|
@@ -9,8 +10,8 @@ module Geoblacklight
|
|
9
10
|
end
|
10
11
|
|
11
12
|
def create_search_params
|
12
|
-
{
|
13
|
-
|
13
|
+
{fq: "#{@field}:#{@search_id}",
|
14
|
+
fl: [Settings.FIELDS.TITLE, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE]}
|
14
15
|
end
|
15
16
|
|
16
17
|
def execute_query
|
@@ -22,7 +23,7 @@ module Geoblacklight
|
|
22
23
|
|
23
24
|
def results
|
24
25
|
response = execute_query
|
25
|
-
response[
|
26
|
+
response["response"]
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
module Relation
|
4
5
|
class RelationResponse
|
@@ -27,9 +28,9 @@ module Geoblacklight
|
|
27
28
|
|
28
29
|
def query_type(option)
|
29
30
|
case option.query_type
|
30
|
-
when
|
31
|
+
when "ancestors"
|
31
32
|
Geoblacklight::Relation::Ancestors
|
32
|
-
when
|
33
|
+
when "descendants"
|
33
34
|
Geoblacklight::Relation::Descendants
|
34
35
|
else
|
35
36
|
fail ArgumentError, "Bad RelationResponse query_type: #{option.query_type}. Only 'ancestors' or 'descendants' is allowed."
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
module Routes
|
4
5
|
class Downloadable
|
@@ -7,8 +8,8 @@ module Geoblacklight
|
|
7
8
|
end
|
8
9
|
|
9
10
|
def call(mapper, _options = {})
|
10
|
-
mapper.get
|
11
|
-
mapper.get
|
11
|
+
mapper.get "file/:id", action: "file", as: :file
|
12
|
+
mapper.get "hgl/:id", action: "hgl", as: :hgl
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
module Routes
|
4
5
|
class Exportable
|
@@ -8,9 +9,9 @@ module Geoblacklight
|
|
8
9
|
|
9
10
|
def call(mapper, _options = {})
|
10
11
|
mapper.member do
|
11
|
-
mapper.get
|
12
|
-
mapper.get
|
13
|
-
mapper.get
|
12
|
+
mapper.get "web_services"
|
13
|
+
mapper.get "metadata"
|
14
|
+
mapper.get "relations" => "relation#index"
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
data/lib/geoblacklight/routes.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
module Routes
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
5
|
+
require "geoblacklight/routes/exportable"
|
6
|
+
require "geoblacklight/routes/downloadable"
|
7
|
+
require "geoblacklight/routes/wms"
|
7
8
|
end
|
8
9
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
# Override Blacklight helpers to inject behavior
|
4
5
|
module ViewHelperOverride
|
@@ -7,9 +8,9 @@ module Geoblacklight
|
|
7
8
|
end
|
8
9
|
|
9
10
|
def render_search_to_s_bbox(params)
|
10
|
-
return
|
11
|
+
return "".html_safe if params["bbox"].blank?
|
11
12
|
|
12
|
-
render_search_to_s_element(t(
|
13
|
+
render_search_to_s_element(t("geoblacklight.bbox_label"), render_filter_value(params["bbox"]))
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
class FeatureInfoResponse
|
4
5
|
def initialize(response)
|
@@ -15,11 +16,11 @@ module Geoblacklight
|
|
15
16
|
|
16
17
|
def format
|
17
18
|
page = Nokogiri::HTML(@response.body)
|
18
|
-
table_values = {
|
19
|
-
page.css(
|
19
|
+
table_values = {values: []}
|
20
|
+
page.css("th").each do |th|
|
20
21
|
table_values[:values].push([th.text])
|
21
22
|
end
|
22
|
-
page.css(
|
23
|
+
page.css("td").each_with_index do |td, index|
|
23
24
|
table_values[:values][index].push(td.text) unless index >= table_values[:values].count
|
24
25
|
end
|
25
26
|
table_values
|
@@ -27,7 +28,7 @@ module Geoblacklight
|
|
27
28
|
|
28
29
|
def error?
|
29
30
|
@response[:error] ||
|
30
|
-
@response.headers[
|
31
|
+
@response.headers["content-type"].slice(0, 9) == "text/xml"
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
class WmsLayer
|
4
5
|
def initialize(params)
|
@@ -7,11 +8,11 @@ module Geoblacklight
|
|
7
8
|
end
|
8
9
|
|
9
10
|
def url
|
10
|
-
@params[
|
11
|
+
@params["URL"]
|
11
12
|
end
|
12
13
|
|
13
14
|
def search_params
|
14
|
-
@params.except(
|
15
|
+
@params.except("URL")
|
15
16
|
end
|
16
17
|
|
17
18
|
def feature_info
|
@@ -27,7 +28,7 @@ module Geoblacklight
|
|
27
28
|
end
|
28
29
|
rescue Faraday::ConnectionFailed, Faraday::TimeoutError => error
|
29
30
|
Geoblacklight.logger.error error.inspect
|
30
|
-
{
|
31
|
+
{error: error.inspect}
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end
|
data/lib/geoblacklight.rb
CHANGED
@@ -1,37 +1,38 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require
|
2
|
+
|
3
|
+
require "active_support/dependencies"
|
4
|
+
require "geoblacklight/engine"
|
4
5
|
|
5
6
|
module Geoblacklight
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
24
|
-
require
|
25
|
-
require
|
26
|
-
require
|
27
|
-
require
|
28
|
-
require
|
29
|
-
require
|
30
|
-
require
|
31
|
-
require
|
32
|
-
require
|
33
|
-
require
|
34
|
-
require
|
7
|
+
require "geoblacklight/bounding_box"
|
8
|
+
require "geoblacklight/constants"
|
9
|
+
require "geoblacklight/exceptions"
|
10
|
+
require "geoblacklight/geometry"
|
11
|
+
require "geoblacklight/view_helper_override"
|
12
|
+
require "geoblacklight/item_viewer"
|
13
|
+
require "geoblacklight/wms_layer"
|
14
|
+
require "geoblacklight/wms_layer/feature_info_response"
|
15
|
+
require "geoblacklight/download"
|
16
|
+
require "geoblacklight/download/geojson_download"
|
17
|
+
require "geoblacklight/download/geotiff_download"
|
18
|
+
require "geoblacklight/download/kmz_download"
|
19
|
+
require "geoblacklight/download/shapefile_download"
|
20
|
+
require "geoblacklight/download/hgl_download"
|
21
|
+
require "geoblacklight/metadata"
|
22
|
+
require "geoblacklight/metadata/base"
|
23
|
+
require "geoblacklight/metadata/fgdc"
|
24
|
+
require "geoblacklight/metadata/html"
|
25
|
+
require "geoblacklight/metadata/iso19139"
|
26
|
+
require "geoblacklight/metadata_transformer"
|
27
|
+
require "geoblacklight/metadata_transformer/base"
|
28
|
+
require "geoblacklight/metadata_transformer/fgdc"
|
29
|
+
require "geoblacklight/metadata_transformer/iso19139"
|
30
|
+
require "geoblacklight/reference"
|
31
|
+
require "geoblacklight/references"
|
32
|
+
require "geoblacklight/routes"
|
33
|
+
require "geoblacklight/relation/descendants"
|
34
|
+
require "geoblacklight/relation/ancestors"
|
35
|
+
require "geoblacklight/relation/relation_response"
|
35
36
|
|
36
37
|
def self.logger
|
37
38
|
::Rails.logger
|