geoblacklight 3.2.0 → 4.0.0.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +148 -0
  3. data/.gitignore +8 -0
  4. data/.rubocop.yml +14 -10
  5. data/.rubocop_todo.yml +361 -26
  6. data/README.md +3 -3
  7. data/Rakefile +19 -12
  8. data/app/assets/images/blacklight/michigan-state-university.svg +6 -0
  9. data/app/assets/images/blacklight/pennsylvania-state-university.svg +6 -0
  10. data/app/assets/images/blacklight/purdue-university.svg +6 -0
  11. data/app/assets/images/blacklight/the-ohio-state-university.svg +7 -0
  12. data/app/assets/images/blacklight/university-of-chicago.svg +6 -0
  13. data/app/assets/images/blacklight/university-of-illinois-urbana-champaign.svg +6 -0
  14. data/app/assets/images/blacklight/university-of-iowa.svg +5 -0
  15. data/app/assets/images/blacklight/university-of-maryland.svg +5 -0
  16. data/app/assets/images/blacklight/university-of-michigan.svg +5 -0
  17. data/app/assets/images/blacklight/university-of-minnesota.svg +5 -0
  18. data/app/assets/images/blacklight/university-of-nebraska-lincoln.svg +8 -0
  19. data/app/assets/images/blacklight/university-of-wisconsin-madison.svg +5 -0
  20. data/app/assets/images/favicon.ico +0 -0
  21. data/app/assets/javascripts/geoblacklight/geoblacklight.js +18 -1
  22. data/app/assets/javascripts/geoblacklight/modules/bookmarks.js +43 -0
  23. data/app/assets/javascripts/geoblacklight/modules/metadata_download_button.js +6 -1
  24. data/app/assets/javascripts/geoblacklight/modules/results.js +7 -8
  25. data/app/assets/javascripts/geoblacklight/modules/util.js +5 -0
  26. data/app/assets/javascripts/geoblacklight/viewers/esri.js +1 -1
  27. data/app/assets/javascripts/geoblacklight/viewers/index_map.js +1 -1
  28. data/app/assets/javascripts/geoblacklight/viewers/map.js +12 -2
  29. data/app/assets/javascripts/geoblacklight/viewers/tms.js +10 -0
  30. data/app/assets/javascripts/geoblacklight/viewers/wms.js +1 -1
  31. data/app/assets/stylesheets/geoblacklight/modules/icon-customization.scss +41 -0
  32. data/app/assets/stylesheets/geoblacklight/modules/results.scss +1 -1
  33. data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +6 -0
  34. data/app/components/geoblacklight/homepage_feature_facet_component.html.erb +11 -0
  35. data/app/components/geoblacklight/homepage_feature_facet_component.rb +13 -0
  36. data/{lib → app/helpers}/geoblacklight/geoblacklight_helper_behavior.rb +6 -4
  37. data/app/helpers/geoblacklight_helper.rb +14 -8
  38. data/app/models/concerns/geoblacklight/solr_document/citation.rb +2 -2
  39. data/app/models/concerns/geoblacklight/solr_document.rb +11 -16
  40. data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +5 -5
  41. data/app/views/catalog/_arcgis.html.erb +1 -1
  42. data/app/views/catalog/_data_dictionary.html.erb +1 -2
  43. data/app/views/catalog/_document_split.html.erb +1 -1
  44. data/app/views/catalog/_header_icons.html.erb +1 -1
  45. data/app/views/catalog/_home_text.html.erb +7 -29
  46. data/app/views/catalog/_index_split_default.html.erb +1 -1
  47. data/app/views/catalog/_show_default_viewer_container.html.erb +1 -1
  48. data/app/views/catalog/_show_header_default.html.erb +1 -1
  49. data/app/views/download/hgl.html.erb +13 -11
  50. data/app/views/relation/_relations.html.erb +15 -0
  51. data/app/views/relation/index.html.erb +4 -16
  52. data/app/views/relation/index.json.jbuilder +6 -2
  53. data/babel.config.json +4 -0
  54. data/config/initializers/new_gbl_settings_defaults_3_4.yml +6 -0
  55. data/config/locales/geoblacklight.en.yml +12 -0
  56. data/geoblacklight.gemspec +5 -3
  57. data/jest.config.js +25 -0
  58. data/lib/generators/geoblacklight/install_generator.rb +1 -1
  59. data/lib/generators/geoblacklight/templates/catalog_controller.rb +78 -35
  60. data/lib/generators/geoblacklight/templates/settings.gbl_v1.yml +195 -0
  61. data/lib/generators/geoblacklight/templates/settings.yml +91 -17
  62. data/lib/geoblacklight/bounding_box.rb +1 -1
  63. data/lib/geoblacklight/constants.rb +1 -0
  64. data/lib/geoblacklight/download/geojson_download.rb +1 -1
  65. data/lib/geoblacklight/download/geotiff_download.rb +1 -1
  66. data/lib/geoblacklight/download/hgl_download.rb +1 -1
  67. data/lib/geoblacklight/download/kmz_download.rb +2 -2
  68. data/lib/geoblacklight/download/shapefile_download.rb +1 -1
  69. data/lib/geoblacklight/geometry.rb +85 -0
  70. data/lib/geoblacklight/item_viewer.rb +5 -1
  71. data/lib/geoblacklight/metadata/base.rb +1 -7
  72. data/lib/geoblacklight/references.rb +1 -1
  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 +21 -6
  76. data/lib/geoblacklight/version.rb +1 -1
  77. data/lib/geoblacklight/view_helper_override.rb +1 -1
  78. data/lib/geoblacklight/wms_layer.rb +1 -4
  79. data/lib/geoblacklight.rb +1 -3
  80. data/lib/tasks/geoblacklight.rake +5 -0
  81. data/package.json +17 -1
  82. data/schema/{geoblacklight-schema.json → geoblacklight-schema-1.0.json} +1 -1
  83. data/schema/geoblacklight-schema-aardvark.json +211 -0
  84. data/setupJest.js +14 -0
  85. data/solr/conf/schema.xml +35 -29
  86. data/solr/conf/solrconfig.xml +15 -15
  87. data/spec/components/geoblacklight/homepage_feature_facet_component_spec.rb +39 -0
  88. data/spec/config/initializers/rails_config_spec.rb +15 -0
  89. data/spec/controllers/catalog_controller_spec.rb +7 -7
  90. data/spec/features/esri_viewer_spec.rb +1 -1
  91. data/spec/features/home_page_spec.rb +4 -4
  92. data/spec/features/layer_opacity_spec.rb +1 -0
  93. data/spec/features/metadata_panel_spec.rb +1 -1
  94. data/spec/features/missing_metadata_spec.rb +2 -2
  95. data/spec/features/relations_spec.rb +2 -2
  96. data/spec/features/search_results_map_spec.rb +2 -1
  97. data/spec/features/search_results_overlap_ratio_spec.rb +2 -2
  98. data/spec/features/split_view.html.erb_spec.rb +16 -12
  99. data/spec/features/tms_spec.rb +10 -0
  100. data/spec/fixtures/solr_documents/README.md +48 -36
  101. data/spec/fixtures/solr_documents/actual-papermap1.json +41 -18
  102. data/spec/fixtures/solr_documents/actual-point1.json +47 -27
  103. data/spec/fixtures/solr_documents/actual-polygon1.json +43 -18
  104. data/spec/fixtures/solr_documents/actual-raster1.json +52 -23
  105. data/spec/fixtures/solr_documents/all-relationships.json +48 -0
  106. data/spec/fixtures/solr_documents/baruch_ancestor1.json +62 -37
  107. data/spec/fixtures/solr_documents/baruch_ancestor2.json +62 -37
  108. data/spec/fixtures/solr_documents/baruch_documentation_download.json +60 -34
  109. data/spec/fixtures/solr_documents/bbox-spans-180.json +34 -16
  110. data/spec/fixtures/solr_documents/cornell_html_metadata.json +46 -26
  111. data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +43 -25
  112. data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +45 -28
  113. data/spec/fixtures/solr_documents/esri-feature-layer.json +44 -34
  114. data/spec/fixtures/solr_documents/esri-image-map-layer.json +45 -31
  115. data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +42 -17
  116. data/spec/fixtures/solr_documents/esri-wms-layer.json +46 -21
  117. data/spec/fixtures/solr_documents/harvard_raster.json +55 -36
  118. data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +35 -22
  119. data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +48 -27
  120. data/spec/fixtures/solr_documents/index-map-polygon.json +48 -27
  121. data/spec/fixtures/solr_documents/index-map-stanford.json +54 -25
  122. data/spec/fixtures/solr_documents/index_map_point.json +54 -26
  123. data/spec/fixtures/solr_documents/metadata_no_geom.json +27 -0
  124. data/spec/fixtures/solr_documents/metadata_no_provider.json +39 -0
  125. data/spec/fixtures/solr_documents/multiple-downloads.json +33 -20
  126. data/spec/fixtures/solr_documents/no_locn_geometry.json +25 -0
  127. data/spec/fixtures/solr_documents/no_spatial.json +37 -19
  128. data/spec/fixtures/solr_documents/oembed.json +34 -17
  129. data/spec/fixtures/solr_documents/princeton-child1.json +45 -28
  130. data/spec/fixtures/solr_documents/princeton-child2.json +45 -28
  131. data/spec/fixtures/solr_documents/princeton-child3.json +45 -28
  132. data/spec/fixtures/solr_documents/princeton-child4.json +45 -28
  133. data/spec/fixtures/solr_documents/princeton-parent.json +46 -23
  134. data/spec/fixtures/solr_documents/public_direct_download.json +48 -21
  135. data/spec/fixtures/solr_documents/public_iiif_princeton.json +49 -24
  136. data/spec/fixtures/solr_documents/public_polygon_mit.json +31 -15
  137. data/spec/fixtures/solr_documents/restricted-line.json +52 -21
  138. data/spec/fixtures/solr_documents/the-related-record.json +27 -0
  139. data/spec/fixtures/solr_documents/tms.json +45 -0
  140. data/spec/fixtures/solr_documents/umn_metro_result1.json +44 -28
  141. data/spec/fixtures/solr_documents/umn_state_result1.json +44 -26
  142. data/spec/fixtures/solr_documents/umn_state_result2.json +45 -24
  143. data/spec/fixtures/solr_documents/uva_slug_colon.json +43 -20
  144. data/spec/{lib → helpers}/geoblacklight/geoblacklight_helper_behavior_spec.rb +1 -0
  145. data/spec/helpers/geoblacklight_helper_spec.rb +30 -4
  146. data/spec/javascripts/geoblacklight_spec.js +0 -6
  147. data/spec/javascripts/metadata_download_button_spec.js +5 -3
  148. data/spec/javascripts/util_spec.js +2 -4
  149. data/spec/lib/geoblacklight/download/geojson_download_spec.rb +1 -1
  150. data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +1 -1
  151. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +1 -1
  152. data/spec/lib/geoblacklight/download/kmz_download_spec.rb +2 -2
  153. data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +1 -1
  154. data/spec/lib/geoblacklight/download_spec.rb +1 -1
  155. data/spec/lib/geoblacklight/geometry_spec.rb +59 -0
  156. data/spec/lib/geoblacklight/item_viewer_spec.rb +12 -0
  157. data/spec/lib/geoblacklight/references_spec.rb +3 -3
  158. data/spec/lib/geoblacklight/relation/ancestors_spec.rb +3 -3
  159. data/spec/lib/geoblacklight/relation/descendants_spec.rb +3 -3
  160. data/spec/lib/geoblacklight/relation/relation_response_spec.rb +32 -17
  161. data/spec/models/concerns/geoblacklight/solr_document_spec.rb +4 -4
  162. data/spec/spec_helper.rb +2 -0
  163. data/spec/support/view_component_capybara_test_helpers.rb +8 -0
  164. data/spec/test_app_templates/Gemfile.extra +1 -0
  165. data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -7
  166. data/spec/views/catalog/_document_split.html.erb_spec.rb +1 -1
  167. data/spec/views/catalog/_index_split.html.erb_spec.rb +1 -1
  168. data/template.rb +1 -0
  169. metadata +99 -51
  170. data/.circleci/config.yml +0 -256
  171. data/app/views/catalog/_document_action.html.erb +0 -6
  172. data/app/views/catalog/_facet_tag_item.html.erb +0 -3
  173. data/app/views/catalog/_facet_tag_layout.html.erb +0 -2
  174. data/app/views/relation/_ancestors.html.erb +0 -8
  175. data/app/views/relation/_descendants.html.erb +0 -15
  176. data/schema/format-values.md +0 -50
  177. data/schema/geoblacklight-schema-deprecated.md +0 -39
  178. data/schema/geoblacklight-schema.md +0 -323
  179. data/schema/geometry-type-values.md +0 -11
  180. data/schema/references.md +0 -23
  181. data/schema/schema-commentary.md +0 -198
  182. data/schema/subjects.md +0 -41
  183. data/schema/type-values.md +0 -10
  184. data/spec/fixtures/solr_documents/metadata_no_dct_provenance_s.json +0 -30
  185. data/spec/fixtures/solr_documents/metadata_no_layer_geom_type_s.json +0 -17
  186. data/spec/fixtures/solr_documents/metadata_no_solr_geom.json +0 -23
  187. data/spec/javascripts/geoblacklight/viewers/esri/tiled_map_layer_spec.js +0 -12
  188. data/spec/javascripts/spec_helper.js +0 -32
  189. data/spec/lib/geoblacklight/controller_override_spec.rb +0 -2
  190. data/spec/teaspoon_env.rb +0 -214
@@ -28,7 +28,7 @@ module Geoblacklight
28
28
  # @param [String] bbox as "W S E N"
29
29
  # @return [Geoblacklight::BoundingBox]
30
30
  def self.from_rectangle(rectangle)
31
- rectangle_array = rectangle.split(' ')
31
+ rectangle_array = rectangle.split
32
32
  message = 'Bounding box should be a string in Solr rectangle syntax e.g."W S E N"'
33
33
  fail Geoblacklight::Exceptions::WrongBoundingBoxFormat, message if rectangle_array.count != 4
34
34
  new(
@@ -16,6 +16,7 @@ module Geoblacklight
16
16
  wcs: 'http://www.opengis.net/def/serviceType/ogc/wcs',
17
17
  wfs: 'http://www.opengis.net/def/serviceType/ogc/wfs',
18
18
  wms: 'http://www.opengis.net/def/serviceType/ogc/wms',
19
+ tms: 'https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification',
19
20
  hgl: 'http://schema.org/DownloadAction',
20
21
  feature_layer: 'urn:x-esri:serviceType:ArcGIS#FeatureLayer',
21
22
  tiled_map_layer: 'urn:x-esri:serviceType:ArcGIS#TiledMapLayer',
@@ -10,7 +10,7 @@ module Geoblacklight
10
10
  }.freeze
11
11
 
12
12
  def initialize(document, options = {})
13
- request_params = GEOJSON_DOWNLOAD_PARAMS.merge(typeName: document[:layer_id_s])
13
+ request_params = GEOJSON_DOWNLOAD_PARAMS.merge(typeName: document[Settings.FIELDS.WXS_IDENTIFIER])
14
14
  super(document, {
15
15
  type: 'geojson',
16
16
  extension: 'json',
@@ -7,7 +7,7 @@ module Geoblacklight
7
7
  }.freeze
8
8
 
9
9
  def initialize(document, options = {})
10
- request_params = GEOTIFF_DOWNLOAD_PARAMS.merge(layers: document[:layer_id_s])
10
+ request_params = GEOTIFF_DOWNLOAD_PARAMS.merge(layers: document[Settings.FIELDS.WXS_IDENTIFIER])
11
11
  super(document, {
12
12
  type: 'geotiff',
13
13
  extension: 'tif',
@@ -3,7 +3,7 @@ module Geoblacklight
3
3
  class HglDownload < Geoblacklight::Download
4
4
  def initialize(document, email, options = {})
5
5
  request_params = {
6
- 'LayerName' => document[:layer_id_s].sub(/^cite:/, ''),
6
+ 'LayerName' => document[Settings.FIELDS.WXS_IDENTIFIER].sub(/^cite:/, ''),
7
7
  'UserEmail' => email
8
8
  }
9
9
  super(document, {
@@ -9,8 +9,8 @@ module Geoblacklight
9
9
  width: 2000, height: 2000 }.freeze
10
10
 
11
11
  def initialize(document, options = {})
12
- bbox_wsen = document.bounding_box_as_wsen.split(' ').join(', ')
13
- request_params = KMZ_DOWNLOAD_PARAMS.merge(layers: document[:layer_id_s], bbox: bbox_wsen)
12
+ bbox_wsen = document.geometry.bounding_box
13
+ request_params = KMZ_DOWNLOAD_PARAMS.merge(layers: document[Settings.FIELDS.WXS_IDENTIFIER], bbox: bbox_wsen)
14
14
  super(document, {
15
15
  type: 'kmz',
16
16
  extension: 'kmz',
@@ -8,7 +8,7 @@ module Geoblacklight
8
8
  outputformat: 'SHAPE-ZIP' }.freeze
9
9
 
10
10
  def initialize(document, options = {})
11
- request_params = SHAPEFILE_DOWNLOAD_PARAMS.merge(typeName: document[:layer_id_s])
11
+ request_params = SHAPEFILE_DOWNLOAD_PARAMS.merge(typeName: document[Settings.FIELDS.WXS_IDENTIFIER])
12
12
  super(document, {
13
13
  type: 'shapefile',
14
14
  extension: 'zip',
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+ require 'rgeo'
3
+ require 'rgeo-geojson'
4
+
5
+ module Geoblacklight
6
+ # Transforms and parses geometry expressed in WKT or CSW WKT ENVELOPE syntax
7
+ class Geometry
8
+ attr_reader :geom
9
+
10
+ # @param [String] geom WKT or WKT ENVELOPE syntax formatted string
11
+ def initialize(geom)
12
+ @geom = geom
13
+ end
14
+
15
+ # Convert geometry to GeoJSON
16
+ # @return [String]
17
+ def geojson
18
+ obj = factory.parse_wkt(geometry_as_wkt)
19
+ RGeo::GeoJSON.encode(obj).to_json
20
+ rescue StandardError
21
+ Geoblacklight.logger.warn "Geometry is not valid: #{geom}"
22
+ default_extent
23
+ end
24
+
25
+ # Generate a wsen bounding box from the geometry
26
+ # @return [String] bounding box as comma delimited wsen "w, s, e, n"
27
+ def bounding_box
28
+ obj = factory.parse_wkt(geometry_as_wkt)
29
+
30
+ # Get the minimum bounding box for the geometry as a Polygon
31
+ bbox = obj.envelope
32
+
33
+ # Return as wsen string
34
+ minx = bbox.coordinates[0][0][0]
35
+ miny = bbox.coordinates[0][0][1]
36
+ maxx = bbox.coordinates[0][1][0]
37
+ maxy = bbox.coordinates[0][2][1]
38
+ "#{minx}, #{miny}, #{maxx}, #{maxy}"
39
+ rescue RGeo::Error::ParseError
40
+ Geoblacklight.logger.warn "Error parsing geometry: #{geom}"
41
+ default_extent
42
+ end
43
+
44
+ private
45
+
46
+ # Default extent as GeoJSON
47
+ # @return [String]
48
+ def default_extent
49
+ {
50
+ 'type' => 'Polygon',
51
+ 'coordinates' => [
52
+ [
53
+ [-180.0, 90.0], [-180.0, -90.0], [180.0, -90.0], [180.0, 90.0], [-180.0, 90.0]
54
+ ]
55
+ ]
56
+ }.to_json
57
+ end
58
+
59
+ # Convert WKT ENVELOPE string to WKT POLYGON string
60
+ # @return [String]
61
+ def envelope_to_polygon
62
+ exp = /^\s*ENVELOPE\(
63
+ \s*([-.\d]+)\s*,
64
+ \s*([-.\d]+)\s*,
65
+ \s*([-.\d]+)\s*,
66
+ \s*([-.\d]+)\s*
67
+ \)\s*$/x # uses 'x' option for free-spacing mode
68
+ bbox_match = exp.match(geom)
69
+ minx, maxx, maxy, miny = bbox_match.captures
70
+ "POLYGON ((#{minx} #{maxy}, #{minx} #{miny}, #{maxx} #{miny}, #{maxx} #{maxy}, #{minx} #{maxy}))"
71
+ end
72
+
73
+ def factory
74
+ @factory ||= RGeo::Cartesian.factory
75
+ end
76
+
77
+ # Return geometry as valid WKT string
78
+ # @return [String]
79
+ def geometry_as_wkt
80
+ return geom unless geom.match?(/ENVELOPE/)
81
+
82
+ envelope_to_polygon
83
+ end
84
+ end
85
+ end
@@ -47,8 +47,12 @@ module Geoblacklight
47
47
  @references.oembed
48
48
  end
49
49
 
50
+ def tms
51
+ @references.tms
52
+ end
53
+
50
54
  def viewer_preference
51
- [oembed, index_map, wms, iiif, tiled_map_layer, dynamic_map_layer,
55
+ [oembed, index_map, tms, wms, iiif, tiled_map_layer, dynamic_map_layer,
52
56
  image_map_layer, feature_layer].compact.map(&:to_hash).first
53
57
  end
54
58
  end
@@ -55,13 +55,7 @@ module Geoblacklight
55
55
  return response.body unless response.nil? || response.status == 404
56
56
  Geoblacklight.logger.error "Could not reach #{@reference.endpoint}"
57
57
  ''
58
- rescue Faraday::ConnectionFailed => error
59
- Geoblacklight.logger.error error.inspect
60
- ''
61
- rescue Faraday::TimeoutError => error
62
- Geoblacklight.logger.error error.inspect
63
- ''
64
- rescue OpenSSL::SSL::SSLError => error
58
+ rescue Faraday::ConnectionFailed, Faraday::TimeoutError, OpenSSL::SSL::SSLError => error
65
59
  Geoblacklight.logger.error error.inspect
66
60
  ''
67
61
  end
@@ -30,7 +30,7 @@ module Geoblacklight
30
30
  # Accessor for a document's file format
31
31
  # @return [String] file format for the document
32
32
  def format
33
- @document[Settings.FIELDS.FILE_FORMAT]
33
+ @document[Settings.FIELDS.FORMAT]
34
34
  end
35
35
 
36
36
  ##
@@ -2,14 +2,15 @@
2
2
  module Geoblacklight
3
3
  module Relation
4
4
  class Ancestors
5
- def initialize(id, repository)
5
+ def initialize(id, field, repository)
6
6
  @search_id = id
7
+ @field = field
7
8
  @repository = repository
8
9
  end
9
10
 
10
11
  def create_search_params
11
- { fq: ["{!join from=#{Settings.FIELDS.SOURCE} to=layer_slug_s}layer_slug_s:#{@search_id}"],
12
- fl: [Settings.FIELDS.TITLE, 'layer_slug_s', Settings.FIELDS.GEOM_TYPE] }
12
+ { fq: ["{!join from=#{@field} to=#{Settings.FIELDS.ID}}#{Settings.FIELDS.ID}:#{@search_id}"],
13
+ fl: [Settings.FIELDS.TITLE, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE] }
13
14
  end
14
15
 
15
16
  def execute_query
@@ -2,14 +2,15 @@
2
2
  module Geoblacklight
3
3
  module Relation
4
4
  class Descendants
5
- def initialize(id, repository)
5
+ def initialize(id, field, repository)
6
6
  @search_id = id
7
+ @field = field
7
8
  @repository = repository
8
9
  end
9
10
 
10
11
  def create_search_params
11
- { fq: "#{Settings.FIELDS.SOURCE}:#{@search_id}",
12
- fl: [Settings.FIELDS.TITLE, 'layer_slug_s', Settings.FIELDS.GEOM_TYPE] }
12
+ { fq: "#{@field}:#{@search_id}",
13
+ fl: [Settings.FIELDS.TITLE, Settings.FIELDS.ID, Settings.FIELDS.RESOURCE_TYPE] }
13
14
  end
14
15
 
15
16
  def execute_query
@@ -9,16 +9,31 @@ module Geoblacklight
9
9
  @repository = repository
10
10
  end
11
11
 
12
- def ancestors
13
- @ancestors ||= Geoblacklight::Relation::Ancestors.new(@search_id, @repository).results
12
+ def method_missing(method, *args, &block)
13
+ if Settings.RELATIONSHIPS_SHOWN.key?(method)
14
+ field = Settings.RELATIONSHIPS_SHOWN[method].field
15
+ query_type = query_type(Settings.RELATIONSHIPS_SHOWN[method])
16
+ @results = query_type.new(@search_id, field, @repository).results
17
+ else
18
+ super
19
+ end
14
20
  end
15
21
 
16
- def descendants
17
- @descendants ||= Geoblacklight::Relation::Descendants.new(@search_id, @repository).results
22
+ def respond_to_missing?(method_name, *args)
23
+ Settings.RELATIONSHIPS_SHOWN.key?(method_name) or super
18
24
  end
19
25
 
20
- def empty?
21
- !(ancestors['numFound'].positive? || descendants['numFound'].positive?)
26
+ private
27
+
28
+ def query_type(option)
29
+ case option.query_type
30
+ when 'ancestors'
31
+ Geoblacklight::Relation::Ancestors
32
+ when 'descendants'
33
+ Geoblacklight::Relation::Descendants
34
+ else
35
+ fail ArgumentError, "Bad RelationResponse query_type: #{option.query_type}. Only 'ancestors' or 'descendants' is allowed."
36
+ end
22
37
  end
23
38
  end
24
39
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Geoblacklight
3
- VERSION = '3.2.0'
3
+ VERSION = '4.0.0-alpha'
4
4
  end
@@ -27,7 +27,7 @@ module Geoblacklight
27
27
 
28
28
  def render_constraints_filters(localized_params = params)
29
29
  content = super(localized_params)
30
- localized_params = localized_params.to_unsafe_h if localized_params.respond_to?(:to_unsafe_h)
30
+ localized_params = localized_params.to_h if localized_params.respond_to?(:to_h)
31
31
 
32
32
  if localized_params[:bbox]
33
33
  path = search_action_path(remove_spatial_filter_group(:bbox, localized_params))
@@ -25,10 +25,7 @@ module Geoblacklight
25
25
  request.options.timeout = Settings.TIMEOUT_WMS
26
26
  request.options.open_timeout = Settings.TIMEOUT_WMS
27
27
  end
28
- rescue Faraday::ConnectionFailed => error
29
- Geoblacklight.logger.error error.inspect
30
- { error: error.inspect }
31
- rescue Faraday::TimeoutError => error
28
+ rescue Faraday::ConnectionFailed, Faraday::TimeoutError => error
32
29
  Geoblacklight.logger.error error.inspect
33
30
  { error: error.inspect }
34
31
  end
data/lib/geoblacklight.rb CHANGED
@@ -6,9 +6,8 @@ module Geoblacklight
6
6
  require 'geoblacklight/bounding_box'
7
7
  require 'geoblacklight/catalog_helper_override'
8
8
  require 'geoblacklight/constants'
9
- # require 'geoblacklight/controller_override'
10
9
  require 'geoblacklight/exceptions'
11
- require 'geoblacklight/geoblacklight_helper_behavior'
10
+ require 'geoblacklight/geometry'
12
11
  require 'geoblacklight/view_helper_override'
13
12
  require 'geoblacklight/item_viewer'
14
13
  require 'geoblacklight/wms_layer'
@@ -36,7 +35,6 @@ module Geoblacklight
36
35
  require 'geoblacklight/relation/relation_response'
37
36
 
38
37
  def self.inject!
39
- # CatalogController.send(:include, Geoblacklight::ControllerOverride)
40
38
  CatalogController.send(:include, Geoblacklight::CatalogHelperOverride)
41
39
  CatalogController.send(:include, Geoblacklight::ViewHelperOverride)
42
40
  CatalogController.send(:helper, Geoblacklight::ViewHelperOverride) unless
@@ -106,4 +106,9 @@ namespace :geoblacklight do
106
106
  Rake::Task['geoblacklight:index:seed'].invoke
107
107
  end
108
108
  end
109
+
110
+ desc 'Stdout output asset paths'
111
+ task application_asset_paths: [:environment] do
112
+ puts Rails.application.config.assets.paths
113
+ end
109
114
  end
data/package.json CHANGED
@@ -1,4 +1,20 @@
1
1
  {
2
2
  "name": "geoblacklight",
3
- "version": "2.1.2"
3
+ "version": "2.1.2",
4
+ "private": true,
5
+ "license": "Apache-2.0",
6
+ "private": true,
7
+ "scripts": {
8
+ "test": "jest -c jest.config.js"
9
+ },
10
+ "devDependencies": {
11
+ "@babel/cli": "^7.12.16",
12
+ "@babel/core": "^7.12.16",
13
+ "@babel/plugin-transform-runtime": "^7.12.15",
14
+ "@babel/preset-env": "^7.12.16",
15
+ "@testing-library/dom": "^7.29.4",
16
+ "@testing-library/jest-dom": "^5.11.9",
17
+ "jest": "^26.6.3",
18
+ "jest-fixtures": "^0.6.0"
19
+ }
4
20
  }
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json-schema.org/draft-04/schema#",
3
3
  "description": "Schema for GeoBlacklight. See https://github.com/geoblacklight/geoblacklight/wiki/Schema for more details.",
4
4
  "id": "http://geoblacklight.org/v1.0/schema",
5
- "title": "GeoBlacklight Schema",
5
+ "title": "GeoBlacklight Schema - v1.0",
6
6
  "definitions": {
7
7
  "layer": {
8
8
  "title": "layer",
@@ -0,0 +1,211 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema#",
3
+ "description": "Schema for GeoBlacklight. See https://opengeometadata.github.io/aardvark/aardvarkMetadata.html for more details.",
4
+ "id": "http://geoblacklight.org/schema/aardvark",
5
+ "title": "GeoBlacklight Schema - Aardvark",
6
+ "type": "object",
7
+ "properties": {
8
+ "dct_title_s": { "type": "string" },
9
+ "dct_alternative_sm": {
10
+ "type": "array",
11
+ "items": {
12
+ "type": "string"
13
+ }
14
+ },
15
+ "dct_description_sm": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "string"
19
+ }
20
+ },
21
+ "dct_language_sm": {
22
+ "type": "array",
23
+ "items": {
24
+ "type": "string"
25
+ }
26
+ },
27
+ "dct_creator_sm": {
28
+ "type": "array",
29
+ "items": {
30
+ "type": "string"
31
+ }
32
+ },
33
+ "dct_publisher_sm": {
34
+ "type": "array",
35
+ "items": {
36
+ "type": "string"
37
+ }
38
+ },
39
+ "schema_provider_s": { "type": "string" },
40
+ "gbl_resourceClass_sm": {
41
+ "type": "array",
42
+ "items": {
43
+ "type": "string",
44
+ "enum": [
45
+ "Datasets",
46
+ "Maps",
47
+ "Imagery",
48
+ "Collections",
49
+ "Websites",
50
+ "Web services",
51
+ "Other"
52
+ ]
53
+ }
54
+ },
55
+ "gbl_resourceType_sm": {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "string"
59
+ }
60
+ },
61
+ "dct_subject_sm": {
62
+ "type": "array",
63
+ "items": {
64
+ "type": "string"
65
+ }
66
+ },
67
+ "dcat_theme_sm": {
68
+ "type": "array",
69
+ "items": {
70
+ "type": "string",
71
+ "enum": [
72
+ "Farming",
73
+ "Biota",
74
+ "Boundaries",
75
+ "Climatology, Meteorology and Atmosphere",
76
+ "Economy",
77
+ "Elevation",
78
+ "Environment",
79
+ "Geoscientific Information",
80
+ "Health",
81
+ "Imagery and Base Maps",
82
+ "Intelligence and Military",
83
+ "Inland Waters",
84
+ "Location",
85
+ "Oceans",
86
+ "Planning and Cadastral",
87
+ "Society",
88
+ "Structure",
89
+ "Transportation",
90
+ "Utilities and Communications"
91
+ ]
92
+ }
93
+ },
94
+ "dcat_keyword_sm": {
95
+ "type": "array",
96
+ "items": {
97
+ "type": "string"
98
+ }
99
+ },
100
+ "dct_temporal_sm": {
101
+ "type": "array",
102
+ "items": {
103
+ "type": "string"
104
+ }
105
+ },
106
+ "dct_issued_s": { "type": "string" },
107
+ "gbl_indexYear_im": {
108
+ "type": "array",
109
+ "items": {
110
+ "type": "integer"
111
+ }
112
+ },
113
+ "gbl_dateRange_drsim": {
114
+ "type": "array",
115
+ "items": {
116
+ "type": "string"
117
+ }
118
+ },
119
+ "dct_spatial_sm": {
120
+ "type": "array",
121
+ "items": {
122
+ "type": "string"
123
+ }
124
+ },
125
+ "locn_geometry": { "type": "string" },
126
+ "dcat_centroid_ss": { "type": "string" },
127
+ "dct_relation_sm": {
128
+ "type": "array",
129
+ "items": {
130
+ "type": "string"
131
+ }
132
+ },
133
+ "pcdm_memberOf_sm": {
134
+ "type": "array",
135
+ "items": {
136
+ "type": "string"
137
+ }
138
+ },
139
+ "dct_isPartOf_sm": {
140
+ "type": "array",
141
+ "items": {
142
+ "type": "string"
143
+ }
144
+ },
145
+ "dct_source_sm": {
146
+ "type": "array",
147
+ "items": {
148
+ "type": "string"
149
+ }
150
+ },
151
+ "dct_isVersionOf_sm": {
152
+ "type": "array",
153
+ "items": {
154
+ "type": "string"
155
+ }
156
+ },
157
+ "dct_replaces_sm": {
158
+ "type": "array",
159
+ "items": {
160
+ "type": "string"
161
+ }
162
+ },
163
+ "dct_isReplacedBy_sm": {
164
+ "type": "array",
165
+ "items": {
166
+ "type": "string"
167
+ }
168
+ },
169
+ "dct_rights_sm": {
170
+ "type": "array",
171
+ "items": {
172
+ "type": "string"
173
+ }
174
+ },
175
+ "dct_rightsHolder_sm": {
176
+ "type": "array",
177
+ "items": {
178
+ "type": "string"
179
+ }
180
+ },
181
+ "dct_license_sm": {
182
+ "type": "array",
183
+ "items": {
184
+ "type": "string"
185
+ }
186
+ },
187
+ "dct_accessRights_s": { "type": "string" },
188
+ "dct_format_s": { "type": "string" },
189
+ "gbl_fileSize_s": { "type": "string" },
190
+ "gbl_wxsIdentifier_s": { "type": "string" },
191
+ "dct_references_s": { "type": "string" },
192
+ "id": { "type": "string" },
193
+ "dct_identifier_sm": {
194
+ "type": "array",
195
+ "items": {
196
+ "type": "string"
197
+ }
198
+ },
199
+ "gbl_mdModified_dt": {
200
+ "type": "string",
201
+ "format": "date-time"
202
+ },
203
+ "gbl_mdVersion_s": {
204
+ "type": "string",
205
+ "const": "Aardvark"
206
+ },
207
+ "gbl_suppressed_b": { "type": "boolean" },
208
+ "gbl_georeferenced_b": { "type": "boolean" }
209
+ },
210
+ "required": ["id", "dct_title_s", "gbl_resourceClass_sm", "dct_accessRights_s", "gbl_mdVersion_s"]
211
+ }