Skip to main content

Visualize Cloud Optimized GeoTIFF in browser

Project description

rio-viz

Packaging status CircleCI codecov

Rasterio plugin to visualize Cloud Optimized GeoTIFF in browser.

Freely adapted from the great mapbox/rio-glui

Install

You can install rio-viz using pip

Note: 3d visualization features are optional, you'll need to have cython==0.28 installed before being able to install rio-viz

$ pip install rio-viz

with 3d features

$ pip install -U pip cython==0.28
$ pip install rio-viz[mvt]

Built from source

$ git clone https://github.com/developmentseed/rio-viz.git
$ cd rio-viz
$ pip install -e .

How To

$ rio viz --help                                                                                                                  
Usage: rio viz [OPTIONS] SRC_PATHS...

  Rasterio Viz cli.

Options:
  --nodata NUMBER|nan        Set nodata masking values for input dataset.
  --minzoom INTEGER          Overwrite minzoom
  --maxzoom INTEGER          Overwrite maxzoom
  --style [satellite|basic]  Mapbox basemap
  --port INTEGER             Webserver port (default: 8080)
  --host TEXT                Webserver host url (default: 127.0.0.1)
  --mapbox-token TOKEN       Pass Mapbox token
  --no-check                 Ignore COG validation
  --simple                   Launch simple viewer
  --help                     Show this message and exit.

Note: 

You can provide multiple paths (e.g: bands stored as separate path) to rio-viz:

```bash
$ rio viz https://s3.eu-central-1.amazonaws.com/remotepixel-eu-central-1/sentinel-s2-l1c/tiles/18/T/XR/2019/4/21/0/B0{4,3,2}.tif

Experimental

rio-viz supports Mapbox VectorTiles encoding from a raster array. This feature was added to visualize sparse data stored as raster but will also work for dense array. This is highly experimental and might be slow to render in certain browser and/or for big rasters.

Template Factories

The HTML templates provided by rio-viz may be injected into an external FastAPI app using the factory functions defined in rio_viz.templates.template. This allows the raw HTML to be reused in external applications without deploying rio-viz. The parameters passed to each factory define which endpoints are used by the template. For example, if the path operation to create a tilejson is bound to the create_tilejson function and the path operation to read metadata about a COG is bound to the read_info function, a dependency can be created as follows:

from rio_viz.templates.template import create_simple_template_factory

dependency = create_simple_template_factory(tilejson="create_tilejson", info="read_info")

Contribution & Development

Issues and pull requests are more than welcome.

dev install

$ git clone https://github.com/developmentseed/rio-viz.git
$ cd rio-viz
$ pip install -e .[dev]

Python3.7 only

This repo is set to use pre-commit to run my-py, flake8, pydocstring and black ("uncompromising Python code formatter") when commiting new code.

$ pre-commit install

Authors

Created by Development Seed

Project details


Download files

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

Source Distribution

rio-viz-0.3.0.tar.gz (22.9 kB view details)

Uploaded Source

File details

Details for the file rio-viz-0.3.0.tar.gz.

File metadata

  • Download URL: rio-viz-0.3.0.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.2

File hashes

Hashes for rio-viz-0.3.0.tar.gz
Algorithm Hash digest
SHA256 06e46eb68d6668614c6033780e4a3793170b6c4967eef7307ce0287c2c7994da
MD5 3b78887e1c809b4e5e7617d35ce2ad22
BLAKE2b-256 8805ee603e9bac9929973948d1c27c0e39e10a4e5b26013a2e8a79887792f296

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