geoblacklight 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +21 -6
  3. data/.solr_wrapper +1 -0
  4. data/.standard.yml +1 -0
  5. data/Gemfile +13 -11
  6. data/README.md +1 -1
  7. data/Rakefile +42 -50
  8. data/app/assets/images/blacklight/american-geographical-society-library-uwm-libraries.svg +26 -0
  9. data/app/assets/images/blacklight/arizona.svg +4 -0
  10. data/app/assets/images/blacklight/circle-info-solid.svg +1 -0
  11. data/app/assets/images/blacklight/fire-solid.svg +1 -0
  12. data/app/assets/images/blacklight/lightbulb-solid.svg +1 -0
  13. data/app/assets/images/blacklight/nebraska.svg +4 -0
  14. data/app/assets/images/blacklight/rutgers.svg +5 -0
  15. data/app/assets/images/blacklight/triangle-exclamation-solid.svg +1 -0
  16. data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +8 -0
  17. data/app/components/geoblacklight/display_note_component.html.erb +1 -0
  18. data/app/components/geoblacklight/display_note_component.rb +47 -0
  19. data/app/components/geoblacklight/icon_facet_item_component.rb +2 -2
  20. data/app/controllers/download_controller.rb +36 -37
  21. data/app/controllers/relation_controller.rb +1 -0
  22. data/app/controllers/wms_controller.rb +1 -0
  23. data/app/helpers/arcgis_helper.rb +2 -1
  24. data/app/helpers/blacklight_helper.rb +2 -1
  25. data/app/helpers/carto_helper.rb +3 -2
  26. data/app/helpers/geoblacklight/geoblacklight_helper_behavior.rb +2 -1
  27. data/app/helpers/geoblacklight_helper.rb +44 -36
  28. data/app/models/concerns/geoblacklight/bbox_filter_query.rb +1 -1
  29. data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +1 -0
  30. data/app/models/concerns/geoblacklight/solr_document/carto.rb +1 -0
  31. data/app/models/concerns/geoblacklight/solr_document/citation.rb +3 -2
  32. data/app/models/concerns/geoblacklight/solr_document/finder.rb +1 -0
  33. data/app/models/concerns/geoblacklight/solr_document/inspection.rb +1 -0
  34. data/app/models/concerns/geoblacklight/solr_document.rb +17 -9
  35. data/app/models/concerns/geoblacklight/suppressed_records_search_behavior.rb +2 -1
  36. data/app/presenters/geoblacklight/document_presenter.rb +3 -2
  37. data/app/views/catalog/_show_default_display_note.html.erb +7 -0
  38. data/app/views/catalog/_show_sidebar.html.erb +1 -0
  39. data/app/views/catalog/_show_sidebar_static_map.html.erb +10 -0
  40. data/app/views/relation/index.json.jbuilder +1 -1
  41. data/config/initializers/new_gbl_settings_defaults_4.1.yml +104 -0
  42. data/config/initializers/rails_config.rb +5 -1
  43. data/config/locales/geoblacklight.en.yml +18 -10
  44. data/geoblacklight.gemspec +36 -40
  45. data/lib/generators/geoblacklight/assets_generator.rb +15 -15
  46. data/lib/generators/geoblacklight/install_generator.rb +24 -23
  47. data/lib/generators/geoblacklight/templates/catalog_controller.rb +66 -71
  48. data/lib/generators/geoblacklight/templates/settings.yml +74 -22
  49. data/lib/geoblacklight/bounding_box.rb +1 -0
  50. data/lib/geoblacklight/constants.rb +26 -25
  51. data/lib/geoblacklight/download/geojson_download.rb +10 -9
  52. data/lib/geoblacklight/download/geotiff_download.rb +6 -5
  53. data/lib/geoblacklight/download/hgl_download.rb +4 -3
  54. data/lib/geoblacklight/download/kmz_download.rb +11 -10
  55. data/lib/geoblacklight/download/shapefile_download.rb +10 -9
  56. data/lib/geoblacklight/download.rb +12 -11
  57. data/lib/geoblacklight/engine.rb +10 -9
  58. data/lib/geoblacklight/exceptions.rb +3 -0
  59. data/lib/geoblacklight/faraday_middleware/follow_redirects.rb +12 -11
  60. data/lib/geoblacklight/geometry.rb +6 -5
  61. data/lib/geoblacklight/item_viewer.rb +4 -3
  62. data/lib/geoblacklight/metadata/base.rb +4 -3
  63. data/lib/geoblacklight/metadata/fgdc.rb +1 -0
  64. data/lib/geoblacklight/metadata/html.rb +5 -4
  65. data/lib/geoblacklight/metadata/iso19139.rb +1 -0
  66. data/lib/geoblacklight/metadata.rb +1 -0
  67. data/lib/geoblacklight/metadata_transformer/base.rb +5 -4
  68. data/lib/geoblacklight/metadata_transformer/fgdc.rb +1 -0
  69. data/lib/geoblacklight/metadata_transformer/iso19139.rb +1 -0
  70. data/lib/geoblacklight/metadata_transformer.rb +6 -2
  71. data/lib/geoblacklight/reference.rb +3 -2
  72. data/lib/geoblacklight/references.rb +11 -6
  73. data/lib/geoblacklight/relation/ancestors.rb +4 -3
  74. data/lib/geoblacklight/relation/descendants.rb +4 -3
  75. data/lib/geoblacklight/relation/relation_response.rb +3 -2
  76. data/lib/geoblacklight/routes/downloadable.rb +3 -2
  77. data/lib/geoblacklight/routes/exportable.rb +4 -3
  78. data/lib/geoblacklight/routes/wms.rb +2 -1
  79. data/lib/geoblacklight/routes.rb +4 -3
  80. data/lib/geoblacklight/version.rb +2 -1
  81. data/lib/geoblacklight/view_helper_override.rb +3 -2
  82. data/lib/geoblacklight/wms_layer/feature_info_response.rb +5 -4
  83. data/lib/geoblacklight/wms_layer.rb +4 -3
  84. data/lib/geoblacklight.rb +32 -31
  85. data/lib/tasks/geoblacklight.rake +45 -44
  86. data/schema/geoblacklight-schema-aardvark.json +6 -0
  87. data/spec/components/geoblacklight/display_note_component_spec.rb +27 -0
  88. data/spec/components/geoblacklight/homepage_feature_facet_component_spec.rb +11 -10
  89. data/spec/components/geoblacklight/icon_facet_item_component_spec.rb +8 -7
  90. data/spec/config/initializers/rails_config_spec.rb +10 -9
  91. data/spec/controllers/catalog_controller_spec.rb +27 -26
  92. data/spec/controllers/download_controller_spec.rb +50 -49
  93. data/spec/controllers/relation_controller_spec.rb +5 -4
  94. data/spec/controllers/wms_controller_spec.rb +10 -9
  95. data/spec/factories/user.rb +3 -2
  96. data/spec/features/bookmarks_spec.rb +7 -6
  97. data/spec/features/configurable_basemap_spec.rb +12 -11
  98. data/spec/features/data_dictionary_download_spec.rb +11 -10
  99. data/spec/features/download_layer_spec.rb +64 -63
  100. data/spec/features/empty_search_spec.rb +6 -5
  101. data/spec/features/esri_viewer_spec.rb +33 -32
  102. data/spec/features/exports_spec.rb +18 -17
  103. data/spec/features/full_screen_controll_spec.rb +8 -8
  104. data/spec/features/help_text_spec.rb +6 -5
  105. data/spec/features/home_page_spec.rb +30 -29
  106. data/spec/features/iiif_viewer_spec.rb +6 -5
  107. data/spec/features/index_map_spec.rb +17 -16
  108. data/spec/features/layer_inspection_spec.rb +8 -7
  109. data/spec/features/layer_opacity_spec.rb +15 -14
  110. data/spec/features/layer_preview_spec.rb +11 -10
  111. data/spec/features/layer_with_no_references_spec.rb +5 -4
  112. data/spec/features/linkified_attribute_table_spec.rb +8 -7
  113. data/spec/features/metadata_panel_spec.rb +32 -31
  114. data/spec/features/missing_metadata_spec.rb +18 -17
  115. data/spec/features/multiple_downloads_spec.rb +11 -10
  116. data/spec/features/oembed_spec.rb +6 -5
  117. data/spec/features/relations_spec.rb +51 -26
  118. data/spec/features/saved_searches_spec.rb +7 -6
  119. data/spec/features/search_bar_spec.rb +9 -8
  120. data/spec/features/search_results_complex_geometry_spec.rb +12 -11
  121. data/spec/features/search_results_icons_spec.rb +10 -9
  122. data/spec/features/search_results_map_spec.rb +21 -20
  123. data/spec/features/search_results_overlap_ratio_spec.rb +17 -16
  124. data/spec/features/search_spec.rb +19 -18
  125. data/spec/features/show_page_download_spec.rb +15 -14
  126. data/spec/features/show_page_metadata_spec.rb +9 -8
  127. data/spec/features/show_page_sidebar_static_map_spec.rb +21 -0
  128. data/spec/features/sms_spec.rb +12 -11
  129. data/spec/features/split_view.html.erb_spec.rb +56 -55
  130. data/spec/features/suppressed_records_spec.rb +10 -9
  131. data/spec/features/tilejson_spec.rb +9 -8
  132. data/spec/features/tms_spec.rb +6 -5
  133. data/spec/features/web_services_modal_spec.rb +37 -36
  134. data/spec/features/wmts_spec.rb +16 -15
  135. data/spec/features/xyz_spec.rb +6 -5
  136. data/spec/fixtures/solr_documents/actual-papermap1.json +1 -1
  137. data/spec/fixtures/solr_documents/actual-point1.json +1 -1
  138. data/spec/fixtures/solr_documents/actual-polygon1.json +1 -1
  139. data/spec/fixtures/solr_documents/actual-raster1.json +1 -1
  140. data/spec/fixtures/solr_documents/baruch_ancestor1.json +1 -1
  141. data/spec/fixtures/solr_documents/baruch_ancestor2.json +1 -1
  142. data/spec/fixtures/solr_documents/baruch_documentation_download.json +2 -2
  143. data/spec/fixtures/solr_documents/cornell_html_metadata.json +1 -1
  144. data/spec/fixtures/solr_documents/display-note.json +52 -0
  145. data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +1 -1
  146. data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +1 -1
  147. data/spec/fixtures/solr_documents/esri-feature-layer.json +1 -1
  148. data/spec/fixtures/solr_documents/esri-image-map-layer.json +1 -1
  149. data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +1 -1
  150. data/spec/fixtures/solr_documents/esri-wms-layer.json +1 -1
  151. data/spec/fixtures/solr_documents/harvard_raster.json +1 -1
  152. data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +1 -1
  153. data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +1 -1
  154. data/spec/fixtures/solr_documents/index-map-polygon.json +1 -1
  155. data/spec/fixtures/solr_documents/index-map-stanford.json +1 -1
  156. data/spec/fixtures/solr_documents/index_map_point.json +1 -1
  157. data/spec/fixtures/solr_documents/princeton-parent.json +1 -1
  158. data/spec/fixtures/solr_documents/public_direct_download.json +1 -1
  159. data/spec/fixtures/solr_documents/public_iiif_princeton.json +1 -1
  160. data/spec/fixtures/solr_documents/restricted-line.json +1 -1
  161. data/spec/fixtures/solr_documents/tilejson.json +2 -2
  162. data/spec/fixtures/solr_documents/umn_metro_result1.json +2 -2
  163. data/spec/fixtures/solr_documents/umn_state_result1.json +1 -1
  164. data/spec/fixtures/solr_documents/umn_state_result2.json +1 -1
  165. data/spec/fixtures/solr_documents/uva_slug_colon.json +1 -1
  166. data/spec/fixtures/solr_documents/wmts-multiple.json +1 -1
  167. data/spec/fixtures/solr_documents/wmts-single-layer.json +6 -6
  168. data/spec/fixtures/solr_documents/xyz.json +3 -3
  169. data/spec/helpers/arcgis_helper_spec.rb +8 -7
  170. data/spec/helpers/carto_helper_spec.rb +6 -5
  171. data/spec/helpers/geoblacklight/geoblacklight_helper_behavior_spec.rb +10 -15
  172. data/spec/helpers/geoblacklight_helper_spec.rb +139 -138
  173. data/spec/lib/geoblacklight/bounding_box_spec.rb +14 -13
  174. data/spec/lib/geoblacklight/document_presenter_spec.rb +26 -25
  175. data/spec/lib/geoblacklight/download/geojson_download_spec.rb +8 -7
  176. data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +8 -7
  177. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +16 -15
  178. data/spec/lib/geoblacklight/download/kmz_download_spec.rb +9 -8
  179. data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +8 -7
  180. data/spec/lib/geoblacklight/download_spec.rb +61 -60
  181. data/spec/lib/geoblacklight/geometry_spec.rb +29 -28
  182. data/spec/lib/geoblacklight/item_viewer_spec.rb +25 -24
  183. data/spec/lib/geoblacklight/metadata/base_spec.rb +44 -43
  184. data/spec/lib/geoblacklight/metadata/html_spec.rb +7 -6
  185. data/spec/lib/geoblacklight/metadata_spec.rb +15 -14
  186. data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +13 -12
  187. data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +8 -7
  188. data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +8 -7
  189. data/spec/lib/geoblacklight/metadata_transformer_spec.rb +15 -14
  190. data/spec/lib/geoblacklight/reference_spec.rb +28 -27
  191. data/spec/lib/geoblacklight/references_spec.rb +89 -76
  192. data/spec/lib/geoblacklight/relation/ancestors_spec.rb +17 -16
  193. data/spec/lib/geoblacklight/relation/descendants_spec.rb +17 -16
  194. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +29 -28
  195. data/spec/lib/geoblacklight/view_helper_override_spec.rb +14 -13
  196. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +19 -18
  197. data/spec/lib/geoblacklight/wms_layer_spec.rb +31 -30
  198. data/spec/models/concerns/geoblacklight/bbox_filter_field_spec.rb +31 -31
  199. data/spec/models/concerns/geoblacklight/bbox_filter_query_spec.rb +32 -32
  200. data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +16 -15
  201. data/spec/models/concerns/geoblacklight/solr_document/citation_spec.rb +7 -6
  202. data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +16 -17
  203. data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +7 -6
  204. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +121 -107
  205. data/spec/models/concerns/geoblacklight/suppressed_records_search_behavior_spec.rb +8 -7
  206. data/spec/presenters/geoblacklight/bbox_item_presenter_spec.rb +10 -10
  207. data/spec/routing/catalog_routing_spec.rb +4 -3
  208. data/spec/spec_helper.rb +34 -33
  209. data/spec/support/backport_test_helpers.rb +6 -5
  210. data/spec/support/features/session_helpers.rb +8 -7
  211. data/spec/support/features.rb +2 -1
  212. data/spec/support/fixtures.rb +2 -1
  213. data/spec/tasks/geoblacklight_spec.rb +10 -9
  214. data/spec/test_app_templates/lib/generators/test_app_generator.rb +16 -15
  215. data/spec/views/catalog/_document_split.html.erb_spec.rb +3 -2
  216. data/spec/views/catalog/_index_split.html.erb_spec.rb +3 -2
  217. data/spec/views/catalog/_results_pagination.html.erb_spec.rb +5 -4
  218. data/spec/views/catalog/_show_downloads.html.erb_spec.rb +11 -10
  219. data/spec/views/catalog/_show_tools.html.erb_spec.rb +13 -12
  220. data/template.rb +9 -8
  221. metadata +29 -212
  222. data/.gitmodules +0 -0
  223. data/.rubocop.yml +0 -111
  224. data/.rubocop_todo.yml +0 -437
  225. 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
- MEMBER_OF:
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
- icon: nil
128
- label: geoblacklight.relations.member_of
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
- query_type: ancestors
132
- icon: nil
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
- RELATION:
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
- label: geoblacklight.relations.relation
144
- REPLACES:
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
- label: geoblacklight.relations.replaces
149
- REPLACED_BY:
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
- label: geoblacklight.relations.ancestor
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
- label: geoblacklight.relations.descendant
164
- VERSION_OF:
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
- icon: nil
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,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  ##
4
5
  # Transforms and parses a bounding box for various formats
@@ -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: 'http://schema.org/downloadUrl',
7
- fgdc: 'http://www.opengis.net/cat/csw/csdgm',
8
- geojson: 'http://geojson.org/geojson-spec.html',
9
- html: 'http://www.w3.org/1999/xhtml',
10
- iiif: 'http://iiif.io/api/image',
11
- iiif_manifest: 'http://iiif.io/api/presentation#manifest',
12
- iso19139: 'http://www.isotc211.org/schemas/2005/gmd',
13
- mods: 'http://www.loc.gov/mods/v3',
14
- shapefile: 'http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf',
15
- url: 'http://schema.org/url',
16
- wcs: 'http://www.opengis.net/def/serviceType/ogc/wcs',
17
- wfs: 'http://www.opengis.net/def/serviceType/ogc/wfs',
18
- wms: 'http://www.opengis.net/def/serviceType/ogc/wms',
19
- wmts: 'http://www.opengis.net/def/serviceType/ogc/wmts',
20
- tms: 'https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification',
21
- tilejson: 'https://github.com/mapbox/tilejson-spec',
22
- xyz: 'https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames',
23
- hgl: 'http://schema.org/DownloadAction',
24
- feature_layer: 'urn:x-esri:serviceType:ArcGIS#FeatureLayer',
25
- tiled_map_layer: 'urn:x-esri:serviceType:ArcGIS#TiledMapLayer',
26
- dynamic_map_layer: 'urn:x-esri:serviceType:ArcGIS#DynamicMapLayer',
27
- image_map_layer: 'urn:x-esri:serviceType:ArcGIS#ImageMapLayer',
28
- data_dictionary: 'http://lccn.loc.gov/sh85035852',
29
- index_map: 'https://openindexmaps.org',
30
- oembed: 'https://oembed.com'
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: 'wfs',
6
- version: '2.0.0',
7
- request: 'GetFeature',
8
- srsName: 'EPSG:4326',
9
- outputformat: 'application/json'
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: 'geojson',
16
- extension: 'json',
16
+ type: "geojson",
17
+ extension: "json",
17
18
  request_params: request_params,
18
- content_type: 'application/json',
19
- service_type: 'wfs'
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: 'image/geotiff',
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: 'geotiff',
13
- extension: 'tif',
13
+ type: "geotiff",
14
+ extension: "tif",
14
15
  request_params: request_params,
15
- content_type: 'image/geotiff',
16
- service_type: 'wms',
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
- 'LayerName' => document[Settings.FIELDS.WXS_IDENTIFIER].sub(/^cite:/, ''),
7
- 'UserEmail' => email
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: 'hgl'
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 = { service: 'wms',
5
- version: '1.1.0',
6
- request: 'GetMap',
7
- srsName: 'EPSG:3857',
8
- format: 'application/vnd.google-earth.kmz',
9
- width: 2000, height: 2000 }.freeze
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: 'kmz',
16
- extension: 'kmz',
16
+ type: "kmz",
17
+ extension: "kmz",
17
18
  request_params: request_params,
18
- content_type: 'application/vnd.google-earth.kmz',
19
- service_type: 'wms'
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 = { service: 'wfs',
5
- version: '2.0.0',
6
- request: 'GetFeature',
7
- srsName: 'EPSG:4326',
8
- outputformat: 'SHAPE-ZIP' }.freeze
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: 'shapefile',
14
- extension: 'zip',
14
+ type: "shapefile",
15
+ extension: "zip",
15
16
  request_params: request_params,
16
- content_type: 'application/zip',
17
- service_type: 'wfs'
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('tmp', 'cache', 'downloads')
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", 'wb') do |file|
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['content-type']}"
53
+ "received #{download.headers["content-type"]}"
53
54
  File.delete("#{file_path_and_name}.tmp")
54
- raise Geoblacklight::Exceptions::ExternalDownloadFailed, message: 'Wrong download type'
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
- message: 'Download connection failed',
72
- url: conn.url_prefix.to_s
72
+ message: "Download connection failed",
73
+ url: conn.url_prefix.to_s
73
74
  rescue Faraday::TimeoutError
74
75
  raise Geoblacklight::Exceptions::ExternalDownloadFailed,
75
- message: 'Download timed out',
76
- url: conn.url_prefix.to_s
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 + '/?' + URI.encode_www_form(@options[:request_params])
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['content-type']) == @options[:content_type]
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 += '/reflect' if @options[:reflect]
106
+ url += "/reflect" if @options[:reflect]
106
107
  url
107
108
  end
108
109
  end
@@ -1,18 +1,19 @@
1
1
  # frozen_string_literal: true
2
- require 'blacklight'
3
- require 'coderay'
4
- require 'config'
5
- require 'faraday'
6
- require 'geoblacklight/version'
7
- require 'nokogiri'
8
- require 'mime/types'
9
- require 'handlebars_assets'
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 'geoblacklight.helpers' do
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 'faraday'
4
- require 'set'
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['location']}"
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 = Set.new [301, 302, 303, 307, 308]
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 = Set.new [:status, :response, :response_headers]
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;/?:@&=+$,\[\]%]}.freeze
56
+ URI_UNSAFE = %r{[^\-_.!~*'()a-zA-Z\d;/?:@&=+$,\[\]%]}
56
57
 
57
- AUTH_HEADER = 'Authorization'
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['location'] || '')
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('#')[0] # we want to remove the fragment if present
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('H2' * match.bytesize).join('%').upcase}"
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
- require 'rgeo'
3
- require 'rgeo-geojson'
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 StandardError
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
- 'type' => 'Polygon',
51
- 'coordinates' => [
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 'map' if viewer_preference.nil?
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 '' if viewer_preference.nil?
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
- image_map_layer, feature_layer].compact.map(&:to_hash).first
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
- require 'geoblacklight/faraday_middleware/follow_redirects'
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,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Geoblacklight
3
4
  module Metadata
4
5
  class Fgdc < Base
@@ -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
- src: @reference.endpoint,
8
- scrolling: 'yes',
9
- frameborder: 0)
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