跳转到主要内容

友好的Rasterio插件,用于读取栅格数据集。

项目描述

rio-tiler

rio-tiler

友好的Rasterio插件,用于读取栅格数据集。

Test Coverage Package version Conda Forge Downloads Downloads Binder


文档: https://cogeotiff.github.io/rio-tiler/

源代码https://github.com/cogeotiff/rio-tiler


描述

rio-tiler最初是为了从大型栅格数据源创建可滑动地图瓦片,并在网络地图上动态渲染这些瓦片而设计的。自从rio-tiler v2.0以来,我们添加了许多辅助方法来从任何由Rasterio/GDAL支持的栅格源读取数据和元数据。这包括通过HTTP、AWS S3、Google Cloud Storage等本地和远程文件。

在底层,rio-tiler仅仅是rasterioGDAL库的包装。

功能

  • 读取GDAL/Rasterio支持的任何数据集

    from rio_tiler.io import Reader
    
    with Reader("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
    
  • 用户友好的tilepartfeaturepoint读取方法

    from rio_tiler.io import Reader
    
    with Reader("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
    
  • 在数据读取时启用属性分配(例如nodata)

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

    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},
        )
    
  • Xarray支持 (>=4.0)

    import xarray
    from rio_tiler.io import XarrayReader
    
    ds = 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"]
    with XarrayReader(da) as dst:
        print(dst.info())
        img = dst.tile(1, 1, 2)
    

    注意:XarrayReader需要安装可选依赖项,请运行pip install rio-tiler["xarray"]

  • 非地理图像支持 (>=4.0)

    from rio_tiler.io import ImageReader
    
    with ImageReader("image.jpeg") as src:
        im = src.tile(0, 0, src.maxzoom)  # read top-left `tile`
        im = src.part((0, 100, 100, 0))  # read top-left 100x100 pixels
        pt = src.point(0, 0)  # read pixel value
    

    注意:ImageReader也与适当的地理参照栅格数据集兼容。

  • 镶嵌(合并或堆叠)

    from rio_tiler.io import Reader
    from rio_tiler.mosaic import mosaic_reader
    
    def reader(file, x, y, z, **kwargs):
        with Reader(file) as image:
            return image.tile(x, y, z, **kwargs)
    
    img, assets = mosaic_reader(["image1.tif", "image2.tif"], reader, x, y, z)
    
  • 通过morecantile原生支持多个TileMatrixSet

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

安装

您可以使用pip安装rio-tiler

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

或从源安装

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

插件

rio-tiler-pds

rio-tiler v1包含从云服务提供商读取流行公共数据集(例如Sentinel 2、Sentinel 1、Landsat 8、CBERS)的几个辅助工具。此功能现在作为一个单独的插件存在,使访问更多公共数据集更加容易。

rio-tiler-mvt

从栅格源创建Mapbox矢量瓦片

实现

titiler:一个轻量级云优化GeoTIFF动态瓦片服务器。

cogeo-mosaic:根据mosaicJSON规范创建基于云优化的GeoTIFF镶嵌。

贡献与开发

CONTRIBUTING.md

作者

rio-tiler项目始于Mapbox,并于2019年1月转移到cogeotiff Github组织。

AUTHORS.txt以获取个人贡献者列表。

变更

CHANGES.md

许可协议

LICENSE

项目详情


发布历史 发布通知 | RSS源

下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

rio_tiler-6.7.0.tar.gz (170.3 kB 查看哈希值)

上传时间

构建分发

rio_tiler-6.7.0-py3-none-any.whl (264.0 kB 查看哈希值)

上传时间 Python 3

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面