Skip to main content

User friendly Rasterio plugin to read raster datasets.

Project description

rio-tiler

rio-tiler

User friendly Rasterio plugin to read raster datasets.

Test Coverage Package version Conda Forge Downloads Downloads Binder


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

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


Description

rio-tiler was initially designed to create slippy map tiles from large raster data sources and render these tiles dynamically on a web map. Since rio-tiler v2.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-tiler is just a wrapper around the rasterio.vrt.WarpedVRT class, which can be useful for doing re-projection and/or property overriding (e.g nodata value).

Features

  • Read any dataset supported by GDAL/Rasterio

    from rio_tiler.io import COGReader
    
    with COGReader("my.tif") as image:
        print(image.dataset)  # rasterio opened dataset
        img = image.read()    # similar to rasterio.open("my.tif").read() but returns a rio_tiler.models.ImageData object
    
  • User friendly tile, part, feature, point reading methods

    from rio_tiler.io import COGReader
    
    with COGReader("my.tif") as image:
        img = image.tile(x, y, z)            # read mercator tile z-x-y
        img = image.part(bbox)               # read the data intersecting a bounding box
        img = image.feature(geojson_feature) # read the data intersecting a geojson feature
        img = image.point(lon,lat)           # get pixel values for a lon/lat coordinates
    
  • Enable property assignment (e.g nodata) on data reading

    from rio_tiler.io import COGReader
    
    with COGReader("my.tif") as image:
        img = image.tile(x, y, z, nodata=-9999) # read mercator tile z-x-y
    
  • STAC support

    from rio_tiler.io import STACReader
    
    with STACReader("item.json") as stac:
        print(stac.assets)  # available asset
        img = stac.tile(  # read tile for asset1 and indexes 1,2,3
            x,
            y,
            z,
            assets="asset1",
            indexes=(1, 2, 3),  # same as asset_indexes={"asset1": (1, 2, 3)},
        )
    
        # Merging data from different assets
        img = stac.tile(  # create an image from assets 1,2,3 using their first band
            x,
            y,
            z,
            assets=("asset1", "asset2", "asset3",),
            asset_indexes={"asset1": 1, "asset2": 1, "asset3": 1},
        )
    
  • Mosaic (merging or stacking)

    from rio_tiler.io import COGReader
    from rio_tiler.mosaic import mosaic_reader
    
    def reader(file, x, y, z, **kwargs):
        with COGReader(file) as image:
            return image.tile(x, y, z, **kwargs)
    
    img, assets = mosaic_reader(["image1.tif", "image2.tif"], reader, x, y, z)
    
  • Native support for multiple TileMatrixSet via morecantile

    import morecantile
    from rio_tiler.io import COGReader
    
    # Use EPSG:4326 (WGS84) grid
    wgs84_grid = morecantile.tms.get("WorldCRS84Quad")
    with COGReader("my.tif", tms=wgs84_grid) as cog:
        img = cog.tile(1, 1, 1)
    

Install

You can install rio-tiler using pip

$ pip install -U pip
$ pip install -U rio-tiler

or install from source:

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

Plugins

rio-tiler-pds

rio-tiler v1 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 a separate plugin, enabling easier access to more public datasets.

rio-tiler-mvt

Create Mapbox Vector Tiles from raster sources

Implementations

rio-viz: Visualize Cloud Optimized GeoTIFFs locally in the browser

titiler: A lightweight Cloud Optimized GeoTIFF dynamic tile server.

cogeo-mosaic: Create mosaics of Cloud Optimized GeoTIFF based on the mosaicJSON specification.

Contribution & Development

See CONTRIBUTING.md

Authors

The rio-tiler project was begun at Mapbox and was transferred to the cogeotiff Github organization in January 2019.

See AUTHORS.txt for a listing of individual contributors.

Changes

See CHANGES.md.

License

See LICENSE

Project details


Release history Release notifications | RSS feed

This version

3.1.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rio-tiler-3.1.3.tar.gz (131.3 kB view details)

Uploaded Source

Built Distribution

rio_tiler-3.1.3-py3-none-any.whl (198.4 kB view details)

Uploaded Python 3

File details

Details for the file rio-tiler-3.1.3.tar.gz.

File metadata

  • Download URL: rio-tiler-3.1.3.tar.gz
  • Upload date:
  • Size: 131.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.27.1

File hashes

Hashes for rio-tiler-3.1.3.tar.gz
Algorithm Hash digest
SHA256 4277749e40f7f9b708fd77b0137a49449ecf0117f15ff24db48b95a948b354ea
MD5 0a158d0db8caf8cabe533defd095fd59
BLAKE2b-256 2fd29efa622590a624c24f8d3425895334e9359f1c171bbb93a359f38bc6c178

See more details on using hashes here.

File details

Details for the file rio_tiler-3.1.3-py3-none-any.whl.

File metadata

  • Download URL: rio_tiler-3.1.3-py3-none-any.whl
  • Upload date:
  • Size: 198.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.27.1

File hashes

Hashes for rio_tiler-3.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6c2164ddddd711b36c1282fb1fa978584a0c07cc58e35dc9276d9ccdbe77810f
MD5 2223e7279b38d500090975c03b9771c3
BLAKE2b-256 e85f9888dae7b2a05cfdbe36ed5f23a2931daf5da8c48914e0a1d38c8d85ed6f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page