Skip to content

Commit

Permalink
Upgrade titiler and titiler-pgstac
Browse files Browse the repository at this point in the history
  • Loading branch information
ividito committed Jan 25, 2023
1 parent 5307460 commit 7ecd74c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
5 changes: 2 additions & 3 deletions raster_api/runtime/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
long_description = f.read()

inst_reqs = [
"titiler.pgstac==0.1.0.a9",
"titiler.application>=0.5,<0.6",
"starlette-cramjam>=0.1.0,<0.2",
"titiler.pgstac==0.2.0",
"titiler.application>=0.10,<0.11",
"importlib_resources>=1.1.0;python_version<'3.9'",
"aws_xray_sdk>=2.6.0,<3",
"aws-lambda-powertools>=1.18.0",
Expand Down
16 changes: 12 additions & 4 deletions raster_api/runtime/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from starlette.middleware.cors import CORSMiddleware
from starlette.requests import Request
from starlette.responses import HTMLResponse, JSONResponse
from starlette.templating import Jinja2Templates
from starlette_cramjam.middleware import CompressionMiddleware
from titiler.application.custom import templates
from titiler.core.dependencies import DatasetPathParams
from titiler.core.errors import DEFAULT_STATUS_CODES, add_exception_handlers
from titiler.core.factory import TilerFactory
Expand All @@ -25,6 +25,12 @@
from titiler.pgstac.dependencies import ItemPathParams
from titiler.pgstac.reader import PgSTACReader

try:
from importlib.resources import files as resources_files # type: ignore
except ImportError:
# Try backported to PY<39 `importlib_resources`.
from importlib_resources import files as resources_files # type: ignore

from .monitoring import LoggerRouteHandler, logger, metrics, tracer

logging.getLogger("botocore.credentials").disabled = True
Expand All @@ -33,6 +39,8 @@

settings = ApiSettings()

templates = Jinja2Templates(directory=str(resources_files(__package__) / "templates")) # type: ignore

if settings.debug:
optional_headers = [OptionalHeader.server_timing, OptionalHeader.x_assets]
else:
Expand All @@ -49,7 +57,7 @@
router_prefix="/mosaic",
enable_mosaic_search=settings.enable_mosaic_search,
optional_headers=optional_headers,
gdal_config=settings.get_gdal_config(),
environment_dependency=settings.get_gdal_config,
dataset_dependency=DatasetParams,
router=APIRouter(route_class=LoggerRouteHandler),
)
Expand All @@ -61,15 +69,15 @@
path_dependency=ItemPathParams,
optional_headers=optional_headers,
router_prefix="/stac",
gdal_config=settings.get_gdal_config(),
environment_dependency=settings.get_gdal_config,
router=APIRouter(route_class=LoggerRouteHandler),
)
app.include_router(stac.router, tags=["Items"], prefix="/stac")

cog = TilerFactory(
router_prefix="/cog",
optional_headers=optional_headers,
gdal_config=settings.get_gdal_config(),
environment_dependency=settings.get_gdal_config,
router=APIRouter(route_class=LoggerRouteHandler),
)

Expand Down

0 comments on commit 7ecd74c

Please sign in to comment.