diff --git a/app/javascript/openlayers/ol_initializer.js b/app/javascript/openlayers/ol_initializer.js index 98ebfd59..915494c0 100644 --- a/app/javascript/openlayers/ol_initializer.js +++ b/app/javascript/openlayers/ol_initializer.js @@ -4,12 +4,14 @@ import TileLayer from 'ol/layer/Tile' import VectorTile from 'ol/layer/VectorTile' import XYZ from 'ol/source/XYZ' import GeoJSON from 'ol/format/GeoJSON' -import { useGeographic } from 'ol/proj' +import { Projection, useGeographic } from 'ol/proj' import { Style, Stroke, Fill, Circle } from 'ol/style' import GeoTIFF from 'ol/source/GeoTIFF' import WebGLTileLayer from 'ol/layer/WebGLTile' +import VectorLayer from 'ol/layer/Vector' +import VectorSource from 'ol/source/Vector' import { FullScreen, defaults as defaultControls } from 'ol/control' import { PMTilesVectorSource } from 'ol-pmtiles' @@ -24,7 +26,9 @@ export default class OlInitializer { run () { if (!this.element) return false - if (this.data.protocol === 'Pmtiles') { + if (this.data.available !== 'true') { + this.initializeBoundsOverlay() + } else if (this.data.protocol === 'Pmtiles') { this.initializePmtiles() } else if (this.data.protocol === 'Cog') { this.initializeCog() @@ -100,4 +104,29 @@ export default class OlInitializer { map.getView().fit(view.extent, map.getSize()) }) } + + initializeBoundsOverlay () { + const vectorLayer = new VectorLayer({ + source: new VectorSource({ + features: new GeoJSON().readFeatures(this.data.mapGeom) + }) + }) + + const proj = new Projection({ + code: 'EPSG:4326', + units: 'degrees' + }) + + const map = new Map({ + layers: [ + this.baseLayer(), + vectorLayer + ], + target: 'ol-map', + view: new View({ + projection: proj + }) + }) + map.getView().fit(this.extent, { size: map.getSize(), padding: [10, 10, 10, 10] }) + } } diff --git a/spec/fixtures/solr_documents/princeton_public_cog.json b/spec/fixtures/solr_documents/princeton_public_cog.json new file mode 100644 index 00000000..0410d347 --- /dev/null +++ b/spec/fixtures/solr_documents/princeton_public_cog.json @@ -0,0 +1,42 @@ +{ + "geoblacklight_version": "1.0", + "dc_identifier_s": "ark:/88435/dc7h14b252v", + "layer_slug_s": "princeton-dc7h14b252v", + "uuid": "princeton-dc7h14b252v", + "dc_title_s": "Map illustrating the journey of the Pundit Nain Singh through Great Tibet from Lada\u0301kh to Assam [cartographic material] : to accompany the paper by Captn. H. Trotter R.E. / [engraved by] Edwd. Weller. (geotiff)", + "solr_geom": "ENVELOPE(79.257732, 92.742268, 34.178571, 26.339286)", + "dct_provenance_s": "Princeton", + "dc_rights_s": "Public", + "dc_description_s": "Relief shown by hachures and spot heights. The Pundit's route is colored red. Routes of previous explorers and major roads are also shown. Romanized name of Indian explorer: Nain Singh Rawat. British boundaries and approximate boundary between Nepal and Tibet are shown. Includes glossary of local terms for geographic features. From: The Journal of the Royal Geographical Society of London. Vol. 47, (1877), pp. 86-136; held in Firestone Library. Call number: G7 .J687 v.47 1877", + "dc_language_s": "en", + "dc_publisher_s": "London: published for the Journal of the Royal Geographical Society by J. Murray, Albemarle Street, 1877.", + "all_subject_sm": [ + "Himalaya Mountains\u2014Discovery and exploration\u2014Maps", + "Tibet\u2014Discovery and exploration\u2014Maps", + "Physical geography\u2014Himalaya Mountains\u2014Maps", + "Great Trigonometrical Survey of India", + "Himalaya Mountains\u2014Maps", + "Tibet Autonomous Region (China)\u2014Maps", + "India, Northeastern\u2014Maps", + "Physical maps", + "Maps" + ], + "dct_spatial_sm": [ + "Himalaya Mountains" + ], + "solr_year_i": 1877, + "layer_modified_dt": "2023-09-01T18:49:36Z", + "layer_id_s": "public-figgy:p-67d9ca18-49ee-44a6-8d87-3d4cbc70b0c5", + "dct_references_s": "{\"http://schema.org/url\":\"https://catalog.princeton.edu/catalog/9971226563506421\",\"http://schema.org/downloadUrl\":\"https://figgy.princeton.edu/downloads/67d9ca18-49ee-44a6-8d87-3d4cbc70b0c5/file/a95c7f34-d4a8-49a5-a51a-ad782e43b37a\",\"http://schema.org/thumbnailUrl\":\"https://figgy.princeton.edu/downloads/67d9ca18-49ee-44a6-8d87-3d4cbc70b0c5/file/8b9b0834-0f3e-48ef-95d0-e065b30cd231\",\"http://www.opengis.net/def/serviceType/ogc/wmts\":\"https://map-tiles.princeton.edu/cog/WMTSCapabilities.xml?id=07f0ec69493248d6a0f69bd80e8cb1da\",\"https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames\":\"https://map-tiles.princeton.edu/cog/tiles/WebMercatorQuad/{z}/{x}/{y}@1x.png?id=07f0ec69493248d6a0f69bd80e8cb1da\",\"https://github.com/cogeotiff/cog-spec\":\"https://geodata.lib.princeton.edu/13/f5/58/13f5582c32a54be98fc2982077d0456e/display_raster.tif\"}", + "layer_geom_type_s": "Raster", + "layer_geom_type_sm": [ + "Raster" + ], + "dc_format_s": "GeoTIFF", + "suppressed_b": true, + "dc_source_sm": [ + "princeton-j098zd574" + ], + "call_number_s": "G7402.H5B5 1877 .R6", + "rights_statement_s": "No Known Copyright

Princeton University Library reasonably believes that the Item is not restricted by copyright or related rights, but a conclusive determination could not be made.\n
You are free to use this Item in any way that is permitted by the copyright and related rights legislation that applies to your use.

Princeton University Library claims no copyright or license governing this digital resource. It is provided for free, on a non-commercial, open-access basis, for fair-use academic and research purposes only. Anyone who claims copyright over any part of these resources and feels that they should not be presented in this manner is invited to contact Princeton University Library, who will in turn consider such concerns and make every effort to respond appropriately. We request that users reproducing this resource cite it according to the guidelines described at https://library.princeton.edu/special-collections/policies/forms-citation.\n

" +} diff --git a/spec/fixtures/solr_documents/princeton_restricted_cog.json b/spec/fixtures/solr_documents/princeton_restricted_cog.json new file mode 100644 index 00000000..61044c6f --- /dev/null +++ b/spec/fixtures/solr_documents/princeton_restricted_cog.json @@ -0,0 +1,41 @@ +{ + "geoblacklight_version": "1.0", + "dc_identifier_s": "ark:/88435/dcgx41mw63n", + "layer_slug_s": "princeton-dcgx41mw63n", + "uuid": "princeton-dcgx41mw63n", + "dc_title_s": "Part of Kam in Eastern Tibet [cartographic material] / by Eric Teichman, C.I.E., B.A. (geotiff)", + "solr_geom": "ENVELOPE(96.05, 100.2, 33.35, 28.8)", + "dct_provenance_s": "Princeton", + "dc_rights_s": "Restricted", + "dc_description_s": "Relief shown by spot heights. Mr. Teichman's routes, passes, and boundaries of states and provinces are shown. Includes information on terrain and ground cover. \"Names are all given in Tibetan, with Chinese names, where the latter are in common use, added in brackets.\" Includes East Tibetan Glossary of geographical terms. Includes inset showing area of map within Asia. From: Geographical Journal. Vol. 59, no. 1 (January 1922), pp. 1-19; held in Firestone Library. Call number: G7 .J6874", + "dc_creator_sm": [ + "Teichman, Eric, 1884-1944" + ], + "dc_language_s": "en", + "dc_publisher_s": "London : Edward Stanford, 1922.", + "all_subject_sm": [ + "Tibet\u2014Description and travel\u2014Maps", + "Physical geography\u2014Tibet", + "Tibet\u2014Maps", + "Physical maps", + "Maps" + ], + "dct_spatial_sm": [ + "Tibet (China)" + ], + "solr_year_i": 1922, + "layer_modified_dt": "2023-11-10T21:04:40Z", + "layer_id_s": "public-figgy:p-726b457b-09a8-49ec-bf9b-fa37b488a693", + "dct_references_s": "{\"http://schema.org/url\":\"https://catalog.princeton.edu/catalog/9975632383506421\",\"http://schema.org/downloadUrl\":\"https://figgy.princeton.edu/downloads/726b457b-09a8-49ec-bf9b-fa37b488a693/file/91ebee67-0fd7-4689-9fad-aa295ec4239f\",\"http://schema.org/thumbnailUrl\":\"https://figgy.princeton.edu/downloads/726b457b-09a8-49ec-bf9b-fa37b488a693/file/ed5b7d8d-982a-46c7-9844-504ab821ef68\",\"http://www.opengis.net/def/serviceType/ogc/wmts\":\"https://map-tiles.princeton.edu/cog/WMTSCapabilities.xml?id=c2a0cc9fe29641e99a6981f71b0d773b\",\"https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames\":\"https://map-tiles.princeton.edu/cog/tiles/WebMercatorQuad/{z}/{x}/{y}@1x.png?id=c2a0cc9fe29641e99a6981f71b0d773b\",\"https://github.com/cogeotiff/cog-spec\":\"https://geodata.lib.princeton.edu/f6/df/29/f6df291284ad483bad2517d4c75273dd/display_raster.tif\"}", + "layer_geom_type_s": "Raster", + "layer_geom_type_sm": [ + "Raster" + ], + "dc_format_s": "GeoTIFF", + "suppressed_b": true, + "dc_source_sm": [ + "princeton-70795b14w" + ], + "call_number_s": "G7823.T5C1 1922 .R6", + "rights_statement_s": "No Known Copyright

Princeton University Library reasonably believes that the Item is not restricted by copyright or related rights, but a conclusive determination could not be made.\n
You are free to use this Item in any way that is permitted by the copyright and related rights legislation that applies to your use.

Princeton University Library claims no copyright or license governing this digital resource. It is provided for free, on a non-commercial, open-access basis, for fair-use academic and research purposes only. Anyone who claims copyright over any part of these resources and feels that they should not be presented in this manner is invited to contact Princeton University Library, who will in turn consider such concerns and make every effort to respond appropriately. We request that users reproducing this resource cite it according to the guidelines described at https://library.princeton.edu/special-collections/policies/forms-citation.\n

" +}