-
Notifications
You must be signed in to change notification settings - Fork 146
/
responses.py
52 lines (34 loc) · 1.12 KB
/
responses.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""TiTiler response models."""
from typing import Dict, List, Union
from geojson_pydantic.features import Feature, FeatureCollection
from geojson_pydantic.geometries import Geometry, Polygon
from pydantic import BaseModel
from rio_tiler.models import BandStatistics, Info
class Point(BaseModel):
"""
Point model.
response model for `/point` endpoints
"""
coordinates: List[float]
values: List[float]
band_names: List[str]
InfoGeoJSON = Feature[Polygon, Info]
Statistics = Dict[str, BandStatistics]
class StatisticsInGeoJSON(BaseModel):
"""Statistics model in geojson response."""
statistics: Statistics
class Config:
"""Config for model."""
extra = "allow"
StatisticsGeoJSON = Union[
FeatureCollection[Geometry, StatisticsInGeoJSON],
Feature[Geometry, StatisticsInGeoJSON],
]
# MultiBase Models
MultiBaseInfo = Dict[str, Info]
MultiBaseInfoGeoJSON = Feature[Polygon, MultiBaseInfo]
MultiBaseStatistics = Dict[str, Statistics]
MultiBaseStatisticsGeoJSON = Union[
FeatureCollection[Geometry, StatisticsInGeoJSON],
Feature[Geometry, StatisticsInGeoJSON],
]