Clean and fast and geospatial raster I/O for Python programmers who use Numpy
Questions tagged [rasterio]
440 questions
0
votes
0 answers
Extract raster value using multipolygon type of shape using python
I am trying to export raster values using multipolygon shapefile in python. I have found the answer here, but the calculation there is not valid for multipolygon. Could please someone guide me, how i should correct the code in order to have not…

Lusia
- 23
- 1
0
votes
0 answers
Wrong min value for a geo tif file
I am working on pre-processing a few geo-tif files. I want to obtain the minimum value for my raster image. My OS is Linux and Rasterio version 1.3.3. When I run my script in a conda environment, I realized that the minimum value is given as zero…

carol
- 1
- 1
0
votes
0 answers
Troubleshooting scipy.ndimage.label on raster
I would like to process a geotif raster using scipy.ndimage.label into regions defined by adjacing equal raster values. The original file looks as below.
Landuse raster
When plotting using show_hist the histogram looks as follows.
Histogram…

Sebastian
- 1
- 2
0
votes
0 answers
How to change the origin point of a geotif in python
I have a raster image from hydraulic modelisation, i want to change some values, and create a new raster to open it in Qgis. I have the following script:
H_export is the name of my raster
# for opening the raster read-only and saving it on a…

John 84
- 1
- 1
0
votes
0 answers
Is there a rasterio gdal2tiles equivalent?
Does any one know of a rasterio equivalent to gdal2tiles script?
I need to split geotiff file to tiles of different zooms.

Ze'ev Dreifuss
- 1
- 2
0
votes
1 answer
Loop through each pixel of a raster stack and return a time series of pixels using Python
I'm new to Python language and I'm trying to loop through a rasterstack and store pixels in a time-series manner.
For example, suppose I have three rasters of three dates, for 2020, 2021, 2022:
A = array([[[0.2, 0.3, 0.4, 0.5,
0.6,…

kolrocket
- 9
- 3
0
votes
0 answers
rasterio: clip polygons from rasterized features
I rasterized vectors using features.rasterize. Then I'd like to clip polygons from that raster but the mask.mask function requires a dataset, not an image array.
Here's how I create the raster:
rasterized = features.rasterize(shapes,
…

nside
- 113
- 2
- 8
0
votes
0 answers
Rasterio Reprojection
I am trying to create a function to re-project rasters in a dataset. However I get an error.
RasterioIOError: Attempt to create new tiff file 'E:/MapsForTesting/Reprojected' failed: Permission denied
How do I allow my computer or rasterio to write…
0
votes
1 answer
Raster and Shapefiles not lining up using Geopandas, Rasterio, and Contextily
I am trying to get a DEM raster to line up with a shapefile in Python, but it will not show up no matter what I do. This is for lab exercise, the entire rest of the exercise relies on these lining up, as I will be extracting data from the raster and…

MrBlueSky
- 1
- 1
0
votes
0 answers
How to display a raster/hyperspectral image in Pyqt5 canvas?
I want to display/embed a hyperspectral image (having bands around 200)in my user interface which I'm developing using python (pyqt5 + Qt Designer).
It's working totally fine with 2d normal image but with hyperspectral image its not working.
I…
0
votes
0 answers
No module named 'rasterio' in docker
I'm working with docker and try to use the module rasterio but I get the error No module named 'rasterio'. In the requirements.txt of the docker image, rasterio is…

Akut Luna
- 191
- 2
- 10
0
votes
0 answers
How to compare two geotiff datasets
I have two geotiff with the same projection and the same dimension. One dataset is related to population and the other one to distances. I want to count the population only in the pixels where the distance is greater than 10. This is what I am…

emax
- 6,965
- 19
- 74
- 141
0
votes
0 answers
rioxaray plot geotiff and show lat lon coordinates
I have some code with a sample geotiff file, I'd like the plot to show the lat/lon coordinates and not the pixel (?) values.
How can I do that?
import rioxarray
fl = 'https://download.osgeo.org/geotiff/samples/gdal_eg/cea.tif'
da =…

Rafael
- 3,096
- 1
- 23
- 61
0
votes
1 answer
converting geotiff to datarame and preserving lat/lon in columns
I downloaded a geotiff from here: https://www.nass.usda.gov/Research_and_Science/Crop_Progress_Gridded_Layers/index.php
(file also available: https://drive.google.com/file/d/1XcfEw-CZgVFE2NJytu4B1yBvjWydF-Tm/view?usp=sharing)
Looking at one of the…

Rafael
- 3,096
- 1
- 23
- 61
0
votes
0 answers
Add data in two xarray rasters with different dimensions
I want to add a bunch of different raster maps in datasets with common data variables.
So far, I have been using my own complicated function to fix this problem (See below).
But I have a suspicion this is not optimal, and I seem to be getting some…