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

feat(raster)!: update titiler-pgstac from 0.2.3 to 0.8.0 #239

Merged
merged 8 commits into from
Oct 17, 2023

Conversation

vincentsarago
Copy link
Contributor

@vincentsarago vincentsarago commented Oct 16, 2023

ref #234

This PR aims to update titiler-pgstac from version 0.2.3 to 0.8.0. Doing so, will also update titiler, rio-tiler, morecantile, fastapi and pydantic.

Endpoint changes

  • Use /collections/{collection_id}/items/{item_id} prefix for Item endpoint.

I was able to keep this as it was ({endpoint}/stac/info?collection=collection1&item=item1)

  • post_process= -> algorithm=

  • change tile url path parameter order from /tiles/{searchid}/{TileMatrixSetId}/{z}/{x}/{y} to /{searchid}/tiles/{TileMatrixSetId}/{z}/{x}/{y}

# Before
{endpoint}/mosaic/tiles/20200307aC0853900w361030/0/0/0

# Now
{endpoint}/mosaic/20200307aC0853900w361030/tiles/0/0/0
  • replace /{searchid}/{z}/{x}/{y}/assets endpoints by /{searchid}/tiles/{z}/{x}/{y}/assets

  • replace - by _ in query parameters

    • coord-crs -> coord_crs
    • dst-crs -> dst_crs
  • remove max_size default for mosaic's /statistics [POST] endpoint breaking change

  • add /bbox and /feature [POST] optional endpoints

@@ -12,7 +12,7 @@ repos:
language_version: python

- repo: https://github.com/PyCQA/flake8
rev: 3.8.3
rev: 6.1.0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flake8 didn't like Annotated types so I had to update

@@ -1,9 +1,9 @@
FROM public.ecr.aws/sam/build-python3.9:latest
FROM public.ecr.aws/sam/build-python3.11:latest
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not mandatory but will be faster

}
)

PostProcessParams = algorithms.dependency
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this replace the post_process option we used in DatasetParams

stac = MultiBaseTilerFactory(
reader=PgSTACReader,
path_dependency=ItemPathParams,
optional_headers=optional_headers,
router_prefix=f"{path_prefix}/stac",
environment_dependency=settings.get_gdal_config,
router=APIRouter(route_class=LoggerRouteHandler),
extensions=[
stacViewerExtension(),
],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now use extensions instead of creating custom Factories

extensions=[
cogValidateExtension(),
cogViewerExtension(),
],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the official titiler extensions for the /validate and /viewer endpoints

super().__post_init__()

if self.post_process is not None:
self.post_process = pp_methods.get(self.post_process) # type: ignore
Copy link
Contributor Author

@vincentsarago vincentsarago Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced by Algorithm

breaking change now we need to pass algorithm=swir instead of post_process=swir

],
) -> pystac.Item:
"""STAC Item dependency."""
return get_stac_item(request.app.state.dbpool, collection, item)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to keep the collection={collection_id}&item={item_id} query parameters for the /stac endpoints

return features[0]


def DatasetPathParams(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this was used

"item": item.id,
},
media_type="text/html",
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extension instead of custom Factory

@vincentsarago vincentsarago force-pushed the feature/titiler-pgstac-update0.8.0 branch from e789826 to d177f15 Compare October 16, 2023 19:36
"titiler.pgstac==0.2.3",
"titiler.application>=0.10,<0.11",
"importlib_resources>=1.1.0;python_version<='3.9'", # https://github.com/cogeotiff/rio-tiler/pull/379
"boto3",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boto3 is now an optional dependency in rio-tiler

@vincentsarago vincentsarago marked this pull request as ready for review October 17, 2023 06:51
@anayeaye anayeaye merged commit 7f0cbbc into develop Oct 17, 2023
4 checks passed
@anayeaye anayeaye deleted the feature/titiler-pgstac-update0.8.0 branch October 17, 2023 20:39
@hanbyul-here hanbyul-here mentioned this pull request Oct 23, 2023
3 tasks
anayeaye added a commit that referenced this pull request Nov 13, 2023
…cloudfront (#244)

# What
- adds optional configuration to deploy all endpoints with a custom root
path (i.e. `/api/stac` and `/api/raster`) #229, #241
- adds support for using a cloudfront as a reverse proxy #229, #241,
#245
- titiler-pgstac upgraded from 0.2.3 to 0.8.0 #239
- titiler upgrade for custom colormap configuration #243

# How tested
A temporary test stack was deployed to confirm that raster-api works as
expected and that the two-subdomain staging-stac and staging-raster
pattern is still supported. The [pre-deploy diff action for this
pr](https://github.com/NASA-IMPACT/veda-backend/actions/runs/6791564314/job/18463354484#step:11:919)
confirms that the raster API lambda will be upgraded and no domain name
changes will be caused.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants