Skip to content

Interface with rio-tilerΒ #157

@darribas

Description

@darribas

It'd be really cool if we could build a bridge to rio-tiler. This would allow to use data on COGs directly as contextual basemaps.

If I read it correctly, they support direct tiling from a file on the web:

from rio_tiler.io import cogeo

tile, mask = cogeo.tile(
  'http://oin-hotosm.s3.amazonaws.com/5a95f32c2553e6000ce5ad2e/0/10edab38-1bdd-4c06-b83d-6e10ac532b7d.tif',
  691559,
  956905,
  21,
  tilesize=256
)
print(tile.shape)
> (3, 256, 256)

print(mask.shape)
> (256, 256)

So it'd be up to contextily to wire this in with our machinery to pull tiles from an extent:

    # download and merge tiles
    tiles = []
    arrays = []
    for t in mt.tiles(w, s, e, n, [zoom]):
        x, y, z = t.x, t.y, t.z
        tile_url = _construct_tile_url(provider, x, y, z)
        image = _fetch_tile(tile_url, wait, max_retries)
        tiles.append(t)
        arrays.append(image)

I don't think this would be too onerous. Would it be worth the effort/interest in having this "exist"? Looping @jorisvandenbossche, @martinfleis and @vincentsarago on this as their view will surely be better informed than mine. Do you think this is worth the time implementing?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions