geoblacklight 3.8.1 → 4.0.0.pre.alpha
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 +98 -22
- data/.gitignore +0 -1
- data/.rubocop.yml +5 -1
- data/.solr_wrapper +0 -1
- data/README.md +1 -1
- data/app/assets/images/blacklight/geoblacklight-icons.json +66 -102
- data/app/assets/images/blacklight/michigan-state-university.svg +1 -0
- data/app/assets/images/blacklight/pennsylvania-state-university.svg +1 -0
- data/app/assets/images/blacklight/purdue-university.svg +1 -0
- data/app/assets/images/blacklight/the-ohio-state-university.svg +1 -0
- data/app/assets/images/blacklight/university-of-chicago.svg +1 -0
- data/app/assets/images/blacklight/university-of-illinois-urbana-champaign.svg +1 -0
- data/app/assets/images/blacklight/university-of-iowa.svg +1 -0
- data/app/assets/images/blacklight/university-of-maryland.svg +1 -0
- data/app/assets/images/blacklight/university-of-michigan.svg +1 -0
- data/app/assets/images/blacklight/university-of-minnesota.svg +1 -0
- data/app/assets/images/blacklight/university-of-nebraska-lincoln.svg +1 -0
- data/app/assets/images/blacklight/university-of-wisconsin-madison.svg +1 -0
- data/app/assets/javascripts/geoblacklight/viewers/tms.js +2 -2
- data/app/assets/javascripts/geoblacklight/viewers/wms.js +2 -2
- data/app/models/concerns/geoblacklight/solr_document/citation.rb +2 -2
- data/app/models/concerns/geoblacklight/solr_document.rb +4 -4
- data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +3 -3
- data/app/views/catalog/_header_icons.html.erb +1 -1
- data/app/views/catalog/_home_text.html.erb +2 -2
- data/app/views/relation/_relations.html.erb +15 -0
- data/app/views/relation/index.html.erb +4 -16
- data/app/views/relation/index.json.jbuilder +6 -2
- data/bin/coverage.rb +36 -0
- data/config/initializers/rails_config.rb +0 -8
- data/config/locales/geoblacklight.en.yml +8 -8
- data/geoblacklight.gemspec +4 -4
- data/lib/generators/geoblacklight/assets_generator.rb +1 -1
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +78 -36
- data/lib/generators/geoblacklight/templates/settings.gbl_v1.yml +195 -0
- data/lib/generators/geoblacklight/templates/settings.yml +81 -25
- data/lib/geoblacklight/constants.rb +0 -3
- data/lib/geoblacklight/download/geojson_download.rb +1 -1
- data/lib/geoblacklight/download/geotiff_download.rb +1 -1
- data/lib/geoblacklight/download/hgl_download.rb +1 -1
- data/lib/geoblacklight/download/kmz_download.rb +1 -1
- data/lib/geoblacklight/download/shapefile_download.rb +1 -1
- data/lib/geoblacklight/engine.rb +3 -4
- data/lib/geoblacklight/item_viewer.rb +1 -13
- data/lib/geoblacklight/metadata/base.rb +1 -2
- data/lib/geoblacklight/references.rb +1 -1
- data/lib/geoblacklight/relation/ancestors.rb +4 -3
- data/lib/geoblacklight/relation/descendants.rb +4 -3
- data/lib/geoblacklight/relation/relation_response.rb +21 -6
- data/lib/geoblacklight/version.rb +1 -1
- data/schema/{geoblacklight-schema.json → geoblacklight-schema-1.0.json} +1 -1
- data/schema/geoblacklight-schema-aardvark.json +211 -0
- data/solr/conf/schema.xml +38 -30
- data/solr/conf/solrconfig.xml +18 -18
- data/spec/components/geoblacklight/homepage_feature_facet_component_spec.rb +1 -1
- data/spec/config/initializers/rails_config_spec.rb +5 -8
- data/spec/controllers/catalog_controller_spec.rb +6 -6
- data/spec/features/download_layer_spec.rb +1 -1
- data/spec/features/esri_viewer_spec.rb +0 -1
- data/spec/features/home_page_spec.rb +4 -4
- data/spec/features/missing_metadata_spec.rb +2 -2
- data/spec/features/relations_spec.rb +2 -2
- data/spec/features/search_results_map_spec.rb +2 -1
- data/spec/features/search_results_overlap_ratio_spec.rb +2 -2
- data/spec/features/split_view.html.erb_spec.rb +16 -12
- data/spec/features/tms_spec.rb +1 -1
- data/spec/features/web_services_modal_spec.rb +0 -33
- data/spec/fixtures/solr_documents/README.md +48 -36
- data/spec/fixtures/solr_documents/actual-papermap1.json +41 -18
- data/spec/fixtures/solr_documents/actual-point1.json +47 -27
- data/spec/fixtures/solr_documents/actual-polygon1.json +43 -18
- data/spec/fixtures/solr_documents/actual-raster1.json +52 -23
- data/spec/fixtures/solr_documents/all-relationships.json +48 -0
- data/spec/fixtures/solr_documents/baruch_ancestor1.json +62 -37
- data/spec/fixtures/solr_documents/baruch_ancestor2.json +62 -37
- data/spec/fixtures/solr_documents/baruch_documentation_download.json +60 -34
- data/spec/fixtures/solr_documents/bbox-spans-180.json +34 -16
- data/spec/fixtures/solr_documents/cornell_html_metadata.json +46 -26
- data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +43 -25
- data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +45 -28
- data/spec/fixtures/solr_documents/esri-feature-layer.json +44 -34
- data/spec/fixtures/solr_documents/esri-image-map-layer.json +45 -31
- data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +42 -17
- data/spec/fixtures/solr_documents/esri-wms-layer.json +46 -21
- data/spec/fixtures/solr_documents/harvard_raster.json +55 -36
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +35 -22
- data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +48 -27
- data/spec/fixtures/solr_documents/index-map-polygon.json +48 -27
- data/spec/fixtures/solr_documents/index-map-stanford.json +54 -25
- data/spec/fixtures/solr_documents/index_map_point.json +54 -26
- data/spec/fixtures/solr_documents/metadata_no_geom.json +27 -0
- data/spec/fixtures/solr_documents/metadata_no_provider.json +39 -0
- data/spec/fixtures/solr_documents/multiple-downloads.json +33 -20
- data/spec/fixtures/solr_documents/no_locn_geometry.json +25 -0
- data/spec/fixtures/solr_documents/no_spatial.json +37 -19
- data/spec/fixtures/solr_documents/oembed.json +34 -17
- data/spec/fixtures/solr_documents/princeton-child1.json +45 -28
- data/spec/fixtures/solr_documents/princeton-child2.json +45 -28
- data/spec/fixtures/solr_documents/princeton-child3.json +45 -28
- data/spec/fixtures/solr_documents/princeton-child4.json +45 -28
- data/spec/fixtures/solr_documents/princeton-parent.json +46 -23
- data/spec/fixtures/solr_documents/public_direct_download.json +48 -21
- data/spec/fixtures/solr_documents/public_iiif_princeton.json +49 -24
- data/spec/fixtures/solr_documents/public_polygon_mit.json +31 -15
- data/spec/fixtures/solr_documents/restricted-line.json +52 -21
- data/spec/fixtures/solr_documents/the-related-record.json +27 -0
- data/spec/fixtures/solr_documents/tms.json +33 -17
- data/spec/fixtures/solr_documents/umn_metro_result1.json +44 -28
- data/spec/fixtures/solr_documents/umn_state_result1.json +44 -26
- data/spec/fixtures/solr_documents/umn_state_result2.json +45 -24
- data/spec/fixtures/solr_documents/uva_slug_colon.json +43 -20
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +1 -1
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +1 -1
- data/spec/lib/geoblacklight/download/hgl_download_spec.rb +1 -1
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +1 -1
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +1 -1
- data/spec/lib/geoblacklight/download_spec.rb +1 -1
- data/spec/lib/geoblacklight/metadata/base_spec.rb +0 -18
- data/spec/lib/geoblacklight/references_spec.rb +2 -2
- data/spec/lib/geoblacklight/relation/ancestors_spec.rb +3 -3
- data/spec/lib/geoblacklight/relation/descendants_spec.rb +3 -3
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +32 -17
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +4 -4
- data/spec/spec_helper.rb +0 -5
- data/spec/test_app_templates/Gemfile.extra +0 -1
- data/spec/views/catalog/_results_pagination.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_show_downloads.html.erb_spec.rb +1 -1
- metadata +43 -74
- data/app/assets/images/blacklight/american-geographical-society-library-uwm-libraries.svg +0 -26
- data/app/assets/images/blacklight/arizona.svg +0 -4
- data/app/assets/images/blacklight/george-mason.svg +0 -4
- data/app/assets/images/blacklight/nebraska.svg +0 -4
- data/app/assets/images/blacklight/rutgers.svg +0 -5
- data/app/assets/javascripts/geoblacklight/viewers/tilejson.js +0 -33
- data/app/assets/javascripts/geoblacklight/viewers/wmts.js +0 -85
- data/app/assets/javascripts/geoblacklight/viewers/xyz.js +0 -10
- data/app/views/relation/_ancestors.html.erb +0 -8
- data/app/views/relation/_descendants.html.erb +0 -15
- data/config/initializers/new_gbl_settings_defaults_3_3.yml +0 -10
- data/lib/geoblacklight/faraday_middleware/follow_redirects.rb +0 -176
- data/schema/format-values.md +0 -50
- data/schema/geoblacklight-schema-deprecated.md +0 -39
- data/schema/geoblacklight-schema.md +0 -323
- data/schema/geometry-type-values.md +0 -11
- data/schema/references.md +0 -23
- data/schema/schema-commentary.md +0 -198
- data/schema/subjects.md +0 -41
- data/schema/type-values.md +0 -10
- data/spec/features/tilejson_spec.rb +0 -22
- data/spec/features/wmts_spec.rb +0 -34
- data/spec/features/xyz_spec.rb +0 -10
- data/spec/fixtures/manifests/tilejson.json +0 -21
- data/spec/fixtures/manifests/wmts-multiple.xml +0 -813
- data/spec/fixtures/manifests/wmts-single.xml +0 -126
- data/spec/fixtures/solr_documents/metadata_no_dct_provenance_s.json +0 -30
- data/spec/fixtures/solr_documents/metadata_no_layer_geom_type_s.json +0 -17
- data/spec/fixtures/solr_documents/metadata_no_solr_geom.json +0 -23
- data/spec/fixtures/solr_documents/tilejson.json +0 -38
- data/spec/fixtures/solr_documents/wmts-multiple.json +0 -32
- data/spec/fixtures/solr_documents/wmts-single-layer.json +0 -38
- data/spec/fixtures/solr_documents/xyz.json +0 -29
@@ -1,33 +0,0 @@
|
|
1
|
-
//= require geoblacklight/viewers/wms
|
2
|
-
|
3
|
-
GeoBlacklight.Viewer.Tilejson = GeoBlacklight.Viewer.Wms.extend({
|
4
|
-
|
5
|
-
addPreviewLayer: function() {
|
6
|
-
var _this = this;
|
7
|
-
fetch(this.data.url).then(function(response) {
|
8
|
-
if (!response.ok) {
|
9
|
-
throw new Error("Unable to fetch tile.json document");
|
10
|
-
}
|
11
|
-
return response.json();
|
12
|
-
}).then(function(tilejson) {
|
13
|
-
var bounds = _this.getBounds(tilejson),
|
14
|
-
options = bounds ? { bounds: bounds } : {},
|
15
|
-
url = tilejson.tiles[0],
|
16
|
-
tileJsonLayer = L.tileLayer(url, options);
|
17
|
-
_this.overlay.addLayer(tileJsonLayer);
|
18
|
-
}).catch(function(error) {
|
19
|
-
console.debug(error);
|
20
|
-
});
|
21
|
-
},
|
22
|
-
|
23
|
-
getBounds: function(doc) {
|
24
|
-
// Get the bounds from the document, if they exist, and
|
25
|
-
// convert to a Leaflet latlngBounds object
|
26
|
-
var bounds = doc.bounds;
|
27
|
-
if(bounds) {
|
28
|
-
var corner1 = L.latLng(bounds[1], bounds[0]),
|
29
|
-
corner2 = L.latLng(bounds[3], bounds[2]);
|
30
|
-
return L.latLngBounds(corner1, corner2);
|
31
|
-
}
|
32
|
-
}
|
33
|
-
});
|
@@ -1,85 +0,0 @@
|
|
1
|
-
//= require geoblacklight/viewers/wms
|
2
|
-
|
3
|
-
GeoBlacklight.Viewer.Wmts = GeoBlacklight.Viewer.Wms.extend({
|
4
|
-
|
5
|
-
addPreviewLayer: function() {
|
6
|
-
var _this = this;
|
7
|
-
fetch(this.data.url).then(function(response) {
|
8
|
-
if (!response.ok) {
|
9
|
-
throw new Error("Unable to fetch WMTSCapabilities document");
|
10
|
-
}
|
11
|
-
return response.text();
|
12
|
-
}).then(function(wmtsCapabilities) {
|
13
|
-
var tileInfo = _this.parseCapabilities(wmtsCapabilities),
|
14
|
-
options = tileInfo.bounds ? { bounds: tileInfo.bounds } : {},
|
15
|
-
tileLayer = L.tileLayer(tileInfo.url, options);
|
16
|
-
_this.overlay.addLayer(tileLayer);
|
17
|
-
}).catch(function(error) {
|
18
|
-
console.debug(error);
|
19
|
-
});
|
20
|
-
},
|
21
|
-
|
22
|
-
parseCapabilities: function(wmtsCapabilities) {
|
23
|
-
var parser = new DOMParser(),
|
24
|
-
doc = parser.parseFromString(wmtsCapabilities, "application/xml"),
|
25
|
-
layers = doc.getElementsByTagName("Layer"),
|
26
|
-
selectedLayer = this.findLayer(layers),
|
27
|
-
resourceElement = selectedLayer.getElementsByTagName("ResourceURL")[0];
|
28
|
-
|
29
|
-
// Generate URL with Leaflet.TileLayer URL template formatting
|
30
|
-
var tileURL = resourceElement.getAttribute("template")
|
31
|
-
.replace("{Style}", this.getStyle(selectedLayer))
|
32
|
-
.replace("{TileMatrixSet}", this.getTileMatrixSet(selectedLayer))
|
33
|
-
.replace("TileMatrix", "z")
|
34
|
-
.replace("TileCol","x")
|
35
|
-
.replace("TileRow","y");
|
36
|
-
|
37
|
-
return { url: tileURL, bounds: this.getBounds(selectedLayer) };
|
38
|
-
},
|
39
|
-
|
40
|
-
findLayer: function(layers) {
|
41
|
-
if (layers.length === 1) {
|
42
|
-
// If there is only one layer in the document, return it
|
43
|
-
return layers[0];
|
44
|
-
} else {
|
45
|
-
// Search each layer for an identifier that matches the
|
46
|
-
// layerId and return it
|
47
|
-
for (i = 0; i < layers.length; i++) {
|
48
|
-
var ids = layers[i].getElementsByTagName("ows:Identifier");
|
49
|
-
for(x = 0; x < ids.length; x++) {
|
50
|
-
if (ids[x].textContent === this.data.layerId) {
|
51
|
-
return layers[i];
|
52
|
-
}
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
},
|
57
|
-
|
58
|
-
getStyle: function(layer) {
|
59
|
-
var styleElement = layer.getElementsByTagName("Style")[0];
|
60
|
-
if(styleElement) {
|
61
|
-
return styleElement.getElementsByTagName("ows:Identifier")[0].textContent;
|
62
|
-
}
|
63
|
-
},
|
64
|
-
|
65
|
-
getTileMatrixSet: function(layer) {
|
66
|
-
var tileMatrixElement = layer.getElementsByTagName("TileMatrixSet")[0];
|
67
|
-
if(tileMatrixElement) {
|
68
|
-
return tileMatrixElement.textContent;
|
69
|
-
}
|
70
|
-
},
|
71
|
-
|
72
|
-
getBounds: function(layer) {
|
73
|
-
// Get the layer's lower corner and upper corner values,
|
74
|
-
// if they exist, and convert to a Leaflet latlngBounds object
|
75
|
-
var lcElement = layer.getElementsByTagName("ows:LowerCorner")[0],
|
76
|
-
ucElement = layer.getElementsByTagName("ows:UpperCorner")[0];
|
77
|
-
if(lcElement && ucElement) {
|
78
|
-
var lc = lcElement.textContent.split(" "),
|
79
|
-
uc = ucElement.textContent.split(" "),
|
80
|
-
corner1 = L.latLng(lc[1], lc[0]),
|
81
|
-
corner2 = L.latLng(uc[1], uc[0]);
|
82
|
-
return L.latLngBounds(corner1, corner2);
|
83
|
-
}
|
84
|
-
}
|
85
|
-
});
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<% @relations.ancestors['docs'].each do |ancestor| %>
|
2
|
-
<li class="list-group-item border-bottom-0">
|
3
|
-
<%= link_to solr_document_path(ancestor[Settings.FIELDS.UNIQUE_KEY]) do %>
|
4
|
-
<%= relations_icon(ancestor, 'pagelines-brands') %>
|
5
|
-
<%= ancestor[Settings.FIELDS.TITLE] %>
|
6
|
-
<% end %>
|
7
|
-
</li>
|
8
|
-
<% end %>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<% @relations.descendants['docs'][0..2].each do |descendant| %>
|
2
|
-
<li class="list-group-item border-bottom-0">
|
3
|
-
<%= link_to solr_document_path(descendant[Settings.FIELDS.UNIQUE_KEY]) do %>
|
4
|
-
<%= relations_icon(descendant, 'leaf') %>
|
5
|
-
<%= descendant[Settings.FIELDS.TITLE] %>
|
6
|
-
<% end %>
|
7
|
-
</li>
|
8
|
-
<% end %>
|
9
|
-
<% unless (@relations.descendants['numFound'].to_i <= 3) %>
|
10
|
-
<li class="list-group-item border-bottom-0">
|
11
|
-
<%= link_to search_catalog_path({f: {"#{Settings.FIELDS.SOURCE}" => [@relations.link_id]}}) do %>
|
12
|
-
<%= t('geoblacklight.relations.browse_all', count: @relations.descendants['numFound']) %>
|
13
|
-
<% end %>
|
14
|
-
</li>
|
15
|
-
<% end %>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# New GeoBlacklight v3.3 Solr field mappings
|
2
|
-
FIELDS:
|
3
|
-
:IDENTIFIER: 'dc_identifier_s'
|
4
|
-
:LANGUAGE: 'dc_language_s'
|
5
|
-
:LAYER_MODIFIED: 'layer_modified_dt'
|
6
|
-
:OVERLAP_FIELD: 'solr_bboxtype'
|
7
|
-
:SOURCE: 'dc_source_sm'
|
8
|
-
:SUPPRESSED: 'suppressed_b'
|
9
|
-
:TYPE: 'dc_type_s'
|
10
|
-
:UNIQUE_KEY: 'layer_slug_s'
|
@@ -1,176 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
# :nocov:
|
3
|
-
require 'faraday'
|
4
|
-
require 'set'
|
5
|
-
|
6
|
-
module Geoblacklight
|
7
|
-
# NOTE: We copied this class from faraday_middleware in order to support
|
8
|
-
# both Faraday 1 & 2. If this middleware is ever extracted from
|
9
|
-
# faraday_middleware into its own gem we should remove this and use that
|
10
|
-
# instead.
|
11
|
-
module FaradayMiddleware
|
12
|
-
# Exception thrown when the maximum amount of requests is
|
13
|
-
# exceeded.
|
14
|
-
class RedirectLimitReached < ::Faraday::ClientError
|
15
|
-
attr_reader :response
|
16
|
-
|
17
|
-
def initialize(response)
|
18
|
-
super "too many redirects; last one to: #{response['location']}"
|
19
|
-
@response = response
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
# Public: Follow HTTP 301, 302, 303, 307, and 308 redirects.
|
24
|
-
#
|
25
|
-
# For HTTP 301, 302, and 303, the original GET, POST, PUT, DELETE, or PATCH
|
26
|
-
# request gets converted into a GET. With `:standards_compliant => true`,
|
27
|
-
# however, the HTTP method after 301/302 remains unchanged. This allows you
|
28
|
-
# to opt into HTTP/1.1 compliance and act unlike the major web browsers.
|
29
|
-
#
|
30
|
-
# This middleware currently only works with synchronous requests; i.e. it
|
31
|
-
# doesn't support parallelism.
|
32
|
-
#
|
33
|
-
# If you wish to persist cookies across redirects, you could use
|
34
|
-
# the faraday-cookie_jar gem:
|
35
|
-
#
|
36
|
-
# Faraday.new(:url => url) do |faraday|
|
37
|
-
# faraday.use FaradayMiddleware::FollowRedirects
|
38
|
-
# faraday.use :cookie_jar
|
39
|
-
# faraday.adapter Faraday.default_adapter
|
40
|
-
# end
|
41
|
-
#
|
42
|
-
class FollowRedirects < ::Faraday::Middleware
|
43
|
-
# HTTP methods for which 30x redirects can be followed
|
44
|
-
ALLOWED_METHODS = Set.new [:head, :options, :get, :post, :put, :patch, :delete]
|
45
|
-
# HTTP redirect status codes that this middleware implements
|
46
|
-
REDIRECT_CODES = Set.new [301, 302, 303, 307, 308]
|
47
|
-
# Keys in env hash which will get cleared between requests
|
48
|
-
ENV_TO_CLEAR = Set.new [:status, :response, :response_headers]
|
49
|
-
|
50
|
-
# Default value for max redirects followed
|
51
|
-
FOLLOW_LIMIT = 3
|
52
|
-
|
53
|
-
# Regex that matches characters that need to be escaped in URLs, sans
|
54
|
-
# the "%" character which we assume already represents an escaped sequence.
|
55
|
-
URI_UNSAFE = %r{[^\-_.!~*'()a-zA-Z\d;/?:@&=+$,\[\]%]}.freeze
|
56
|
-
|
57
|
-
AUTH_HEADER = 'Authorization'
|
58
|
-
|
59
|
-
# Public: Initialize the middleware.
|
60
|
-
#
|
61
|
-
# options - An options Hash (default: {}):
|
62
|
-
# :limit - A Numeric redirect limit (default: 3)
|
63
|
-
# :standards_compliant - A Boolean indicating whether to respect
|
64
|
-
# the HTTP spec when following 301/302
|
65
|
-
# (default: false)
|
66
|
-
# :callback - A callable used on redirects
|
67
|
-
# with the old and new envs
|
68
|
-
# :cookies - An Array of Strings (e.g.
|
69
|
-
# ['cookie1', 'cookie2']) to choose
|
70
|
-
# cookies to be kept, or :all to keep
|
71
|
-
# all cookies (default: []).
|
72
|
-
# :clear_authorization_header - A Boolean indicating whether the request
|
73
|
-
# Authorization header should be cleared on
|
74
|
-
# redirects (default: true)
|
75
|
-
def initialize(app, options = {})
|
76
|
-
super(app)
|
77
|
-
@options = options
|
78
|
-
|
79
|
-
@convert_to_get = Set.new [303]
|
80
|
-
@convert_to_get << 301 << 302 unless standards_compliant?
|
81
|
-
end
|
82
|
-
|
83
|
-
def call(env)
|
84
|
-
perform_with_redirection(env, follow_limit)
|
85
|
-
end
|
86
|
-
|
87
|
-
private
|
88
|
-
|
89
|
-
def convert_to_get?(response)
|
90
|
-
[:head, :options].exclude?(response.env[:method]) &&
|
91
|
-
@convert_to_get.include?(response.status)
|
92
|
-
end
|
93
|
-
|
94
|
-
def perform_with_redirection(env, follows)
|
95
|
-
request_body = env[:body]
|
96
|
-
response = @app.call(env)
|
97
|
-
|
98
|
-
response.on_complete do |response_env|
|
99
|
-
if follow_redirect?(response_env, response)
|
100
|
-
fail RedirectLimitReached, response if follows.zero?
|
101
|
-
|
102
|
-
new_request_env = update_env(response_env.dup, request_body, response)
|
103
|
-
callback&.call(response_env, new_request_env)
|
104
|
-
response = perform_with_redirection(new_request_env, follows - 1)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
response
|
108
|
-
end
|
109
|
-
|
110
|
-
def update_env(env, request_body, response)
|
111
|
-
redirect_from_url = env[:url].to_s
|
112
|
-
redirect_to_url = safe_escape(response['location'] || '')
|
113
|
-
env[:url] += redirect_to_url
|
114
|
-
|
115
|
-
ENV_TO_CLEAR.each { |key| env.delete key }
|
116
|
-
|
117
|
-
if convert_to_get?(response)
|
118
|
-
env[:method] = :get
|
119
|
-
env[:body] = nil
|
120
|
-
else
|
121
|
-
env[:body] = request_body
|
122
|
-
end
|
123
|
-
|
124
|
-
clear_authorization_header(env, redirect_from_url, redirect_to_url)
|
125
|
-
|
126
|
-
env
|
127
|
-
end
|
128
|
-
|
129
|
-
def follow_redirect?(env, response)
|
130
|
-
ALLOWED_METHODS.include?(env[:method]) &&
|
131
|
-
REDIRECT_CODES.include?(response.status)
|
132
|
-
end
|
133
|
-
|
134
|
-
def follow_limit
|
135
|
-
@options.fetch(:limit, FOLLOW_LIMIT)
|
136
|
-
end
|
137
|
-
|
138
|
-
def standards_compliant?
|
139
|
-
@options.fetch(:standards_compliant, false)
|
140
|
-
end
|
141
|
-
|
142
|
-
def callback
|
143
|
-
@options[:callback]
|
144
|
-
end
|
145
|
-
|
146
|
-
# Internal: escapes unsafe characters from an URL which might be a path
|
147
|
-
# component only or a fully qualified URI so that it can be joined onto an
|
148
|
-
# URI:HTTP using the `+` operator. Doesn't escape "%" characters so to not
|
149
|
-
# risk double-escaping.
|
150
|
-
def safe_escape(uri)
|
151
|
-
uri = uri.split('#')[0] # we want to remove the fragment if present
|
152
|
-
uri.to_s.gsub(URI_UNSAFE) do |match|
|
153
|
-
"%#{match.unpack('H2' * match.bytesize).join('%').upcase}"
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
def clear_authorization_header(env, from_url, to_url)
|
158
|
-
return env if redirect_to_same_host?(from_url, to_url)
|
159
|
-
return env unless @options.fetch(:clear_authorization_header, true)
|
160
|
-
|
161
|
-
env[:request_headers].delete(AUTH_HEADER)
|
162
|
-
end
|
163
|
-
|
164
|
-
def redirect_to_same_host?(from_url, to_url)
|
165
|
-
return true if to_url.start_with?('/')
|
166
|
-
|
167
|
-
from_uri = URI.parse(from_url)
|
168
|
-
to_uri = URI.parse(to_url)
|
169
|
-
|
170
|
-
[from_uri.scheme, from_uri.host, from_uri.port] ==
|
171
|
-
[to_uri.scheme, to_uri.host, to_uri.port]
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
176
|
-
# :nocov:
|
data/schema/format-values.md
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
## GeoBlacklight Format Controlled Vocabulary
|
2
|
-
|
3
|
-
#### Type: Dataset
|
4
|
-
| Format | Associated Geometry Type(s) |
|
5
|
-
|:----------------------------|:-------------|
|
6
|
-
|ArcGRID |Raster |
|
7
|
-
|CD-ROM |Vector or Raster |
|
8
|
-
|DEM |Vector or Raster |
|
9
|
-
|DVD-ROM |Vector or Raster |
|
10
|
-
|Feature Class |Vector or Raster |
|
11
|
-
|Geodatabase |Vector or Raster |
|
12
|
-
|GeoJPEG |Raster |
|
13
|
-
|GeoJSON |Vector |
|
14
|
-
|GeoPackage |Vector or Raster |
|
15
|
-
|GeoPDF |Vector or Raster |
|
16
|
-
|GeoTIFF |Raster |
|
17
|
-
|KML |Vector |
|
18
|
-
|KMZ |Vector or Raster |
|
19
|
-
|LAS | |
|
20
|
-
|LAZ | |
|
21
|
-
|Mixed |Vector or Raster |
|
22
|
-
|Pulsewaves | |
|
23
|
-
|Raster Dataset |Raster |
|
24
|
-
|Shapefile |Vector |
|
25
|
-
|SQLite Database|Vector or Raster |
|
26
|
-
|Tabular Data |- |
|
27
|
-
|
28
|
-
#### Type: Image
|
29
|
-
|
30
|
-
| Format |
|
31
|
-
|:----------------------------|
|
32
|
-
|JPEG |
|
33
|
-
|JPEG2000 |
|
34
|
-
|Mixed |
|
35
|
-
|MrSID |
|
36
|
-
|PDF |
|
37
|
-
|PNG |
|
38
|
-
|TIFF |
|
39
|
-
|
40
|
-
|
41
|
-
#### Type: Interactive Resource
|
42
|
-
| Format |
|
43
|
-
|:----------------------------|
|
44
|
-
|Web Application|
|
45
|
-
|
46
|
-
#### Type: Physical Object
|
47
|
-
| Format |
|
48
|
-
|:----------------------------|
|
49
|
-
|Cartographic Material|
|
50
|
-
|Paper Map|
|
@@ -1,39 +0,0 @@
|
|
1
|
-
## <a name="resource-layer">layer</a>
|
2
|
-
|
3
|
-
|
4
|
-
A GIS data layer. See [this example](https://github.com/OpenGeoMetadata/edu.stanford.purl/blob/master/bb/099/zb/1450/geoblacklight.json) metadata layer.
|
5
|
-
|
6
|
-
### Attributes
|
7
|
-
|
8
|
-
| Name | Type | Description | Example |
|
9
|
-
| ------- | ------- | ------- | ------- |
|
10
|
-
| **dc_creator_sm** | *array* | Author(s) of the layer. *Optional* | `"George Washington, Thomas Jefferson"` |
|
11
|
-
| **dc_description_s** | *string* | Description for the layer. *Optional* | `"My Description"` |
|
12
|
-
| **dc_format_s** | *string* | File format for the layer, ideally using a controlled vocabulary. *Optional* | `"Shapefile, GeoTIFF, ArcGRID"` |
|
13
|
-
| **dc_identifier_s** | *string* | Unique identifier for layer as a URI. It should be globally unique across all institutions, assumed not to be end-user visible, and is usually of the form `http://institution/id`. See https://github.com/geoblacklight/geoblacklight/wiki/Schema for more detailed documentation. | `"http://purl.stanford.edu/vr593vj7147"` |
|
14
|
-
| **dc_language_s** | *string* | Language for the layer. *Optional*. Note that future versions of the schema may make this a multi-valued field. | `"English"` |
|
15
|
-
| **dc_publisher_s** | *string* | Publisher of the layer. *Optional* | `"ML InfoMap"` |
|
16
|
-
| **dc_relation_sm** | *array* | *DEPRECATED* (use `dct_isPartOf_sm`). A reference to a related resource for this layer. *Optional* | `"http://purl.stanford.edu/vr593vj7147"` |
|
17
|
-
| **dc_rights_s** | *string* | Access rights for the layer.<br/> **one of:**`"Public"` or `"Restricted"` | `"Public"` |
|
18
|
-
| **dc_source_sm** | *array* | The identity of a layer from which this layer's data was derived. *Optional* | `"stanford-vr593vj7147"` |
|
19
|
-
| **dc_subject_sm** | *array* | Subjects for the layer, preferrably in a controlled vocabulary. *Optional* | `"Census, Human settlements"` |
|
20
|
-
| **dc_title_s** | *string* | Title for the layer. | `"My Title"` |
|
21
|
-
| **dc_type_s** | *string* | Resource type of the layer, using DCMI Type Vocabulary, usually a `Dataset`. *Optional*<br/> **one of:**`"Dataset"` or `"Image"` or `"PhysicalObject"` | `"Dataset"` |
|
22
|
-
| **dct_isPartOf_sm** | *array* | Holding entity for the layer, such as the title of a collection. *Optional* | `"Village Maps of India"` |
|
23
|
-
| **dct_issued_dt** | *date-time* | Issued date for the layer, using XML Schema dateTime format (YYYY-MM-DDThh:mm:ssZ). *Optional* | `"2015-01-01T12:00:00Z"` |
|
24
|
-
| **dct_provenance_s** | *string* | Institution who holds the layer. | `"Stanford"` |
|
25
|
-
| **dct_references_s** | *string* | External resources that are available for the layer. The value is a JSON hash where each key is a URI for the protocol or format, and the value is the URL to the external resource. See `dct_references_s` [detailed documentation](http://geoblacklight.org/tutorial/2015/02/09/geoblacklight-overview.html). *Optional*<br/> **pattern:** `\{.*\}` | `"{ ... }"` |
|
26
|
-
| **dct_spatial_sm** | *array* | Spatial coverage and place names for the layer, preferrably in a controlled vocabulary. *Optional* | `"Paris, San Francisco"` |
|
27
|
-
| **dct_temporal_sm** | *array* | Temporal coverage for the layer, typically years or dates. Note that this field is not in a specific date format. *Optional* | `"1989, circa 2010, 2007-2009"` |
|
28
|
-
| **geoblacklight_version** | *string* | The version of the GeoBlacklight Schema to which this metadata record conforms.<br/> **one of:**`"1.0"` | `"1.0"` |
|
29
|
-
| **georss_box_s** | *string* | *DEPRECATED* (use `solr_geom`): Bounding box for the layer, as maximum values for S W N E. | `"12.6 -119.4 19.9 84.8"` |
|
30
|
-
| **georss_point_s** | *string* | *DEPRECATED* (use `georss_box_s`): Point representation for layer as y, x - i.e., centroid | `"12.6 -119.4"` |
|
31
|
-
| **layer_geom_type_s** | *string* | Geometry type for layer data, using controlled vocabulary.<br/> **one of:**`"Point"` or `"Line"` or `"Polygon"` or `"Raster"` or `"Scanned Map"` or `"Image"` or `"Mixed"` | `"Point"` |
|
32
|
-
| **layer_id_s** | *string* | The complete identifier for the layer via WMS/WFS/WCS protocol. *Optional* | `"druid:vr593vj7147"` |
|
33
|
-
| **layer_modified_dt** | *date-time* | Last modification date for the metadata record, using XML Schema dateTime format (YYYY-MM-DDThh:mm:ssZ). *Optional* | `"2015-01-01T12:00:00Z"` |
|
34
|
-
| **layer_slug_s** | *string* | Identifies a layer in human-readable keywords. Note this value is visible to the user, and used for Permalinks. The value should be alpha-numeric characters separated by dashes, and is typically of the form `institution-keyword1-keyword2`. It should also be globally unique across all institutions in *your* GeoBlacklight index. See https://github.com/geoblacklight/geoblacklight/wiki/Schema for more detailed documentation.<br/> **pattern:** `^[-a-zA-Z0-9]+$` | `"stanford-andhra-pradesh-village-boundaries"` |
|
35
|
-
| **solr_geom** | *string* | Bounding box of the layer as a ENVELOPE WKT (from the CQL standard) using coordinates in (West, East, North, South) order. Note that this field is indexed as a Solr spatial (RPT) field.<br/> **pattern:** `ENVELOPE(.*,.*,.*,.*)` | `"ENVELOPE(76.76, 84.76, 19.91, 12.62)"` |
|
36
|
-
| **solr_year_i** | *integer* | *DEPRECATED* (only used by the Blacklight range plugin, not core GeoBlacklight, and generally you want a multi-valued field here): *Derived from* `dct_temporal_sm`. Year for which layer is valid and only a single value. Note that this field is indexed as a Solr numeric field. | `"1989"` |
|
37
|
-
| **uuid** | *string* | *DEPRECATED* (use `dc_identifier_s`): Unique identifier for layer that is globally unique. | `"http://purl.stanford.edu/vr593vj7147"` |
|
38
|
-
|
39
|
-
|