NASA-IMPACT / dashboard-api-starter

API for the Earthdata Dashboard
MIT License
1 stars 2 forks source link

feat: add support for lambda to create a MosaicJSON representaion of a STAC API Search result #8

Closed philvarner closed 3 years ago

philvarner commented 3 years ago

Issue: https://github.com/MAAP-Project/ZenHub/issues/339

Deployed to https://qnz86q6bnb.execute-api.us-east-1.amazonaws.com/v1/mosaics

A request like this, containing a stac_api_root, a username, and the same parameters as accepted by the STAC API Item Search endpoint (/search):

curl -X "POST" "https://qnz86q6bnb.execute-api.us-east-1.amazonaws.com/v1/mosaics" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "stac_api_root": "https://earth-search.aws.element84.com/v0",
  "username": "philvarner",
  "datetime": "2021-04-20T00:00:00Z/2021-04-21T02:00:00Z",
  "collections": [
    "sentinel-s2-l2a-cogs"
  ],
  "bbox": [
    20,
    20,
    21,
    21
  ]
}'

will generate a mosaicjson endpoint and return a body with a Link to the tilejson for it:

{
  "id": "philvarner.RNOyIRiuXOewxcwtbPuuaYWROmXtTxzy",
  "links": [
    {
      "href": "https://api.cogeo.xyz/mosaicjson/philvarner.RNOyIRiuXOewxcwtbPuuaYWROmXtTxzy/tilejson.json",
      "rel": "tilejson",
      "type": "application/json",
      "title": "TileJSON"
    }
  ]
}

This endpoint depends on cogeo-mosaic, which needs a newer version of rio-tiler (~=2.1.0) than dashboard api (2.0a.11). There are several incompatibilities between dashboard and rio-tiler >= 2.0.0, due to methods being removed in rio-tiler in 2.0.0 final that existed in the alphas. 🤷🏻 This shouldn't take but a few hours to fix, and it would be good in general to get rio-tiler upgraded.

This necessitated that the code be packaged separately and use a different setup.py, hence it all being a subdirectory.

Ideally, we could update dashboard api to use a newer rio-tiler and just incorporate all of this code for the mosaic_api as another endpoint in dashboard api. Another option would be to move dashboard_api into sibling directory to mosaic_api instead of being in a parent of it.

Remaining Issues:

vincentsarago commented 3 years ago

@philvarner 😭 we just updated a rio-tiler and cogeo-mosaic last week, I'm sorry for the trouble. I'll have a look at the PR as soon as I can!

abarciauskas-bgse commented 3 years ago

I think we can close this in favor of using https://github.com/NASA-IMPACT/titiler/ for mosaic management and tiling right @philvarner ?