-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render extension started during STAC render sprint in SatSummit Lisbon 2024. - listing (or showing to please Vincent) Please contribute to complete the feature to - generate the final XYZ link for rendering following the rules in STAC extensions - add a dedicated endpoint for render XYZ
- Loading branch information
1 parent
8718fa1
commit 529d864
Showing
4 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"id":"bs_to_save","bbox":[-120.61338752166166,38.54940283865057,-119.91905658168675,38.90577651328637],"type":"Feature","links":[{"rel":"collection","type":"application/json","href":"https://openveda.cloud/api/stac/collections/caldor-fire-burn-severity"},{"rel":"parent","type":"application/json","href":"https://openveda.cloud/api/stac/collections/caldor-fire-burn-severity"},{"rel":"root","type":"application/json","href":"https://openveda.cloud/api/stac/"},{"rel":"self","type":"application/geo+json","href":"https://openveda.cloud/api/stac/collections/caldor-fire-burn-severity/items/bs_to_save"},{"title":"Map of Item","href":"https://openveda.cloud/api/raster/collections/caldor-fire-burn-severity/items/bs_to_save/map?assets=cog_default&rescale=0%2C5&colormap_name=inferno_r","rel":"preview","type":"text/html"}],"assets":{"cog_default":{"href":"s3://veda-data-store/caldor-fire-burn-severity/bs_to_save.tif","type":"image/tiff; application=geotiff","roles":["data","layer"],"title":"Default COG Layer","proj:bbox":[-120.61338752166166,38.54940283865057,-119.91905658168675,38.90577651328637],"proj:epsg":4326,"proj:wkt2":"GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AXIS[\"Latitude\",NORTH],AXIS[\"Longitude\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]","proj:shape":[1103,2149],"description":"Cloud optimized default layer to display on map","raster:bands":[{"scale":1.0,"nodata":-100.0,"offset":0.0,"sampling":"area","data_type":"float64","histogram":{"max":4.0,"min":1.0,"count":11,"buckets":[10233,0,0,67409,0,0,71518,0,0,24232]},"statistics":{"mean":2.63295307741995,"stddev":0.7936384596443959,"maximum":4.0,"minimum":1.0,"valid_percent":32.191658745247146}}],"proj:geometry":{"type":"Polygon","coordinates":[[[-120.61338752166166,38.54940283865057],[-119.91905658168675,38.54940283865057],[-119.91905658168675,38.90577651328637],[-120.61338752166166,38.90577651328637],[-120.61338752166166,38.54940283865057]]]},"proj:projjson":{"id":{"code":4326,"authority":"EPSG"},"name":"WGS 84","type":"GeographicCRS","datum":{"name":"World Geodetic System 1984","type":"GeodeticReferenceFrame","ellipsoid":{"name":"WGS 84","semi_major_axis":6378137,"inverse_flattening":298.257223563}},"$schema":"https://proj.org/schemas/v0.4/projjson.schema.json","coordinate_system":{"axis":[{"name":"Geodetic latitude","unit":"degree","direction":"north","abbreviation":"Lat"},{"name":"Geodetic longitude","unit":"degree","direction":"east","abbreviation":"Lon"}],"subtype":"ellipsoidal"}},"proj:transform":[0.0003230948999417961,0.0,-120.61338752166166,0.0,-0.00032309489994179427,38.90577651328637,0.0,0.0,1.0]},"rendered_preview":{"title":"Rendered preview","href":"https://openveda.cloud/api/raster/collections/caldor-fire-burn-severity/items/bs_to_save/preview.png?assets=cog_default&rescale=0%2C5&colormap_name=inferno_r","rel":"preview","roles":["overview"],"type":"image/png"}},"geometry":{"type":"Polygon","coordinates":[[[-120.61338752166166,38.54940283865057],[-119.91905658168675,38.54940283865057],[-119.91905658168675,38.90577651328637],[-120.61338752166166,38.90577651328637],[-120.61338752166166,38.54940283865057]]]},"collection":"caldor-fire-burn-severity","properties":{"end_datetime":"2021-10-21T12:00:00+00:00","start_datetime":"2021-08-15T00:00:00+00:00"},"stac_version":"1.0.0","stac_extensions":["https://stac-extensions.github.io/raster/v1.1.0/schema.json","https://stac-extensions.github.io/projection/v1.1.0/schema.json"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""render Extension.""" | ||
|
||
from typing import Any, Dict, List, Literal, Optional | ||
|
||
from attrs import define | ||
from fastapi import Depends | ||
|
||
from titiler.core.factory import FactoryExtension, MultiBaseTilerFactory | ||
|
||
import pystac | ||
|
||
|
||
@define | ||
class renderExtension(FactoryExtension): | ||
"""Add /stac endpoint to a COG TilerFactory.""" | ||
|
||
''' | ||
''' | ||
def register(self, factory: MultiBaseTilerFactory): | ||
"""Register endpoint to the tiler factory.""" | ||
|
||
@factory.router.get("/renders", response_model=Dict, name="List STAC renders") | ||
def show_renders( | ||
src_path=Depends(factory.path_dependency) | ||
): | ||
with factory.reader(src_path) as src: | ||
renders = {} | ||
# if hasattr(src.item, "ext") and src.item.ext.has("renders"): | ||
# renders = src.item.ext.renders | ||
|
||
if src.item.properties.get("renders"): | ||
renders = src.item.properties.get("renders") | ||
|
||
return {"renders": renders} |