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

Add mosaic tile support for collections #813

Merged
merged 19 commits into from
Jul 21, 2021

Conversation

jisantuc
Copy link
Contributor

@jisantuc jisantuc commented Jul 12, 2021

Overview

This PR adds mosaic tile support to Franklin in a format inspired by but not compliant with the mosaicjson spec. The reason for non-compliance (right now) is the tiles property, which requires linking asset locations to tile quadkeys at the lowest supported zoom. We have a database with geometries that we can use to do this filtering very quickly and can easily cache things, so this requires a lot of JSON and still requires filtering after the fact for higher zoom levels, so I left it off. Maybe that's a discussion for another place.

Checklist

  • [/] New tests have been added or existing tests have been modified -- kind of! Two tests are skipped for now because turning on tiles, which is required for the routes to exist, breaks some equality expectations for collections. I skipped creating tests for the other new mosaic routes, and testing tile routes has always been really hard 😢. I'm opening a follow up issue. (Properly test mosaic routes #829)

Notes

  • add items asset validation function
  • add items <-> collection validation function
  • actually serve imagery based on the mosaic definition

Testing Instructions

  • bring up the database
  • fire up an sbt shell
  • run migrations: application/run migrate --db-host=localhost
  • start the server from the sbt shell: application/run serve --db-host=localhost --with-transactions --with-tiles
  • run this nice friendly bash script from the stac-client demo (I'll show you if you don't have access) to create a collection and two items within it:
#!/bin/bash

python create_collection.py demo-collection --bbox 0,0,1,1 --start-date 2021-01-01 --end-date 2021-08-01

AWS_PROFILE=raster-foundry python create_item.py demo-item-1 2021-07-18 s3://rasterfoundry-production-data-us-east-1/demo-cogs/s2-canary-islands-rgb-cog.tif demo-collection

AWS_PROFILE=raster-foundry python create_item.py demo-item-2 2021-07-18 s3://rasterfoundry-production-data-us-east-1/demo-cogs/s2-canary-islands-rgb-cog-2.tif demo-collection
  • create a json file with the following contents called mosaic-definition.json:
{
    "id": "d9b4db0f-7d80-4d96-b176-15a1400c01de",
    "description": null,
    "center": [
        -16.16291,
        28.2916,
        14
    ],
    "items": [
        {
            "itemId": "demo-item-1",
            "assetName": "cog"
        },
        {
            "itemId": "demo-item-2",
            "assetName": "cog"
        }
    ],
    "minZoom": 2,
    "maxZoom": 30,
    "bounds": [
        -180,
        -90,
        180,
        90
    ]
}
  • post that json to the collections mosaic endpoint: cat mosaic-definition.json | http :9090/collections/demo-collection/mosaic
  • put a tile layer in QGIS with the following URL: http://localhost:9090/tiles/collections/demo-collection/mosaic/1bfd50c4-7417-4fdb-a7d1-6b5faca99edf/WebMercatorQuad/{z}/{x}/{y}?lowerQuantile=4&upperQuantile=95
  • zoom to the canary islands
  • double click your new XYZ layer to put it on the map
  • you should see some pretty islands that would probably be nice to visit

Closes azavea/raster-foundry-platform#1272

@jisantuc jisantuc force-pushed the feature/js/add-collection-mosaics branch from 4022cd6 to 8a3f340 Compare July 13, 2021 22:38
@jisantuc jisantuc changed the title [wip] Add mosaic tile support for collections Add mosaic tile support for collections Jul 19, 2021
@jisantuc jisantuc requested a review from aaronxsu July 19, 2021 22:30
Copy link
Member

@aaronxsu aaronxsu left a comment

Choose a reason for hiding this comment

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

🚀

@jisantuc jisantuc merged commit fd79ada into master Jul 21, 2021
@jisantuc jisantuc deleted the feature/js/add-collection-mosaics branch July 21, 2021 21:58
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