Rasterio plugin to read mercator tiles from Cloud Optimized GeoTIFF.
Source Code: https://github.com/cogeotiff/rio-tiler
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 .
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.
- rio-tiler-mvt: Create Mapbox Vector Tile from numpy array (tile/mask)
Mission Specific tiler
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.
- 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
rio-tiler project was begun at Mapbox and has been transferred in January 2019.
See AUTHORS.txt for a listing of individual contributors.