Sha256: a274bba519bdd1eb8c2a14858cbbd05578bb8849fc1f4c473e202fcf15cc5d68

Contents?: true

Size: 809 Bytes

Versions: 4

Compression:

Stored size: 809 Bytes

Contents

# frozen_string_literal: true

module GeoblacklightAdmin
  class ImageService
    module Wms
      ##
      # Formats and returns a thumbnail url from a Web Map Service endpoint.
      # This utilizes the GeoServer specific 'reflect' service to generate
      # parameters like bbox that are difficult to tweak without more detailed
      # information about the layer.
      # @param [SolrDocument]
      # @param [Integer] thumbnail size
      # @return [String] wms thumbnail url
      def self.image_url(document, size)
        endpoint = document.viewer_endpoint
        "#{endpoint}/reflect?" \
          "&FORMAT=image%2Fpng" \
          "&TRANSPARENT=TRUE" \
          "&LAYERS=#{document["gbl_wxsIdentifier_s"]}" \
          "&WIDTH=#{size}" \
          "&HEIGHT=#{size}"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geoblacklight_admin-0.6.0 app/services/geoblacklight_admin/image_service/wms.rb
geoblacklight_admin-0.5.1 app/services/geoblacklight_admin/image_service/wms.rb
geoblacklight_admin-0.5.0 app/services/geoblacklight_admin/image_service/wms.rb
geoblacklight_admin-0.4.2 app/services/geoblacklight_admin/image_service/wms.rb