class STAC::Extent
Represents STAC extent object, which describes the spatio-temporal extents of a collection.
Specification: github.com/radiantearth/stac-spec/blob/master/collection-spec/collection-spec.md#extent-object
Attributes
spatial[RW]
temporal[RW]
Public Class Methods
from_hash(hash)
click to toggle source
Deserializes an Extent
from a Hash.
# File lib/stac/extent.rb, line 14 def from_hash(hash) transformed = hash.transform_keys(&:to_sym) transformed[:spatial] = Spatial.from_hash(transformed.fetch(:spatial)) transformed[:temporal] = Temporal.from_hash(transformed.fetch(:temporal)) new(**transformed) end
new(spatial:, temporal:, **extra)
click to toggle source
# File lib/stac/extent.rb, line 24 def initialize(spatial:, temporal:, **extra) @spatial = spatial @temporal = temporal @extra = extra.transform_keys(&:to_s) end
Public Instance Methods
to_h()
click to toggle source
Serializes self to a Hash.
# File lib/stac/extent.rb, line 31 def to_h { 'spatial' => spatial.to_h, 'temporal' => temporal.to_h, }.merge(extra) end