geo_works 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +34 -0
- data/.csslintrc +2 -0
- data/.engine_cart.yml +1 -0
- data/.eslintignore +1 -0
- data/.eslintrc +8 -0
- data/.fcrepo_wrapper +3 -0
- data/.gitignore +14 -0
- data/.rubocop.yml +105 -0
- data/.solr_wrapper +7 -0
- data/.travis.yml +33 -0
- data/CONTRIBUTING.md +159 -0
- data/Gemfile +48 -0
- data/LICENSE +202 -0
- data/README.md +143 -0
- data/Rakefile +25 -0
- data/app/assets/images/geo_works/.keep +0 -0
- data/app/assets/images/geo_works/images/geocoder.png +0 -0
- data/app/assets/images/geo_works/images/move-handle.png +0 -0
- data/app/assets/images/geo_works/images/resize-handle.png +0 -0
- data/app/assets/images/geo_works/images/throbber.gif +0 -0
- data/app/assets/javascripts/geo_works/Control.Geocoder.js +1056 -0
- data/app/assets/javascripts/geo_works/application.js +4 -0
- data/app/assets/javascripts/geo_works/bounding_box_selector.js +107 -0
- data/app/assets/javascripts/geo_works/es6-modules.js +7 -0
- data/app/assets/javascripts/geo_works/geo_works_boot.es6 +8 -0
- data/app/assets/javascripts/geo_works/leaflet-boundingbox.js +467 -0
- data/app/assets/javascripts/geo_works/relationships.js +3 -0
- data/app/assets/javascripts/geo_works/relationships/child_works.es6 +20 -0
- data/app/assets/javascripts/geo_works/relationships/parent_works.es6 +20 -0
- data/app/assets/javascripts/geo_works/relationships/related_works.es6 +187 -0
- data/app/assets/stylesheets/geo_works/Control.Geocoder.scss +104 -0
- data/app/assets/stylesheets/geo_works/application.css +18 -0
- data/app/assets/stylesheets/geo_works/bounding_box.scss +15 -0
- data/app/assets/stylesheets/geo_works/leaflet-boundingbox.scss +17 -0
- data/app/assets/stylesheets/geo_works/related_works.scss +29 -0
- data/app/assets/stylesheets/geo_works/thumbnails.scss +13 -0
- data/app/controllers/concerns/geo_works/events_behavior.rb +29 -0
- data/app/controllers/concerns/geo_works/file_sets_controller_behavior.rb +31 -0
- data/app/controllers/concerns/geo_works/geoblacklight_controller_behavior.rb +29 -0
- data/app/controllers/concerns/geo_works/image_works_controller_behavior.rb +9 -0
- data/app/controllers/concerns/geo_works/raster_works_controller_behavior.rb +9 -0
- data/app/controllers/concerns/geo_works/vector_works_controller_behavior.rb +9 -0
- data/app/forms/geo_works/basic_geo_metadata_form.rb +9 -0
- data/app/forms/geo_works/external_metadata_file_form.rb +8 -0
- data/app/forms/geo_works/georeferenced_form.rb +9 -0
- data/app/forms/hyrax/image_work_form.rb +7 -0
- data/app/forms/hyrax/raster_work_form.rb +8 -0
- data/app/forms/hyrax/vector_work_form.rb +8 -0
- data/app/helpers/geo_works/application_helper.rb +4 -0
- data/app/helpers/geo_works/bounding_box_helper.rb +73 -0
- data/app/helpers/geo_works/file_set_actions_helper.rb +31 -0
- data/app/helpers/geo_works/geo_works_helper.rb +22 -0
- data/app/helpers/geo_works/populate_metadata_helper.rb +7 -0
- data/app/jobs/geoblacklight_job.rb +10 -0
- data/app/jobs/geoserver_delivery_job.rb +36 -0
- data/app/models/concerns/geo_works/ability.rb +12 -0
- data/app/models/concerns/geo_works/basic_geo_metadata.rb +21 -0
- data/app/models/concerns/geo_works/external_metadata_file_behavior.rb +31 -0
- data/app/models/concerns/geo_works/extractors/fgdc_helper.rb +9 -0
- data/app/models/concerns/geo_works/extractors/fgdc_metadata_extractor.rb +114 -0
- data/app/models/concerns/geo_works/extractors/iso19139_helper.rb +50 -0
- data/app/models/concerns/geo_works/extractors/mods_helper.rb +15 -0
- data/app/models/concerns/geo_works/file_set_metadata.rb +15 -0
- data/app/models/concerns/geo_works/file_set_presenter_behavior.rb +7 -0
- data/app/models/concerns/geo_works/geo_file_format_behavior.rb +37 -0
- data/app/models/concerns/geo_works/geo_file_set_behavior.rb +11 -0
- data/app/models/concerns/geo_works/georeferenced_behavior.rb +18 -0
- data/app/models/concerns/geo_works/image_file_behavior.rb +14 -0
- data/app/models/concerns/geo_works/image_work_behavior.rb +69 -0
- data/app/models/concerns/geo_works/metadata_extraction_helper.rb +27 -0
- data/app/models/concerns/geo_works/raster_file_behavior.rb +14 -0
- data/app/models/concerns/geo_works/raster_work_behavior.rb +82 -0
- data/app/models/concerns/geo_works/solr_document_behavior.rb +46 -0
- data/app/models/concerns/geo_works/vector_file_behavior.rb +14 -0
- data/app/models/concerns/geo_works/vector_work_behavior.rb +78 -0
- data/app/presenters/geo_works/geo_works_show_presenter.rb +48 -0
- data/app/presenters/geo_works/image_work_show_presenter.rb +5 -0
- data/app/presenters/geo_works/raster_work_show_presenter.rb +5 -0
- data/app/presenters/geo_works/vector_work_show_presenter.rb +5 -0
- data/app/processors/geo_works/geoblacklight_event_processor.rb +29 -0
- data/app/processors/geo_works/geoblacklight_event_processor/delete_processor.rb +13 -0
- data/app/processors/geo_works/geoblacklight_event_processor/processor.rb +28 -0
- data/app/processors/geo_works/geoblacklight_event_processor/unknown_event.rb +15 -0
- data/app/processors/geo_works/geoblacklight_event_processor/update_processor.rb +15 -0
- data/app/processors/geo_works/processors/base_geo_processor.rb +81 -0
- data/app/processors/geo_works/processors/gdal.rb +49 -0
- data/app/processors/geo_works/processors/image.rb +66 -0
- data/app/processors/geo_works/processors/ogr.rb +19 -0
- data/app/processors/geo_works/processors/raster.rb +26 -0
- data/app/processors/geo_works/processors/raster/aig.rb +40 -0
- data/app/processors/geo_works/processors/raster/base.rb +41 -0
- data/app/processors/geo_works/processors/raster/dem.rb +29 -0
- data/app/processors/geo_works/processors/raster/info.rb +52 -0
- data/app/processors/geo_works/processors/rendering.rb +79 -0
- data/app/processors/geo_works/processors/vector.rb +24 -0
- data/app/processors/geo_works/processors/vector/base.rb +44 -0
- data/app/processors/geo_works/processors/vector/info.rb +84 -0
- data/app/processors/geo_works/processors/vector/shapefile.rb +20 -0
- data/app/processors/geo_works/processors/zip.rb +29 -0
- data/app/renderers/geo_works/coverage_renderer.rb +39 -0
- data/app/runners/geo_works/runners/raster_derivatives.rb +9 -0
- data/app/runners/geo_works/runners/vector_derivatives.rb +9 -0
- data/app/schemas/geo_works/basic_geo_metadata_optional.rb +40 -0
- data/app/schemas/geo_works/basic_geo_metadata_required.rb +25 -0
- data/app/schemas/geo_works/file_set_metadata_required.rb +5 -0
- data/app/services/geo_works/authority_service.rb +29 -0
- data/app/services/geo_works/delivery/geoserver.rb +118 -0
- data/app/services/geo_works/delivery_service.rb +11 -0
- data/app/services/geo_works/discovery.rb +4 -0
- data/app/services/geo_works/discovery/abstract_document.rb +37 -0
- data/app/services/geo_works/discovery/document_builder.rb +46 -0
- data/app/services/geo_works/discovery/document_builder/basic_metadata_builder.rb +71 -0
- data/app/services/geo_works/discovery/document_builder/composite_builder.rb +21 -0
- data/app/services/geo_works/discovery/document_builder/date_builder.rb +53 -0
- data/app/services/geo_works/discovery/document_builder/document_helper.rb +10 -0
- data/app/services/geo_works/discovery/document_builder/document_path.rb +91 -0
- data/app/services/geo_works/discovery/document_builder/layer_info_builder.rb +65 -0
- data/app/services/geo_works/discovery/document_builder/references_builder.rb +101 -0
- data/app/services/geo_works/discovery/document_builder/slug_builder.rb +24 -0
- data/app/services/geo_works/discovery/document_builder/spatial_builder.rb +37 -0
- data/app/services/geo_works/discovery/document_builder/wxs.rb +76 -0
- data/app/services/geo_works/discovery/geoblacklight_document.rb +152 -0
- data/app/services/geo_works/events_generator.rb +24 -0
- data/app/services/geo_works/events_generator/composite_generator.rb +18 -0
- data/app/services/geo_works/events_generator/geoblacklight_event_generator.rb +53 -0
- data/app/services/geo_works/events_generator/geoserver_event_generator.rb +33 -0
- data/app/services/geo_works/file_set_derivatives_service.rb +67 -0
- data/app/services/geo_works/image_format_service.rb +6 -0
- data/app/services/geo_works/metadata_format_service.rb +6 -0
- data/app/services/geo_works/raster_format_service.rb +6 -0
- data/app/services/geo_works/vector_format_service.rb +6 -0
- data/app/services/hyrax/curation_concern.rb +18 -0
- data/app/values/geo_works/coverage.rb +36 -0
- data/app/values/geo_works/time_period.rb +30 -0
- data/app/views/geo_works/_attribute_rows.html.erb +4 -0
- data/app/views/geo_works/_form_progress.html.erb +50 -0
- data/app/views/geo_works/_guts4form.html.erb +47 -0
- data/app/views/geo_works/_member.html.erb +11 -0
- data/app/views/geo_works/_metadata.html.erb +13 -0
- data/app/views/geo_works/_relationships.html.erb +12 -0
- data/app/views/geo_works/_representative_media.html.erb +5 -0
- data/app/views/geo_works/file_sets/_form.html.erb +48 -0
- data/app/views/geo_works/file_sets/actions/_default_actions.html.erb +16 -0
- data/app/views/geo_works/file_sets/actions/_image_actions.html.erb +22 -0
- data/app/views/geo_works/file_sets/actions/_metadata_actions.html.erb +16 -0
- data/app/views/geo_works/file_sets/actions/_raster_actions.html.erb +25 -0
- data/app/views/geo_works/file_sets/actions/_vector_actions.html.erb +25 -0
- data/app/views/geo_works/file_sets/media_display/_geo.html.erb +16 -0
- data/app/views/geo_works/file_sets/new.html.erb +12 -0
- data/app/views/geo_works/related/_child_member.html.erb +13 -0
- data/app/views/geo_works/related/_child_works.html.erb +24 -0
- data/app/views/geo_works/related/_external_metadata_file_member.html.erb +11 -0
- data/app/views/geo_works/related/_external_metadata_files.html.erb +24 -0
- data/app/views/geo_works/related/_geo_files.html.erb +24 -0
- data/app/views/geo_works/related/_new_child_member.html.erb +22 -0
- data/app/views/geo_works/related/_new_parent_member.html.erb +13 -0
- data/app/views/geo_works/related/_parent_member.html.erb +13 -0
- data/app/views/geo_works/related/_parent_works.html.erb +22 -0
- data/app/views/hyrax/image_works/_file_actions.html.erb +8 -0
- data/app/views/hyrax/image_works/_form.html.erb +16 -0
- data/app/views/hyrax/image_works/_image_actions.html.erb +11 -0
- data/app/views/hyrax/image_works/_image_work.html.erb +2 -0
- data/app/views/hyrax/image_works/_show_actions.html.erb +22 -0
- data/app/views/hyrax/image_works/show.html.erb +31 -0
- data/app/views/hyrax/raster_works/_file_actions.html.erb +8 -0
- data/app/views/hyrax/raster_works/_form.html.erb +16 -0
- data/app/views/hyrax/raster_works/_raster_actions.html.erb +11 -0
- data/app/views/hyrax/raster_works/_raster_work.html.erb +2 -0
- data/app/views/hyrax/raster_works/_show_actions.html.erb +22 -0
- data/app/views/hyrax/raster_works/show.html.erb +31 -0
- data/app/views/hyrax/vector_works/_file_actions.html.erb +8 -0
- data/app/views/hyrax/vector_works/_form.html.erb +16 -0
- data/app/views/hyrax/vector_works/_show_actions.html.erb +22 -0
- data/app/views/hyrax/vector_works/_vector_actions.html.erb +11 -0
- data/app/views/hyrax/vector_works/_vector_work.html.erb +2 -0
- data/app/views/hyrax/vector_works/show.html.erb +31 -0
- data/app/views/records/edit_fields/_coverage.html.erb +3 -0
- data/app/views/records/edit_fields/_should_populate_metadata.html.erb +10 -0
- data/app/vocabs/geo_works/geo_terms.rb +12 -0
- data/config/discovery/geoblacklight-schema.json +214 -0
- data/config/fcrepo_wrapper_test.yml +3 -0
- data/config/geoblacklight.yml +12 -0
- data/config/geoserver.yml +27 -0
- data/config/initializers/geo_server.rb +17 -0
- data/config/initializers/geoblacklight_config.rb +18 -0
- data/config/initializers/simpler_tiles.rb +65 -0
- data/config/locales/image_work.en.yml +8 -0
- data/config/locales/raster_work.en.yml +8 -0
- data/config/locales/vector_work.en.yml +8 -0
- data/config/routes.rb +24 -0
- data/config/simpler_tiles.yml +24 -0
- data/config/solr_wrapper_test.yml +7 -0
- data/docker-compose-full.yml +30 -0
- data/docker-compose.yml +9 -0
- data/geo_works.gemspec +44 -0
- data/lib/generators/geo_works/install_generator.rb +152 -0
- data/lib/generators/geo_works/templates/actors/hyrax/actors/image_work_actor.rb +6 -0
- data/lib/generators/geo_works/templates/actors/hyrax/actors/raster_work_actor.rb +6 -0
- data/lib/generators/geo_works/templates/actors/hyrax/actors/vector_work_actor.rb +6 -0
- data/lib/generators/geo_works/templates/config/authorities/image_formats.yml +7 -0
- data/lib/generators/geo_works/templates/config/authorities/metadata_formats.yml +7 -0
- data/lib/generators/geo_works/templates/config/authorities/raster_formats.yml +13 -0
- data/lib/generators/geo_works/templates/config/authorities/vector_formats.yml +7 -0
- data/lib/generators/geo_works/templates/config/initializers/hyrax_derivative_path_monkey_patch.rb +18 -0
- data/lib/generators/geo_works/templates/controllers/hyrax/file_sets_controller.rb +7 -0
- data/lib/generators/geo_works/templates/controllers/hyrax/image_works_controller.rb +7 -0
- data/lib/generators/geo_works/templates/controllers/hyrax/raster_works_controller.rb +8 -0
- data/lib/generators/geo_works/templates/controllers/hyrax/vector_works_controller.rb +8 -0
- data/lib/generators/geo_works/templates/geo_works.js +1 -0
- data/lib/generators/geo_works/templates/geo_works.scss +3 -0
- data/lib/generators/geo_works/templates/models/file_set.rb +4 -0
- data/lib/generators/geo_works/templates/models/image_work.rb +7 -0
- data/lib/generators/geo_works/templates/models/raster_work.rb +8 -0
- data/lib/generators/geo_works/templates/models/vector_work.rb +8 -0
- data/lib/generators/geo_works/templates/presenters/file_set_presenter.rb +3 -0
- data/lib/generators/geo_works/templates/spec/actor_spec.rb.erb +9 -0
- data/lib/generators/geo_works/templates/spec/controller_spec.rb.erb +9 -0
- data/lib/generators/geo_works/templates/spec/model_spec.rb.erb +9 -0
- data/lib/geo_works.rb +9 -0
- data/lib/geo_works/engine.rb +4 -0
- data/lib/geo_works/version.rb +3 -0
- data/lib/tasks/geo_works_tasks.rake +4 -0
- data/run-docker.sh +16 -0
- data/solr/config/_rest_managed.json +3 -0
- data/solr/config/admin-extra.html +31 -0
- data/solr/config/elevate.xml +36 -0
- data/solr/config/mapping-ISOLatin1Accent.txt +246 -0
- data/solr/config/protwords.txt +21 -0
- data/solr/config/schema.xml +372 -0
- data/solr/config/scripts.conf +24 -0
- data/solr/config/solrconfig.xml +321 -0
- data/solr/config/spellings.txt +2 -0
- data/solr/config/stopwords.txt +58 -0
- data/solr/config/stopwords_en.txt +58 -0
- data/solr/config/synonyms.txt +31 -0
- data/solr/config/xslt/example.xsl +132 -0
- data/solr/config/xslt/example_atom.xsl +67 -0
- data/solr/config/xslt/example_rss.xsl +66 -0
- data/solr/config/xslt/luke.xsl +337 -0
- data/spec/controllers/file_sets_controller_spec.rb +70 -0
- data/spec/controllers/image_works_controller_spec.rb +40 -0
- data/spec/controllers/raster_works_controller_spec.rb +36 -0
- data/spec/controllers/vector_works_controller_spec.rb +69 -0
- data/spec/factories/collections.rb +17 -0
- data/spec/factories/external_metadata_files.rb +20 -0
- data/spec/factories/image_files.rb +32 -0
- data/spec/factories/image_works.rb +69 -0
- data/spec/factories/permission_templates.rb +41 -0
- data/spec/factories/raster_files.rb +35 -0
- data/spec/factories/raster_works.rb +88 -0
- data/spec/factories/sipity_entities.rb +7 -0
- data/spec/factories/users.rb +26 -0
- data/spec/factories/vector_files.rb +31 -0
- data/spec/factories/vector_works.rb +84 -0
- data/spec/factories/workflow_states.rb +6 -0
- data/spec/factories/workflows.rb +6 -0
- data/spec/features/create_image_work_spec.rb +34 -0
- data/spec/features/create_raster_work_spec.rb +35 -0
- data/spec/features/create_vector_work_spec.rb +34 -0
- data/spec/features/image_work_show_spec.rb +62 -0
- data/spec/features/raster_work_show_spec.rb +62 -0
- data/spec/features/vector_work_show_spec.rb +61 -0
- data/spec/forms/geo_works/basic_geo_metadata_form_spec.rb +31 -0
- data/spec/forms/geo_works/external_metadata_file_form_spec.rb +30 -0
- data/spec/forms/geo_works/georeferenced_form_spec.rb +33 -0
- data/spec/forms/hyrax/image_work_form_spec.rb +11 -0
- data/spec/forms/hyrax/raster_work_form_spec.rb +17 -0
- data/spec/forms/hyrax/vector_work_form_spec.rb +17 -0
- data/spec/helpers/bounding_box_helper_spec.rb +39 -0
- data/spec/helpers/geo_works/file_set_actions_helper_spec.rb +70 -0
- data/spec/helpers/geo_works/populate_metadata_helper_spec.rb +31 -0
- data/spec/helpers/geo_works_helper_spec.rb +30 -0
- data/spec/jobs/geoblacklight_job_spec.rb +18 -0
- data/spec/jobs/geoserver_delivery_job_spec.rb +45 -0
- data/spec/models/concerns/basic_geo_metadata_spec.rb +21 -0
- data/spec/models/concerns/geo_works/file_set/derivatives_spec.rb +102 -0
- data/spec/models/concerns/geo_works/file_set/geo_file_format_behavior_spec.rb +56 -0
- data/spec/models/external_metadata_file_spec.rb +118 -0
- data/spec/models/file_set_spec.rb +9 -0
- data/spec/models/image_file_spec.rb +48 -0
- data/spec/models/image_work_spec.rb +71 -0
- data/spec/models/raster_file_spec.rb +48 -0
- data/spec/models/raster_work_spec.rb +122 -0
- data/spec/models/solr_document_spec.rb +41 -0
- data/spec/models/vector_file_spec.rb +48 -0
- data/spec/models/vector_work_spec.rb +109 -0
- data/spec/presenters/file_set_presenter_spec.rb +13 -0
- data/spec/presenters/geo_works_show_presenter_spec.rb +46 -0
- data/spec/presenters/image_work_show_presenter_spec.rb +51 -0
- data/spec/presenters/raster_work_show_presenter_spec.rb +74 -0
- data/spec/presenters/vector_work_show_presenter_spec.rb +41 -0
- data/spec/processors/geo_works/geoblacklight_event_processor_spec.rb +80 -0
- data/spec/processors/geo_works/processors/base_geo_processor_spec.rb +115 -0
- data/spec/processors/geo_works/processors/gdal_spec.rb +59 -0
- data/spec/processors/geo_works/processors/image_spec.rb +64 -0
- data/spec/processors/geo_works/processors/ogr_spec.rb +36 -0
- data/spec/processors/geo_works/processors/raster/aig_spec.rb +35 -0
- data/spec/processors/geo_works/processors/raster/base_spec.rb +54 -0
- data/spec/processors/geo_works/processors/raster/dem_spec.rb +30 -0
- data/spec/processors/geo_works/processors/raster/info_spec.rb +35 -0
- data/spec/processors/geo_works/processors/raster/processor_spec.rb +39 -0
- data/spec/processors/geo_works/processors/rendering_spec.rb +64 -0
- data/spec/processors/geo_works/processors/vector/base_spec.rb +54 -0
- data/spec/processors/geo_works/processors/vector/info_spec.rb +50 -0
- data/spec/processors/geo_works/processors/vector/processor_spec.rb +28 -0
- data/spec/processors/geo_works/processors/vector/shapefile_spec.rb +17 -0
- data/spec/processors/geo_works/processors/zip_spec.rb +39 -0
- data/spec/renderers/geo_works/coverage_renderer_spec.rb +21 -0
- data/spec/services/geo_works/delivery/geoserver_spec.rb +117 -0
- data/spec/services/geo_works/delivery_service_spec.rb +24 -0
- data/spec/services/geo_works/discovery/abstract_document_spec.rb +23 -0
- data/spec/services/geo_works/discovery/document_builder/basic_metadata_builder_spec.rb +35 -0
- data/spec/services/geo_works/discovery/document_builder/wxs_spec.rb +71 -0
- data/spec/services/geo_works/discovery/document_builder_spec.rb +220 -0
- data/spec/services/geo_works/discovery/geoblacklight_document_spec.rb +20 -0
- data/spec/services/geo_works/event_generator_spec.rb +18 -0
- data/spec/services/geo_works/events_generator/geoblacklight_event_generator_spec.rb +84 -0
- data/spec/services/geo_works/events_generator/geoserver_event_generator_spec.rb +22 -0
- data/spec/services/geo_works/raster_format_service_spec.rb +13 -0
- data/spec/services/hyrax/derivative_path_spec.rb +26 -0
- data/spec/spec_helper.rb +77 -0
- data/spec/support/backport_test.rb +14 -0
- data/spec/support/controllers/engine_helpers.rb +7 -0
- data/spec/support/database_cleaner.rb +18 -0
- data/spec/support/factory_girl.rb +3 -0
- data/spec/support/features.rb +14 -0
- data/spec/support/features/session_helpers.rb +40 -0
- data/spec/support/fixture_reader.rb +7 -0
- data/spec/support/helpers/controller_level_helpers.rb +27 -0
- data/spec/support/views/test_view_helpers.rb +10 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +24 -0
- data/spec/values/coverage_spec.rb +40 -0
- data/tasks/geo_works.rake +39 -0
- data/template.rb +10 -0
- metadata +789 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GeoWorks::Processors::Rendering do
|
4
|
+
before do
|
5
|
+
class TestProcessor
|
6
|
+
include GeoWorks::Processors::Rendering
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
after { Object.send(:remove_const, :TestProcessor) }
|
11
|
+
|
12
|
+
subject { TestProcessor.new }
|
13
|
+
|
14
|
+
let(:output_file) { 'output/geo.png' }
|
15
|
+
let(:file_name) { 'files' }
|
16
|
+
let(:options) { { output_size: '150 200' } }
|
17
|
+
let(:bounds) { { north: 40.0, east: -74.0, south: 40.0, west: -74.0 } }
|
18
|
+
let(:info) { instance_double(GeoWorks::Processors::Vector::Info, name: 'test', bounds: bounds) }
|
19
|
+
let(:config) {
|
20
|
+
{
|
21
|
+
'stroke' => '#483d8b',
|
22
|
+
'line-cap' => 'square',
|
23
|
+
'line-join' => 'miter',
|
24
|
+
'weight' => '0.3',
|
25
|
+
'fill' => '#e4e3ea',
|
26
|
+
'radius' => '2'
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
before do
|
31
|
+
allow(GeoWorks::Processors::Vector::Info).to receive(:new).and_return(info)
|
32
|
+
allow(SimplerTiles.config).to receive(:to_h).and_return(config)
|
33
|
+
allow(SimplerTiles.config).to receive(:bg_color).and_return('#ffffff00')
|
34
|
+
allow(Dir).to receive(:glob).and_return(['test.shp'])
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#vector_thumbnail' do
|
38
|
+
it 'saves a vector thumbnail using simpler tiles' do
|
39
|
+
expect(File).to receive(:open).with(output_file, 'wb')
|
40
|
+
subject.class.vector_thumbnail(file_name, output_file, options)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe '#simple_tiles_map' do
|
45
|
+
subject { described_class.simple_tiles_map(file_name, options) }
|
46
|
+
|
47
|
+
it 'has a background color' do
|
48
|
+
expect(subject.bgcolor).to eq('#ffffff00')
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'has a valid bounds property' do
|
52
|
+
expect(subject.bounds.to_wkt).to match(/-74.000000 40.000000/)
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'has the correct width and height' do
|
56
|
+
expect(subject.width).to eq(150)
|
57
|
+
expect(subject.height).to eq(200)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'has a WGS 84 projection' do
|
61
|
+
expect(subject.srs).to eq('+proj=longlat +datum=WGS84 +no_defs ')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GeoWorks::Processors::Vector::Base do
|
4
|
+
let(:output_file) { 'output/geo.png' }
|
5
|
+
let(:file_name) { 'files/geo.zip' }
|
6
|
+
let(:label) {}
|
7
|
+
let(:options) { { output_size: '150 150', label: label } }
|
8
|
+
|
9
|
+
subject { described_class.new(file_name, {}) }
|
10
|
+
|
11
|
+
describe '#encode' do
|
12
|
+
context 'when output label is thumbnail' do
|
13
|
+
let(:label) { :thumbnail }
|
14
|
+
it 'calls the encode_vector method' do
|
15
|
+
expect(subject.class).to receive(:encode_vector)
|
16
|
+
subject.class.encode(file_name, options, output_file)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when output label is display_vector' do
|
21
|
+
let(:label) { :display_vector }
|
22
|
+
it 'calls the reproject_vector method' do
|
23
|
+
expect(subject.class).to receive(:reproject_vector)
|
24
|
+
subject.class.encode(file_name, options, output_file)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#encode_queue' do
|
30
|
+
it 'returns an array of command name symbols' do
|
31
|
+
expect(subject.class.encode_queue).to include :vector_thumbnail
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#reproject_queue' do
|
36
|
+
it 'returns an array of command name symbols' do
|
37
|
+
expect(subject.class.reproject_queue).to include :zip
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#encode_vector' do
|
42
|
+
it 'runs commands to encode the raster thumbnail' do
|
43
|
+
expect(subject.class).to receive(:run_commands)
|
44
|
+
subject.class.encode_vector(file_name, options, output_file)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe '#reproject_vector' do
|
49
|
+
it 'runs commands to reproject the raster' do
|
50
|
+
expect(subject.class).to receive(:run_commands)
|
51
|
+
subject.class.reproject_vector(file_name, options, output_file)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
describe GeoWorks::Processors::Vector::Info do
|
5
|
+
let(:path) { 'test.tif' }
|
6
|
+
let(:info_doc) { read_test_data_fixture('ogrinfo.txt') }
|
7
|
+
|
8
|
+
subject { described_class.new(path) }
|
9
|
+
|
10
|
+
context 'when initializing a new info class' do
|
11
|
+
it 'shells out to ogrinfo and sets the doc variable to the output string' do
|
12
|
+
expect(Open3).to receive(:capture3).with("ogrinfo -ro -so -al #{path}")
|
13
|
+
.and_return([info_doc, '', ''])
|
14
|
+
expect(subject.doc).to eq(info_doc)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'after intialization' do
|
19
|
+
before do
|
20
|
+
allow(subject).to receive(:doc).and_return(info_doc)
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#name' do
|
24
|
+
it 'returns with min and max values' do
|
25
|
+
expect(subject.name).to eq('tufts-cambridgegrid100-04')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#driver' do
|
30
|
+
it 'returns with min and max values' do
|
31
|
+
expect(subject.driver).to eq('ESRI Shapefile')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#geom' do
|
36
|
+
it 'returns raster size' do
|
37
|
+
expect(subject.geom).to eq('Polygon')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#bounds' do
|
42
|
+
it 'returns bounds hash' do
|
43
|
+
expect(subject.bounds).to eq(north: 42.408249,
|
44
|
+
east: -71.052853,
|
45
|
+
south: 42.347654,
|
46
|
+
west: -71.163867)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GeoWorks::Processors::Vector::Processor do
|
4
|
+
subject { described_class.new(file_name, directives) }
|
5
|
+
let(:processor) { double }
|
6
|
+
|
7
|
+
context 'when a shapefile format type is passed' do
|
8
|
+
let(:file_name) { 'files/shapefile.zip' }
|
9
|
+
let(:directives) { { input_format: 'application/zip; ogr-format="ESRI Shapefile"' } }
|
10
|
+
|
11
|
+
it 'calls the shapefile processor' do
|
12
|
+
expect(GeoWorks::Processors::Vector::Shapefile).to receive(:new).and_return(processor)
|
13
|
+
expect(processor).to receive(:process)
|
14
|
+
subject.process
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'when a geojson format type is passed' do
|
19
|
+
let(:file_name) { 'files/geo.json' }
|
20
|
+
let(:directives) { { input_format: 'application/vnd.geo+json' } }
|
21
|
+
|
22
|
+
it 'calls the base vector processor' do
|
23
|
+
expect(GeoWorks::Processors::Vector::Base).to receive(:new).and_return(processor)
|
24
|
+
expect(processor).to receive(:process)
|
25
|
+
subject.process
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GeoWorks::Processors::Vector::Shapefile do
|
4
|
+
let(:output_file) { 'output/geo.png' }
|
5
|
+
let(:file_name) { 'files/Shapefile.zip' }
|
6
|
+
let(:options) { { output_size: '150 150', label: :thumbnail } }
|
7
|
+
|
8
|
+
subject { described_class.new(file_name, {}) }
|
9
|
+
|
10
|
+
describe '#encode' do
|
11
|
+
it 'wraps encode vector method in an unzip block' do
|
12
|
+
allow(subject.class).to receive(:unzip).and_yield(file_name)
|
13
|
+
expect(subject.class).to receive(:encode_vector)
|
14
|
+
subject.class.encode(file_name, options, output_file)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GeoWorks::Processors::Zip do
|
4
|
+
before do
|
5
|
+
class TestProcessor
|
6
|
+
include Hydra::Derivatives::Processors::ShellBasedProcessor
|
7
|
+
include GeoWorks::Processors::Zip
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
after { Object.send(:remove_const, :TestProcessor) }
|
12
|
+
|
13
|
+
subject { TestProcessor.new }
|
14
|
+
let(:path) { 'files/test.zip' }
|
15
|
+
let(:output_file) { 'output/test.tif' }
|
16
|
+
|
17
|
+
describe '#unzip' do
|
18
|
+
let(:command) { 'unzip -qq -j -d "output/test_out" "files/test.zip"' }
|
19
|
+
|
20
|
+
context 'given an input and output path' do
|
21
|
+
it 'runs an unzip command and yields to a block' do
|
22
|
+
arg = ''
|
23
|
+
expect(subject.class).to receive(:execute).with(command)
|
24
|
+
expect(FileUtils).to receive(:rm_rf)
|
25
|
+
subject.class.unzip(path, output_file) { |a| arg = a }
|
26
|
+
expect(arg).to eq('output/test_out')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#zip' do
|
32
|
+
let(:command) { 'zip -j -qq -r "output/test.tif" "files/test.zip"' }
|
33
|
+
|
34
|
+
it 'runs a zip command ' do
|
35
|
+
expect(subject.class).to receive(:execute).with(command)
|
36
|
+
subject.class.zip(path, output_file)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GeoWorks::CoverageRenderer do
|
4
|
+
let(:coverage) { 'northlimit=2.7; eastlimit=4.0; southlimit=1.3; westlimit=2.9; units=degrees; projection=EPSG:4326' }
|
5
|
+
let(:renderer) { described_class.new(:coverage, [coverage]) }
|
6
|
+
subject { renderer.render }
|
7
|
+
|
8
|
+
it 'includes the coverage string' do
|
9
|
+
expect(subject).to include coverage
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'includes a map' do
|
13
|
+
expect(subject).to include "<div id='bbox'"
|
14
|
+
expect(subject).to include "boundingBoxSelector"
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'includes a toggle button' do
|
18
|
+
expect(subject).to include "<a data-toggle='collapse' data-parent='accordion' href='#bbox'"
|
19
|
+
expect(subject).to include "Toggle Map"
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GeoWorks::Delivery::Geoserver do
|
4
|
+
let(:id) { 'abc123' }
|
5
|
+
let(:file_set) { instance_double("FileSet") }
|
6
|
+
let(:visibility) { 'open' }
|
7
|
+
let(:path) { 'spec/fixtures/files/tufts-cambridgegrid100-04.zip' }
|
8
|
+
|
9
|
+
subject { described_class.new file_set, path }
|
10
|
+
|
11
|
+
before do
|
12
|
+
allow(file_set).to receive(:visibility).and_return(visibility)
|
13
|
+
allow(file_set).to receive(:id).and_return(id)
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'with an authenticated file set visibility' do
|
17
|
+
let(:visibility) { 'authenticated' }
|
18
|
+
it 'does not raise error' do
|
19
|
+
expect { subject }.not_to raise_error
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'with a private file set visibility' do
|
24
|
+
let(:visibility) { 'private' }
|
25
|
+
it 'raises an error' do
|
26
|
+
expect { subject }.to raise_error(ArgumentError, /FileSet visibility/)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#publish' do
|
31
|
+
context 'when type is vector' do
|
32
|
+
let(:path) { 'spec/fixtures/files/tufts-cambridgegrid100-04.zip' }
|
33
|
+
it 'routes to publish_vector' do
|
34
|
+
expect(subject).to receive(:publish_vector)
|
35
|
+
subject.publish
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'logs a message if there is an error' do
|
39
|
+
expect(subject).to receive(:publish_vector).and_raise(StandardError, 'error')
|
40
|
+
expect(Rails.logger).to receive(:error).with("GeoServer delivery job failed with: error")
|
41
|
+
subject.publish
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when type is raster' do
|
46
|
+
let(:path) { 'spec/fixtures/files/S_566_1914_clip.tif' }
|
47
|
+
it 'routes to publish_raster' do
|
48
|
+
expect(subject).to receive(:publish_raster)
|
49
|
+
subject.publish
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'when type is not a raster or vector' do
|
54
|
+
let(:path) { 'not-a-zip-or-tif' }
|
55
|
+
it 'raises an error' do
|
56
|
+
expect(Rails.logger).to receive(:error).with(/Not a ZIPed Shapefile/)
|
57
|
+
subject.publish
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe '#publish_vector' do
|
63
|
+
context 'with a path to a zipped shapefile' do
|
64
|
+
let(:shapefile_path) { ['/spec/fixtures/files/shapefile/tufts-cambridgegrid100-04/tufts-cambridgegrid100-04.shp'] }
|
65
|
+
let(:url) { "file:////opt/geoserver/data_dir/derivatives#{shapefile_path.first}" }
|
66
|
+
let(:ws) { double }
|
67
|
+
let(:ds) { double }
|
68
|
+
|
69
|
+
before do
|
70
|
+
allow(Dir).to receive(:glob).and_return(shapefile_path)
|
71
|
+
allow(subject).to receive(:system).and_return(true)
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'dispatches to RGeoServer' do
|
75
|
+
expect(RGeoServer::Workspace).to receive(:new).with(subject.catalog, hash_including(name: 'public')).and_return(ws)
|
76
|
+
expect(ws).to receive(:'new?').and_return(true)
|
77
|
+
expect(ws).to receive(:save)
|
78
|
+
expect(RGeoServer::DataStore).to receive(:new).with(subject.catalog, hash_including(workspace: ws, name: id)).and_return(ds)
|
79
|
+
expect(ds).to receive(:upload_external).with(url, hash_including(publish: true))
|
80
|
+
subject.send(:publish_vector)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe '#publish_raster' do
|
86
|
+
let(:path) { 'spec/fixtures/files/S_566_1914_clip.tif' }
|
87
|
+
let(:url) { 'file:////opt/geoserver/data_dir/derivativesspec/fixtures/files/S_566_1914_clip.tif' }
|
88
|
+
let(:ws) { double }
|
89
|
+
let(:cs) { double }
|
90
|
+
let(:cov) { double }
|
91
|
+
|
92
|
+
it 'dispatches to RGeoServer' do
|
93
|
+
expect(RGeoServer::Workspace).to receive(:new).with(subject.catalog, hash_including(name: 'public')).and_return(ws).twice
|
94
|
+
expect(ws).to receive(:'new?').and_return(true).twice
|
95
|
+
expect(ws).to receive(:save).twice
|
96
|
+
expect(RGeoServer::CoverageStore).to receive(:new).with(subject.catalog, hash_including(workspace: ws, name: id)).and_return(cs)
|
97
|
+
expect(cs).to receive(:name).and_return('abcdefg').at_least(:once)
|
98
|
+
expect(cs).to receive(:url=).with(url)
|
99
|
+
expect(cs).to receive(:enabled=).with('true')
|
100
|
+
expect(cs).to receive(:data_type=).with('GeoTIFF')
|
101
|
+
expect(cs).to receive(:save)
|
102
|
+
expect(RGeoServer::Coverage).to receive(:new).with(subject.catalog, hash_including(workspace: ws, coverage_store: cs, name: cs.name)).and_return(cov)
|
103
|
+
expect(cov).to receive(:title=).with(cs.name)
|
104
|
+
expect(cov).to receive(:metadata_links=).with([])
|
105
|
+
expect(cov).to receive(:save)
|
106
|
+
subject.send(:publish_raster)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe '#catalog' do
|
111
|
+
it 'connects to a RGeoServer catalog' do
|
112
|
+
expect(RGeoServer).to receive(:catalog).with(hash_including(:url, :user, :password)).and_return(double).once
|
113
|
+
subject.catalog
|
114
|
+
subject.catalog # should cache result
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GeoWorks::DeliveryService do
|
4
|
+
let(:id) { 'abc123' }
|
5
|
+
let(:path) { 'somewhere-to-display-copy' }
|
6
|
+
let(:file_set) { instance_double("FileSet") }
|
7
|
+
let(:visibility) { 'open' }
|
8
|
+
let(:service) { instance_double('GeoWorks::Delivery::Geoserver') }
|
9
|
+
|
10
|
+
subject { described_class.new file_set, path }
|
11
|
+
|
12
|
+
before do
|
13
|
+
allow(file_set).to receive(:visibility).and_return(visibility)
|
14
|
+
allow(service).to receive(:visibility).and_return(visibility)
|
15
|
+
end
|
16
|
+
|
17
|
+
context '#publish' do
|
18
|
+
it 'dispatches to Geoserver delivery' do
|
19
|
+
expect(subject).to receive(:geoserver).and_return(service)
|
20
|
+
expect(service).to receive(:publish)
|
21
|
+
subject.publish
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe GeoWorks::Discovery::AbstractDocument do
|
4
|
+
subject { described_class.new }
|
5
|
+
|
6
|
+
describe '#to_hash' do
|
7
|
+
it 'raises an error because the class should not be instantiated directly' do
|
8
|
+
expect { subject.to_hash(nil) }.to raise_error(/hash/)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#to_json' do
|
13
|
+
it 'raises an error because the class should not be instantiated directly' do
|
14
|
+
expect { subject.to_json(nil) }.to raise_error(/json/)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '#to_xml' do
|
19
|
+
it 'raises an error because the class should not be instantiated directly' do
|
20
|
+
expect { subject.to_xml(nil) }.to raise_error(/xml/)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|