Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

titiler 0.4.0 #394

Merged
merged 19 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update output model for mosaic
  • Loading branch information
vincentsarago committed Nov 4, 2021
commit bac098fd9c110b1e373f4d3e44f9c02d86b934cb
2 changes: 1 addition & 1 deletion src/titiler/core/titiler/core/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def register_routes(self):

Because we wrap the endpoints in a class we cannot define the routes as
methods (because of the self argument). The HACK is to define routes inside
the class method and register them after the class initialisation.
the class method and register them after the class initialization.

"""
# Default Routes
Expand Down
7 changes: 3 additions & 4 deletions src/titiler/core/titiler/core/models/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Dict, List, Union

from geojson_pydantic.features import Feature, FeatureCollection
from geojson_pydantic.geometries import Geometry
from geojson_pydantic.geometries import Geometry, Polygon
from pydantic import BaseModel
from rio_tiler.models import BandStatistics, Info

Expand All @@ -27,8 +27,7 @@ class MultiBasePoint(BaseModel):
values: List[List[float]]


InfoGeoJSON = Feature[Geometry, Info]

InfoGeoJSON = Feature[Polygon, Info]
Statistics = Dict[str, BandStatistics]


Expand All @@ -50,7 +49,7 @@ class Config:

# MultiBase Models
MultiBaseInfo = Dict[str, Info]
MultiBaseInfoGeoJSON = Feature[Geometry, MultiBaseInfo]
MultiBaseInfoGeoJSON = Feature[Polygon, MultiBaseInfo]

MultiBaseStatistics = Dict[str, Statistics]
MultiBaseStatisticsGeoJSON = Union[
Expand Down
9 changes: 6 additions & 3 deletions src/titiler/mosaic/titiler/mosaic/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os
from dataclasses import dataclass, field
from typing import Callable, Dict, Optional, Type
from typing import Callable, Dict, Optional, Type, Union
from urllib.parse import urlencode, urlparse

import rasterio
Expand All @@ -19,8 +19,9 @@
from titiler.core.dependencies import WebMercatorTMSParams
from titiler.core.factory import BaseTilerFactory, img_endpoint_params, templates
from titiler.core.models.mapbox import TileJSON
from titiler.core.models.responses import MultiBasePoint, Point
from titiler.core.resources.enums import ImageType, MediaType, OptionalHeader
from titiler.core.resources.responses import GeoJSONResponse, XMLResponse
from titiler.core.resources.responses import GeoJSONResponse, JSONResponse, XMLResponse
from titiler.core.utils import Timer
from titiler.mosaic.resources.enums import PixelSelectionMethod

Expand Down Expand Up @@ -126,7 +127,7 @@ def info(src_path=Depends(self.path_dependency)):

@self.router.get(
"/info.geojson",
response_model=Feature,
response_model=Feature[Polygon, mosaicInfo],
response_model_exclude_none=True,
response_class=GeoJSONResponse,
responses={
Expand Down Expand Up @@ -438,6 +439,8 @@ def point(self):

@self.router.get(
r"/point/{lon},{lat}",
response_model=Union[Point, MultiBasePoint],
response_class=JSONResponse,
responses={200: {"description": "Return a value for a point"}},
)
def point(
Expand Down