Module: GeoblacklightSidecarImages::ImageService::Wms

Defined in:
app/services/geoblacklight_sidecar_images/image_service/wms.rb

Class Method Summary collapse

Class Method Details

.image_url(document, size) ⇒ String

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.

Parameters:

  • (SolrDocument)
  • thumbnail (Integer)

    size

Returns:

  • (String)

    wms thumbnail url



14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/services/geoblacklight_sidecar_images/image_service/wms.rb', line 14

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["gbl_wxsIdentifier_s"]}" \
    "&WIDTH=#{size}" \
    "&HEIGHT=#{size}"
end