stac 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -0
- data/CHANGELOG.md +18 -0
- data/GETTING_STARTED.md +384 -0
- data/Gemfile.lock +48 -37
- data/README.md +16 -57
- data/Rakefile +62 -4
- data/Steepfile +2 -0
- data/lib/stac/asset.rb +7 -1
- data/lib/stac/catalog.rb +81 -9
- data/lib/stac/collection.rb +43 -9
- data/lib/stac/common_metadata.rb +162 -0
- data/lib/stac/errors.rb +2 -5
- data/lib/stac/extension.rb +34 -0
- data/lib/stac/extensions/electro_optical.rb +67 -0
- data/lib/stac/extensions/projection.rb +42 -0
- data/lib/stac/extensions/scientific_citation.rb +84 -0
- data/lib/stac/extensions/view_geometry.rb +38 -0
- data/lib/stac/extent.rb +39 -31
- data/lib/stac/file_writer.rb +31 -0
- data/lib/stac/hash_like.rb +74 -0
- data/lib/stac/item.rb +58 -22
- data/lib/stac/link.rb +50 -14
- data/lib/stac/object_resolver.rb +14 -20
- data/lib/stac/properties.rb +6 -1
- data/lib/stac/provider.rb +5 -1
- data/lib/stac/{default_http_client.rb → simple_http_client.rb} +9 -4
- data/lib/stac/stac_object.rb +142 -31
- data/lib/stac/version.rb +1 -1
- data/lib/stac.rb +18 -2
- data/sig/stac/asset.rbs +3 -3
- data/sig/stac/catalog.rbs +29 -5
- data/sig/stac/collection.rbs +13 -5
- data/sig/stac/common_metadata.rbs +34 -0
- data/sig/stac/errors.rbs +1 -4
- data/sig/stac/extension.rbs +12 -0
- data/sig/stac/extensions/electro_optical.rbs +40 -0
- data/sig/stac/extensions/projection.rbs +32 -0
- data/sig/stac/extensions/scientific_citation.rbs +38 -0
- data/sig/stac/extensions/view_geometry.rbs +22 -0
- data/sig/stac/extent.rbs +13 -16
- data/sig/stac/file_writer.rbs +13 -0
- data/sig/stac/hash_like.rbs +13 -0
- data/sig/stac/item.rbs +17 -7
- data/sig/stac/link.rbs +21 -12
- data/sig/stac/object_resolver.rbs +5 -9
- data/sig/stac/properties.rbs +3 -3
- data/sig/stac/provider.rbs +2 -3
- data/sig/stac/{default_http_client.rbs → simple_http_client.rbs} +5 -2
- data/sig/stac/stac_object.rbs +34 -11
- data/sig/stac.rbs +7 -1
- data/stac.gemspec +1 -1
- metadata +26 -9
@@ -0,0 +1,13 @@
|
|
1
|
+
module STAC
|
2
|
+
class FileWriter
|
3
|
+
@hash_to_json: ^(Hash[String, untyped]) -> String
|
4
|
+
|
5
|
+
def initialize: (?hash_to_json: ^(Hash[String, untyped]) -> String) -> void
|
6
|
+
|
7
|
+
def write: (Hash[String, untyped], dest: String) -> void
|
8
|
+
end
|
9
|
+
|
10
|
+
interface _Writer
|
11
|
+
def write: (Hash[String, untyped], dest: String) -> void
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module STAC
|
2
|
+
module HashLike
|
3
|
+
attr_reader extra: Hash[String, untyped]
|
4
|
+
|
5
|
+
def []: (String | Symbol key) -> untyped
|
6
|
+
def []=: (String | Symbol key, untyped value) -> untyped
|
7
|
+
def update: (**untyped) -> self
|
8
|
+
def to_hash: -> Hash[String, untyped]
|
9
|
+
def to_h: -> Hash[String, untyped]
|
10
|
+
def to_json: -> String
|
11
|
+
def deep_dup: -> self
|
12
|
+
end
|
13
|
+
end
|
data/sig/stac/item.rbs
CHANGED
@@ -1,27 +1,37 @@
|
|
1
1
|
module STAC
|
2
2
|
class Item < STACObject
|
3
|
-
def self.from_hash: (Hash[String, untyped] hash) -> Item
|
3
|
+
def self.from_hash: (Hash[String | Symbol, untyped] hash) -> Item
|
4
4
|
|
5
|
+
attr_accessor id: String
|
5
6
|
attr_accessor geometry: Hash[String, untyped]?
|
6
|
-
attr_accessor properties: Properties
|
7
|
-
attr_accessor assets: Hash[String, Asset]
|
8
7
|
attr_accessor bbox: Array[Numeric]?
|
9
8
|
attr_accessor collection_id: String?
|
10
9
|
|
10
|
+
attr_reader properties: Properties
|
11
|
+
attr_reader assets: Hash[String, Asset]
|
12
|
+
|
11
13
|
def initialize: (
|
12
14
|
id: String,
|
13
15
|
geometry: Hash[String, untyped]?,
|
14
16
|
properties: Properties,
|
15
|
-
links: Array[
|
16
|
-
assets: Hash[String, Asset],
|
17
|
+
?links: Array[Hash[String, String]],
|
18
|
+
?assets: Hash[String, Asset],
|
17
19
|
?bbox: Array[Numeric]?,
|
18
20
|
?collection: String | Collection | nil,
|
19
|
-
?stac_extensions: Array[String]
|
21
|
+
?stac_extensions: Array[String],
|
20
22
|
**untyped
|
21
23
|
) -> void
|
22
24
|
|
23
|
-
def datetime: -> Time?
|
24
25
|
def collection: -> Collection?
|
25
26
|
def collection=: (Collection collection) -> void
|
27
|
+
def add_asset: (
|
28
|
+
key: String,
|
29
|
+
href: String,
|
30
|
+
?title: String?,
|
31
|
+
?description: String?,
|
32
|
+
?type: String?,
|
33
|
+
?roles: Array[String]?,
|
34
|
+
**untyped
|
35
|
+
) -> self
|
26
36
|
end
|
27
37
|
end
|
data/sig/stac/link.rbs
CHANGED
@@ -1,24 +1,33 @@
|
|
1
1
|
module STAC
|
2
|
+
class LinkHrefError < Error
|
3
|
+
attr_reader link: Link
|
4
|
+
|
5
|
+
def initialize: (?String? msg, link: Link) -> void
|
6
|
+
end
|
7
|
+
|
2
8
|
class Link
|
9
|
+
include HashLike
|
10
|
+
|
3
11
|
def self.from_hash: (Hash[String, untyped]) -> Link
|
4
12
|
|
5
13
|
attr_accessor rel: String
|
6
|
-
|
14
|
+
attr_writer href: String?
|
7
15
|
attr_accessor type: String?
|
8
16
|
attr_accessor title: String?
|
9
|
-
attr_accessor
|
10
|
-
attr_accessor
|
11
|
-
@target:
|
17
|
+
attr_accessor owner: STACObject?
|
18
|
+
attr_accessor http_client: _HTTPClient
|
19
|
+
@target: STACObject?
|
12
20
|
@resolver: ObjectResolver
|
13
21
|
|
14
|
-
def initialize: (rel: String, href: String
|
15
|
-
|
16
|
-
def
|
22
|
+
def initialize: (?STACObject? target, rel: String, href: String?, ?type: String?, ?title: String?, **untyped) -> void
|
23
|
+
def resolved?: -> bool
|
24
|
+
def href: -> String?
|
17
25
|
def absolute_href: -> String?
|
18
|
-
def
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
def
|
26
|
+
def relative_href: -> String?
|
27
|
+
def target: (?http_client: _HTTPClient) -> STACObject?
|
28
|
+
|
29
|
+
def href!: -> String
|
30
|
+
def absolute_href!: -> String
|
31
|
+
def relative_href!: -> String
|
23
32
|
end
|
24
33
|
end
|
@@ -2,27 +2,23 @@ module STAC
|
|
2
2
|
class ObjectResolver
|
3
3
|
RESOLVABLES: Array[_STACObjectClass]
|
4
4
|
|
5
|
-
|
5
|
+
attr_reader self.resolvables: Array[_STACObjectClass]
|
6
6
|
|
7
7
|
def self.default_http_client: -> _HTTPClient
|
8
8
|
|
9
9
|
attr_reader http_client: _HTTPClient
|
10
10
|
|
11
|
-
def initialize: (
|
11
|
+
def initialize: (http_client: _HTTPClient) -> void
|
12
12
|
|
13
13
|
def resolve: (String url) -> (Catalog | Collection | Item)
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def read: (String url) -> String
|
17
|
+
def read: (String url) -> Hash[String, untyped]
|
18
18
|
end
|
19
19
|
|
20
20
|
interface _STACObjectClass
|
21
|
-
def type: -> String
|
22
|
-
def from_hash: (Hash[String, untyped] hash) ->
|
23
|
-
end
|
24
|
-
|
25
|
-
interface _HTTPClient
|
26
|
-
def get: (URI uri) -> String
|
21
|
+
def type: -> String?
|
22
|
+
def from_hash: (Hash[String, untyped] hash) -> untyped
|
27
23
|
end
|
28
24
|
end
|
data/sig/stac/properties.rbs
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
module STAC
|
2
2
|
class Properties
|
3
|
+
include HashLike
|
4
|
+
include CommonMetadata
|
5
|
+
|
3
6
|
def self.from_hash: (Hash[String, untyped] hash) -> Properties
|
4
7
|
|
5
8
|
attr_accessor datetime: Time?
|
6
|
-
attr_accessor extra: Hash[String, untyped]
|
7
9
|
|
8
10
|
def initialize: (datetime: Time?, **untyped) -> void
|
9
|
-
|
10
|
-
def to_h: -> Hash[String, untyped]
|
11
11
|
end
|
12
12
|
end
|
data/sig/stac/provider.rbs
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
module STAC
|
2
2
|
class Provider
|
3
|
+
include HashLike
|
4
|
+
|
3
5
|
def self.from_hash: (Hash[String, untyped] hash) -> Provider
|
4
6
|
|
5
7
|
attr_accessor name: String
|
6
8
|
attr_accessor description: String?
|
7
9
|
attr_accessor roles: Array[String]?
|
8
10
|
attr_accessor url: String?
|
9
|
-
attr_accessor extra: Hash[String, untyped]
|
10
11
|
|
11
12
|
def initialize: (name: String, ?description: String?, ?roles: Array[String]?, ?url: String?, **untyped) -> void
|
12
|
-
|
13
|
-
def to_h: -> Hash[String, untyped]
|
14
13
|
end
|
15
14
|
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
module STAC
|
2
|
-
class
|
2
|
+
class HTTPError < Error
|
3
|
+
end
|
4
|
+
|
5
|
+
class SimpleHTTPClient
|
3
6
|
attr_reader options: Hash[String, String]
|
4
7
|
|
5
8
|
def initialize: (?Hash[String, String] options) -> void
|
6
9
|
|
7
|
-
def get: (URI
|
10
|
+
def get: (URI::Generic | String url) -> Hash[String, untyped]
|
8
11
|
end
|
9
12
|
end
|
data/sig/stac/stac_object.rbs
CHANGED
@@ -1,28 +1,51 @@
|
|
1
1
|
module STAC
|
2
|
+
class NoSelfHrefError < Error
|
3
|
+
attr_reader stac_object: STACObject
|
4
|
+
|
5
|
+
def initialize: (?String? msg, stac_object: STACObject) -> void
|
6
|
+
end
|
7
|
+
|
2
8
|
class STACObject
|
3
|
-
|
9
|
+
include HashLike
|
10
|
+
|
11
|
+
@@extendables: Hash[String, Extension]
|
4
12
|
|
5
|
-
|
13
|
+
attr_reader self.type: String?
|
6
14
|
|
7
|
-
|
8
|
-
|
9
|
-
|
15
|
+
def self.extendables: -> Array[Extension]
|
16
|
+
def self.add_extendable: (Extension) -> self
|
17
|
+
def self.from_hash: (Hash[String | Symbol, untyped]) -> STACObject
|
18
|
+
|
19
|
+
attr_accessor http_client: _HTTPClient
|
20
|
+
attr_reader stac_extensions: Array[String]
|
10
21
|
attr_reader links: Array[Link]
|
11
22
|
|
23
|
+
@extended: Array[Extension]
|
24
|
+
|
12
25
|
def initialize: (
|
13
|
-
|
26
|
+
?links: Array[Hash[String, String]], ?stac_extensions: Array[String], **untyped
|
14
27
|
) -> void
|
15
28
|
|
16
29
|
def type: -> String
|
17
|
-
def
|
18
|
-
def
|
19
|
-
def
|
30
|
+
def extended: -> Array[Extension]
|
31
|
+
def add_extension: (Extension | String) -> self
|
32
|
+
def find_link: (rel: String, ?type: String?) -> Link?
|
33
|
+
def add_link: (?STACObject? target, rel: String, ?href: String?, ?type: String?, ?title: String?, **untyped) -> self
|
20
34
|
def self_href: -> String?
|
21
35
|
def self_href=: (String) -> void
|
36
|
+
def root: -> Catalog?
|
37
|
+
def root=: (Catalog? catalog) -> void
|
38
|
+
def parent: -> Catalog?
|
39
|
+
def parent=: (Catalog? catalog) -> void
|
40
|
+
def save: (?String? dest, ?writer: _Writer) -> void
|
41
|
+
|
42
|
+
def self_href!: -> String
|
22
43
|
|
23
44
|
private
|
24
45
|
|
25
|
-
def
|
26
|
-
def
|
46
|
+
def extensions: -> Array[Extension]
|
47
|
+
def apply_extensions!: -> void
|
48
|
+
def apply_extension!: (Module) -> void
|
49
|
+
def remove_links: (rel: String) -> Array[Link]?
|
27
50
|
end
|
28
51
|
end
|
data/sig/stac.rbs
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# See the writing guide of rbs: https://github.com/ruby/rbs#guides
|
2
2
|
module STAC
|
3
|
+
attr_accessor self.default_http_client: _HTTPClient
|
4
|
+
|
3
5
|
def self.from_file: (String path) -> (Catalog | Collection | Item)
|
4
|
-
|
6
|
+
def self.from_url: (String url, ?http_client: _HTTPClient) -> (Catalog | Collection | Item)
|
7
|
+
|
8
|
+
interface _HTTPClient
|
9
|
+
def get: (URI::Generic | String url) -> Hash[String, untyped]
|
10
|
+
end
|
5
11
|
end
|
data/stac.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.files = Dir.chdir(__dir__) do
|
27
27
|
`git ls-files -z`.split("\x0").reject do |f|
|
28
28
|
(f == __FILE__) || f.match(
|
29
|
-
%r{\A(?:(?:bin|spec
|
29
|
+
%r{\A(?:(?:bin|spec)/|\.(?:git|vscode|devcontainer)|stac-spec)},
|
30
30
|
)
|
31
31
|
end
|
32
32
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro Miyoshi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description:
|
14
14
|
email:
|
15
15
|
- takahiro-miyoshi@sankichi.net
|
16
16
|
executables: []
|
@@ -21,6 +21,7 @@ files:
|
|
21
21
|
- ".rubocop.yml"
|
22
22
|
- CHANGELOG.md
|
23
23
|
- CODE_OF_CONDUCT.md
|
24
|
+
- GETTING_STARTED.md
|
24
25
|
- Gemfile
|
25
26
|
- Gemfile.lock
|
26
27
|
- LICENSE.txt
|
@@ -31,14 +32,22 @@ files:
|
|
31
32
|
- lib/stac/asset.rb
|
32
33
|
- lib/stac/catalog.rb
|
33
34
|
- lib/stac/collection.rb
|
34
|
-
- lib/stac/
|
35
|
+
- lib/stac/common_metadata.rb
|
35
36
|
- lib/stac/errors.rb
|
37
|
+
- lib/stac/extension.rb
|
38
|
+
- lib/stac/extensions/electro_optical.rb
|
39
|
+
- lib/stac/extensions/projection.rb
|
40
|
+
- lib/stac/extensions/scientific_citation.rb
|
41
|
+
- lib/stac/extensions/view_geometry.rb
|
36
42
|
- lib/stac/extent.rb
|
43
|
+
- lib/stac/file_writer.rb
|
44
|
+
- lib/stac/hash_like.rb
|
37
45
|
- lib/stac/item.rb
|
38
46
|
- lib/stac/link.rb
|
39
47
|
- lib/stac/object_resolver.rb
|
40
48
|
- lib/stac/properties.rb
|
41
49
|
- lib/stac/provider.rb
|
50
|
+
- lib/stac/simple_http_client.rb
|
42
51
|
- lib/stac/spec_version.rb
|
43
52
|
- lib/stac/stac_object.rb
|
44
53
|
- lib/stac/version.rb
|
@@ -47,14 +56,22 @@ files:
|
|
47
56
|
- sig/stac/asset.rbs
|
48
57
|
- sig/stac/catalog.rbs
|
49
58
|
- sig/stac/collection.rbs
|
50
|
-
- sig/stac/
|
59
|
+
- sig/stac/common_metadata.rbs
|
51
60
|
- sig/stac/errors.rbs
|
61
|
+
- sig/stac/extension.rbs
|
62
|
+
- sig/stac/extensions/electro_optical.rbs
|
63
|
+
- sig/stac/extensions/projection.rbs
|
64
|
+
- sig/stac/extensions/scientific_citation.rbs
|
65
|
+
- sig/stac/extensions/view_geometry.rbs
|
52
66
|
- sig/stac/extent.rbs
|
67
|
+
- sig/stac/file_writer.rbs
|
68
|
+
- sig/stac/hash_like.rbs
|
53
69
|
- sig/stac/item.rbs
|
54
70
|
- sig/stac/link.rbs
|
55
71
|
- sig/stac/object_resolver.rbs
|
56
72
|
- sig/stac/properties.rbs
|
57
73
|
- sig/stac/provider.rbs
|
74
|
+
- sig/stac/simple_http_client.rbs
|
58
75
|
- sig/stac/spec_version.rbs
|
59
76
|
- sig/stac/stac_object.rbs
|
60
77
|
- sig/stac/version.rbs
|
@@ -69,7 +86,7 @@ metadata:
|
|
69
86
|
documentation_uri: https://sankichi92.github.io/stac-ruby/
|
70
87
|
github_repo: https://github.com/sankichi92/stac-ruby.git
|
71
88
|
rubygems_mfa_required: 'true'
|
72
|
-
post_install_message:
|
89
|
+
post_install_message:
|
73
90
|
rdoc_options: []
|
74
91
|
require_paths:
|
75
92
|
- lib
|
@@ -84,8 +101,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
101
|
- !ruby/object:Gem::Version
|
85
102
|
version: '0'
|
86
103
|
requirements: []
|
87
|
-
rubygems_version: 3.3.
|
88
|
-
signing_key:
|
104
|
+
rubygems_version: 3.3.26
|
105
|
+
signing_key:
|
89
106
|
specification_version: 4
|
90
107
|
summary: A library for working with SpatioTemporal Asset Catalog (STAC)
|
91
108
|
test_files: []
|