geoblacklight 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +21 -6
- data/.solr_wrapper +1 -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/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 +44 -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/_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.yml +74 -22
- 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 +12 -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 +11 -6
- 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/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 +9 -8
- data/spec/features/tms_spec.rb +6 -5
- data/spec/features/web_services_modal_spec.rb +37 -36
- data/spec/features/wmts_spec.rb +16 -15
- data/spec/features/xyz_spec.rb +6 -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 +2 -2
- 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 +6 -6
- 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 +34 -33
- 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 +29 -212
- 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
@@ -50,6 +50,7 @@ FIELDS:
|
|
50
50
|
:DATE_ISSUED: 'dct_issued_s'
|
51
51
|
:DATE_RANGE: 'gbl_dateRange_drsim'
|
52
52
|
:DESCRIPTION: 'dct_description_sm'
|
53
|
+
:DISPLAY_NOTE: 'gbl_displayNote_sm'
|
53
54
|
:FORMAT: 'dct_format_s'
|
54
55
|
:FILE_SIZE: 'gbl_fileSize_s'
|
55
56
|
:GEOREFERENCED: 'gbl_georeferenced_b'
|
@@ -119,54 +120,100 @@ WEBSERVICES_SHOWN:
|
|
119
120
|
- 'dynamic_map_layer'
|
120
121
|
- 'image_map_layer'
|
121
122
|
|
123
|
+
# Display Notes to display / Non-prefixed default bootstrap class is alert-secondary
|
124
|
+
DISPLAY_NOTES_SHOWN:
|
125
|
+
danger:
|
126
|
+
bootstrap_alert_class: alert-danger
|
127
|
+
icon: fire-solid
|
128
|
+
note_prefix: "Danger: "
|
129
|
+
info:
|
130
|
+
bootstrap_alert_class: alert-info
|
131
|
+
icon: circle-info-solid
|
132
|
+
note_prefix: "Info: "
|
133
|
+
tip:
|
134
|
+
bootstrap_alert_class: alert-success
|
135
|
+
icon: lightbulb-solid
|
136
|
+
note_prefix: "Tip: "
|
137
|
+
warning:
|
138
|
+
bootstrap_alert_class: alert-warning
|
139
|
+
icon: triangle-exclamation-solid
|
140
|
+
note_prefix: "Warning: "
|
141
|
+
|
122
142
|
# Relationships to display
|
123
143
|
RELATIONSHIPS_SHOWN:
|
124
|
-
|
144
|
+
MEMBER_OF_ANCESTORS:
|
125
145
|
field: pcdm_memberOf_sm
|
146
|
+
icon: parent-item
|
147
|
+
inverse: :MEMBER_OF_DESCENDANTS
|
148
|
+
label: geoblacklight.relations.member_of_ancestors
|
126
149
|
query_type: ancestors
|
127
|
-
|
128
|
-
|
150
|
+
MEMBER_OF_DESCENDANTS:
|
151
|
+
field: pcdm_memberOf_sm
|
152
|
+
icon: child-item
|
153
|
+
inverse: :MEMBER_OF_ANCESTORS
|
154
|
+
label: geoblacklight.relations.member_of_descendants
|
155
|
+
query_type: descendants
|
129
156
|
PART_OF_ANCESTORS:
|
130
157
|
field: dct_isPartOf_sm
|
131
|
-
|
132
|
-
|
158
|
+
icon: parent-item
|
159
|
+
inverse: :PART_OF_DESCENDANTS
|
133
160
|
label: geoblacklight.relations.part_of_ancestors
|
161
|
+
query_type: ancestors
|
134
162
|
PART_OF_DESCENDANTS:
|
135
163
|
field: dct_isPartOf_sm
|
136
|
-
query_type: descendants
|
137
164
|
icon: child-item
|
165
|
+
inverse: :PART_OF_ANCESTORS
|
138
166
|
label: geoblacklight.relations.part_of_descendants
|
139
|
-
|
167
|
+
query_type: descendants
|
168
|
+
RELATION_ANCESTORS:
|
140
169
|
field: dct_relation_sm
|
170
|
+
icon: nil
|
171
|
+
inverse: :RELATION_DESCENDANTS
|
172
|
+
label: geoblacklight.relations.relation_ancestors
|
141
173
|
query_type: ancestors
|
174
|
+
RELATION_DESCENDANTS:
|
175
|
+
field: dct_relation_sm
|
142
176
|
icon: nil
|
143
|
-
|
144
|
-
|
177
|
+
inverse: :RELATION_ANCESTORS
|
178
|
+
label: geoblacklight.relations.relation_descendants
|
179
|
+
query_type: descendants
|
180
|
+
REPLACES_ANCESTORS:
|
145
181
|
field: dct_replaces_sm
|
182
|
+
icon: nil
|
183
|
+
inverse: :REPLACES_DESCENDANTS
|
184
|
+
label: geoblacklight.relations.replaces_ancestors
|
146
185
|
query_type: ancestors
|
186
|
+
REPLACES_DESCENDANTS:
|
187
|
+
field: dct_replaces_sm
|
147
188
|
icon: nil
|
148
|
-
|
149
|
-
|
150
|
-
field: dct_isReplacedBy_sm
|
189
|
+
inverse: :REPLACES_ANCESTORS
|
190
|
+
label: geoblacklight.relations.replaces_descendants
|
151
191
|
query_type: descendants
|
152
|
-
icon: nil
|
153
|
-
label: geoblacklight.relations.replaced_by
|
154
192
|
SOURCE_ANCESTORS:
|
155
193
|
field: dct_source_sm
|
156
|
-
query_type: ancestors
|
157
194
|
icon: parent-item
|
158
|
-
|
195
|
+
inverse: :SOURCE_DESCENDANTS
|
196
|
+
label: geoblacklight.relations.source_ancestors
|
197
|
+
query_type: ancestors
|
159
198
|
SOURCE_DESCENDANTS:
|
160
199
|
field: dct_source_sm
|
161
|
-
query_type: descendants
|
162
200
|
icon: child-item
|
163
|
-
|
164
|
-
|
201
|
+
inverse: :SOURCE_ANCESTORS
|
202
|
+
label: geoblacklight.relations.source_descendants
|
203
|
+
query_type: descendants
|
204
|
+
VERSION_OF_ANCESTORS:
|
165
205
|
field: dct_isVersionOf_sm
|
206
|
+
icon: parent-item
|
207
|
+
inverse: :VERSION_OF_DESCENDANTS
|
208
|
+
label: geoblacklight.relations.version_of_ancestors
|
209
|
+
query_type: ancestors
|
210
|
+
VERSION_OF_DESCENDANTS:
|
211
|
+
field: dct_isVersionOf_sm
|
212
|
+
icon: child-item
|
213
|
+
inverse: :VERSION_OF_ANCESTORS
|
214
|
+
label: geoblacklight.relations.version_of_descendants
|
166
215
|
query_type: descendants
|
167
|
-
|
168
|
-
label: geoblacklight.relations.version_of
|
169
|
-
|
216
|
+
|
170
217
|
# WMS Parameters
|
171
218
|
WMS_PARAMS:
|
172
219
|
:SERVICE: 'WMS'
|
@@ -234,3 +281,8 @@ HELP_TEXT:
|
|
234
281
|
- 'wms'
|
235
282
|
- 'tms'
|
236
283
|
- 'oembed'
|
284
|
+
|
285
|
+
# Enable catalog#show sidebar static map for items with the following viewer protocols
|
286
|
+
SIDEBAR_STATIC_MAP:
|
287
|
+
- 'iiif'
|
288
|
+
- 'iiif_manifest'
|
@@ -1,33 +1,34 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
# Module to declare application level constants and lookup hash
|
4
5
|
module Constants
|
5
6
|
URI = {
|
6
|
-
download:
|
7
|
-
fgdc:
|
8
|
-
geojson:
|
9
|
-
html:
|
10
|
-
iiif:
|
11
|
-
iiif_manifest:
|
12
|
-
iso19139:
|
13
|
-
mods:
|
14
|
-
shapefile:
|
15
|
-
url:
|
16
|
-
wcs:
|
17
|
-
wfs:
|
18
|
-
wms:
|
19
|
-
wmts:
|
20
|
-
tms:
|
21
|
-
tilejson:
|
22
|
-
xyz:
|
23
|
-
hgl:
|
24
|
-
feature_layer:
|
25
|
-
tiled_map_layer:
|
26
|
-
dynamic_map_layer:
|
27
|
-
image_map_layer:
|
28
|
-
data_dictionary:
|
29
|
-
index_map:
|
30
|
-
oembed:
|
7
|
+
download: "http://schema.org/downloadUrl",
|
8
|
+
fgdc: "http://www.opengis.net/cat/csw/csdgm",
|
9
|
+
geojson: "http://geojson.org/geojson-spec.html",
|
10
|
+
html: "http://www.w3.org/1999/xhtml",
|
11
|
+
iiif: "http://iiif.io/api/image",
|
12
|
+
iiif_manifest: "http://iiif.io/api/presentation#manifest",
|
13
|
+
iso19139: "http://www.isotc211.org/schemas/2005/gmd",
|
14
|
+
mods: "http://www.loc.gov/mods/v3",
|
15
|
+
shapefile: "http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf",
|
16
|
+
url: "http://schema.org/url",
|
17
|
+
wcs: "http://www.opengis.net/def/serviceType/ogc/wcs",
|
18
|
+
wfs: "http://www.opengis.net/def/serviceType/ogc/wfs",
|
19
|
+
wms: "http://www.opengis.net/def/serviceType/ogc/wms",
|
20
|
+
wmts: "http://www.opengis.net/def/serviceType/ogc/wmts",
|
21
|
+
tms: "https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification",
|
22
|
+
tilejson: "https://github.com/mapbox/tilejson-spec",
|
23
|
+
xyz: "https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames",
|
24
|
+
hgl: "http://schema.org/DownloadAction",
|
25
|
+
feature_layer: "urn:x-esri:serviceType:ArcGIS#FeatureLayer",
|
26
|
+
tiled_map_layer: "urn:x-esri:serviceType:ArcGIS#TiledMapLayer",
|
27
|
+
dynamic_map_layer: "urn:x-esri:serviceType:ArcGIS#DynamicMapLayer",
|
28
|
+
image_map_layer: "urn:x-esri:serviceType:ArcGIS#ImageMapLayer",
|
29
|
+
data_dictionary: "http://lccn.loc.gov/sh85035852",
|
30
|
+
index_map: "https://openindexmaps.org",
|
31
|
+
oembed: "https://oembed.com"
|
31
32
|
}.freeze
|
32
33
|
end
|
33
34
|
end
|
@@ -1,22 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
class GeojsonDownload < Geoblacklight::Download
|
4
5
|
GEOJSON_DOWNLOAD_PARAMS = {
|
5
|
-
service:
|
6
|
-
version:
|
7
|
-
request:
|
8
|
-
srsName:
|
9
|
-
outputformat:
|
6
|
+
service: "wfs",
|
7
|
+
version: "2.0.0",
|
8
|
+
request: "GetFeature",
|
9
|
+
srsName: "EPSG:4326",
|
10
|
+
outputformat: "application/json"
|
10
11
|
}.freeze
|
11
12
|
|
12
13
|
def initialize(document, options = {})
|
13
14
|
request_params = GEOJSON_DOWNLOAD_PARAMS.merge(typeName: document[Settings.FIELDS.WXS_IDENTIFIER])
|
14
15
|
super(document, {
|
15
|
-
type:
|
16
|
-
extension:
|
16
|
+
type: "geojson",
|
17
|
+
extension: "json",
|
17
18
|
request_params: request_params,
|
18
|
-
content_type:
|
19
|
-
service_type:
|
19
|
+
content_type: "application/json",
|
20
|
+
service_type: "wfs"
|
20
21
|
}.merge(options))
|
21
22
|
end
|
22
23
|
end
|
@@ -1,19 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
class GeotiffDownload < Geoblacklight::Download
|
4
5
|
GEOTIFF_DOWNLOAD_PARAMS = {
|
5
|
-
format:
|
6
|
+
format: "image/geotiff",
|
6
7
|
width: 4096
|
7
8
|
}.freeze
|
8
9
|
|
9
10
|
def initialize(document, options = {})
|
10
11
|
request_params = GEOTIFF_DOWNLOAD_PARAMS.merge(layers: document[Settings.FIELDS.WXS_IDENTIFIER])
|
11
12
|
super(document, {
|
12
|
-
type:
|
13
|
-
extension:
|
13
|
+
type: "geotiff",
|
14
|
+
extension: "tif",
|
14
15
|
request_params: request_params,
|
15
|
-
content_type:
|
16
|
-
service_type:
|
16
|
+
content_type: "image/geotiff",
|
17
|
+
service_type: "wms",
|
17
18
|
reflect: true
|
18
19
|
}.merge(options))
|
19
20
|
end
|
@@ -1,14 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
class HglDownload < Geoblacklight::Download
|
4
5
|
def initialize(document, email, options = {})
|
5
6
|
request_params = {
|
6
|
-
|
7
|
-
|
7
|
+
"LayerName" => document[Settings.FIELDS.WXS_IDENTIFIER].sub(/^cite:/, ""),
|
8
|
+
"UserEmail" => email
|
8
9
|
}
|
9
10
|
super(document, {
|
10
11
|
request_params: request_params,
|
11
|
-
service_type:
|
12
|
+
service_type: "hgl"
|
12
13
|
}.merge(options))
|
13
14
|
end
|
14
15
|
|
@@ -1,22 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
class KmzDownload < Geoblacklight::Download
|
4
|
-
KMZ_DOWNLOAD_PARAMS = {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
KMZ_DOWNLOAD_PARAMS = {service: "wms",
|
6
|
+
version: "1.1.0",
|
7
|
+
request: "GetMap",
|
8
|
+
srsName: "EPSG:3857",
|
9
|
+
format: "application/vnd.google-earth.kmz",
|
10
|
+
width: 2000, height: 2000}.freeze
|
10
11
|
|
11
12
|
def initialize(document, options = {})
|
12
13
|
bbox_wsen = document.geometry.bounding_box
|
13
14
|
request_params = KMZ_DOWNLOAD_PARAMS.merge(layers: document[Settings.FIELDS.WXS_IDENTIFIER], bbox: bbox_wsen)
|
14
15
|
super(document, {
|
15
|
-
type:
|
16
|
-
extension:
|
16
|
+
type: "kmz",
|
17
|
+
extension: "kmz",
|
17
18
|
request_params: request_params,
|
18
|
-
content_type:
|
19
|
-
service_type:
|
19
|
+
content_type: "application/vnd.google-earth.kmz",
|
20
|
+
service_type: "wms"
|
20
21
|
}.merge(options))
|
21
22
|
end
|
22
23
|
end
|
@@ -1,20 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
class ShapefileDownload < Geoblacklight::Download
|
4
|
-
SHAPEFILE_DOWNLOAD_PARAMS = {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
SHAPEFILE_DOWNLOAD_PARAMS = {service: "wfs",
|
6
|
+
version: "2.0.0",
|
7
|
+
request: "GetFeature",
|
8
|
+
srsName: "EPSG:4326",
|
9
|
+
outputformat: "SHAPE-ZIP"}.freeze
|
9
10
|
|
10
11
|
def initialize(document, options = {})
|
11
12
|
request_params = SHAPEFILE_DOWNLOAD_PARAMS.merge(typeName: document[Settings.FIELDS.WXS_IDENTIFIER])
|
12
13
|
super(document, {
|
13
|
-
type:
|
14
|
-
extension:
|
14
|
+
type: "shapefile",
|
15
|
+
extension: "zip",
|
15
16
|
request_params: request_params,
|
16
|
-
content_type:
|
17
|
-
service_type:
|
17
|
+
content_type: "application/zip",
|
18
|
+
service_type: "wfs"
|
18
19
|
}.merge(options))
|
19
20
|
end
|
20
21
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
class Download
|
4
5
|
def initialize(document, options = {})
|
@@ -15,7 +16,7 @@ module Geoblacklight
|
|
15
16
|
end
|
16
17
|
|
17
18
|
def self.file_path
|
18
|
-
Settings.DOWNLOAD_PATH || Rails.root.join(
|
19
|
+
Settings.DOWNLOAD_PATH || Rails.root.join("tmp", "cache", "downloads")
|
19
20
|
end
|
20
21
|
|
21
22
|
def file_path_and_name
|
@@ -41,7 +42,7 @@ module Geoblacklight
|
|
41
42
|
def create_download_file
|
42
43
|
download = initiate_download
|
43
44
|
|
44
|
-
File.open("#{file_path_and_name}.tmp",
|
45
|
+
File.open("#{file_path_and_name}.tmp", "wb") do |file|
|
45
46
|
fail Geoblacklight::Exceptions::WrongDownloadFormat unless matches_mimetype?(download)
|
46
47
|
file.write download.body
|
47
48
|
end
|
@@ -49,9 +50,9 @@ module Geoblacklight
|
|
49
50
|
file_name
|
50
51
|
rescue Geoblacklight::Exceptions::WrongDownloadFormat => error
|
51
52
|
Geoblacklight.logger.error "#{error} expected #{@options[:content_type]} " \
|
52
|
-
"received #{download.headers[
|
53
|
+
"received #{download.headers["content-type"]}"
|
53
54
|
File.delete("#{file_path_and_name}.tmp")
|
54
|
-
raise Geoblacklight::Exceptions::ExternalDownloadFailed, message:
|
55
|
+
raise Geoblacklight::Exceptions::ExternalDownloadFailed, message: "Wrong download type"
|
55
56
|
end
|
56
57
|
|
57
58
|
##
|
@@ -68,25 +69,25 @@ module Geoblacklight
|
|
68
69
|
end
|
69
70
|
rescue Faraday::ConnectionFailed
|
70
71
|
raise Geoblacklight::Exceptions::ExternalDownloadFailed,
|
71
|
-
|
72
|
-
|
72
|
+
message: "Download connection failed",
|
73
|
+
url: conn.url_prefix.to_s
|
73
74
|
rescue Faraday::TimeoutError
|
74
75
|
raise Geoblacklight::Exceptions::ExternalDownloadFailed,
|
75
|
-
|
76
|
-
|
76
|
+
message: "Download timed out",
|
77
|
+
url: conn.url_prefix.to_s
|
77
78
|
end
|
78
79
|
|
79
80
|
##
|
80
81
|
# Creates a download url for the object
|
81
82
|
# @return [String]
|
82
83
|
def url_with_params
|
83
|
-
url +
|
84
|
+
url + "/?" + URI.encode_www_form(@options[:request_params])
|
84
85
|
end
|
85
86
|
|
86
87
|
private
|
87
88
|
|
88
89
|
def matches_mimetype?(download)
|
89
|
-
MIME::Type.simplified(download.headers[
|
90
|
+
MIME::Type.simplified(download.headers["content-type"]) == @options[:content_type]
|
90
91
|
end
|
91
92
|
|
92
93
|
##
|
@@ -102,7 +103,7 @@ module Geoblacklight
|
|
102
103
|
# @return [String] URL that is checked in download
|
103
104
|
def url
|
104
105
|
url = @document.references.send(@options[:service_type]).endpoint
|
105
|
-
url +=
|
106
|
+
url += "/reflect" if @options[:reflect]
|
106
107
|
url
|
107
108
|
end
|
108
109
|
end
|
data/lib/geoblacklight/engine.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
2
|
+
|
3
|
+
require "blacklight"
|
4
|
+
require "coderay"
|
5
|
+
require "config"
|
6
|
+
require "faraday"
|
7
|
+
require "geoblacklight/version"
|
8
|
+
require "nokogiri"
|
9
|
+
require "mime/types"
|
10
|
+
require "handlebars_assets"
|
10
11
|
|
11
12
|
module Geoblacklight
|
12
13
|
class Engine < ::Rails::Engine
|
13
14
|
# GeoblacklightHelper is needed by all helpers, so we inject it
|
14
15
|
# into action view base here.
|
15
|
-
initializer
|
16
|
+
initializer "geoblacklight.helpers" do
|
16
17
|
config.after_initialize do
|
17
18
|
ActionView::Base.send :include, GeoblacklightHelper
|
18
19
|
ActionView::Base.send :include, CartoHelper
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
module Exceptions
|
4
5
|
class ExternalDownloadFailed < StandardError
|
@@ -20,8 +21,10 @@ module Geoblacklight
|
|
20
21
|
@options[:message].to_s
|
21
22
|
end
|
22
23
|
end
|
24
|
+
|
23
25
|
class WrongDownloadFormat < StandardError
|
24
26
|
end
|
27
|
+
|
25
28
|
class WrongBoundingBoxFormat < StandardError
|
26
29
|
end
|
27
30
|
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
# :nocov:
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require "faraday"
|
5
|
+
require "set"
|
5
6
|
|
6
7
|
module Geoblacklight
|
7
8
|
# NOTE: We copied this class from faraday_middleware in order to support
|
@@ -15,7 +16,7 @@ module Geoblacklight
|
|
15
16
|
attr_reader :response
|
16
17
|
|
17
18
|
def initialize(response)
|
18
|
-
super "too many redirects; last one to: #{response[
|
19
|
+
super "too many redirects; last one to: #{response["location"]}"
|
19
20
|
@response = response
|
20
21
|
end
|
21
22
|
end
|
@@ -43,18 +44,18 @@ module Geoblacklight
|
|
43
44
|
# HTTP methods for which 30x redirects can be followed
|
44
45
|
ALLOWED_METHODS = Set.new [:head, :options, :get, :post, :put, :patch, :delete]
|
45
46
|
# HTTP redirect status codes that this middleware implements
|
46
|
-
REDIRECT_CODES
|
47
|
+
REDIRECT_CODES = Set.new [301, 302, 303, 307, 308]
|
47
48
|
# Keys in env hash which will get cleared between requests
|
48
|
-
ENV_TO_CLEAR
|
49
|
+
ENV_TO_CLEAR = Set.new [:status, :response, :response_headers]
|
49
50
|
|
50
51
|
# Default value for max redirects followed
|
51
52
|
FOLLOW_LIMIT = 3
|
52
53
|
|
53
54
|
# Regex that matches characters that need to be escaped in URLs, sans
|
54
55
|
# the "%" character which we assume already represents an escaped sequence.
|
55
|
-
URI_UNSAFE = %r{[^\-_.!~*'()a-zA-Z\d;/?:@&=+$,\[\]%]}
|
56
|
+
URI_UNSAFE = %r{[^\-_.!~*'()a-zA-Z\d;/?:@&=+$,\[\]%]}
|
56
57
|
|
57
|
-
AUTH_HEADER =
|
58
|
+
AUTH_HEADER = "Authorization"
|
58
59
|
|
59
60
|
# Public: Initialize the middleware.
|
60
61
|
#
|
@@ -109,7 +110,7 @@ module Geoblacklight
|
|
109
110
|
|
110
111
|
def update_env(env, request_body, response)
|
111
112
|
redirect_from_url = env[:url].to_s
|
112
|
-
redirect_to_url = safe_escape(response[
|
113
|
+
redirect_to_url = safe_escape(response["location"] || "")
|
113
114
|
env[:url] += redirect_to_url
|
114
115
|
|
115
116
|
ENV_TO_CLEAR.each { |key| env.delete key }
|
@@ -148,9 +149,9 @@ module Geoblacklight
|
|
148
149
|
# URI:HTTP using the `+` operator. Doesn't escape "%" characters so to not
|
149
150
|
# risk double-escaping.
|
150
151
|
def safe_escape(uri)
|
151
|
-
uri = uri.split(
|
152
|
+
uri = uri.split("#")[0] # we want to remove the fragment if present
|
152
153
|
uri.to_s.gsub(URI_UNSAFE) do |match|
|
153
|
-
"%#{match.unpack(
|
154
|
+
"%#{match.unpack("H2" * match.bytesize).join("%").upcase}"
|
154
155
|
end
|
155
156
|
end
|
156
157
|
|
@@ -162,7 +163,7 @@ module Geoblacklight
|
|
162
163
|
end
|
163
164
|
|
164
165
|
def redirect_to_same_host?(from_url, to_url)
|
165
|
-
return true if to_url.start_with?(
|
166
|
+
return true if to_url.start_with?("/")
|
166
167
|
|
167
168
|
from_uri = URI.parse(from_url)
|
168
169
|
to_uri = URI.parse(to_url)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require
|
2
|
+
|
3
|
+
require "rgeo"
|
4
|
+
require "rgeo-geojson"
|
4
5
|
|
5
6
|
module Geoblacklight
|
6
7
|
# Transforms and parses geometry expressed in WKT or CSW WKT ENVELOPE syntax
|
@@ -17,7 +18,7 @@ module Geoblacklight
|
|
17
18
|
def geojson
|
18
19
|
obj = factory.parse_wkt(geometry_as_wkt)
|
19
20
|
RGeo::GeoJSON.encode(obj).to_json
|
20
|
-
rescue
|
21
|
+
rescue
|
21
22
|
Geoblacklight.logger.warn "Geometry is not valid: #{geom}"
|
22
23
|
default_extent
|
23
24
|
end
|
@@ -47,8 +48,8 @@ module Geoblacklight
|
|
47
48
|
# @return [String]
|
48
49
|
def default_extent
|
49
50
|
{
|
50
|
-
|
51
|
-
|
51
|
+
"type" => "Polygon",
|
52
|
+
"coordinates" => [
|
52
53
|
[
|
53
54
|
[-180.0, 90.0], [-180.0, -90.0], [180.0, -90.0], [180.0, 90.0], [-180.0, 90.0]
|
54
55
|
]
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Geoblacklight
|
3
4
|
class ItemViewer
|
4
5
|
def initialize(references)
|
@@ -6,12 +7,12 @@ module Geoblacklight
|
|
6
7
|
end
|
7
8
|
|
8
9
|
def viewer_protocol
|
9
|
-
return
|
10
|
+
return "map" if viewer_preference.nil?
|
10
11
|
viewer_preference.keys.first.to_s
|
11
12
|
end
|
12
13
|
|
13
14
|
def viewer_endpoint
|
14
|
-
return
|
15
|
+
return "" if viewer_preference.nil?
|
15
16
|
viewer_preference.values.first.to_s
|
16
17
|
end
|
17
18
|
|
@@ -65,7 +66,7 @@ module Geoblacklight
|
|
65
66
|
|
66
67
|
def viewer_preference
|
67
68
|
[oembed, index_map, tilejson, xyz, wmts, tms, wms, iiif, tiled_map_layer, dynamic_map_layer,
|
68
|
-
|
69
|
+
image_map_layer, feature_layer].compact.map(&:to_hash).first
|
69
70
|
end
|
70
71
|
end
|
71
72
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "geoblacklight/faraday_middleware/follow_redirects"
|
3
4
|
module Geoblacklight
|
4
5
|
module Metadata
|
5
6
|
##
|
@@ -55,10 +56,10 @@ module Geoblacklight
|
|
55
56
|
response = connection.get
|
56
57
|
return response.body unless response.nil? || response.status == 404
|
57
58
|
Geoblacklight.logger.error "Could not reach #{@reference.endpoint}"
|
58
|
-
|
59
|
+
""
|
59
60
|
rescue Faraday::ConnectionFailed, Faraday::TimeoutError, OpenSSL::SSL::SSLError => error
|
60
61
|
Geoblacklight.logger.error error.inspect
|
61
|
-
|
62
|
+
""
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
@@ -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
|