Clean and fast and geospatial raster I/O for Python programmers who use Numpy
Questions tagged [rasterio]
440 questions
2
votes
0 answers
How to open zip raster tif file with spatial information in rasterio python
I am trying to import zip raster tif file which include spatial information such as ovr. ,tfw. and aux.xml. file extensions. However, I couldn't find any code of opening raster zip file.
As follows, tif file is composed of four small files to have…

Valerie
- 21
- 2
2
votes
1 answer
Rasterio: writing tiff with cmap on float values
I have this very simple code:
import numpy as np
from rasterio.transform import Affine
nx = 5
maxx = 4.0
minx = -4.0
res = (maxx - minx) / nx
maxy = 3.0
miny = -3.0
ny = int((maxy - miny) / res)
x = np.linspace(minx, maxx, nx)
y =…

Vincent Bénet
- 1,212
- 6
- 20
2
votes
0 answers
RasterioIOError: Attempt to create new tiff file failed: Permission denied
I am tring to resample Chirps data from 0.25 to 0.0025degrees resolution with the following code, I am still using 1 as an upscale factor to get the code to run:
import rasterio
from rasterio.enums import Resampling
import os
upscale_factor = 1
i…

Core Thee
- 21
- 3
2
votes
1 answer
memory error while processing large geotiffs on python
I have two raster image geotiffs, one of (275521, 329643) dims (let's call this the yearly image) and the other of (73583, 152367) dims (the monthly image). The cell sizes of both rasters are already the same. Using Python, I would like to do the…

jwrap
- 23
- 6
2
votes
0 answers
Missing StripOffsets field when creating a new gtiff
My code that has been working flawlessly (as far as I can tell) now, after some Python and Spyder updates produces error message:
CPLE_AppDefinedError: vaesto1960.tif: MissingRequired:TIFF directory is missing required "StripOffsets" field
when…

mja
- 23
- 2
2
votes
1 answer
Load raster from bytestream and set its CRS
What I want to do : load a raster from an s3 bucket in memory and set its CRS to 4326 (it has no crs set)
What I have so far:
import boto3
import rasterio
from rasterio.crs import CRS
bucket = 'my bucket'
key = 'my_key'
s3 =…

GStav
- 1,066
- 12
- 20
2
votes
0 answers
Problems with GDAL, Libspatialite, Rasterio and Sumo (ImportError, Symbol _GEOSArea not found, Referencing from libspatialite.7.dylib)
I'm new to using gdal/libspatialite/rasterio/sumo and all the family of library and packages that is related to geographical, time and space. But I was just wondering what's this error here? Does anyone have experience with this error before? Have…

M. Fire
- 117
- 2
- 6
2
votes
0 answers
Rasterio instalation error on aws lambda sam build
I'm trying to use lambGeo docker-lambda (https://github.com/lambgeo/docker-lambda) but when I try to build with sam in Cloud9 it's give the error
#include "cpl_conv.h"
^~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with…

Rennan Paloschi
- 36
- 2
2
votes
1 answer
What is the correct way to reproject a raster from a CRS to another using Python?
I have a raster of Land Cover data (specifically this one /eodata/auxdata/S2GLC/2017/S2GLC_T32TMS_2017 in https://finder.creodias.eu) that uses 'epsg:32632' as CRS. I want to reproject this raster on 'epsg:21781'. This is what the raster looks like…

hyperpiano
- 404
- 3
- 9
2
votes
1 answer
How to create TF Dataset from GeoTiff files using custom map() function
I'm trying to create a TensorFlow Dataset from multichannel tiff files. The tfio.experimental.image.decode_tiff(image) from TensorFlow I/O works for 4 channels only so I tried to read it first into numpy using in this case rasterio and then convert…

Lukiz
- 175
- 1
- 9
2
votes
2 answers
How to raise an error that coordinates are out of raster bounds (rasterio.sample)?
I'm using rasterio sample module, list_of_coords are just 3 random points but only 2nd is within the raster bounds:
list_of_coords = [(754.2,4248548.6), (754222.6,4248548.6), (54.9,4248548.4)]
sample =…

Edyficjum
- 81
- 6
2
votes
2 answers
Rasterio " does not exist in the file system, and is not recognized as a supported dataset name."
Following this tutorial: https://www.usgs.gov/media/files/landsat-cloud-direct-access-requester-pays-tutorial
import boto3
import rasterio as rio
from matplotlib.pyplot import imshow
from rasterio.session import AWSSession
s3 = boto3.client('s3',…

isaacm
- 23
- 1
- 4
2
votes
1 answer
Using rasterio to mask/crop a raster results in AttributeError
I'm trying to use rasterio to mask a raster. According to the mask documentation, I need to load a raster file in 'r' mode, which I have done like so:
file = rasterio.open('/data/corine2018_100m/test.tif')
print(file)

Simon
- 991
- 8
- 30
2
votes
1 answer
Rasterio set a unique name for each band
I have an array of shape (b, N, M) which has b bands or images of size N x M. I am able to write them into a multiband .tiff file using:
band_nums = range(1, b + 1)
with rasterio.open(file_path, 'w', **meta_data) as dst:
…

aminrd
- 4,300
- 4
- 23
- 45
2
votes
0 answers
Python rasterio error, unable to open EPSG support file gcs.csv
My question is about setting the GDAL_DATA environment variable to the right directory. I have read some posts where they had the same issue as me and the advice was to set the GDAL_DATA environment, but I'm at a loss of how to do that.
I am using…

Jochem 't Hart
- 41
- 1