module STAC::CommonMetadata
Provides read/write methods for STAC Common Metadata.
These methods are shorthand accessors of extra
Hash. Asset
and Item Properties
include this module.
Specification: github.com/radiantearth/stac-spec/blob/master/item-spec/common-metadata.md
Attributes
extra[R]
Public Instance Methods
constellation()
click to toggle source
# File lib/stac/common_metadata.rb, line 138 def constellation extra['constellation'] end
constellation=(str)
click to toggle source
# File lib/stac/common_metadata.rb, line 142 def constellation=(str) extra['constellation'] = str end
created()
click to toggle source
# File lib/stac/common_metadata.rb, line 31 def created if (str = extra['created']) Time.iso8601(str) end end
created=(time)
click to toggle source
# File lib/stac/common_metadata.rb, line 37 def created=(time) extra['created'] = case time when Time time.iso8601 else time end end
datetime_range()
click to toggle source
Returns a range from start_datetime
to end_datetime
.
# File lib/stac/common_metadata.rb, line 92 def datetime_range if (start = start_datetime) && (last = end_datetime) start..last end end
datetime_range=(time_range)
click to toggle source
Sets start_datetime
and end_datetime
by the given range.
# File lib/stac/common_metadata.rb, line 99 def datetime_range=(time_range) self.start_datetime = time_range.begin self.end_datetime = time_range.end end
description()
click to toggle source
# File lib/stac/common_metadata.rb, line 23 def description extra['description'] end
description=(str)
click to toggle source
# File lib/stac/common_metadata.rb, line 27 def description=(str) extra['description'] = str end
end_datetime()
click to toggle source
# File lib/stac/common_metadata.rb, line 76 def end_datetime if (str = extra['end_datetime']) Time.iso8601(str) end end
end_datetime=(time)
click to toggle source
# File lib/stac/common_metadata.rb, line 82 def end_datetime=(time) extra['end_datetime'] = case time when Time time.iso8601 else time end end
gsd()
click to toggle source
# File lib/stac/common_metadata.rb, line 154 def gsd extra['gsd'] end
gsd=(num)
click to toggle source
# File lib/stac/common_metadata.rb, line 158 def gsd=(num) extra['gsd'] = num end
instruments()
click to toggle source
# File lib/stac/common_metadata.rb, line 130 def instruments extra['instruments'] end
instruments=(arr)
click to toggle source
# File lib/stac/common_metadata.rb, line 134 def instruments=(arr) extra['instruments'] = arr end
license()
click to toggle source
# File lib/stac/common_metadata.rb, line 104 def license extra['license'] end
license=(str)
click to toggle source
# File lib/stac/common_metadata.rb, line 108 def license=(str) extra['license'] = str end
mission()
click to toggle source
# File lib/stac/common_metadata.rb, line 146 def mission extra['mission'] end
mission=(str)
click to toggle source
# File lib/stac/common_metadata.rb, line 150 def mission=(str) extra['mission'] = str end
platform()
click to toggle source
# File lib/stac/common_metadata.rb, line 122 def platform extra['platform'] end
platform=(str)
click to toggle source
# File lib/stac/common_metadata.rb, line 126 def platform=(str) extra['platform'] = str end
providers()
click to toggle source
# File lib/stac/common_metadata.rb, line 112 def providers extra.fetch('providers', []).map do |provider_hash| Provider.from_hash(provider_hash) end end
providers=(arr)
click to toggle source
# File lib/stac/common_metadata.rb, line 118 def providers=(arr) extra['providers'] = arr.map(&:to_h) end
start_datetime()
click to toggle source
# File lib/stac/common_metadata.rb, line 61 def start_datetime if (str = extra['start_datetime']) Time.iso8601(str) end end
start_datetime=(time)
click to toggle source
# File lib/stac/common_metadata.rb, line 67 def start_datetime=(time) extra['start_datetime'] = case time when Time time.iso8601 else time end end
title()
click to toggle source
# File lib/stac/common_metadata.rb, line 15 def title extra['title'] end
title=(str)
click to toggle source
# File lib/stac/common_metadata.rb, line 19 def title=(str) extra['title'] = str end
updated()
click to toggle source
# File lib/stac/common_metadata.rb, line 46 def updated if (str = extra['updated']) Time.iso8601(str) end end
updated=(time)
click to toggle source
# File lib/stac/common_metadata.rb, line 52 def updated=(time) extra['updated'] = case time when Time time.iso8601 else time end end