geo_concerns 0.0.4 → 0.0.5

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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +9 -2
  3. data/README.md +13 -0
  4. data/app/controllers/concerns/geo_concerns/file_sets_controller_behavior.rb +15 -0
  5. data/app/controllers/concerns/geo_concerns/geoblacklight_controller_behavior.rb +29 -0
  6. data/app/models/concerns/geo_concerns/ability.rb +12 -0
  7. data/app/models/concerns/geo_concerns/file_set/derivatives.rb +6 -6
  8. data/app/models/concerns/geo_concerns/geo_file_format_behavior.rb +4 -4
  9. data/app/presenters/geo_concerns/raster_work_show_presenter.rb +1 -1
  10. data/app/processors/geo_concerns/processors/mapnik.rb +30 -0
  11. data/app/processors/geo_concerns/processors/vector/base.rb +2 -1
  12. data/app/processors/geo_concerns/processors/vector/info.rb +66 -0
  13. data/app/services/geo_concerns/authority_service.rb +29 -0
  14. data/app/services/geo_concerns/discovery.rb +4 -0
  15. data/app/services/geo_concerns/discovery/abstract_document.rb +36 -0
  16. data/app/services/geo_concerns/discovery/document_builder.rb +69 -0
  17. data/app/services/geo_concerns/discovery/document_builder/basic_metadata_builder.rb +69 -0
  18. data/app/services/geo_concerns/discovery/document_builder/composite_builder.rb +21 -0
  19. data/app/services/geo_concerns/discovery/document_builder/date_builder.rb +38 -0
  20. data/app/services/geo_concerns/discovery/document_builder/document_helper.rb +10 -0
  21. data/app/services/geo_concerns/discovery/document_builder/document_path.rb +82 -0
  22. data/app/services/geo_concerns/discovery/document_builder/layer_info_builder.rb +65 -0
  23. data/app/services/geo_concerns/discovery/document_builder/references_builder.rb +82 -0
  24. data/app/services/geo_concerns/discovery/document_builder/spatial_builder.rb +40 -0
  25. data/app/services/geo_concerns/discovery/geoblacklight_document.rb +122 -0
  26. data/app/services/geo_concerns/image_format_service.rb +6 -0
  27. data/app/services/geo_concerns/metadata_format_service.rb +6 -0
  28. data/app/services/geo_concerns/raster_format_service.rb +6 -0
  29. data/app/services/geo_concerns/vector_format_service.rb +6 -0
  30. data/app/views/curation_concerns/image_works/show.html.erb +1 -1
  31. data/app/views/curation_concerns/raster_works/show.html.erb +1 -1
  32. data/app/views/curation_concerns/vector_works/show.html.erb +1 -1
  33. data/app/views/geo_concerns/_representative_media.html.erb +5 -0
  34. data/app/views/{curation_concerns → geo_concerns}/file_sets/_form.html.erb +4 -4
  35. data/app/views/geo_concerns/file_sets/media_display/_geo.html.erb +16 -0
  36. data/app/views/geo_concerns/file_sets/new.html.erb +12 -0
  37. data/config/routes.rb +18 -0
  38. data/geo_concerns.gemspec +2 -0
  39. data/lib/generators/geo_concerns/install_generator.rb +34 -0
  40. data/lib/generators/geo_concerns/templates/config/authorities/image_formats.yml +2 -0
  41. data/lib/generators/geo_concerns/templates/config/authorities/raster_formats.yml +4 -0
  42. data/lib/generators/geo_concerns/templates/config/authorities/vector_formats.yml +2 -0
  43. data/lib/generators/geo_concerns/templates/config/discovery/geoblacklight_schema.json +168 -0
  44. data/lib/generators/geo_concerns/templates/config/mapnik.yml +24 -0
  45. data/lib/generators/geo_concerns/templates/controllers/curation_concerns/image_works_controller.rb +1 -0
  46. data/lib/generators/geo_concerns/templates/controllers/curation_concerns/raster_works_controller.rb +1 -0
  47. data/lib/generators/geo_concerns/templates/controllers/curation_concerns/vector_works_controller.rb +1 -0
  48. data/lib/geo_concerns/version.rb +1 -1
  49. data/spec/controllers/file_sets_controller_spec.rb +20 -0
  50. data/spec/controllers/vector_works_controller_spec.rb +33 -0
  51. data/spec/processors/geo_concerns/processors/mapnik_spec.rb +48 -0
  52. data/spec/processors/geo_concerns/processors/vector/base_spec.rb +1 -1
  53. data/spec/processors/geo_concerns/processors/vector/info_spec.rb +41 -0
  54. data/spec/services/geo_concerns/discovery/abstract_document_spec.rb +23 -0
  55. data/spec/services/geo_concerns/discovery/document_builder_spec.rb +186 -0
  56. data/spec/services/geo_concerns/discovery/geoblacklight_document_spec.rb +17 -0
  57. data/spec/services/raster_format_service_spec.rb +1 -1
  58. data/template.rb +2 -2
  59. metadata +70 -9
  60. data/app/services/authority_service.rb +0 -23
  61. data/app/services/image_format_service.rb +0 -4
  62. data/app/services/metadata_format_service.rb +0 -4
  63. data/app/services/raster_format_service.rb +0 -4
  64. data/app/services/vector_format_service.rb +0 -4
@@ -0,0 +1,6 @@
1
+ module GeoConcerns
2
+ class ImageFormatService
3
+ include GeoConcerns::AuthorityService
4
+ self.authority = Qa::Authorities::Local.subauthority_for('image_formats')
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module GeoConcerns
2
+ class MetadataFormatService
3
+ include GeoConcerns::AuthorityService
4
+ self.authority = Qa::Authorities::Local.subauthority_for('metadata_formats')
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module GeoConcerns
2
+ class RasterFormatService
3
+ include GeoConcerns::AuthorityService
4
+ self.authority = Qa::Authorities::Local.subauthority_for('raster_formats')
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module GeoConcerns
2
+ class VectorFormatService
3
+ include GeoConcerns::AuthorityService
4
+ self.authority = Qa::Authorities::Local.subauthority_for('vector_formats')
5
+ end
6
+ end
@@ -6,7 +6,7 @@
6
6
  <% collector = can?(:collect, @presenter.id) %>
7
7
  <% editor = can?(:edit, @presenter.id) %>
8
8
 
9
- <%= render 'representative_media', presenter: @presenter %>
9
+ <%= render 'geo_concerns/representative_media', presenter: @presenter %>
10
10
  <%= render 'geo_concerns/attributes', presenter: @presenter %>
11
11
 
12
12
  <%= render 'geo_concerns/related_geo_files', presenter: @presenter %>
@@ -6,7 +6,7 @@
6
6
  <% collector = can?(:collect, @presenter.id) %>
7
7
  <% editor = can?(:edit, @presenter.id) %>
8
8
 
9
- <%= render 'representative_media', presenter: @presenter %>
9
+ <%= render 'geo_concerns/representative_media', presenter: @presenter %>
10
10
  <%= render 'geo_concerns/attributes', presenter: @presenter %>
11
11
 
12
12
  <%= render 'geo_concerns/related_geo_files', presenter: @presenter %>
@@ -6,7 +6,7 @@
6
6
  <% collector = can?(:collect, @presenter.id) %>
7
7
  <% editor = can?(:edit, @presenter.id) %>
8
8
 
9
- <%= render 'representative_media', presenter: @presenter %>
9
+ <%= render 'geo_concerns/representative_media', presenter: @presenter %>
10
10
  <%= render 'geo_concerns/attributes', presenter: @presenter %>
11
11
 
12
12
  <%= render 'geo_concerns/related_geo_files', presenter: @presenter %>
@@ -0,0 +1,5 @@
1
+ <% if presenter.representative_id.present? %>
2
+ <%= render partial: 'geo_concerns/file_sets/media_display/geo', locals: { file_set: presenter.representative_presenter } %>
3
+ <% else %>
4
+ <%= image_tag 'nope.png', class: "canonical-image" %>
5
+ <% end %>
@@ -15,13 +15,13 @@
15
15
  Attach Your File
16
16
  </legend>
17
17
  <% select_options = if params['type'] == 'metadata'
18
- MetadataFormatService.select_options
18
+ GeoConcerns::MetadataFormatService.select_options
19
19
  elsif params['type'] == 'image-data'
20
- ImageFormatService.select_options
20
+ GeoConcerns::ImageFormatService.select_options
21
21
  elsif params['type'] == 'raster-data'
22
- RasterFormatService.select_options
22
+ GeoConcerns::RasterFormatService.select_options
23
23
  elsif params['type'] == 'vector-data'
24
- VectorFormatService.select_options
24
+ GeoConcerns::VectorFormatService.select_options
25
25
  end %>
26
26
  <% if select_options %>
27
27
  <%= f.input(:geo_mime_type, as: :select, collection: select_options,
@@ -0,0 +1,16 @@
1
+ <% if CurationConcerns.config.display_media_download_link %>
2
+ <%= link_to main_app.download_path(file_set), target: "_new", title: "Download the data" do %>
3
+ <figure>
4
+ <%= image_tag main_app.download_path(file_set, file: 'thumbnail'),
5
+ class: "img-responsive",
6
+ alt: "Download the data for #{file_set.to_s}" %>
7
+ <figcaption>Download the data</figcaption>
8
+ </figure>
9
+ <% end %>
10
+ <% else %>
11
+ <figure>
12
+ <%= image_tag main_app.download_path(file_set, file: 'thumbnail'),
13
+ class: "img-responsive",
14
+ alt: "Thumbnail of #{file_set.to_s}" %>
15
+ </figure>
16
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% provide :page_title, curation_concern_page_title(curation_concern) %>
2
+ <% provide :page_header do %>
3
+ <h2>Describe Your <%= curation_concern.human_readable_type %></h2>
4
+ <p>
5
+ The more descriptive information you provide the better we can serve your needs.
6
+ </p>
7
+ <p>
8
+ Please consider releasing your <%= curation_concern.human_readable_type.downcase %> as an <span class="label label-success">Open Access</span> work.
9
+ </p>
10
+ <% end %>
11
+
12
+ <%= render 'geo_concerns/file_sets/form' %>
@@ -2,5 +2,23 @@ GeoConcerns::Engine.routes.draw do
2
2
  namespace :curation_concerns, path: :concern do
3
3
  resources :raster_works, only: [:new, :create], path: 'container/:parent_id/raster_works', as: 'member_raster_work'
4
4
  resources :vector_works, only: [:new, :create], path: 'container/:parent_id/vector_works', as: 'member_vector_work'
5
+
6
+ resources :image_works, only: [] do
7
+ member do
8
+ get :geoblacklight, defaults: { format: :json }
9
+ end
10
+ end
11
+
12
+ resources :raster_works, only: [] do
13
+ member do
14
+ get :geoblacklight, defaults: { format: :json }
15
+ end
16
+ end
17
+
18
+ resources :vector_works, only: [] do
19
+ member do
20
+ get :geoblacklight, defaults: { format: :json }
21
+ end
22
+ end
5
23
  end
6
24
  end
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'curation_concerns', '1.0.0.beta3'
22
22
  spec.add_dependency 'leaflet-rails', '~> 0.7'
23
+ spec.add_dependency 'simple_mapnik', '0.0.9'
24
+ spec.add_dependency 'json-schema'
23
25
 
24
26
  spec.add_development_dependency 'sqlite3'
25
27
  spec.add_development_dependency 'rspec-rails'
@@ -9,6 +9,30 @@ module GeoConcerns
9
9
  inject_into_file 'config/routes.rb', after: /curation_concerns_embargo_management\s*\n/ do
10
10
  " mount GeoConcerns::Engine => '/'\n"\
11
11
  end
12
+
13
+ inject_into_file 'config/routes.rb', after: /root 'welcome#index'\s*\n/ do
14
+ " default_url_options Rails.application.config.action_mailer.default_url_options\n"\
15
+ end
16
+ end
17
+
18
+ def install_default_url
19
+ inject_into_file 'config/environments/development.rb', after: /Rails.application.configure do\s*\n/ do
20
+ " config.action_mailer.default_url_options = { host: 'localhost:3000' }\n"\
21
+ end
22
+
23
+ inject_into_file 'config/environments/test.rb', after: /Rails.application.configure do\s*\n/ do
24
+ " config.action_mailer.default_url_options = { host: 'localhost:3000' }\n"\
25
+ end
26
+
27
+ inject_into_file 'config/environments/production.rb', after: /Rails.application.configure do\s*\n/ do
28
+ " config.action_mailer.default_url_options = { host: 'geo.example.com', protocol: 'https' }\n"\
29
+ end
30
+ end
31
+
32
+ def install_ability
33
+ inject_into_file 'app/models/ability.rb', after: "include CurationConcerns::Ability\n" do
34
+ " include GeoConcerns::Ability\n"
35
+ end
12
36
  end
13
37
 
14
38
  def register_work
@@ -50,6 +74,16 @@ module GeoConcerns
50
74
  end
51
75
  end
52
76
 
77
+ def install_mapnik_config
78
+ file_path = 'config/mapnik.yml'
79
+ copy_file file_path, file_path
80
+ end
81
+
82
+ def install_discovery_config
83
+ file_path = "config/discovery/geoblacklight_schema.json"
84
+ copy_file file_path, file_path
85
+ end
86
+
53
87
  def override_characterize_job
54
88
  file_path = 'app/jobs/characterize_job.rb'
55
89
  copy_file 'jobs/characterize_job.rb', file_path
@@ -1,5 +1,7 @@
1
1
  terms:
2
2
  - id: image/jpeg
3
3
  term: JPEG
4
+ code: JPEG
4
5
  - id: image/tiff
5
6
  term: TIFF
7
+ code: TIFF
@@ -1,9 +1,13 @@
1
1
  terms:
2
2
  - id: image/tiff; gdal-format=GTiff
3
3
  term: GeoTIFF
4
+ code: GTiff
4
5
  - id: text/plain; gdal-format=AAIGrid
5
6
  term: Arc/Info ASCII Grid
7
+ code: AAIGrid
6
8
  - id: application/octet-stream; gdal-format=AIG
7
9
  term: Arc/Info Binary Grid
10
+ code: AIG
8
11
  - id: text/plain; gdal-format=USGSDEM
9
12
  term: USGS ASCII DEM
13
+ code: USGSDEM
@@ -1,5 +1,7 @@
1
1
  terms:
2
2
  - id: application/zip; ogr-format="ESRI Shapefile"
3
3
  term: ESRI Shapefile
4
+ code: ESRI Shapefile
4
5
  - id: application/vnd.geo+json
5
6
  term: GeoJSON
7
+ code: GeoJSON
@@ -0,0 +1,168 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "description": "Schema for GeoBlacklight as implemented for Solr 4.10+. See http://journal.code4lib.org/articles/9710 for more details. Note that the Solr schema uses dynamic typing based on the suffix of the field name. For example, _s denotes a string where _sm denotes a multi-valued string (array of strings).",
4
+ "id": "http://geoblacklight.org/schema",
5
+ "title": "GeoBlacklight Schema",
6
+ "required": [
7
+ "uuid",
8
+ "dc_identifier_s",
9
+ "dc_title_s",
10
+ "dc_description_s",
11
+ "dc_rights_s",
12
+ "dct_provenance_s",
13
+ "georss_box_s",
14
+ "layer_id_s",
15
+ "layer_geom_type_s",
16
+ "layer_modified_dt",
17
+ "layer_slug_s",
18
+ "solr_geom",
19
+ "solr_year_i"
20
+ ],
21
+ "type": "object",
22
+ "properties": {
23
+ "uuid": {
24
+ "type": "string",
25
+ "description": "Unique identifier for layer that is globally unique."
26
+
27
+ },
28
+ "dc_identifier_s": {
29
+ "type": "string",
30
+ "description": "Unique identifier for layer. May be same as UUID but may be an alternate identifier."
31
+ },
32
+ "dc_title_s": {
33
+ "type": "string",
34
+ "description": "Title for the layer."
35
+
36
+ },
37
+ "dc_description_s": {
38
+ "type": "string",
39
+ "description": "Description for the layer."
40
+
41
+ },
42
+ "dc_rights_s": {
43
+ "type": "string",
44
+ "enum": ["Public", "Restricted"],
45
+ "description": "Access rights for the layer."
46
+
47
+ },
48
+ "dct_provenance_s": {
49
+ "type": "string",
50
+ "description": "Institution who holds the layer."
51
+
52
+ },
53
+ "dct_references_s": {
54
+ "type": "string",
55
+ "description": "JSON hash for external resources, where each key is a URI for the protocol or format and the value is the URL to the resource."
56
+
57
+ },
58
+ "georss_box_s": {
59
+ "type": "string",
60
+ "description": "Bounding box as maximum values for S W N E. Example: 12.6 -119.4 19.9 84.8."
61
+
62
+ },
63
+ "layer_id_s": {
64
+ "type": "string",
65
+ "description": "The complete identifier for the layer via WMS/WFS/WCS protocol. Example: druid:vr593vj7147."
66
+
67
+ },
68
+ "layer_geom_type_s": {
69
+ "type": "string",
70
+ "enum": ["Point", "Line", "Polygon", "Raster", "Scanned Map", "Mixed"],
71
+ "description": "Geometry type for layer data, using controlled vocabulary."
72
+ },
73
+ "layer_modified_dt": {
74
+ "type": "string",
75
+ "format": "date-time",
76
+ "description": "Last modification date for the metadata record, using XML Schema dateTime format (YYYY-MM-DDThh:mm:ssZ)."
77
+ },
78
+ "layer_slug_s": {
79
+ "type": "string",
80
+ "description": "Unique identifier visible to the user, used for Permalinks. Example: stanford-vr593vj7147."
81
+
82
+ },
83
+ "solr_geom": {
84
+ "type": "string",
85
+ "pattern": "ENVELOPE(.*,.*,.*,.*)",
86
+ "description": "Derived from georss_polygon_s or georss_box_s. Shape of the layer as a ENVELOPE WKT using W E N S. Example: ENVELOPE(76.76, 84.76, 19.91, 12.62). Note that this field is indexed as a Solr spatial (RPT) field."
87
+
88
+ },
89
+ "solr_year_i": {
90
+ "type": "integer",
91
+ "description": "Derived from dct_temporal_sm. Year for which layer is valid and only a single value. Example: 1989. Note that this field is indexed as a Solr numeric field."
92
+
93
+ },
94
+ "dc_creator_sm": {
95
+ "type": "array",
96
+ "items": {
97
+ "type": "string"
98
+ },
99
+ "description": "Author(s). Example: George Washington, Thomas Jefferson."
100
+
101
+ },
102
+ "dc_format_s": {
103
+ "type": "string",
104
+ "enum": ["Shapefile", "GeoTIFF", "ArcGRID", "GeoJSON", "AAIGrid", "USGSDEM", "JPEG", "TIFF"],
105
+ "description": "File format for the layer, using a controlled vocabulary."
106
+
107
+ },
108
+ "dc_language_s": {
109
+ "type": "string",
110
+ "description": "Language for the layer. Example: English."
111
+
112
+ },
113
+ "dc_publisher_s": {
114
+ "type": "string",
115
+ "description": "Publisher. Example: ML InfoMap."
116
+
117
+ },
118
+ "dc_subject_sm": {
119
+ "type": "array",
120
+ "items": {
121
+ "type": "string"
122
+ },
123
+ "description": "Subjects, preferrably in a controlled vocabulary. Examples: Census, Human settlements."
124
+
125
+ },
126
+ "dc_type_s": {
127
+ "type": "string",
128
+ "enum": ["Dataset", "Image", "PhysicalObject"],
129
+ "description": "Resource type, using DCMI Type Vocabulary."
130
+
131
+ },
132
+ "dct_spatial_sm": {
133
+ "type": "array",
134
+ "items": {
135
+ "type": "string"
136
+ },
137
+ "description": "Spatial coverage and place names, preferrably in a controlled vocabulary. Example: 'Paris, France'."
138
+
139
+ },
140
+ "dct_temporal_sm": {
141
+ "type": "array",
142
+ "items": {
143
+ "type": "string"
144
+ },
145
+ "description": "Temporal coverage, typically years or dates. Example: 1989, circa 2010, 2007-2009. Note that this field is not in a specific date format."
146
+
147
+ },
148
+ "dct_issued_dt": {
149
+ "type": "string",
150
+ "format": "date-time",
151
+ "description": "Issued date for the layer, using XML Schema dateTime format (YYYY-MM-DDThh:mm:ssZ)."
152
+
153
+ },
154
+ "dct_isPartOf_sm": {
155
+ "type": "array",
156
+ "items": {
157
+ "type": "string"
158
+ },
159
+ "description": "Holding dataset for the layer, such as the name of a collection. Example: Village Maps of India."
160
+
161
+ },
162
+ "georss_point_s": {
163
+ "type": "string",
164
+ "description": "Point representation for layer as y, x - i.e., centroid. Example: 12.6 -119.4."
165
+
166
+ }
167
+ }
168
+ }
@@ -0,0 +1,24 @@
1
+ # Basic Mapnik style settings. Values are explained here:
2
+ # https://github.com/mapnik/mapnik/wiki/XMLConfigReference
3
+
4
+ # Use '#ffffff' for a solid white background.
5
+ # Add two zeros to a six digit hex color code
6
+ # for a png (does not work with jpeg) image
7
+ # with a transparent background.
8
+ background_color: '#ffffff00'
9
+
10
+ # Polygon feature settings
11
+ polygon_fill_color: '#fffff0'
12
+
13
+ # Line feature settings
14
+ line_stroke_color: '#483d8b'
15
+ line_stroke_width: '0.3'
16
+
17
+ # Point feature settings
18
+ marker_fill: '#0000ff'
19
+ marker_width: '5'
20
+ marker_height: '5'
21
+ marker_stroke_color: '#483d8b'
22
+ marker_stroke_width: '0.2'
23
+ marker_placement: 'point'
24
+ marker_allow_overlap-overlap: 'true'
@@ -1,5 +1,6 @@
1
1
  class CurationConcerns::ImageWorksController < ApplicationController
2
2
  include CurationConcerns::CurationConcernController
3
3
  include GeoConcerns::ImageWorksControllerBehavior
4
+ include GeoConcerns::GeoblacklightControllerBehavior
4
5
  self.curation_concern_type = ImageWork
5
6
  end
@@ -2,5 +2,6 @@ class CurationConcerns::RasterWorksController < ApplicationController
2
2
  include CurationConcerns::CurationConcernController
3
3
  include CurationConcerns::ParentContainer
4
4
  include GeoConcerns::RasterWorksControllerBehavior
5
+ include GeoConcerns::GeoblacklightControllerBehavior
5
6
  self.curation_concern_type = RasterWork
6
7
  end
@@ -2,5 +2,6 @@ class CurationConcerns::VectorWorksController < ApplicationController
2
2
  include CurationConcerns::CurationConcernController
3
3
  include CurationConcerns::ParentContainer
4
4
  include GeoConcerns::VectorWorksControllerBehavior
5
+ include GeoConcerns::GeoblacklightControllerBehavior
5
6
  self.curation_concern_type = VectorWork
6
7
  end