Class: Geoserver::Publish::CoverageStore
- Inherits:
-
Object
- Object
- Geoserver::Publish::CoverageStore
- Defined in:
- lib/geoserver/publish/coverage_store.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #create(workspace_name:, coverage_store_name:, url:, type: "GeoTIFF", additional_payload: nil) ⇒ Object
- #delete(workspace_name:, coverage_store_name:) ⇒ Object
- #find(workspace_name:, coverage_store_name:) ⇒ Object
-
#initialize(conn = nil) ⇒ CoverageStore
constructor
A new instance of CoverageStore.
- #update(workspace_name:, coverage_store_name:, url:, type: "GeoTIFF", additional_payload: nil) ⇒ Object
-
#upload(workspace_name:, coverage_store_name:, format:, file:, method: "file", content_type: "application/zip") ⇒ Object
Upload raster data files to a new coverage store # @param workspace_name [String] # @param coverage_store_name [String] # @param format [String] One of: geotiff == GeoTIFF worldimage == Georeferenced image (JPEG, PNG, TIFF) imagemosaic == Image mosaic See: docs.geoserver.org/stable/en/user/rest/api/coveragestores.html#extension # @param file [String] Depending on value of method: file == binary stream url == URL to publicly available raster files (DOESN’T ACTUALLY WORK).
Constructor Details
#initialize(conn = nil) ⇒ CoverageStore
Returns a new instance of CoverageStore.
7 8 9 |
# File 'lib/geoserver/publish/coverage_store.rb', line 7 def initialize(conn = nil) @connection = conn || Geoserver::Publish::Connection.new end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
5 6 7 |
# File 'lib/geoserver/publish/coverage_store.rb', line 5 def connection @connection end |
Instance Method Details
#create(workspace_name:, coverage_store_name:, url:, type: "GeoTIFF", additional_payload: nil) ⇒ Object
22 23 24 25 26 |
# File 'lib/geoserver/publish/coverage_store.rb', line 22 def create(workspace_name:, coverage_store_name:, url:, type: "GeoTIFF", additional_payload: nil) path = coverage_store_url(workspace_name: workspace_name, coverage_store_name: nil) payload = payload_new(workspace_name: workspace_name, coverage_store_name: coverage_store_name, url: url, type: type, payload: additional_payload) connection.post(path: path, payload: payload) end |
#delete(workspace_name:, coverage_store_name:) ⇒ Object
11 12 13 14 |
# File 'lib/geoserver/publish/coverage_store.rb', line 11 def delete(workspace_name:, coverage_store_name:) path = coverage_store_url(workspace_name: workspace_name, coverage_store_name: coverage_store_name) connection.delete(path: path) end |
#find(workspace_name:, coverage_store_name:) ⇒ Object
16 17 18 19 20 |
# File 'lib/geoserver/publish/coverage_store.rb', line 16 def find(workspace_name:, coverage_store_name:) path = coverage_store_url(workspace_name: workspace_name, coverage_store_name: coverage_store_name) out = connection.get(path: path) JSON.parse(out) if out end |
#update(workspace_name:, coverage_store_name:, url:, type: "GeoTIFF", additional_payload: nil) ⇒ Object
28 29 30 31 32 |
# File 'lib/geoserver/publish/coverage_store.rb', line 28 def update(workspace_name:, coverage_store_name:, url:, type: "GeoTIFF", additional_payload: nil) path = coverage_store_url(workspace_name: workspace_name, coverage_store_name: coverage_store_name) payload = payload_new(workspace_name: workspace_name, coverage_store_name: coverage_store_name, url: url, type: type, payload: additional_payload) connection.put(path: path, payload: payload, content_type: "application/json") end |
#upload(workspace_name:, coverage_store_name:, format:, file:, method: "file", content_type: "application/zip") ⇒ Object
Upload raster data files to a new coverage store # @param workspace_name [String] # @param coverage_store_name [String] # @param format [String] One of:
geotiff == GeoTIFF
worldimage == Georeferenced image (JPEG, PNG, TIFF)
imagemosaic == Image mosaic
See: https://docs.geoserver.org/stable/en/user/rest/api/coveragestores.html#extension
# @param file [String] Depending on value of method:
file == binary stream
url == URL to publicly available raster files (DOESN'T ACTUALLY WORK).
external == absolute path to existing file
# @param content_type [String] Content-Type for file upload # @param method [String] Can be one of ‘file’, ‘url’, ‘external’.
See: https://docs.geoserver.org/latest/en/api/#1.0.0/coveragestores.yaml
rubocop:disable Metrics/ParameterLists
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/geoserver/publish/coverage_store.rb', line 51 def upload(workspace_name:, coverage_store_name:, format:, file:, method: "file", content_type: "application/zip") path = upload_url( workspace_name: workspace_name, coverage_store_name: coverage_store_name, method: method, format: format ) connection.put(path: path, payload: file, content_type: content_type) end |