Sha256: f30990793646bbdbe777f65a82e07ce10f3bc14192dc383b14dc5d1a739c6896

Contents?: true

Size: 916 Bytes

Versions: 2

Compression:

Stored size: 916 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
geoblacklight_sidecar_images-0.0.2 lib/generators/geoblacklight_sidecar_images/templates/services/image_service/wms.rb
geoblacklight_sidecar_images-0.0.1 lib/generators/geoblacklight_sidecar_images/templates/services/image_service/wms.rb