blacklight_allmaps 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/README.md +109 -0
  4. data/Rakefile +98 -0
  5. data/app/assets/config/blacklight_allmaps_manifest.js +2 -0
  6. data/app/assets/images/blacklight/allmaps/allmaps-logo.svg +39 -0
  7. data/app/assets/images/blacklight/allmaps/blacklight-logo.png +0 -0
  8. data/app/assets/images/blacklight/allmaps/geoblacklight-logo.png +0 -0
  9. data/app/assets/images/blacklight/allmaps/logo.svg +39 -0
  10. data/app/assets/stylesheets/blacklight_allmaps/application.css +15 -0
  11. data/app/controllers/blacklight/allmaps/application_controller.rb +6 -0
  12. data/app/helpers/blacklight/allmaps/application_helper.rb +17 -0
  13. data/app/javascripts/map_controller.js +39 -0
  14. data/app/jobs/blacklight/allmaps/application_job.rb +6 -0
  15. data/app/jobs/blacklight/allmaps/store_sidecar_annotation.rb +39 -0
  16. data/app/mailers/blacklight/allmaps/application_mailer.rb +8 -0
  17. data/app/models/blacklight/allmaps/application_record.rb +7 -0
  18. data/app/models/blacklight/allmaps/sidecar.rb +23 -0
  19. data/app/models/concerns/blacklight/allmaps/solr_document.rb +14 -0
  20. data/app/views/allmaps/show/_blacklight.html.erb +213 -0
  21. data/app/views/allmaps/show/_geoblacklight.html.erb +47 -0
  22. data/app/views/allmaps/sidebar/_allmaps.html.erb +55 -0
  23. data/app/views/catalog/_show_default_viewer_container.html.erb +52 -0
  24. data/app/views/catalog/_show_main_content.html.erb +58 -0
  25. data/app/views/catalog/_show_sidebar.html.erb +5 -0
  26. data/app/views/catalog/_show_sidebar_blacklight.html.erb +10 -0
  27. data/app/views/catalog/_show_sidebar_geoblacklight.html.erb +20 -0
  28. data/config/routes.rb +2 -0
  29. data/db/migrate/20240307155110_create_solr_document_sidecars.rb +15 -0
  30. data/lib/blacklight/allmaps/engine.rb +6 -0
  31. data/lib/blacklight/allmaps/rake_task.rb +7 -0
  32. data/lib/blacklight/allmaps/tasks/index.rake +77 -0
  33. data/lib/blacklight/allmaps/tasks/sidecars.rake +50 -0
  34. data/lib/blacklight/allmaps/version.rb +5 -0
  35. data/lib/blacklight/allmaps.rb +7 -0
  36. data/lib/generators/blacklight/allmaps/config_generator.rb +54 -0
  37. data/lib/generators/blacklight/allmaps/install_generator.rb +27 -0
  38. data/lib/generators/blacklight/allmaps/models_generator.rb +46 -0
  39. data/lib/generators/blacklight/allmaps/templates/manifest.js +5 -0
  40. metadata +229 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4303c5d59179db61e16867a11549e7c4ef6f642b6732619c3a78967b0d089655
4
+ data.tar.gz: 5d294dc06d1b846b631d43c7af5ff30b93a79a27fff0b20ce8281d13a3a1d032
5
+ SHA512:
6
+ metadata.gz: e3afe56c0665e20d189436302c1a37609a73d4b07d46c390a70e392f1bc7f2625e509f2e53ce35b338a272163836e343226778a3ffc71d973d3e4f67b8449ed7
7
+ data.tar.gz: ed11adf2ed33e2abf96747df563e91a85b2dacacb62fe71aa90e504d52eebfbb52c51b7abf189e4c2c52793fd3b581d3e503b2dba1094ff6f16f60bfe967aac7
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2024 Leventhal Map & Education Center
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # Blacklight::Allmaps
2
+
3
+ ![CI](https://github.com/bplmaps/blacklight-allmaps/actions/workflows/ci.yml/badge.svg)
4
+
5
+ <img alt="Allmaps Logo" src="app/assets/images/blacklight/allmaps/allmaps-logo.svg" height="40px"/> <img alt="Blacklight Logo" src="app/assets/images/blacklight/allmaps/blacklight-logo.png" height="40px"/> <img alt="GeoBlacklight Logo" src="app/assets/images/blacklight/allmaps/geoblacklight-logo.png" height="40px"/>
6
+
7
+ A [Blacklight](https://projectblacklight.org/) / [GeoBlacklight](https://geoblacklight.org/) plugin for including [Allmaps](https://allmaps.org/) georeferenced maps inside your application.
8
+
9
+ ![Screen shot](doc/screenshot_layers.png)
10
+
11
+ ## Dependencies
12
+
13
+ * Blacklight v7 (v8 forthcoming)
14
+ * GeoBlacklight v4.1 (v4.2+ forthcoming)
15
+
16
+ ## Installation
17
+ Add this line to your application's Gemfile:
18
+
19
+ ```ruby
20
+ gem "blacklight_allmaps"
21
+ ```
22
+
23
+ And then execute:
24
+ ```bash
25
+ bundle
26
+ ```
27
+
28
+ Run the install generator:
29
+
30
+ ```bash
31
+ # For Blacklight...
32
+ LIGHT=blacklight bundle exec rake blacklight:allmaps:install
33
+
34
+ # For GeoBlacklight
35
+ LIGHT=geoblacklight bundle exec rake blacklight:allmaps:install
36
+ ```
37
+
38
+ ## Rake Tasks
39
+
40
+ ### Harvest Allmaps IIIF Annotation Data
41
+
42
+ We harvest and store Allmaps IIIF Annotation data locally — see the Blacklight::Allmaps::Sidecar section below.
43
+
44
+ The rake task here kicks off a background harvest process that walks through your Solr index documents (using CursorMark) and checks each document for `georeferenceable?` - the presence of a IIIF Manifest. If the document is indeed georeferenceable? (true) we ping the Allmaps API to determine if the map/item has already been georeferenced in Allmaps.
45
+
46
+ ```bash
47
+ rake blacklight_allmaps:sidecars:harvest:allmaps
48
+ ```
49
+
50
+ ### Populate the Georeferenced Facet
51
+
52
+ We expose the georeferenced items in the Blacklight user interface via a Georeferenced facet:
53
+
54
+ ![Screen shot](doc/georeferenced_facet.png)
55
+
56
+ #### Blacklight
57
+
58
+ @TODO
59
+
60
+ #### GeoBlacklight
61
+
62
+ ```bash
63
+ LIGHT=geoblacklight rake blacklight_allmaps:index:gbl_georeferenced_facet
64
+ ```
65
+
66
+ ## ActiveRecord Objects — Blacklight::Allmaps::Sidecar
67
+
68
+ Blacklight::Allmaps adopts the SolrDocumentSidecar "sidecar" pattern from [Spotlight](https://github.com/projectblacklight/spotlight), adding an ActiveRecord object to the database for each SolrDocument object in the index.
69
+
70
+ The Blacklight::Allmaps::Sidecar object contains:
71
+
72
+ * id: primary key
73
+ * solr_document_id: solr document primary key
74
+ * document_type SolrDocument
75
+ * manifest_id: IIIF Manifest ID
76
+ * annotated: boolean (true|false)
77
+ * allmaps_id: Allmaps ID
78
+ * iiif_manifest: Copy of the IIIF Manifest
79
+ * allmaps_annotation: Copy of the Allmaps IIIF Annotation
80
+ * solr_version: solr document version number
81
+ * created_at: created at
82
+ * updated_at: updated at
83
+
84
+ ```ruby
85
+ document.sidecar =>
86
+ #<Blacklight::Allmaps::Sidecar:0x0000000141991a50
87
+ id: 1,
88
+ solr_document_id: "harvard-g4124-m2-1855-m3",
89
+ document_type: "SolrDocument",
90
+ manifest_id: "https://ark.digitalcommonwealth.org/ark:/50959/4m90f9436/manifest",
91
+ annotated: true,
92
+ allmaps_id: "c2f9fc8490151424",
93
+ iiif_manifest:
94
+ "{\"@context\":\"http://iiif.io/api/presentation/2/context.json\",\"@id\":\"https://ark.digitalcommonwealth.org/ark:/50959/4m90f9436/manifest\",\"@type\":\"sc:Manifest\",\"label\":\"Map of Madison and the Four Lake Country, Dane Co. Wis\" ...
95
+ allmaps_annotation:
96
+ "{\n \"type\": \"AnnotationPage\",\n \"@context\": \"http://www.w3.org/ns/anno.jsonld\",\n \"items\": [\n {\n \"id\": \"https://annotations.allmaps.org/maps/3740c2822f443181\",\n \"type\": \"Annotation\",\n \"@context\": [\n \"http://iiif.io/api/extension/georef/1/context.json\" ...
97
+ solr_version: 1794605692067250176,
98
+ created_at: Tue, 26 Mar 2024 15:47:49.422826000 UTC +00:00,
99
+ updated_at: Tue, 26 Mar 2024 16:39:42.427682000 UTC +00:00>
100
+ ```
101
+
102
+ ## Contributing
103
+
104
+ For Developer documentation see [doc/developer.md](./doc/development.md)
105
+
106
+ Additional Contribution directions to come...
107
+
108
+ ## License
109
+ The gem is available as open source under the terms of the [Apache 2.0 License](https://opensource.org/license/apache-2-0).
data/Rakefile ADDED
@@ -0,0 +1,98 @@
1
+ require "rake"
2
+ require "bundler"
3
+ Bundler::GemHelper.install_tasks
4
+
5
+ require "bundler/gem_tasks"
6
+
7
+ require "rspec/core/rake_task"
8
+ require "engine_cart/rake_task"
9
+ require "solr_wrapper"
10
+ require "blacklight/allmaps/rake_task"
11
+
12
+ task default: :ci
13
+
14
+ desc "Run specs"
15
+ RSpec::Core::RakeTask.new
16
+
17
+ task ci: ["engine_cart:generate"] do
18
+ system "rake blacklight_allmaps:seed"
19
+ Rake::Task["spec"].invoke
20
+ end
21
+
22
+ namespace :blacklight_allmaps do
23
+ desc "Put sample data into solr"
24
+ task seed: ["engine_cart:generate"] do
25
+ within_test_app do
26
+ ENV["RAILS_ENV"] ||= "test"
27
+
28
+ # Seed Blacklight data
29
+ # system "rake blacklight:index:seed"
30
+
31
+ # Seed GeoBlacklight data
32
+ # system "rake geoblacklight:index:seed[:remote]"
33
+
34
+ if ENV["LIGHT"] == "geoblacklight"
35
+ # Seed Blacklight Allmaps GeoBlacklight data
36
+ system "rake blacklight_allmaps:index:gbl_fixtures"
37
+ else
38
+ # Seed Blacklight Allmaps Blacklight data
39
+ system "rake blacklight_allmaps:index:bl_fixtures"
40
+ end
41
+
42
+ # Harvest Allmaps data
43
+ system "rake blacklight_allmaps:sidecars:harvest:allmaps"
44
+ end
45
+ end
46
+
47
+ desc "Run Solr and Blacklight for interactive development"
48
+ task :server, [:rails_server_args] do |_t, args|
49
+ if File.exist? EngineCart.destination
50
+ within_test_app do
51
+ system "bundle update"
52
+ end
53
+ else
54
+ Rake::Task["engine_cart:generate"].invoke
55
+ end
56
+
57
+ SolrWrapper.wrap(port: "8983") do |solr|
58
+ solr.with_collection(name: "blacklight-core", dir: File.join(__dir__, "solr", ENV["LIGHT"], "conf")) do
59
+ Rake::Task["blacklight_allmaps:seed"].invoke
60
+
61
+ within_test_app do
62
+ system "bundle exec rails s #{args[:rails_server_args]}"
63
+ end
64
+ end
65
+ end
66
+ end
67
+
68
+ desc "Run Solr and seed with sample data"
69
+ task :solr do |_t, args|
70
+ if File.exist? EngineCart.destination
71
+ within_test_app do
72
+ system "bundle update"
73
+ end
74
+ else
75
+ Rake::Task["engine_cart:generate"].invoke
76
+ end
77
+
78
+ SolrWrapper.wrap(port: "8983") do |solr|
79
+ solr.with_collection(
80
+ name: "blacklight-core",
81
+ dir: File.join(File.expand_path(".", File.dirname(__FILE__)), "solr", ENV["LIGHT"], "conf")
82
+ ) do
83
+ system "rake blacklight_allmaps:seed"
84
+
85
+ within_test_app do
86
+ puts "\nSolr server running: http://localhost:#{solr.port}/solr/#/blacklight-core"
87
+ puts "\n^C to stop"
88
+ puts " "
89
+ begin
90
+ sleep
91
+ rescue Interrupt
92
+ puts "Shutting down..."
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,2 @@
1
+ //= link_directory ../stylesheets/blacklight_allmaps .css
2
+ //= link blacklight/allmaps/allmaps-logo.svg
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 25.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 1440 1440" style="enable-background:new 0 0 1440 1440;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#FFFFFF;}
7
+ .st1{enable-background:new ;}
8
+ </style>
9
+ <g>
10
+ <g>
11
+ <polygon class="st0" points="720,703.8 164.8,1031.6 720,1359.5 1275.2,1031.6 "/>
12
+ <path d="M720,625.3L31.8,1031.6L720,1438l688.2-406.4L720,625.3z M720,703.8l555.2,327.8L720,1359.5l-555.2-327.8L720,703.8z"/>
13
+ </g>
14
+ <g>
15
+ <polygon class="st0" points="720,548 164.8,875.8 720,1203.7 1275.2,875.8 "/>
16
+ <path d="M720,469.5L31.8,875.8L720,1282.2l688.2-406.4L720,469.5z M720,548l555.2,327.8L720,1203.7L164.8,875.8L720,548z"/>
17
+ </g>
18
+ <g>
19
+ <polygon class="st0" points="720,392.2 164.8,720 720,1047.9 1275.2,720 "/>
20
+ <path d="M720,313.7L31.8,720L720,1126.4L1408.2,720L720,313.7z M720,392.2L1275.2,720L720,1047.9L164.8,720L720,392.2z"/>
21
+ </g>
22
+ <g>
23
+ <polygon class="st0" points="720,236.3 164.8,564.2 720,892 1275.2,564.2 "/>
24
+ <path d="M720,157.8L31.8,564.2L720,970.5l688.2-406.3L720,157.8z M720,236.3l555.2,327.8L720,892L164.8,564.2L720,236.3z"/>
25
+ </g>
26
+ <g>
27
+ <polygon class="st0" points="720,80.5 164.8,408.4 720,736.2 1275.2,408.4 "/>
28
+ <path d="M720,2L31.8,408.4L720,814.7l688.2-406.4L720,2z M720,80.5l555.2,327.8L720,736.2L164.8,408.4L720,80.5z"/>
29
+ </g>
30
+ <g>
31
+ <g class="st1">
32
+ <g>
33
+ <path d="M610.5,404l216.7-69.9l-121.3,125L610.5,404 M986,288.6l-80.6-46.5L297.4,420.8l93.5,54L513.6,435l138.1,79.8
34
+ l-68.6,71.1l93.5,54L986,288.6"/>
35
+ </g>
36
+ </g>
37
+ </g>
38
+ </g>
39
+ </svg>
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 25.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 1440 1440" style="enable-background:new 0 0 1440 1440;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#FFFFFF;}
7
+ .st1{enable-background:new ;}
8
+ </style>
9
+ <g>
10
+ <g>
11
+ <polygon class="st0" points="720,703.8 164.8,1031.6 720,1359.5 1275.2,1031.6 "/>
12
+ <path d="M720,625.3L31.8,1031.6L720,1438l688.2-406.4L720,625.3z M720,703.8l555.2,327.8L720,1359.5l-555.2-327.8L720,703.8z"/>
13
+ </g>
14
+ <g>
15
+ <polygon class="st0" points="720,548 164.8,875.8 720,1203.7 1275.2,875.8 "/>
16
+ <path d="M720,469.5L31.8,875.8L720,1282.2l688.2-406.4L720,469.5z M720,548l555.2,327.8L720,1203.7L164.8,875.8L720,548z"/>
17
+ </g>
18
+ <g>
19
+ <polygon class="st0" points="720,392.2 164.8,720 720,1047.9 1275.2,720 "/>
20
+ <path d="M720,313.7L31.8,720L720,1126.4L1408.2,720L720,313.7z M720,392.2L1275.2,720L720,1047.9L164.8,720L720,392.2z"/>
21
+ </g>
22
+ <g>
23
+ <polygon class="st0" points="720,236.3 164.8,564.2 720,892 1275.2,564.2 "/>
24
+ <path d="M720,157.8L31.8,564.2L720,970.5l688.2-406.3L720,157.8z M720,236.3l555.2,327.8L720,892L164.8,564.2L720,236.3z"/>
25
+ </g>
26
+ <g>
27
+ <polygon class="st0" points="720,80.5 164.8,408.4 720,736.2 1275.2,408.4 "/>
28
+ <path d="M720,2L31.8,408.4L720,814.7l688.2-406.4L720,2z M720,80.5l555.2,327.8L720,736.2L164.8,408.4L720,80.5z"/>
29
+ </g>
30
+ <g>
31
+ <g class="st1">
32
+ <g>
33
+ <path d="M610.5,404l216.7-69.9l-121.3,125L610.5,404 M986,288.6l-80.6-46.5L297.4,420.8l93.5,54L513.6,435l138.1,79.8
34
+ l-68.6,71.1l93.5,54L986,288.6"/>
35
+ </g>
36
+ </g>
37
+ </g>
38
+ </g>
39
+ </svg>
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,6 @@
1
+ module Blacklight
2
+ module Allmaps
3
+ class ApplicationController < ActionController::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,17 @@
1
+ module Blacklight
2
+ module Allmaps
3
+ module ApplicationHelper
4
+ # @TODO: Document how to customize this helper
5
+ def georeferenceable?(document = @document)
6
+ # A IIIF Manifest is required for georeferencing
7
+ # However, additional checks might be warranted
8
+
9
+ # GeoBlacklight
10
+ document.iiif_manifest_url ? true : false
11
+ rescue
12
+ # Blacklight
13
+ document["iiif_manifest_url_ssi"] ? true : false
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,39 @@
1
+ // map_controller.js
2
+ import { Controller } from "@hotwired/stimulus"
3
+ import L from 'leaflet'
4
+ import { WarpedMapLayer } from '@allmaps/leaflet'
5
+
6
+ export default class extends Controller {
7
+ static targets = [ "placeholder" ]
8
+
9
+ connect(){
10
+
11
+ console.log("Map Controller Connected");
12
+ console.log(this.element);
13
+
14
+ // Grok: Allmaps annotation for center and zoom level?
15
+ this.map = L.map('allmaps-map', {
16
+ center: [43.063518, -89.3906863],
17
+ zoom: 10,
18
+ zoomAnimationThreshold: 1
19
+ })
20
+
21
+ L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
22
+ maxZoom: 18,
23
+ attribution: '&copy; <a href=https://www.openstreetmap.org/copyright>OpenStreetMap</a> contributors'
24
+ }).addTo(this.map)
25
+
26
+ const annotationUrl = 'https://annotations.allmaps.org/manifests/c2f9fc8490151424'
27
+ const warpedMapLayer = new WarpedMapLayer(annotationUrl)
28
+ .addTo(this.map)
29
+
30
+ const bounds = warpedMapLayer.getBounds();
31
+ this.map.fitBounds(bounds, {
32
+ padding
33
+ });
34
+ }
35
+
36
+ disconnect(){
37
+ this.map.remove()
38
+ }
39
+ }
@@ -0,0 +1,6 @@
1
+ module Blacklight
2
+ module Allmaps
3
+ class ApplicationJob < ActiveJob::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,39 @@
1
+ require "httparty"
2
+
3
+ module Blacklight
4
+ module Allmaps
5
+ class StoreSidecarAnnotation < ApplicationJob
6
+ queue_as :default
7
+
8
+ def perform(document_id)
9
+ solr_document = ::SolrDocument.find(document_id)
10
+ sidecar = solr_document.sidecar_allmaps
11
+
12
+ if ApplicationController.helpers.georeferenceable?(solr_document)
13
+ # Store the IIIF Manifest
14
+ response = HTTParty.get(solr_document.iiif_manifest_url, follow_redirects: true)
15
+ if response.code == 200
16
+ # @TODO: validate the response body is a valid IIIF Manifest
17
+ sidecar.iiif_manifest = response.body
18
+ sidecar.manifest_id = JSON.parse(sidecar.iiif_manifest)["@id"]
19
+ end
20
+
21
+ # Store the Allmaps Annotation
22
+ # Example:
23
+ # https://annotations.allmaps.org/?url=https://www.digitalcommonwealth.org/search/commonwealth:4m90f9436/manifest
24
+ # => https://annotations.allmaps.org/manifests/c2f9fc8490151424
25
+ annotation_url_by_iiif_uri = "https://annotations.allmaps.org/?url=#{solr_document.iiif_manifest_url}"
26
+
27
+ response = HTTParty.get(annotation_url_by_iiif_uri, follow_redirects: true)
28
+ if response.code == 200
29
+ # @TODO: validate the response body is a valid Allmaps Annotation
30
+ sidecar.allmaps_annotation = response.body
31
+ sidecar.annotated = true
32
+ end
33
+
34
+ sidecar.save
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,8 @@
1
+ module Blacklight
2
+ module Allmaps
3
+ class ApplicationMailer < ActionMailer::Base
4
+ default from: "from@example.com"
5
+ layout "mailer"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Blacklight
2
+ module Allmaps
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ self.abstract_class = true
5
+ end
6
+ end
7
+ end