Sha256: af7c88950a7948dd5b26b2c84e12811c7711469ac1ae7cd7ea878c1552d27ea8

Contents?: true

Size: 994 Bytes

Versions: 3

Compression:

Stored size: 994 Bytes

Contents

# frozen_string_literal: true

module GeoblacklightSidecarImages
  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)
        # Swap proxy url with princeton geoserver url.
        # Thumbnail requests send geoserver auth.
        endpoint = document.viewer_endpoint.gsub(Settings.PROXY_GEOSERVER_URL,
          Settings.INSTITUTION_GEOSERVER_URL)
        "#{endpoint}/reflect?" \
          "&FORMAT=image%2Fpng" \
          "&TRANSPARENT=TRUE" \
          "&LAYERS=#{document["layer_id_s"]}" \
          "&WIDTH=#{size}" \
          "&HEIGHT=#{size}"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
geoblacklight_sidecar_images-0.9.2 app/services/geoblacklight_sidecar_images/image_service/wms.rb
geoblacklight_sidecar_images-0.9.1 app/services/geoblacklight_sidecar_images/image_service/wms.rb
geoblacklight_sidecar_images-0.9.0 app/services/geoblacklight_sidecar_images/image_service/wms.rb