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

update dataset name; allow test datasets #173

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
13 changes: 10 additions & 3 deletions app/routes/titiler/umd_glad_dist_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

router = APIRouter()

# TODO: update to the actual dataset when ready
DATASET = "dan_test"
DATASET = "umd_glad_dist_alerts"

today = date.today()

Expand All @@ -30,8 +29,16 @@
tags=["Raster Tiles"],
response_description="PNG Raster Tile",
)
@router.get(
"/{dataset}/{version}/titiler/{z}/{x}/{y}.png", # for testing datasets - hidden from docs.
response_class=Response,
tags=["Raster Tiles"],
response_description="PNG Raster Tile",
include_in_schema=False,
)
async def glad_dist_alerts_raster_tile(
*,
dataset: str = DATASET,
version,
xyz: Tuple[int, int, int] = Depends(raster_xyz),
start_date: Optional[str] = Query(
Expand Down Expand Up @@ -71,7 +78,7 @@ async def glad_dist_alerts_raster_tile(

tile_x, tile_y, zoom = xyz
bands = ["default", "intensity"]
folder: str = f"s3://{DATA_LAKE_BUCKET}/{DATASET}/{version}/raster/epsg-4326/cog"
folder: str = f"s3://{DATA_LAKE_BUCKET}/{dataset}/{version}/raster/epsg-4326/cog"
with AlertsReader(input=folder) as reader:
# NOTE: the bands in the output `image_data` array will be in the order of
# the input `bands` list
Expand Down
25 changes: 25 additions & 0 deletions terraform/modules/content_delivery_network/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,31 @@ resource "aws_cloudfront_distribution" "tiles" {
}
}

ordered_cache_behavior {
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment at line 426 is confusing. Should that comment be here right above line 458, and the comment at line 426 should be "Send all cog requests to the tile cache app"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Both are titiler endpoints. I have added clarifying comment for the DIST alerts one I just added and updated the generic one.

allowed_methods = local.methods
cached_methods = local.methods
target_origin_id = "dynamic"
compress = true
path_pattern = "*/titiler/*"
default_ttl = 86400
max_ttl = 86400
min_ttl = 0
smooth_streaming = false
trusted_signers = []
viewer_protocol_policy = "redirect-to-https"

forwarded_values {
headers = local.headers
query_string = true
query_string_cache_keys = []

cookies {
forward = "none"
whitelisted_names = []
}
}
}

# Default static vector tiles are stored on S3
# They won't change and can stay in cache for a year
# We will set response headers for selected tile caches in S3 if required
Expand Down
Loading