Package: rio-tiler
rio-tilerUser friendly Rasterio plugin to read raster datasets.Documentation:https://cogeotiff.github.io/rio-tiler/Source Code:https://github.com/cogeotiff/rio-tilerDescriptionrio-tilerwas initially designed to createslippy map
tilesfrom large raster data
sources and render these tiles dynamically on a web map. Sincerio-tilerv2.0, we added many more helper methods to read
data and metadata from any raster source supported by Rasterio/GDAL.
This includes local and remote files via HTTP, AWS S3, Google Cloud Storage,
etc.At the low level,rio-tilerisjusta wrapper around therasterioandGDALlibraries.FeaturesRead any dataset supported by GDAL/Rasteriofromrio_tiler.ioimportReaderwithReader("my.tif")asimage:print(image.dataset)# rasterio opened datasetimg=image.read()# similar to rasterio.open("my.tif").read() but returns a rio_tiler.models.ImageData objectUser friendlytile,part,feature,pointreading methodsfromrio_tiler.ioimportReaderwithReader("my.tif")asimage:img=image.tile(x,y,z)# read mercator tile z-x-yimg=image.part(bbox)# read the data intersecting a bounding boximg=image.feature(geojson_feature)# read the data intersecting a geojson featureimg=image.point(lon,lat)# get pixel values for a lon/lat coordinatesEnable property assignment (e.g nodata) on data readingfromrio_tiler.ioimportReaderwithReader("my.tif")asimage:img=image.tile(x,y,z,nodata=-9999)# read mercator tile z-x-ySTACsupportfromrio_tiler.ioimportSTACReaderwithSTACReader("item.json")asstac:print(stac.assets)# available assetimg=stac.tile(# read tile for asset1 and indexes 1,2,3x,y,z,assets="asset1",indexes=(1,2,3),# same as asset_indexes={"asset1": (1, 2, 3)},)# Merging data from different assetsimg=stac.tile(# create an image from assets 1,2,3 using their first bandx,y,z,assets=("asset1","asset2","asset3",),asset_indexes={"asset1":1,"asset2":1,"asset3":1},)Xarraysupport(>=4.0)importxarrayfromrio_tiler.ioimportXarrayReaderds=xarray.open_dataset("https://pangeo.blob.core.windows.net/pangeo-public/daymet-rio-tiler/na-wgs84.zarr/",engine="zarr",decode_coords="all",consolidated=True,)da=ds["tmax"]withXarrayReader(da)asdst:print(dst.info())img=dst.tile(1,1,2)Note: The XarrayReader needs optional dependencies to be installedpip install rio-tiler["xarray"].Non-Geo Image support(>=4.0)fromrio_tiler.ioimportImageReaderwithImageReader("image.jpeg")assrc:im=src.tile(0,0,src.maxzoom)# read top-left `tile`im=src.part((0,100,100,0))# read top-left 100x100 pixelspt=src.point(0,0)# read pixel valueNote:ImageReaderis also compatible with proper geo-referenced raster datasets.Mosaic(merging or stacking)fromrio_tiler.ioimportReaderfromrio_tiler.mosaicimportmosaic_readerdefreader(file,x,y,z,**kwargs):withReader(file)asimage:returnimage.tile(x,y,z,**kwargs)img,assets=mosaic_reader(["image1.tif","image2.tif"],reader,x,y,z)Native support for multiple TileMatrixSet viamorecantileimportmorecantilefromrio_tiler.ioimportReader# Use EPSG:4326 (WGS84) gridwgs84_grid=morecantile.tms.get("WorldCRS84Quad")withReader("my.tif",tms=wgs84_grid)assrc:img=src.tile(1,1,1)InstallYou can installrio-tilerusing pip$pipinstall-Upip
$pipinstall-Urio-tileror install from source:$gitclonehttps://github.com/cogeotiff/rio-tiler.git
$cdrio-tiler
$pipinstall-Upip
$pipinstall-e.Pluginsrio-tiler-pdsrio-tilerv1 included several helpers for reading popular public datasets (e.g. Sentinel 2, Sentinel 1, Landsat 8, CBERS) from cloud providers. This functionality is now in aseparate plugin, enabling easier access to more public datasets.rio-tiler-mvtCreate Mapbox Vector Tiles from raster sourcesImplementationstitiler: A lightweight Cloud Optimized GeoTIFF dynamic tile server.cogeo-mosaic: Create mosaics of Cloud Optimized GeoTIFF based on themosaicJSONspecification.Contribution & DevelopmentSeeCONTRIBUTING.mdAuthorsTherio-tilerproject was begun at Mapbox and was transferred to thecogeotiffGithub organization in January 2019.SeeAUTHORS.txtfor a listing of individual contributors.ChangesSeeCHANGES.md.LicenseSeeLICENSE