rslearn.utils.stac¶
stac ¶
STAC API client.
StacAsset
dataclass
¶
StacItem
dataclass
¶
A STAC item.
Source code in rslearn/utils/stac.py
from_dict
classmethod
¶
from_dict(item: dict[str, Any]) -> StacItem
Create a STAC item from the item dict returned from API.
Source code in rslearn/utils/stac.py
StacClient ¶
Limited functionality client for STAC APIs.
Source code in rslearn/utils/stac.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
search ¶
search(collections: list[str] | None = None, bbox: Bbox | None = None, intersects: dict[str, Any] | None = None, date_time: datetime | tuple[datetime, datetime] | None = None, ids: list[str] | None = None, limit: int | None = None, query: dict[str, Any] | None = None, sortby: list[dict[str, str]] | None = None) -> list[StacItem]
Execute a STAC item search.
We use the JSON POST API. Pagination is handled so the returned items are concatenated across all available pages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
collections
|
list[str] | None
|
only search within the provided collection(s). |
None
|
bbox
|
Bbox | None
|
only return features intersecting the provided bounding box. |
None
|
intersects
|
dict[str, Any] | None
|
only return features intersecting this GeoJSON geometry. |
None
|
date_time
|
datetime | tuple[datetime, datetime] | None
|
only return features that have a temporal property intersecting the provided time range or timestamp. |
None
|
ids
|
list[str] | None
|
only return the provided item IDs. |
None
|
limit
|
int | None
|
number of items per page. We will read all the pages. |
None
|
query
|
dict[str, Any] | None
|
query dict, if STAC query extension is supported by this API. See https://github.com/stac-api-extensions/query. |
None
|
sortby
|
list[dict[str, str]] | None
|
list of sort specifications, e.g. [{"field": "id", "direction": "asc"}]. |
None
|
Returns:
| Type | Description |
|---|---|
list[StacItem]
|
list of matching STAC items. |
Source code in rslearn/utils/stac.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |