Questions tagged [rasterio]

open source Python library for reading and writing geospatial raster data

Rasterio

Geographic information systems use GeoTIFF and other formats to organize and store gridded, or raster, datasets. Rasterio reads and writes these formats and provides a Python API based on N-D arrays.

Rasterio employs GDAL under the hood for file I/O and raster formatting. Its functions typically accept and return Numpy ndarrays. Rasterio is designed to make working with geospatial raster data more productive and more fun.

Rasterio is pronounced raw-STIER-ee-oh.

Issue tracker: https://github.com/mapbox/rasterio

816 questions
13
votes
1 answer

Get a window from a raster in rasterio using coordinates instead of row/column offsets, width and height

I am trying to open a windowed dataset in rasterio, but I have a bounding box to work with. I thought it would be easy to do this but it seems that it involves some complicated process with a "Mixin", something I am having a very hard time…
wfgeo
  • 3,538
  • 2
  • 24
  • 47
4
votes
1 answer

Merging Sentinel 2 RGB bands with rasterio

I'm trying to merge Sentinel 2 bands RGB bands with rasterio like this: import rasterio import numpy as np from rasterio import plot from rasterio.plot import…
user153583
  • 41
  • 1
  • 2
4
votes
1 answer

rasterio read from HDFS - rasterio.errors.RasterioIOError: No such file or directory

I am trying to read TIF files from HDFS with rasterio but I keep getting this error: >>> image_uri="hdfs:///user/hadoop/<>.tif" >>> import rasterio >>> rasterio.open(image_uri) Traceback (most recent call last): File "", line 1, in…
and_apo
  • 141
  • 1
  • 3
2
votes
2 answers

module 'rasterio' has no attribute 'open'

I am new to rasterio. I'm trying to open a tif file using this code: import rasterio dataset= rasterio.open('/home/zaianir/Documents/DB/serie_temporelle_s2/serie_temporelle_s2/Sentinel2_T31TCJ_MASKS.tif') But I get this error: AttributeError:…
rim zayani
  • 21
  • 1
  • 2
2
votes
1 answer

Creating an in-memory raster with rasterio

Note that this is not the same as Creating an in memory rasterio Dataset from numpy array. Currently I have a workflow which creates a "template raster" from which other rasters are derived. However, this template raster is written to disk, which is…
wfgeo
  • 3,538
  • 2
  • 24
  • 47
2
votes
1 answer

Why is rasterio getting a segmentation fault trying to read a valid window of data?

I was trying to run my script and got this output: orig file has 104424 rows and 161190 cols total ('window (row_start, row_stop), (col_start, col_stop)', ((55150, 72608), (13802, 31386))) ./my_script: line 3: 20326 Segmentation fault (core…
muse
  • 53
  • 4
1
vote
1 answer

NameError: name 'src' is not defined

I am trying to clip a raster using a geoJSON without writing to my disk. The following code compiles and produces the correct result. import tempfile import fiona import rasterio from rasterio.io import MemoryFile import rasterio.mask from scipy…
notmenotme
  • 23
  • 5
0
votes
1 answer

Pixel values changing when opening and re-saving file with rasterio

I'm using rasterio to analyze satellite imagery stored in JPEG2000 format and am having the problem that pixel values change when opening and then saving the same file again. Any ideas why this happens? with rasterio.open('/tmp/in.jp2') as infile: …
0
votes
3 answers

Cannot get color plot of single band TIFF image with rasterio

I want to work with TIFF files of aeronautical charts supplied by the FAA here. The Python module rasterio seems to be the right tool for my purposes and I’ve been through several tutorials and reference docs. They all work for me, but not with the…
0
votes
1 answer

Merge with custom method in rasterio

I would like to merge a few rasters by using a custom method, and not the default one (reverse painting). For this purpose I am trying to figure out how to pass the custom callable. For example, I would like to merge raster cells by using the cell…
capooti
  • 2,698
  • 21
  • 22
0
votes
1 answer

Rasterio resolution warping via CLI

I'm trying to warp a raster to meet an exact resolution (0.0022500000000000007, -0.0022499999999999977). I've tried using the CLI to no avail. The example in the docs is rio warp input.tif output.tif --dst-crs EPSG:4326 --bounds -78 22 -76 24…