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

Expose raw data and support queries with geometry #244

Open
dionhaefner opened this issue Dec 23, 2021 · 3 comments
Open

Expose raw data and support queries with geometry #244

dionhaefner opened this issue Dec 23, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@dionhaefner
Copy link
Collaborator

I'm not against adding a route mapping [bbox, zoom level] -> png and [bbox, zoom level] -> pixel data. Something like

# vanilla singleband tile
/singleband/{keys}/{x}/{y}/{z}.png

# untiled access with bbox
/singleband/{keys}/{z}.png?bbox={wkt}

# equivalent to current /preview.png if z == native zoom level (bbox = extent)
/singleband/{keys}/{z}.png

# raw pixel data of tile instead of png image
/singleband/{keys}/{x}/{y}/{z}.json

# raw pixel data in bbox
/singleband/{keys}/{z}.json?bbox={bbox}

# raw pixel data via compute, as requested in this issue
/compute/{keys}/{z}.json?expression={expression}&bbox={bbox}

# also supports reductions like zonal mean
/compute/{keys}/{z}.json?expression=mean(v1)&bbox={bbox}&v1=foo

With lots of validation on the passed bbox. In this proposal all raw pixel data would be aligned with the XYZ grid, so there would be no way to read the unprojected raw data as in the COG. But this also allows for efficient usage of overviews and makes it so we don't have to inform the user of which CRS the data is in, and ensures that tiles and raw data match.

So the .json routes just give you whatever the .png would give without the final step of rendering the data as an image (basically the raw 2D or 3D NumPy array as text).

Originally posted by @dionhaefner in #226 (comment)

@dionhaefner dionhaefner added the enhancement New feature or request label Dec 23, 2021
@j08lue
Copy link
Collaborator

j08lue commented Jan 18, 2022

We have had this on an internal wish list for a while, since pre-fetched PNG for a selected area is a way to render a smooth animation of a selected area on the map.

@chapmanjacobd
Copy link
Contributor

deck.gl-raster might be an interesting Terracotta client

https://kylebarron.dev/deck.gl-raster/overview/#serving-imagery

    if tile_format in ["pbf", "mvt"]:
        tile_url = f"{host}{path}/{{z}}/{{x}}/{{y}}.{tile_format}"
    elif tile_format in ["png", "jpg", "webp", "tif", "npy"]:
        tile_url = f"{host}{path}/{{z}}/{{x}}/{{y}}@{tile_scale}x.{tile_format}"

from https://github.com/kylebarron/landsat-mosaic-tiler/blob/master/landsat_mosaic_tiler/utils.py

@j08lue
Copy link
Collaborator

j08lue commented Feb 16, 2022

Yes, and binary tiles are a cool concept, too. Btw, we have this simple client library https://github.com/DHI-GRAS/terracotta-react

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants