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) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/services/geoblacklight_sidecar_images/image_service/wms.rb', line 6

def self.image_url(document, size)
  endpoint = document.viewer_endpoint.to_s
  proxy = Settings.PROXY_GEOSERVER_URL.to_s
  institution = Settings.INSTITUTION_GEOSERVER_URL.to_s
  if proxy.present? && institution.present?
    endpoint = endpoint.gsub(proxy, institution)
  end

  layer = document[wxs_identifier_field] || document["gbl_wxsIdentifier_s"]
  "#{endpoint}/reflect?" \
    "&FORMAT=image%2Fpng" \
    "&TRANSPARENT=TRUE" \
    "&LAYERS=#{layer}" \
    "&WIDTH=#{size}" \
    "&HEIGHT=#{size}"
end

.wxs_identifier_fieldObject



23
24
25
# File 'app/services/geoblacklight_sidecar_images/image_service/wms.rb', line 23

def self.wxs_identifier_field
  GeoblacklightSidecarImages::FieldMap[:wxs_identifier]
end