Package: rio-viz
rio-vizA Rasterio plugin to visualize Cloud Optimized GeoTIFF in browser.InstallYou can install rio-viz using pip$pipinstallrio-vizwith 3d feature# 3d visualization features is optional$pipinstall-Upip
$pipinstallrio-viz["mvt"]Build from source$gitclonehttps://github.com/developmentseed/rio-viz.git
$cdrio-viz
$pipinstall-e.CLI$rioviz--help
Usage:rioviz[OPTIONS]SRC_PATHRasterioVizcli.

Options:--nodataNUMBER|nanSetnodatamaskingvaluesforinputdataset.--minzoomINTEGEROverwriteminzoom--maxzoomINTEGEROverwritemaxzoom--portINTEGERWebserverport(default:8080)--hostTEXTWebserverhosturl(default:127.0.0.1)--no-checkIgnoreCOGvalidation--readerTEXTrio-tilerReader(BaseReader).Defaultis`rio_tiler.io.COGReader`--layersTEXTlimittospecificlayers(onlyusedforMultiBandandMultiBaseReaders).(e.g--layersb1--layersb2).--server-onlyLaunchAPIwithoutopeningtherio-vizweb-page.--configNAME=VALUEGDALconfigurationoptions.--helpShowthismessageandexit.Multi Reader supportrio-viz support multiple/custom reader as long they are subclass ofrio_tiler.io.base.BaseReader.# Multi Files as Bands$rioviz"cog_band{2,3,4}.tif"--readerrio_viz.io.MultiFilesBandsReader# Simple Mosaic$rioviz"tests/fixtures/mosaic_cog{1,2}.tif"--readerrio_viz.io.MosaicReader# MultiBandReader# Landsat 8 - rio-tiler-pds# We use `--layers` to limit the number of bands$riovizLC08_L1TP_013031_20130930_20170308_01_T1\--readerrio_tiler_pds.landsat.aws.landsat8.L8Reader\--layersB1,B2\--configGDAL_DISABLE_READDIR_ON_OPEN=FALSE\--configCPL_VSIL_CURL_ALLOWED_EXTENSIONS=".TIF,.ovr"# MultiBaseReader# We use `--layers` to limit the number of assetsriovizhttps://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a-cogs/items/S2A_34SGA_20200318_0_L2A\--readerrio_tiler.io.STACReader\--layersB04,B03,B02RestAPIWhen launching rio-viz, the application will create a FastAPI application to access and read the data you want. By default the CLI will open a web-page for you to explore your file but you can use--server-onlyoption to ignore this.$riovizmy.tif--server-only# In another console$curlhttp://127.0.0.1:8080/info|jq{"bounds":[6.608576517072109,51.270642883468895,11.649386808679436,53.89267160832534],"band_metadata":[...],"band_descriptions":[...],"dtype":"uint8","nodata_type":"Mask","colorinterp":["red","green","blue"]}You can see the full API documentation overhttp://127.0.0.1:8080/docsIn Notebook environmentThanks to the awesomeserver-threadwe can userio-vizapplication in Notebook environment.importtimeimporthttpxfromfoliumimportMap,TileLayerfromrio_viz.appimportClient# Create rio-viz Client (using server-thread to launch backgroud task)client=Client("https://data.geo.admin.ch/ch.swisstopo.swissalti3d/swissalti3d_2019_2573-1085/swissalti3d_2019_2573-1085_0.5_2056_5728.tif")# Gives some time for the server to setuptime.sleep(1)r=httpx.get(f"{client.endpoint}/tilejson.json",params={"rescale":"1600,2000",# from the info endpoint"colormap_name":"terrain",}).json()bounds=r["bounds"]m=Map(location=((bounds[1]+bounds[3])/2,(bounds[0]+bounds[2])/2),zoom_start=r["minzoom"])aod_layer=TileLayer(tiles=r["tiles"][0],opacity=1,attr="Yo!!")aod_layer.add_to(m)m3D (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.DockerReady to use docker image can be found on Github registry.https://github.com/developmentseed/rio-viz/pkgs/container/rio-vizdockerrun\--volume"$PWD":/data\--platformlinux/amd64\--rm-it-p8080:8080ghcr.io/developmentseed/rio-viz:latest\rioviz--host0.0.0.0/data/your-file.tifNotes:--platform linux/amd64is only needed if you are using latest MacOS M1 machines--volume "$PWD":/datais needed to mount your local directory to the docker imagerio-viz's option--host 0.0.0.0is required to access the web serverContribution & DevelopmentSeeCONTRIBUTING.mdAuthorsCreated byDevelopment SeedChangesSeeCHANGES.md.LicenseSeeLICENSE.txt