Clean and fast and geospatial raster I/O for Python programmers who use Numpy
Questions tagged [rasterio]
440 questions
0
votes
1 answer
Cannot create a virtual raster from a stack array in rasterio
I Need to know how to create a virtual raster. I iterated over a folder, which contains some binary rasters (1, 0). Those rasters I append it into a numpy array using numpy.concatenate. Then I would like to create a virtual raster using the number…

Roger Almengor
- 442
- 5
- 16
0
votes
1 answer
Processing large grids with Dask results in MemoryError
I have three GeoTIFFs, each roughly 500 MB in size on AWS' S3, which I am trying to process on an EMR cluster using Dask, but I obtain a MemoryError after the processing the first tiff.
After reading the GeoTIFF using xarray.open_rasterio(), I…

jwx
- 137
- 1
- 10
0
votes
2 answers
How to read a GeoTIFF after making a WMS request using Python
I'm trying to read altitude GeoTIFFS from a WMS service. I know how to do this with BytesIO if the output format were a JPEG, but applying the same trick for rasterio does not seem to work. Does anyone have any suggestions?
url =…

Daan
- 349
- 4
- 16
0
votes
1 answer
Rasterio rasterize function : unable to insert correct geometries
Trying to rasterize a polylines shapefile with a specific attribute using rasterize function from Rasterio library. This function needs an iterable containing tuples of (geometry, value), with the geometry being a GeoJSON-like object (see…

user11416216
- 41
- 8
0
votes
1 answer
Raster from XYZ csv format
I have a large csv file of 3 columns of x y and z values. I want to do the following:
1. How to convert that csv into vector shape file (points).
2. How to convert the obtained points in step 2 into geo raster.
3. Lets say a set of separate point…

aminevsaziz
- 33
- 9
0
votes
0 answers
Memory error when read in raster file using Rasterio in python
I am trying to use rasterio package in python to read in a raster file.
The raster file is from USDA - CDL layer: https://www.nass.usda.gov/Research_and_Science/Cropland/Release/index.php
I got a memory error when I tried read in the…

Keru Chen
- 387
- 1
- 3
- 11
0
votes
0 answers
Rasterio: ValueError: width and height must be > 0
I trying to crop a geotiff image using rasterio with a geopandas df but I get an error if I use crop=True
src = 'myFile.tiif'
clipped_array, clipped_transform = rasterio.mask.mask(src, [mapping(df['geometry'][0])], crop=True)
ValueError: width and…

emax
- 6,965
- 19
- 74
- 141
0
votes
0 answers
Create a mosaic from minimum number of Sentine-1 SAR images that has a maximum coverage of a polygon shapefile
I have a polygon shapefile that defines a very large ROI. In order to cover this ROI, I need to create a mosaic of rasters (Sentinel-1 images). The mosaic needs to be made with minimum number of rasters and should cover the ROI completely.
If I do a…

webapp
- 710
- 1
- 6
- 16
0
votes
0 answers
Compute zonal statistics for a numpy array in rotated-coordinate space
BLUF::
I'm having trouble computing zonal statistics with a rotated array using the rasterstats package. I'm guessing the problem is with my affine matrix, but I'm not completely sure. Below is the affine transform matrix and output:
| 951.79, 0.45,…

Jason Bellino
- 494
- 1
- 6
- 18
0
votes
2 answers
Match raster cell size to another raster
I've been using the code posted here to match a rasters' cell size to another raster. More specifically, I have sentinel-2 band (jp2 format) band with 20m cell\pixel size and I would like to split\resample\resize it to 10m. What I did so far, which…

user88484
- 1,249
- 1
- 13
- 34
0
votes
1 answer
Reduce raster size after masking area of interest
I try to mask AOI area on raster image with rasterio
I use rasterio to mask area of interest and then define the rest extent as no data
My goal is to keep original raster bounds ,select area of interest, but reduce image size
I use following…

Toren
- 6,648
- 12
- 41
- 62
0
votes
1 answer
How to project GeoTIFF to specified area extent?
I am trying to display GeoTIFF file in specified area. What I want to do is project multiband GeoTIFF file to specified area.
My GeoTIFF is satellite image containing 3 bands over area of Europe. I want to project it to area of Central Europe…

Lubomir Franko
- 13
- 3
0
votes
1 answer
How to calculate the Pearson correlation coefficient (r) between population and percentage of land cover type?
My following code outputs what appears to be a list of dictionaries for each census tract, which is basically like a designated area of land. I was able to calculate the population and the percentage of a few different land cover types. Now I want…

Yuen_
- 1
0
votes
1 answer
rasterio: center crop geotiff, profiles and window_transform
I'm trying to do a simple center crop of as square geotiff using rasterio.
I crop the image using numpy, which works as expected, then update the image profile's height and width.
I also update the affine transform using src.window_transform, but…

brook
- 247
- 2
- 15
0
votes
1 answer
rasterio - load multi-dimensional data
I just discovered rasterio for easy raster handling in Python. I am working with multi-dimensional climate data (4D and 5D). I was successful to open and read my 4D-NetCDF file with rasterio (lat: 180, lon: 361, time: 6, number: 51). However, the…

jwagemann
- 1
- 2