geoblacklight 2.3.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.
- checksums.yaml +7 -0
- data/.circleci/config.yml +195 -0
- data/.github/ISSUE_TEMPLATE.md +17 -0
- data/.gitignore +21 -0
- data/.gitmodules +0 -0
- data/.hound.yml +8 -0
- data/.jshintignore +2 -0
- data/.jshintrc +67 -0
- data/.rubocop.yml +99 -0
- data/.rubocop_todo.yml +196 -0
- data/.solr_wrapper +5 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +49 -0
- data/Gemfile +39 -0
- data/LICENSE.txt +13 -0
- data/README.md +39 -0
- data/Rakefile +125 -0
- data/app/assets/images/blacklight/arrow-circle-down.svg +4 -0
- data/app/assets/images/blacklight/baruch-cuny.svg +6 -0
- data/app/assets/images/blacklight/berkeley.svg +7 -0
- data/app/assets/images/blacklight/book.svg +6 -0
- data/app/assets/images/blacklight/bookmark.svg +6 -0
- data/app/assets/images/blacklight/cd-rom.svg +6 -0
- data/app/assets/images/blacklight/chicago.svg +7 -0
- data/app/assets/images/blacklight/columbia.svg +6 -0
- data/app/assets/images/blacklight/cornell.svg +8 -0
- data/app/assets/images/blacklight/dvd-rom.svg +6 -0
- data/app/assets/images/blacklight/email.svg +6 -0
- data/app/assets/images/blacklight/esri-globe.svg +34 -0
- data/app/assets/images/blacklight/geoblacklight-icons.json +2079 -0
- data/app/assets/images/blacklight/globe.svg +4 -0
- data/app/assets/images/blacklight/harvard.svg +6 -0
- data/app/assets/images/blacklight/home.svg +4 -0
- data/app/assets/images/blacklight/illinois.svg +7 -0
- data/app/assets/images/blacklight/image.svg +6 -0
- data/app/assets/images/blacklight/indiana.svg +6 -0
- data/app/assets/images/blacklight/iowa.svg +6 -0
- data/app/assets/images/blacklight/leaf.svg +6 -0
- data/app/assets/images/blacklight/lewis-clark.svg +8 -0
- data/app/assets/images/blacklight/line.svg +7 -0
- data/app/assets/images/blacklight/logo.svg +1 -0
- data/app/assets/images/blacklight/map-marker.svg +6 -0
- data/app/assets/images/blacklight/map.svg +6 -0
- data/app/assets/images/blacklight/maryland.svg +6 -0
- data/app/assets/images/blacklight/massgis.svg +6 -0
- data/app/assets/images/blacklight/metadata.svg +6 -0
- data/app/assets/images/blacklight/michigan-state.svg +7 -0
- data/app/assets/images/blacklight/michigan.svg +6 -0
- data/app/assets/images/blacklight/minnesota.svg +6 -0
- data/app/assets/images/blacklight/mit.svg +6 -0
- data/app/assets/images/blacklight/mixed.svg +8 -0
- data/app/assets/images/blacklight/multilinestring.svg +9 -0
- data/app/assets/images/blacklight/multipoint.svg +6 -0
- data/app/assets/images/blacklight/multipolygon.svg +9 -0
- data/app/assets/images/blacklight/nyu.svg +9 -0
- data/app/assets/images/blacklight/ohio-state.svg +8 -0
- data/app/assets/images/blacklight/pagelines-brands.svg +6 -0
- data/app/assets/images/blacklight/paper-map.svg +6 -0
- data/app/assets/images/blacklight/penn-state.svg +7 -0
- data/app/assets/images/blacklight/point.svg +6 -0
- data/app/assets/images/blacklight/polygon.svg +7 -0
- data/app/assets/images/blacklight/polyline.svg +9 -0
- data/app/assets/images/blacklight/princeton.svg +6 -0
- data/app/assets/images/blacklight/public.svg +6 -0
- data/app/assets/images/blacklight/purdue.svg +7 -0
- data/app/assets/images/blacklight/raster.svg +6 -0
- data/app/assets/images/blacklight/restricted.svg +6 -0
- data/app/assets/images/blacklight/sms.svg +6 -0
- data/app/assets/images/blacklight/stanford.svg +6 -0
- data/app/assets/images/blacklight/table.svg +6 -0
- data/app/assets/images/blacklight/tags.svg +4 -0
- data/app/assets/images/blacklight/texas.svg +6 -0
- data/app/assets/images/blacklight/tufts.svg +6 -0
- data/app/assets/images/blacklight/ucla.svg +6 -0
- data/app/assets/images/blacklight/uva.svg +6 -0
- data/app/assets/images/blacklight/web_services.svg +6 -0
- data/app/assets/images/blacklight/wisconsin.svg +6 -0
- data/app/assets/javascripts/geoblacklight/basemaps.js +85 -0
- data/app/assets/javascripts/geoblacklight/controls.js +1 -0
- data/app/assets/javascripts/geoblacklight/controls/opacity.js +6 -0
- data/app/assets/javascripts/geoblacklight/downloaders.js +1 -0
- data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +61 -0
- data/app/assets/javascripts/geoblacklight/downloaders/hgl_downloader.js +32 -0
- data/app/assets/javascripts/geoblacklight/geoblacklight.js +42 -0
- data/app/assets/javascripts/geoblacklight/modules.js +1 -0
- data/app/assets/javascripts/geoblacklight/modules/collapse.js +7 -0
- data/app/assets/javascripts/geoblacklight/modules/download.js +11 -0
- data/app/assets/javascripts/geoblacklight/modules/geosearch.js +133 -0
- data/app/assets/javascripts/geoblacklight/modules/help_text.js +7 -0
- data/app/assets/javascripts/geoblacklight/modules/home.js +16 -0
- data/app/assets/javascripts/geoblacklight/modules/item.js +13 -0
- data/app/assets/javascripts/geoblacklight/modules/layer_opacity.js +68 -0
- data/app/assets/javascripts/geoblacklight/modules/metadata.js +15 -0
- data/app/assets/javascripts/geoblacklight/modules/metadata_download_button.js +53 -0
- data/app/assets/javascripts/geoblacklight/modules/relations.js +14 -0
- data/app/assets/javascripts/geoblacklight/modules/results.js +82 -0
- data/app/assets/javascripts/geoblacklight/modules/util.js +38 -0
- data/app/assets/javascripts/geoblacklight/templates/index_map_download.hbs +19 -0
- data/app/assets/javascripts/geoblacklight/templates/index_map_info.hbs +40 -0
- data/app/assets/javascripts/geoblacklight/viewers.js +1 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri.js +77 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri/dynamic_map_layer.js +85 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri/feature_layer.js +76 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri/image_map_layer.js +14 -0
- data/app/assets/javascripts/geoblacklight/viewers/esri/tiled_map_layer.js +50 -0
- data/app/assets/javascripts/geoblacklight/viewers/iiif.js +25 -0
- data/app/assets/javascripts/geoblacklight/viewers/index_map.js +70 -0
- data/app/assets/javascripts/geoblacklight/viewers/map.js +67 -0
- data/app/assets/javascripts/geoblacklight/viewers/oembed.js +13 -0
- data/app/assets/javascripts/geoblacklight/viewers/viewer.js +65 -0
- data/app/assets/javascripts/geoblacklight/viewers/wms.js +74 -0
- data/app/assets/stylesheets/geoblacklight/_blacklight_overrides.scss +51 -0
- data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +36 -0
- data/app/assets/stylesheets/geoblacklight/_styles.scss +4 -0
- data/app/assets/stylesheets/geoblacklight/application.scss +2 -0
- data/app/assets/stylesheets/geoblacklight/modules/downloads.scss +93 -0
- data/app/assets/stylesheets/geoblacklight/modules/facets.scss +5 -0
- data/app/assets/stylesheets/geoblacklight/modules/geosearch.scss +29 -0
- data/app/assets/stylesheets/geoblacklight/modules/home.scss +28 -0
- data/app/assets/stylesheets/geoblacklight/modules/icon-customization.scss +50 -0
- data/app/assets/stylesheets/geoblacklight/modules/index_maps.scss +7 -0
- data/app/assets/stylesheets/geoblacklight/modules/item.scss +26 -0
- data/app/assets/stylesheets/geoblacklight/modules/layer_opacity.scss +87 -0
- data/app/assets/stylesheets/geoblacklight/modules/metadata.scss +31 -0
- data/app/assets/stylesheets/geoblacklight/modules/metadata_content.scss +43 -0
- data/app/assets/stylesheets/geoblacklight/modules/metadata_markup.scss +9 -0
- data/app/assets/stylesheets/geoblacklight/modules/metadata_missing.scss +7 -0
- data/app/assets/stylesheets/geoblacklight/modules/mixins.scss +5 -0
- data/app/assets/stylesheets/geoblacklight/modules/modal.scss +14 -0
- data/app/assets/stylesheets/geoblacklight/modules/relations.scss +15 -0
- data/app/assets/stylesheets/geoblacklight/modules/results.scss +68 -0
- data/app/assets/stylesheets/geoblacklight/modules/search_widgets.scss +5 -0
- data/app/assets/stylesheets/geoblacklight/modules/sidebar.scss +60 -0
- data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +70 -0
- data/app/assets/stylesheets/geoblacklight/modules/web_services.scss +5 -0
- data/app/controllers/download_controller.rb +114 -0
- data/app/controllers/relation_controller.rb +20 -0
- data/app/controllers/wms_controller.rb +15 -0
- data/app/helpers/arcgis_helper.rb +12 -0
- data/app/helpers/blacklight_helper.rb +9 -0
- data/app/helpers/carto_helper.rb +29 -0
- data/app/helpers/geoblacklight_helper.rb +323 -0
- data/app/models/concerns/geoblacklight/solr_document.rb +113 -0
- data/app/models/concerns/geoblacklight/solr_document/arcgis.rb +10 -0
- data/app/models/concerns/geoblacklight/solr_document/carto.rb +28 -0
- data/app/models/concerns/geoblacklight/solr_document/finder.rb +38 -0
- data/app/models/concerns/geoblacklight/solr_document/inspection.rb +15 -0
- data/app/models/concerns/geoblacklight/spatial_search_behavior.rb +69 -0
- data/app/presenters/geoblacklight/document_presenter.rb +23 -0
- data/app/views/catalog/_data_dictionary.html.erb +6 -0
- data/app/views/catalog/_document_action.html.erb +6 -0
- data/app/views/catalog/_document_split.html.erb +6 -0
- data/app/views/catalog/_download_generated_link.html.erb +4 -0
- data/app/views/catalog/_download_link.html.erb +3 -0
- data/app/views/catalog/_downloads_generated.html.erb +6 -0
- data/app/views/catalog/_downloads_primary.html.erb +14 -0
- data/app/views/catalog/_downloads_secondary.html.erb +39 -0
- data/app/views/catalog/_exports.html.erb +3 -0
- data/app/views/catalog/_facet_tag_item.html.erb +3 -0
- data/app/views/catalog/_facet_tag_layout.html.erb +2 -0
- data/app/views/catalog/_header_icons.html.erb +3 -0
- data/app/views/catalog/_home_text.html.erb +43 -0
- data/app/views/catalog/_icon_facet.html.erb +16 -0
- data/app/views/catalog/_index_split_default.html.erb +22 -0
- data/app/views/catalog/_metadata.html.erb +27 -0
- data/app/views/catalog/_relations_container.html.erb +1 -0
- data/app/views/catalog/_results_pagination.html.erb +12 -0
- data/app/views/catalog/_show_default_attribute_table.html.erb +19 -0
- data/app/views/catalog/_show_default_viewer_container.html.erb +12 -0
- data/app/views/catalog/_show_default_viewer_information.html.erb +4 -0
- data/app/views/catalog/_show_downloads.html.erb +34 -0
- data/app/views/catalog/_show_header_default.html.erb +4 -0
- data/app/views/catalog/_show_sidebar.html.erb +12 -0
- data/app/views/catalog/_show_tools.html.erb +25 -0
- data/app/views/catalog/_web_services.html.erb +8 -0
- data/app/views/catalog/_web_services_default.html.erb +8 -0
- data/app/views/catalog/_web_services_wfs.html.erb +8 -0
- data/app/views/catalog/_web_services_wms.html.erb +8 -0
- data/app/views/catalog/index.html.erb +13 -0
- data/app/views/catalog/metadata.html.erb +11 -0
- data/app/views/catalog/metadata/_content.html.erb +3 -0
- data/app/views/catalog/metadata/_markup.html.erb +8 -0
- data/app/views/catalog/metadata/_missing.html.erb +6 -0
- data/app/views/catalog/web_services.html.erb +10 -0
- data/app/views/download/hgl.html.erb +25 -0
- data/app/views/relation/_ancestors.html.erb +11 -0
- data/app/views/relation/_descendants.html.erb +18 -0
- data/app/views/relation/index.html.erb +13 -0
- data/app/views/relation/index.json.jbuilder +3 -0
- data/app/views/shared/_header_navbar.html.erb +38 -0
- data/config/initializers/rails_config.rb +3 -0
- data/config/locales/geoblacklight.en.yml +163 -0
- data/geoblacklight.gemspec +49 -0
- data/lib/generators/geoblacklight/install_generator.rb +105 -0
- data/lib/generators/geoblacklight/templates/Procfile +3 -0
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +272 -0
- data/lib/generators/geoblacklight/templates/geoblacklight.js +10 -0
- data/lib/generators/geoblacklight/templates/geoblacklight.scss +4 -0
- data/lib/generators/geoblacklight/templates/package.json +14 -0
- data/lib/generators/geoblacklight/templates/settings.yml +127 -0
- data/lib/generators/geoblacklight/templates/webpacker.yml +67 -0
- data/lib/generators/geoblacklight/webpacker_generator.rb +35 -0
- data/lib/geoblacklight.rb +50 -0
- data/lib/geoblacklight/bounding_box.rb +45 -0
- data/lib/geoblacklight/catalog_helper_override.rb +13 -0
- data/lib/geoblacklight/constants.rb +28 -0
- data/lib/geoblacklight/download.rb +108 -0
- data/lib/geoblacklight/download/geojson_download.rb +22 -0
- data/lib/geoblacklight/download/geotiff_download.rb +20 -0
- data/lib/geoblacklight/download/hgl_download.rb +18 -0
- data/lib/geoblacklight/download/kmz_download.rb +22 -0
- data/lib/geoblacklight/download/shapefile_download.rb +20 -0
- data/lib/geoblacklight/engine.rb +27 -0
- data/lib/geoblacklight/exceptions.rb +27 -0
- data/lib/geoblacklight/geoblacklight_helper_behavior.rb +14 -0
- data/lib/geoblacklight/item_viewer.rb +54 -0
- data/lib/geoblacklight/metadata.rb +18 -0
- data/lib/geoblacklight/metadata/base.rb +93 -0
- data/lib/geoblacklight/metadata/fgdc.rb +14 -0
- data/lib/geoblacklight/metadata/html.rb +13 -0
- data/lib/geoblacklight/metadata/iso19139.rb +14 -0
- data/lib/geoblacklight/metadata_transformer.rb +33 -0
- data/lib/geoblacklight/metadata_transformer/base.rb +42 -0
- data/lib/geoblacklight/metadata_transformer/fgdc.rb +8 -0
- data/lib/geoblacklight/metadata_transformer/iso19139.rb +8 -0
- data/lib/geoblacklight/reference.rb +45 -0
- data/lib/geoblacklight/references.rb +132 -0
- data/lib/geoblacklight/relation/ancestors.rb +27 -0
- data/lib/geoblacklight/relation/descendants.rb +27 -0
- data/lib/geoblacklight/relation/relation_response.rb +24 -0
- data/lib/geoblacklight/routes.rb +7 -0
- data/lib/geoblacklight/routes/downloadable.rb +14 -0
- data/lib/geoblacklight/routes/exportable.rb +17 -0
- data/lib/geoblacklight/routes/wms.rb +13 -0
- data/lib/geoblacklight/version.rb +3 -0
- data/lib/geoblacklight/view_helper_override.rb +40 -0
- data/lib/geoblacklight/wms_layer.rb +35 -0
- data/lib/geoblacklight/wms_layer/feature_info_response.rb +32 -0
- data/lib/tasks/geoblacklight.rake +108 -0
- data/package.json +4 -0
- data/schema/format-values.md +50 -0
- data/schema/geoblacklight-schema-deprecated.md +39 -0
- data/schema/geoblacklight-schema.json +214 -0
- data/schema/geoblacklight-schema.md +323 -0
- data/schema/geometry-type-values.md +11 -0
- data/schema/references.md +23 -0
- data/schema/schema-commentary.md +198 -0
- data/schema/subjects.md +41 -0
- data/schema/type-values.md +10 -0
- data/solr/conf/_rest_managed.json +3 -0
- data/solr/conf/admin-extra.html +31 -0
- data/solr/conf/core.properties +5 -0
- data/solr/conf/elevate.xml +36 -0
- data/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/solr/conf/protwords.txt +21 -0
- data/solr/conf/schema.xml +198 -0
- data/solr/conf/scripts.conf +24 -0
- data/solr/conf/solrconfig.xml +243 -0
- data/solr/conf/spellings.txt +2 -0
- data/solr/conf/stopwords.txt +58 -0
- data/solr/conf/stopwords_en.txt +58 -0
- data/solr/conf/synonyms.txt +31 -0
- data/solr/conf/xslt/example.xsl +132 -0
- data/solr/conf/xslt/example_atom.xsl +67 -0
- data/solr/conf/xslt/example_rss.xsl +66 -0
- data/solr/conf/xslt/luke.xsl +337 -0
- data/spec/controllers/catalog_controller_spec.rb +82 -0
- data/spec/controllers/download_controller_spec.rb +120 -0
- data/spec/controllers/relation_controller_spec.rb +11 -0
- data/spec/controllers/wms_controller_spec.rb +34 -0
- data/spec/factories/user.rb +7 -0
- data/spec/features/bookmarks_spec.rb +10 -0
- data/spec/features/configurable_basemap_spec.rb +35 -0
- data/spec/features/data_dictionary_download_spec.rb +16 -0
- data/spec/features/download_layer_spec.rb +93 -0
- data/spec/features/empty_search_spec.rb +11 -0
- data/spec/features/esri_viewer_spec.rb +42 -0
- data/spec/features/exports_spec.rb +36 -0
- data/spec/features/help_text_spec.rb +8 -0
- data/spec/features/home_page_spec.rb +40 -0
- data/spec/features/iiif_viewer_spec.rb +8 -0
- data/spec/features/index_map_spec.rb +31 -0
- data/spec/features/layer_inspection_spec.rb +10 -0
- data/spec/features/layer_opacity_spec.rb +20 -0
- data/spec/features/layer_preview_spec.rb +17 -0
- data/spec/features/layer_with_no_references_spec.rb +8 -0
- data/spec/features/linkified_attribute_table_spec.rb +11 -0
- data/spec/features/metadata_panel_spec.rb +78 -0
- data/spec/features/missing_metadata_spec.rb +24 -0
- data/spec/features/oembed_spec.rb +9 -0
- data/spec/features/relations_spec.rb +51 -0
- data/spec/features/saved_searches_spec.rb +13 -0
- data/spec/features/search_bar_spec.rb +12 -0
- data/spec/features/search_results_map_spec.rb +55 -0
- data/spec/features/search_results_overlap_ratio_spec.rb +55 -0
- data/spec/features/search_spec.rb +14 -0
- data/spec/features/show_page_metadata_spec.rb +12 -0
- data/spec/features/sms_spec.rb +15 -0
- data/spec/features/split_view.html.erb_spec.rb +75 -0
- data/spec/features/suppressed_records_spec.rb +14 -0
- data/spec/features/web_services_modal_spec.rb +25 -0
- data/spec/fixtures/fgdc/harvard-g7064-s2-1834-k3.xml +1 -0
- data/spec/fixtures/iso19139/stanford-cg357zz0321.xml +581 -0
- data/spec/fixtures/mods/fb897vt9938.mods +111 -0
- data/spec/fixtures/mods/stanford-cg357zz0321.mods +113 -0
- data/spec/fixtures/solr_documents/README.md +40 -0
- data/spec/fixtures/solr_documents/actual-papermap1.json +23 -0
- data/spec/fixtures/solr_documents/actual-point1.json +37 -0
- data/spec/fixtures/solr_documents/actual-polygon1.json +23 -0
- data/spec/fixtures/solr_documents/actual-raster1.json +38 -0
- data/spec/fixtures/solr_documents/baruch_ancestor1.json +46 -0
- data/spec/fixtures/solr_documents/baruch_ancestor2.json +46 -0
- data/spec/fixtures/solr_documents/baruch_documentation_download.json +49 -0
- data/spec/fixtures/solr_documents/bbox-spans-180.json +20 -0
- data/spec/fixtures/solr_documents/cornell_html_metadata.json +42 -0
- data/spec/fixtures/solr_documents/esri-dynamic-layer-all-layers.json +38 -0
- data/spec/fixtures/solr_documents/esri-dynamic-layer-single-layer.json +40 -0
- data/spec/fixtures/solr_documents/esri-feature-layer.json +46 -0
- data/spec/fixtures/solr_documents/esri-image-map-layer.json +42 -0
- data/spec/fixtures/solr_documents/esri-tiled_map_layer.json +22 -0
- data/spec/fixtures/solr_documents/esri-wms-layer.json +33 -0
- data/spec/fixtures/solr_documents/harvard_raster.json +44 -0
- data/spec/fixtures/solr_documents/iiif-eastern-hemisphere.json +30 -0
- data/spec/fixtures/solr_documents/index-map-polygon-no-downloadurl.json +37 -0
- data/spec/fixtures/solr_documents/index-map-polygon.json +37 -0
- data/spec/fixtures/solr_documents/index-map-stanford.json +37 -0
- data/spec/fixtures/solr_documents/index_map_point.json +27 -0
- data/spec/fixtures/solr_documents/metadata_no_dct_provenance_s.json +30 -0
- data/spec/fixtures/solr_documents/metadata_no_layer_geom_type_s.json +17 -0
- data/spec/fixtures/solr_documents/metadata_no_solr_geom.json +23 -0
- data/spec/fixtures/solr_documents/no_spatial.json +21 -0
- data/spec/fixtures/solr_documents/oembed.json +24 -0
- data/spec/fixtures/solr_documents/princeton-child1.json +30 -0
- data/spec/fixtures/solr_documents/princeton-child2.json +30 -0
- data/spec/fixtures/solr_documents/princeton-child3.json +30 -0
- data/spec/fixtures/solr_documents/princeton-child4.json +30 -0
- data/spec/fixtures/solr_documents/princeton-parent.json +25 -0
- data/spec/fixtures/solr_documents/public_direct_download.json +34 -0
- data/spec/fixtures/solr_documents/public_iiif_princeton.json +36 -0
- data/spec/fixtures/solr_documents/public_polygon_mit.json +27 -0
- data/spec/fixtures/solr_documents/restricted-line.json +37 -0
- data/spec/fixtures/solr_documents/umn_metro_result1.json +41 -0
- data/spec/fixtures/solr_documents/umn_state_result1.json +38 -0
- data/spec/fixtures/solr_documents/umn_state_result2.json +38 -0
- data/spec/fixtures/solr_documents/uva_slug_colon.json +25 -0
- data/spec/helpers/arcgis_helper_spec.rb +14 -0
- data/spec/helpers/carto_helper_spec.rb +11 -0
- data/spec/helpers/geoblacklight_helper_spec.rb +329 -0
- data/spec/javascripts/geoblacklight_spec.js +21 -0
- data/spec/javascripts/metadata_download_button_spec.js +14 -0
- data/spec/javascripts/spec_helper.js +32 -0
- data/spec/javascripts/util_spec.js +12 -0
- data/spec/lib/geoblacklight/bounding_box_spec.rb +27 -0
- data/spec/lib/geoblacklight/controller_override_spec.rb +1 -0
- data/spec/lib/geoblacklight/document_presenter_spec.rb +61 -0
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +19 -0
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +20 -0
- data/spec/lib/geoblacklight/download/hgl_download_spec.rb +60 -0
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +20 -0
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +19 -0
- data/spec/lib/geoblacklight/download_spec.rb +177 -0
- data/spec/lib/geoblacklight/geoblacklight_helper_behavior_spec.rb +30 -0
- data/spec/lib/geoblacklight/item_viewer_spec.rb +63 -0
- data/spec/lib/geoblacklight/metadata/base_spec.rb +157 -0
- data/spec/lib/geoblacklight/metadata/html_spec.rb +18 -0
- data/spec/lib/geoblacklight/metadata_spec.rb +42 -0
- data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +35 -0
- data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +23 -0
- data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +23 -0
- data/spec/lib/geoblacklight/metadata_transformer_spec.rb +69 -0
- data/spec/lib/geoblacklight/reference_spec.rb +64 -0
- data/spec/lib/geoblacklight/references_spec.rb +216 -0
- data/spec/lib/geoblacklight/relation/ancestors_spec.rb +32 -0
- data/spec/lib/geoblacklight/relation/descendants_spec.rb +32 -0
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +43 -0
- data/spec/lib/geoblacklight/view_helper_override_spec.rb +37 -0
- data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +50 -0
- data/spec/lib/geoblacklight/wms_layer_spec.rb +99 -0
- data/spec/models/concerns/geoblacklight/solr_document/carto_spec.rb +61 -0
- data/spec/models/concerns/geoblacklight/solr_document/finder_spec.rb +40 -0
- data/spec/models/concerns/geoblacklight/solr_document/inspection_spec.rb +16 -0
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +251 -0
- data/spec/models/concerns/geoblacklight/spatial_search_behavior_spec.rb +84 -0
- data/spec/routing/catalog_routing_spec.rb +8 -0
- data/spec/spec_helper.rb +79 -0
- data/spec/support/backport_test_helpers.rb +45 -0
- data/spec/support/features.rb +5 -0
- data/spec/support/features/session_helpers.rb +20 -0
- data/spec/teaspoon_env.rb +213 -0
- data/spec/test_app_templates/Gemfile.extra +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +49 -0
- data/spec/test_app_templates/metadata/fgdc.html +129 -0
- data/spec/test_app_templates/metadata/fgdc.xml +145 -0
- data/spec/test_app_templates/metadata/iso.html +275 -0
- data/spec/test_app_templates/metadata/iso.xml +511 -0
- data/spec/test_app_templates/solr_documents +1 -0
- data/spec/views/catalog/_document_split.html.erb_spec.rb +5 -0
- data/spec/views/catalog/_index_split.html.erb_spec.rb +5 -0
- data/spec/views/catalog/_results_pagination.html.erb_spec.rb +9 -0
- data/spec/views/catalog/_show_downloads.html.erb_spec.rb +41 -0
- data/spec/views/catalog/_show_tools.html.erb_spec.rb +39 -0
- data/template.rb +19 -0
- data/vendor/assets/images/layers-2x.png +0 -0
- data/vendor/assets/images/layers.png +0 -0
- data/vendor/assets/images/marker-icon-2x.png +0 -0
- data/vendor/assets/images/marker-icon.png +0 -0
- data/vendor/assets/images/marker-shadow.png +0 -0
- data/vendor/assets/javascripts/esri-leaflet.js +5 -0
- data/vendor/assets/javascripts/esri-leaflet.js.map +1 -0
- data/vendor/assets/javascripts/leaflet-iiif.js +302 -0
- data/vendor/assets/javascripts/leaflet-src.js.map +1 -0
- data/vendor/assets/javascripts/leaflet.js.erb +13922 -0
- data/vendor/assets/javascripts/native.history.js +1 -0
- data/vendor/assets/javascripts/readmore.js +618 -0
- data/vendor/assets/javascripts/readmore.js.map +1 -0
- data/vendor/assets/stylesheets/leaflet-label.css +54 -0
- data/vendor/assets/stylesheets/leaflet.css +635 -0
- metadata +967 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'blacklight'
|
|
2
|
+
require 'font-awesome-rails'
|
|
3
|
+
require 'coderay'
|
|
4
|
+
require 'config'
|
|
5
|
+
require 'faraday'
|
|
6
|
+
require 'faraday_middleware'
|
|
7
|
+
require 'nokogiri'
|
|
8
|
+
require 'geoblacklight-icons'
|
|
9
|
+
require 'mime/types'
|
|
10
|
+
require 'handlebars_assets'
|
|
11
|
+
|
|
12
|
+
module Geoblacklight
|
|
13
|
+
class Engine < ::Rails::Engine
|
|
14
|
+
Blacklight::Configuration.default_values[:view].split.partials = ['index']
|
|
15
|
+
Blacklight::Configuration.default_values[:view].delete_field('list')
|
|
16
|
+
# GeoblacklightHelper is needed by all helpers, so we inject it
|
|
17
|
+
# into action view base here.
|
|
18
|
+
initializer 'geoblacklight.helpers' do
|
|
19
|
+
ActionView::Base.send :include, GeoblacklightHelper
|
|
20
|
+
ActionView::Base.send :include, CartoHelper
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
config.to_prepare do
|
|
24
|
+
Geoblacklight.inject!
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Geoblacklight
|
|
2
|
+
module Exceptions
|
|
3
|
+
class ExternalDownloadFailed < StandardError
|
|
4
|
+
def initialize(options = {})
|
|
5
|
+
@options = options
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
##
|
|
9
|
+
# URL tried from failed download
|
|
10
|
+
# @return [String]
|
|
11
|
+
def url
|
|
12
|
+
@options[:url].to_s
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
##
|
|
16
|
+
# Message passed from a failed download
|
|
17
|
+
# @return [String]
|
|
18
|
+
def message
|
|
19
|
+
@options[:message].to_s
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
class WrongDownloadFormat < StandardError
|
|
23
|
+
end
|
|
24
|
+
class WrongBoundingBoxFormat < StandardError
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Geoblacklight
|
|
2
|
+
##
|
|
3
|
+
# Adds helper behavior logic for GeoBlacklight, to used alongside
|
|
4
|
+
# BlacklightHelperBehavior
|
|
5
|
+
module GeoblacklightHelperBehavior
|
|
6
|
+
##
|
|
7
|
+
# Calls the presenter on the requested method
|
|
8
|
+
# @param [Symbol, String] presenting_method
|
|
9
|
+
# @return [String]
|
|
10
|
+
def geoblacklight_present(presenting_method, document = @document)
|
|
11
|
+
presenter(document).try(presenting_method.to_sym) || ''
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module Geoblacklight
|
|
2
|
+
class ItemViewer
|
|
3
|
+
def initialize(references)
|
|
4
|
+
@references = references
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def viewer_protocol
|
|
8
|
+
return 'map' if viewer_preference.nil?
|
|
9
|
+
viewer_preference.keys.first.to_s
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def viewer_endpoint
|
|
13
|
+
return '' if viewer_preference.nil?
|
|
14
|
+
viewer_preference.values.first.to_s
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def wms
|
|
18
|
+
@references.wms
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def iiif
|
|
22
|
+
@references.iiif
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def tiled_map_layer
|
|
26
|
+
@references.tiled_map_layer
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def dynamic_map_layer
|
|
30
|
+
@references.dynamic_map_layer
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def feature_layer
|
|
34
|
+
@references.feature_layer
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def image_map_layer
|
|
38
|
+
@references.image_map_layer
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def index_map
|
|
42
|
+
@references.index_map
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def oembed
|
|
46
|
+
@references.oembed
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def viewer_preference
|
|
50
|
+
[oembed, index_map, wms, iiif, tiled_map_layer, dynamic_map_layer,
|
|
51
|
+
image_map_layer, feature_layer].compact.map(&:to_hash).first
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Geoblacklight
|
|
2
|
+
module Metadata
|
|
3
|
+
##
|
|
4
|
+
# Initialize a new Metadata instance
|
|
5
|
+
# @param [Geoblacklight::Reference] reference the reference for the metadata resource
|
|
6
|
+
# @return [Geoblacklight::Metadata::Base]
|
|
7
|
+
def self.instance(reference)
|
|
8
|
+
begin
|
|
9
|
+
klass = "Geoblacklight::Metadata::#{reference.type.capitalize}".constantize
|
|
10
|
+
rescue
|
|
11
|
+
Geoblacklight.logger.warn "Metadata type #{reference.type} is not supported"
|
|
12
|
+
klass = Geoblacklight::Metadata::Base
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
klass.new(reference)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
module Geoblacklight
|
|
2
|
+
module Metadata
|
|
3
|
+
##
|
|
4
|
+
# Abstract Class for metadata
|
|
5
|
+
class Base
|
|
6
|
+
attr_reader :reference
|
|
7
|
+
delegate :type, to: :reference
|
|
8
|
+
delegate :to_html, to: :metadata
|
|
9
|
+
delegate :transform, to: :transformer
|
|
10
|
+
delegate :to_xml, to: :document
|
|
11
|
+
|
|
12
|
+
##
|
|
13
|
+
# Instantiates a Geoblacklight::Metadata object used for retrieving and
|
|
14
|
+
# formatting metadata
|
|
15
|
+
# @param reference [Geoblacklight::Reference] the reference object
|
|
16
|
+
def initialize(reference)
|
|
17
|
+
@reference = reference
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
##
|
|
21
|
+
# Retrieves the XML Document for the metadata
|
|
22
|
+
# @return [Nokogiri::XML::Document]
|
|
23
|
+
def document
|
|
24
|
+
@document ||= metadata.metadata
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
##
|
|
28
|
+
# Determines whether or not a metadata resources is empty
|
|
29
|
+
# @return [Boolean]
|
|
30
|
+
def blank?
|
|
31
|
+
document.nil? || document.children.empty?
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
##
|
|
35
|
+
# Retrieves the URI for the reference resource (e. g. a service endpoint)
|
|
36
|
+
# @return [String, nil]
|
|
37
|
+
def endpoint
|
|
38
|
+
blank? ? nil : @reference.endpoint
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
##
|
|
44
|
+
# Retrieves metadata from a url source
|
|
45
|
+
# @return [String, nil] metadata string or nil if there is a
|
|
46
|
+
# connection error
|
|
47
|
+
def retrieve_metadata
|
|
48
|
+
connection = Faraday.new(url: @reference.endpoint) do |conn|
|
|
49
|
+
conn.use FaradayMiddleware::FollowRedirects
|
|
50
|
+
conn.adapter Faraday.default_adapter
|
|
51
|
+
end
|
|
52
|
+
begin
|
|
53
|
+
response = connection.get
|
|
54
|
+
return response.body unless response.nil? || response.status == 404
|
|
55
|
+
Geoblacklight.logger.error "Could not reach #{@reference.endpoint}"
|
|
56
|
+
''
|
|
57
|
+
rescue Faraday::ConnectionFailed => error
|
|
58
|
+
Geoblacklight.logger.error error.inspect
|
|
59
|
+
''
|
|
60
|
+
rescue Faraday::TimeoutError => error
|
|
61
|
+
Geoblacklight.logger.error error.inspect
|
|
62
|
+
''
|
|
63
|
+
rescue OpenSSL::SSL::SSLError => error
|
|
64
|
+
Geoblacklight.logger.error error.inspect
|
|
65
|
+
''
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
##
|
|
70
|
+
# Retrieve the Class for the GeoCombine data model
|
|
71
|
+
# @return [GeoCombine::Metadata]
|
|
72
|
+
def metadata_class
|
|
73
|
+
GeoCombine::Metadata
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
##
|
|
77
|
+
# Handles metadata and returns the retrieved metadata or an error message if
|
|
78
|
+
# something went wrong
|
|
79
|
+
# @return [String] returned metadata string
|
|
80
|
+
def metadata
|
|
81
|
+
response_body = retrieve_metadata
|
|
82
|
+
metadata_class.new(response_body)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
##
|
|
86
|
+
# Initialize the MetadataTransformer Object for the metadata
|
|
87
|
+
# @return [GeoBlacklight::MetadataTransformer] MetadataTransformer instance
|
|
88
|
+
def transformer
|
|
89
|
+
MetadataTransformer.instance(self)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'geo_combine'
|
|
2
|
+
|
|
3
|
+
module Geoblacklight
|
|
4
|
+
module MetadataTransformer
|
|
5
|
+
##
|
|
6
|
+
# Exceptions raised for the types of geospatial metadata
|
|
7
|
+
class TypeError < EncodingError; end
|
|
8
|
+
##
|
|
9
|
+
# Exceptions raised when parsing geospatial metadata in the XML
|
|
10
|
+
class ParseError < EncodingError; end
|
|
11
|
+
##
|
|
12
|
+
# Exception raised when the geospatial metadata content is empty
|
|
13
|
+
class EmptyMetadataError < ParseError; end
|
|
14
|
+
##
|
|
15
|
+
# Exceptions raised when transforming the metadata into the HTML
|
|
16
|
+
class TransformError < EncodingError; end
|
|
17
|
+
|
|
18
|
+
##
|
|
19
|
+
# Initialize a new MetadataTransformer instance
|
|
20
|
+
# @param [Geoblacklight::Metadata::Base] metadata string or File path to the raw metadata
|
|
21
|
+
# @return [Geoblacklight::MetadataTransformer::BaseTransformer]
|
|
22
|
+
def self.instance(metadata)
|
|
23
|
+
type = metadata.class.name.split('::').last
|
|
24
|
+
begin
|
|
25
|
+
klass = "Geoblacklight::MetadataTransformer::#{type.capitalize}".constantize
|
|
26
|
+
rescue
|
|
27
|
+
raise TypeError, "Metadata type #{type} is not supported"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
klass.new(metadata)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Geoblacklight
|
|
2
|
+
module MetadataTransformer
|
|
3
|
+
##
|
|
4
|
+
# Abstract class for transforming geospatial metadata
|
|
5
|
+
class Base
|
|
6
|
+
##
|
|
7
|
+
# @param [GeoCombine::Metadata] metadata metadata Object
|
|
8
|
+
# @see GeoCombine::Metadata
|
|
9
|
+
def initialize(metadata)
|
|
10
|
+
@metadata = metadata
|
|
11
|
+
# Access the Nokogiri::XML Document from the metadata Object
|
|
12
|
+
fail EmptyMetadataError, 'Failed to retrieve the metadata' if @metadata.blank?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
##
|
|
16
|
+
# Returns HTML for the metadata transformed into HTML using GeoCombine
|
|
17
|
+
# @see GeoCombine::Metadata#to_html
|
|
18
|
+
# @return [String] the transformed metadata in the HTML
|
|
19
|
+
def transform
|
|
20
|
+
cleaned_metadata.to_html
|
|
21
|
+
rescue => e
|
|
22
|
+
raise TransformError, e.message
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
##
|
|
28
|
+
# Clean top-level HTML elements from GeoCombine HTML Documents (e. g. <html> and <body>)
|
|
29
|
+
# @return [Nokogiri::XML::Document] the Nokogiri XML Document for the cleaned HTML
|
|
30
|
+
def cleaned_metadata
|
|
31
|
+
transformed_doc = Nokogiri::XML(@metadata.to_html)
|
|
32
|
+
if transformed_doc.xpath('//body').children.empty?
|
|
33
|
+
fail TransformError,\
|
|
34
|
+
'Failed to extract the <body> child elements from the transformed metadata'
|
|
35
|
+
end
|
|
36
|
+
transformed_doc.xpath('//body').children
|
|
37
|
+
rescue => e
|
|
38
|
+
raise TransformError, e.message
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module Geoblacklight
|
|
2
|
+
##
|
|
3
|
+
# Parses an array of dct_references to create useful reference information
|
|
4
|
+
class Reference
|
|
5
|
+
attr_reader :reference
|
|
6
|
+
|
|
7
|
+
##
|
|
8
|
+
# Initializes a Reference object using an Array
|
|
9
|
+
# @param [Array] reference
|
|
10
|
+
def initialize(reference)
|
|
11
|
+
@reference = reference
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# The endpoint URL for a Geoblacklight::Reference
|
|
16
|
+
# @return [String]
|
|
17
|
+
def endpoint
|
|
18
|
+
@reference[1]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
##
|
|
22
|
+
# Lookups the type from the Constants::URI using the reference's URI
|
|
23
|
+
# @return [Symbol]
|
|
24
|
+
def type
|
|
25
|
+
Geoblacklight::Constants::URI.key(uri)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
##
|
|
29
|
+
# Creates a hash, using its type as key and endpoint as value
|
|
30
|
+
# @return [Hash]
|
|
31
|
+
def to_hash
|
|
32
|
+
{ type => endpoint }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
##
|
|
38
|
+
# The URI used for this instance's creation
|
|
39
|
+
# Remove any trailing slashes
|
|
40
|
+
# @return [String]
|
|
41
|
+
def uri
|
|
42
|
+
@reference[0].sub(/(\/)+$/, '') if @reference[0].present?
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
module Geoblacklight
|
|
2
|
+
# References is a geoblacklight-schema dct:references parser
|
|
3
|
+
class References
|
|
4
|
+
attr_reader :refs, :reference_field
|
|
5
|
+
def initialize(document, reference_field = Settings.FIELDS.REFERENCES)
|
|
6
|
+
@document = document
|
|
7
|
+
@reference_field = reference_field
|
|
8
|
+
@refs = parse_references.map { |ref| Reference.new(ref) }
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
##
|
|
12
|
+
# Return only those metadata references which are exposed within the configuration
|
|
13
|
+
# @return [Geoblacklight::Reference]
|
|
14
|
+
def shown_metadata_refs
|
|
15
|
+
metadata = @refs.select { |ref| Settings.METADATA_SHOWN.include?(ref.type.to_s) }
|
|
16
|
+
metadata.sort do |u, v|
|
|
17
|
+
Settings.METADATA_SHOWN.index(u.type.to_s) <=> Settings.METADATA_SHOWN.index(v.type.to_s)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
##
|
|
22
|
+
# Return only metadata for shown metadata
|
|
23
|
+
# @return [Geoblacklight::Metadata::Base]
|
|
24
|
+
def shown_metadata
|
|
25
|
+
@shown_metadata ||= shown_metadata_refs.map { |ref| Geoblacklight::Metadata.instance(ref) }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
##
|
|
29
|
+
# Accessor for a document's file format
|
|
30
|
+
# @return [String] file format for the document
|
|
31
|
+
def format
|
|
32
|
+
@document[Settings.FIELDS.FILE_FORMAT]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
##
|
|
36
|
+
# @param [String, Symbol] ref_type
|
|
37
|
+
# @return [Geoblacklight::Reference]
|
|
38
|
+
def references(ref_type)
|
|
39
|
+
@refs.find { |reference| reference.type == ref_type }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
##
|
|
43
|
+
# Preferred download (should be a file download)
|
|
44
|
+
# @return [Hash, nil]
|
|
45
|
+
def preferred_download
|
|
46
|
+
return file_download unless download.blank?
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
##
|
|
50
|
+
# Download hash based off of format type
|
|
51
|
+
# @return [Hash, nil]
|
|
52
|
+
def downloads_by_format
|
|
53
|
+
case format
|
|
54
|
+
when 'Shapefile'
|
|
55
|
+
vector_download_formats
|
|
56
|
+
when 'GeoTIFF'
|
|
57
|
+
geotiff_download_formats
|
|
58
|
+
when 'ArcGRID'
|
|
59
|
+
arcgrid_download_formats
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
##
|
|
64
|
+
# Generated download types from wxs services
|
|
65
|
+
# @return (see #downloads_by_format)
|
|
66
|
+
def download_types
|
|
67
|
+
downloads_by_format
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
##
|
|
71
|
+
# Returns all of the Esri webservices for given set of references
|
|
72
|
+
def esri_webservices
|
|
73
|
+
%w[tiled_map_layer dynamic_map_layer feature_layer image_map_layer].map do |layer_type|
|
|
74
|
+
send(layer_type)
|
|
75
|
+
end.compact
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
private
|
|
79
|
+
|
|
80
|
+
##
|
|
81
|
+
# Parses the references field of a document
|
|
82
|
+
# @return [Hash]
|
|
83
|
+
def parse_references
|
|
84
|
+
if @document[reference_field].nil?
|
|
85
|
+
{}
|
|
86
|
+
else
|
|
87
|
+
JSON.parse(@document[reference_field])
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
##
|
|
92
|
+
# Download hash for a static file download
|
|
93
|
+
# @return (see #downloads_by_format)
|
|
94
|
+
def file_download
|
|
95
|
+
{ file_download: download.to_hash }
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
##
|
|
99
|
+
# Download hash for a Shapefile file (currently only vector) with a wms and wfs reference
|
|
100
|
+
# present
|
|
101
|
+
# @return (see #downloads_by_format)
|
|
102
|
+
def vector_download_formats
|
|
103
|
+
{ shapefile: wfs.to_hash,
|
|
104
|
+
kmz: wms.to_hash,
|
|
105
|
+
geojson: wfs.to_hash } if wms.present? && wfs.present?
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
##
|
|
109
|
+
# Download hash for a GeoTiff file with a WMS reference present
|
|
110
|
+
# @return (see #downloads_by_format)
|
|
111
|
+
def geotiff_download_formats
|
|
112
|
+
{ geotiff: wms.to_hash } if wms.present?
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
##
|
|
116
|
+
# Download hash for an ArcGRID file with a WMS reference present
|
|
117
|
+
# @return (see #downloads_by_format)
|
|
118
|
+
def arcgrid_download_formats
|
|
119
|
+
{ geotiff: wms.to_hash } if wms.present?
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
##
|
|
123
|
+
# Adds a call to references for defined URI keys
|
|
124
|
+
def method_missing(m, *args, &b)
|
|
125
|
+
if Geoblacklight::Constants::URI.key?(m)
|
|
126
|
+
references m
|
|
127
|
+
else
|
|
128
|
+
super
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|