Skip to content

Rasterio plugin to read mercator tiles from Cloud Optimized GeoTIFF dataset.

License

Notifications You must be signed in to change notification settings

emmanuelmathot/rio-tiler

 
 

Repository files navigation

rio-tiler

rio-tiler

Rasterio plugin to read mercator tiles from Cloud Optimized GeoTIFF.

Test Coverage Package version Conda Forge Downloads Downloads Binder


Documentation: https://cogeotiff.github.io/rio-tiler/

Source Code: https://github.com/cogeotiff/rio-tiler


Install

You can install rio-tiler using pip

$ pip install -U pip
$ pip install rio-tiler --pre # version 2.0 is in development

or install from source:

$ git clone https://github.com/cogeotiff/rio-tiler.git
$ cd rio-tiler
$ pip install -U pip
$ pip install -e .

Overview

rio-tiler is a rasterio plugin which aims to ease the creation of slippy map tile dynamically from any raster data.

from typing import Dict, List

from rio_tiler.io import COGReader
from rio_tiler.models import ImageData

with COGReader("my-tif.tif") as cog:
    # get info
    info: Dict = cog.info()

    # get image statistics
    stats: Dict = cog.stats()

    # get metadata (info + image statistics)
    meta: Dict = cog.metadata()

    # Read data for a mercator tile
    img: ImageData = cog.tile(tile_x, tile_y, tile_zoom, tilesize=256)
    assert img.data
    assert img.mask

    # Read part of a data for a given bbox (size is maxed out to 1024)
    img: ImageData = cog.part([minx, miny, maxx, maxy])

    # Read data for a given geojson polygon (size is maxed out to 1024)
    img: ImageData = cog.feature(geojson_feature)

    # Get a preview (size is maxed out to 1024)
    img: ImageData = cog.preview()

    # Get pixel values for a given lon/lat coordinate
    value: List = cog.point(lon, lat)

Partial reading on Cloud hosted dataset

rio-tiler perform partial reading on local or distant dataset, which is why it will perform best on Cloud Optimized GeoTIFF (COG). It's important to note that Sentinel-2 scenes hosted on AWS are not in Cloud Optimized format but in JPEG2000. When performing partial reading of JPEG2000 dataset GDAL (rasterio backend library) will need to make a lot of GET requests and transfer a lot of data.

Ref: Do you really want people using your data blog post.

Plugins

  • rio-tiler-mvt: Create Mapbox Vector Tile from numpy array (tile/mask)

Mission Specific tiler

In rio-tiler v2 we choosed to remove the mission specific tilers (Sentinel2, Sentinel1, Landsat8 and CBERS). Those are now in a specific plugin: rio-tiler-pds.

Implementations

  • rio-viz: Visualize Cloud Optimized GeoTIFF in browser locally
  • titiler: A lightweight Cloud Optimized GeoTIFF dynamic tile server.
  • cogeo-mosaic: Create mosaics of Cloud Optimized GeoTIFF based on mosaicJSON specification.

Contribution & Development

See CONTRIBUTING.md

Authors

The rio-tiler project was begun at Mapbox and has been transferred in January 2019.

See AUTHORS.txt for a listing of individual contributors.

Changes

See CHANGES.md.

License

See LICENSE.txt

About

Rasterio plugin to read mercator tiles from Cloud Optimized GeoTIFF dataset.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%