Clean and fast and geospatial raster I/O for Python programmers who use Numpy
Questions tagged [rasterio]
440 questions
0
votes
1 answer
How to find corresponding pixels between two geospatial raster data with different Coordinate Reference System?
I have a few Landsat 8 images that have CRS = EPSG:32610. I have a ground truth image in which each pixel represents a class for that region with CRS = EPSG:4326.
I tried to convert the CRS of ground truth in rasterio as documentation says like…

leo
- 802
- 6
- 15
0
votes
1 answer
Find lat/long coordinates from pixel point in .geotiff using python and gdal
I have points defined by pixel coordinates in a .geotiff imagesat.
I am trying to convert these pixel coordinates into longitude and latitude.
At first a tried to adapt the given code from the inverse question i previously asked here
def…

drheinrich940
- 143
- 1
- 13
0
votes
2 answers
How to optimize a Python loop that replaces raster nan values with other raster region mean values
I need to read 2 rasters, one a satellite image (target) and the other regions of this image (segmentation). The target image present numeric values and nans. The segmentation image are regions, in which each pixel with the same value are from the…

MarujoRe
- 202
- 1
- 6
0
votes
0 answers
Module rasterion.io not being found even it is installed while gropandas plotting
I am trying to plot with geopandas with this [tutorial][1]. However, whenever I run this: I find following errors:
Traceback (most recent call last):
File…

Mahin
- 449
- 2
- 14
- 25
0
votes
1 answer
Can I append a band with different dtype to a geotiff using rasterio?
I have a tiff file named test.tiff. It has 4 bands of dtype uint8. Using these bands I calculated the NDVI which I would now like to save as a fifth band in the test.tiff. Only now I would like to save it as a float32.
Is there a way to do this…

Daan
- 349
- 4
- 16
0
votes
1 answer
Transform Geodetic to Image Coordinate System based on RPC
I am looking for the rasterio function that does forward transformation from geodetic coordinate system to image coordinate system based on RPC. Can anyone help me within this context?
0
votes
1 answer
Rasterio unable to open .jp2 files
I'm beginning to play with GeoPySpark and am implementing an example notebook.
I successfully retrieved the images
!curl -o /tmp/B01.jp2 http://sentinel-s2-l1c.s3.amazonaws.com/tiles/32/T/NM/2017/1/4/0/B01.jp2
!curl -o /tmp/B09.jp2…

Jessica Chambers
- 1,246
- 5
- 28
- 56
0
votes
1 answer
Coordinate reference system transformation in rasterio for geotif
I have the following geotif file. I wrote simple script to transform its coordinates into google maps coordinate system
import rasterio
import rasterio.features
import rasterio.warp
DATA = "/Users/Desktop/TextureUSDA_23/"
def main():
with…

mr.M
- 851
- 6
- 23
- 41
0
votes
1 answer
Unable to clip image using rasterio.mask
I am trying to clip my tiff file either using a shape or geojson file in python. The code for clipping the image is -
from datetime import date
import geopandas as gpd
import rasterio
import rasterio.features
import rasterio.warp
from…

Smita Ahinave
- 1,901
- 7
- 23
- 42
0
votes
1 answer
Chaining virtual file system drivers in rasterio
In plain gdal it's quite straightforward to chain multiple vsi drivers to e.g. directly access a .tif.gz file:
import gdal
import rasterio as rio
## just an example, no real URL
# will work
ds =…

Val
- 6,585
- 5
- 22
- 52
0
votes
1 answer
How to correctly write a raster image (tif) from a value matrix with python
I am starting to work with Geographic Information Systems and I need some advice from you. I need to convert tif (raster) into a 3D matrix, for example, the previous matrix in pandas:
M = [[1, 1]
[2, 4]
[3, 1]]
After exploring python…

henryr
- 169
- 1
- 15
0
votes
1 answer
How to make pixels with values less than 0.2 transparent so the base map in the background can be visible in Python?
I am interpolating point data to generate dynamic flood inundation maps in a for loop. This produces a flood map in each iteration where the pixel values show the probability of water presence. However, I'm unable to make the dry pixels (values <…

srk
- 21
- 3
0
votes
0 answers
How do you convert jpeg (uint8) to tiff (float32) format in Python for raster band indices?
I need to develop an initial python code to take 8-bit unsigned integer JPEG images that have RGB bands, run a VARI band index: (Vari = (green - red) / (green + red - blue)), and then provide the output image with values ranging from -1 to 1.
I…

CJM305
- 1
- 3
0
votes
1 answer
Apply Boxcar average to geospatial image
Assuming that the following array A is the result of reading a GeoTIFF image, for example with rasterio where nodata values are masked which is the array B.
I would like to apply a boxcar average smoothing over a square neighbourhood. The first…

Peterhack
- 941
- 4
- 15
- 34
0
votes
1 answer
Gdal memory leak but Anaconda won't let me upgrade to newer version
I am trying to run some simple operations using Rasterio and GDAL but the memory leaks are just killing my computer. I just wanted to open and plot a tif file and it took about 50 GB!!! of Ram, even though the image itself is only 1.2 GB.
The code…

krishnab
- 9,270
- 12
- 66
- 123