Clip endpoint for MosaicJSON #555
-
Hi! I am trying to create a custom endpoint for my company's DEM data, which exists in many different COGs. I've been using the MosaicJSON endpoint to combine all these cogs into one cohesive view. I'd now like to create an endpoint where you can give a bbox and get back a single image clipped to that bbox - much like the clip endpoint for COGs, but for MosaicJSON. Do you have any advice on how to go about it? Some options include:
Thank you in advance - Titiler is an incredible product |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
ahhhhhh I deleted my original answer 😭 😭 😭 First thanks for the question.
We don't have We added a https://github.com/stac-utils/titiler-pgstac/blob/master/titiler/pgstac/mosaic.py#L321-L384
Well to be honest, COGs scale pretty well, we've work with huge COGs before and it's ofter faster than Mosaics. if you don't need to update this COG often, if might be a good solution.
wmts_dst = "WMTS:http://titiler.xyz/cog/WMTSCapabilities.xml?url=https://noaa-eri-pds.s3.amazonaws.com/2022_Pre_Event/EC2201a_OB_N_RGB/EC2201a_OB_N_C0700000w415145n.tif&bidx=1&bidx=2&bidx=3&tile_format=png"
httpx.get(
"https://titiler.xyz/cog/crop/-69.99510242702613,41.85313673098173,-69.99038118408833,41.857529724573766.png",
params={
"url": wmts_dst,
"max_size": 512,
}
) |
Beta Was this translation helpful? Give feedback.
ahhhhhh I deleted my original answer 😭 😭 😭
First thanks for the question.
We don't have
/crop
endpoint because for MosaicJSON it could result in opening a LOT of files and thus the requests might take too much time.We added a
/statistics
endpoint in titiler-pgstac because by using pgstac we can reduce the number of files needed to be open (/statistics
use a customBackend().feature
method which is close to apart()
method you would need)https://github.com/stac-utils/titiler-pgstac/blob/master/titiler/pgstac/mosaic.py#L321-L384
https://github.com/s…