Module stac_fastapi.types.search¶
stac_fastapi.types.search module.
TODO: replace with stac-pydantic¶
Variables¶
NumType
Functions¶
str2bbox¶
def str2bbox(
x: str
) -> Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]], NoneType]
Convert string to BBox based on , delimiter.
str2list¶
def str2list(
x: str
) -> Union[List, NoneType]
Convert string to list base on , delimiter.
Classes¶
APIRequest¶
class APIRequest(
)
Generic API Request base class.
Ancestors (in MRO)¶
- abc.ABC
Descendants¶
- stac_fastapi.types.search.BaseSearchGetRequest
- stac_fastapi.api.models.CollectionUri
- stac_fastapi.api.models.EmptyRequest
- stac_fastapi.api.models.GETTokenPagination
- stac_fastapi.api.models.GETPagination
- stac_fastapi.extensions.core.fields.request.FieldsExtensionGetRequest
- stac_fastapi.extensions.core.filter.request.FilterExtensionGetRequest
- stac_fastapi.extensions.core.query.request.QueryExtensionGetRequest
- stac_fastapi.extensions.core.sort.request.SortExtensionGetRequest
Methods¶
kwargs¶
def kwargs(
self
) -> Dict
Transform api request params into format which matches the signature of the
endpoint.
BaseSearchGetRequest¶
class BaseSearchGetRequest(
collections: str = None,
ids: str = None,
bbox: str = None,
intersects: Union[str, NoneType] = None,
datetime: Union[str, NoneType] = None,
limit: Union[int, NoneType] = 10
)
Base arguments for GET Request.
Ancestors (in MRO)¶
- stac_fastapi.types.search.APIRequest
- abc.ABC
Methods¶
kwargs¶
def kwargs(
self
) -> Dict
Transform api request params into format which matches the signature of the
endpoint.
BaseSearchPostRequest¶
class BaseSearchPostRequest(
__pydantic_self__,
**data: Any
)
Search model.
Replace base model in STAC-pydantic as it includes additional fields, not in the core model. github.com/radiantearth/stac-api-spec/tree/master/item-search#query-parameter-table
PR to fix this: stac-utils/stac-pydantic!100
Ancestors (in MRO)¶
- pydantic.main.BaseModel
- pydantic.utils.Representation
Class variables¶
Config
Static methods¶
construct¶
def construct(
_fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
**values: Any
) -> 'Model'
Creates a new model setting dict and fields_set from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = 'allow'
was set since it adds all passed values
from_orm¶
def from_orm(
obj: Any
) -> 'Model'
parse_file¶
def parse_file(
path: Union[str, pathlib.Path],
*,
content_type: 'unicode' = None,
encoding: 'unicode' = 'utf8',
proto: pydantic.parse.Protocol = None,
allow_pickle: bool = False
) -> 'Model'
parse_obj¶
def parse_obj(
obj: Any
) -> 'Model'
parse_raw¶
def parse_raw(
b: Union[str, bytes],
*,
content_type: 'unicode' = None,
encoding: 'unicode' = 'utf8',
proto: pydantic.parse.Protocol = None,
allow_pickle: bool = False
) -> 'Model'
schema¶
def schema(
by_alias: bool = True,
ref_template: 'unicode' = '#/definitions/{model}'
) -> 'DictStrAny'
schema_json¶
def schema_json(
*,
by_alias: bool = True,
ref_template: 'unicode' = '#/definitions/{model}',
**dumps_kwargs: Any
) -> 'unicode'
update_forward_refs¶
def update_forward_refs(
**localns: Any
) -> None
Try to update ForwardRefs on fields based on this Model, globalns and localns.
validate¶
def validate(
value: Any
) -> 'Model'
validate_bbox¶
def validate_bbox(
v: Union[str, Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]]]
) -> Union[Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int]], Tuple[Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int], Union[float, int]]]
Check order of supplied bbox coordinates.
validate_datetime¶
def validate_datetime(
v: Union[str, datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime]]
) -> Union[datetime.datetime, Tuple[datetime.datetime, datetime.datetime], Tuple[datetime.datetime, NoneType], Tuple[NoneType, datetime.datetime]]
Parse datetime.
validate_spatial¶
def validate_spatial(
v,
values
)
Check bbox and intersects are not both supplied.
Instance variables¶
end_date
Extract the end date from the datetime string.
spatial_filter
Return a geojson-pydantic object representing the spatial filter for the search
request.
Check for both because the bbox
and intersects
parameters are
mutually exclusive.
start_date
Extract the start date from the datetime string.
Methods¶
copy¶
def copy(
self: 'Model',
*,
include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
update: Union[ForwardRef('DictStrAny'), NoneType] = None,
deep: bool = False
) -> 'Model'
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
include | None | fields to include in new model | None |
exclude | None | fields to exclude from new model, as with values this takes precedence over include | None |
update | None | values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data |
None |
deep | None | set to True to make a deep copy of the model |
None |
Returns:
Type | Description |
---|---|
None | new model instance |
dict¶
def dict(
self,
*,
include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
by_alias: bool = False,
skip_defaults: Union[bool, NoneType] = None,
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False
) -> 'DictStrAny'
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
json¶
def json(
self,
*,
include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny'), NoneType] = None,
by_alias: bool = False,
skip_defaults: Union[bool, NoneType] = None,
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False,
encoder: Union[Callable[[Any], Any], NoneType] = None,
models_as_dict: bool = True,
**dumps_kwargs: Any
) -> 'unicode'
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
Limit¶
class Limit(
/,
*args,
**kwargs
)
An positive integer that maxes out at 10,000.
Ancestors (in MRO)¶
- pydantic.types.ConstrainedInt
- builtins.int
Class variables¶
denominator
ge
gt
imag
le
lt
multiple_of
numerator
real
strict
Static methods¶
validate¶
def validate(
value: int
) -> int
Validate the integer value.
Methods¶
as_integer_ratio¶
def as_integer_ratio(
self,
/
)
Return integer ratio.
Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.
(10).as_integer_ratio() (10, 1) (-10).as_integer_ratio() (-10, 1) (0).as_integer_ratio() (0, 1)
bit_length¶
def bit_length(
self,
/
)
Number of bits necessary to represent self in binary.
bin(37) '0b100101' (37).bit_length() 6
conjugate¶
def conjugate(
...
)
Returns self, the complex conjugate of any int.
from_bytes¶
def from_bytes(
bytes,
byteorder,
*,
signed=False
)
Return the integer represented by the given array of bytes.
bytes Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. signed Indicates whether two's complement is used to represent the integer.
to_bytes¶
def to_bytes(
self,
/,
length,
byteorder,
*,
signed=False
)
Return an array of bytes representing an integer.
length Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. byteorder The byte order used to represent the integer. If byteorder is 'big', the most significant byte is at the beginning of the byte array. If byteorder is 'little', the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder' as the byte order value. signed Determines whether two's complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
Operator¶
class Operator(
/,
*args,
**kwargs
)
Defines the set of operators supported by the API.
Ancestors (in MRO)¶
- builtins.str
- stac_pydantic.utils.AutoValueEnum
- enum.Enum
Class variables¶
eq
gt
gte
lt
lte
ne