Questions tagged [rasterio]

Clean and fast and geospatial raster I/O for Python programmers who use Numpy

Filter by
Sorted by
Tagged with
0
votes
0answers
21 views

Open more than one GeoTiff file with Rasterio and PyCharm at once

I have just started to deal with Rasterio and programming. And have the following problem that I have 20 GeoTiff files of which I need the extent. But I am not able to open and read more than 1 ...
0
votes
0answers
21 views

Create a grid layer over existing raster layer using python modules

I have a DEM raster layer and want to create a square grid of size 10x10 and align into my raster using python modules. I have tried to implement below code. But I'm not sure of what geometry to be ...
2
votes
2answers
60 views

Raster to GeoPandas

I have written a little script to raster to GeoPandas dataframe: with rasterio.open("INPUT FILE", 'r') as raster: df = pd.DataFrame() puntos_calados_combinados=[] puntos=[] ...
2
votes
2answers
50 views

Open and plot a large raster with Python xarray

I have an ASCII Esri file of the type: ncols 5201 nrows 4001 xllcorner -65 yllcorner -35 cellsize 0.025 NODATA_value -9999 -9999 -9999 -9999 255 256 -9999 -9999 ... -9999 -9999 -9999 -9999 -9999 -9999 ...
1
vote
1answer
34 views

Georeferencing Himawari-8 images with Rasterio

I was pulling some Himawari-8 images from RAMMB here and wanted to geo-reference the high res 5500 x 5500 images. I found a related question and answer using GDAL here which does work fine but I was ...
3
votes
1answer
55 views

Iterating over shapefile to mask and extract raster data in Python

I have a shapefile that is a grid with multiple polygons that have a specific id in them ranging from 1 to 50. Each polygon overlays an agriculture research plot that I would like to calculate ...
1
vote
2answers
35 views

Raster has a “none” CRS

My specifications : Python 3.9.1 gdal 3.1.4 rasterio 1.1.8 Windows 10 Business conda version 4.9.2 I have a raster that has no crs : os.chdir(path) file_list= os.listdir() file_list[0] >>> ...
0
votes
0answers
27 views

Apply function to calculate NDVI on list of images

I'm looking for a simple for-loop to apply a function to create NDVI images from an original list and save those in a new folder. I've created a function and show how I would apply it on one image but ...
-2
votes
1answer
49 views

Extracting the pixels value inside the circle drawn over the raster file using Python [closed]

I have a GeoTIFF file and a series of the center point. I want to create/draw the circle over the GeoTIFF using these center points and extract the pixels value inside those circles. I want to do it ...
-1
votes
1answer
35 views

Using rasterio.crs module [closed]

I try to project a raster into another projection and I cannot manage to use the rasterio.crs module I can obtain the CRS of a file using the following code : import rasterio as rio with rio.open('...
1
vote
1answer
33 views

Define Affine transform with rasterio

I have transform vector that I have gotten from bbox with sentinelhub: transform=bbox.get_transform_vector(10,10) >>> (-101.7359960059834, 10.0, 0, 20.8312118894487, 0, -10.0) The type of ...
2
votes
0answers
22 views

rasterio reprojection produces no visible changes

I've been trying to perform translation of a raster using the reproject function from rasterio.warp. I've calculated the translation amount in X and Y from a series of "control points" ...
1
vote
0answers
21 views

Using a shapefile as mask with rasterio mask gives different affine transforms with rasters of the same projection and resolution

I have a list of n file paths to geotiffs of the same resolution and projection but with varying extents. In brief the goal is to use Rasterio's mask module to use a shapefile containing a single ...
1
vote
1answer
49 views

Rasterio and OpenCV shows two different pixel arrays for same image [closed]

I am using Rasterio to open a panchromatic GeoTiff image file. The syntax I used to open the GeoTIFF file using Rasterio: import rasterio src = rasterio.open('...
1
vote
1answer
54 views

Weird coordinates after converting numpy array to raster

I have the NumPy array and its bounding box coordinates. I have tried to convert it into raster using rasterio, based on this answer, and it did save it as raster, but when I use rasterio.show the ...
0
votes
0answers
40 views

Reproject a NumPy array with affine transform

I have NumPy array with one band and no CRS. I do have the shape of the image and the coordinates of the bbox, in WGS84. I would like to reproject it based on bounding box and the shape. I have ...
0
votes
2answers
25 views

Rasterio Python not reading “pixel” values correctly

I'm trying to simply get the NIR values from Sentinel2 in python. It should be as simple as #import required libraries import rasterio band8 = rasterio.open('R10m/B08_10m.jp2', driver='JP2OpenJPEG') #...
1
vote
0answers
20 views

Missing region when reprojecting a raster using rasterio

I'll try my best to describe the issue although it's really confusing me so I'm not sure how well I can explain it. I'm trying to reproject MODIS daat in the form of a raster that covers the entire ...
0
votes
0answers
30 views

Creating raster stack from xarray in Python

I am trying to create a raster stack from an xarray dataset which I obtained from multiple NetCDF files. import netCDF4 as nc import rasterio as rio import numpy as np import xarray as xr import os ...
2
votes
0answers
29 views

Not able to extract values from raster TIFF in EPSG:26912, but can in EPSG:4326?

I have an elevation file (.tif) in EPSG:4326 and point data for wildfire occurrence in the same projection. When I use this projection, I can use the following code to extract the elevation value, for ...
1
vote
2answers
24 views

What is the raster merge criteria algorithm on rasterio.merge?

I'm creating a mosaic from many sentinel images with a bunch of overlapping areas, although I'm trying to understand what is criteria. For example: This is a small piece totally clear of clouds And ...
1
vote
0answers
26 views

GDAL/rasterio multiple windowed reads in one I/O call

I have a cloud optimized geotiff that I need to read multiple small windows from. My current implementation opens the geotiff using rasterio and then performs the windowed reads iteratively. However, ...
3
votes
0answers
27 views

Inconsistently getting “Input shapes do not overlap raster”, CRS appear to match

Masking topographic raster data by a shapefile (bedrock geology polygon). Following this guide I do this: with fiona.open("geology.shp", "r") as shapefile: geology_mask = [...
2
votes
1answer
51 views

Interpolate only no value cells not connected to the egde of the raster

Is it possible to interpolate geotiff raster no value cells that are not connected to the geotiff border by other no value cells with QGIS or other freely available tools? The grey areas are gaps. I ...
0
votes
0answers
52 views

How can I clip the NDVI TIFF file using rasterio mask and fillnodata. I tried using the following approach but edges are not getting smooth

While clipping TIFF file edges are not getting clipped and smooth and cropped. with fiona.open(TiffFilePath, "r") as shapefile: shapes = [feature["geometry"] for feature in ...
0
votes
1answer
34 views

Rasterio: search_criteria

I read the documentation of Rasterio and I got a problem. Because my files begin with 6 or 7 but in documentation they show how to work with 1 letter, like below: search_criteria = "L*.tif" ...
1
vote
1answer
45 views

Extracting shapes from GeoTIFF using rasterio returns excessive number of polygons

I am using the shapes interface of rasterio to extract polygons from a GeoTIFF image. rasterio returns an excessive number of polygons which is not expected. It is taking a long time to extract a ...
1
vote
1answer
75 views

How to create a raster delineating all drainage basins using pysheds python

I am going through the tutorial of "Pysheds" available in the following website https://www.hatarilabs.com/ih-en/elevation-model-conditioning-and-stream-network-delimitation-with-python-and-...
2
votes
1answer
36 views

Affine Tranformation Matrix; shapely asks 6 coefficients, but rasterio delivers 9; how to translate

Some lines have been extracted via scikit-image, now tho goal is to vectorize them within the origin coordinate reference system #some geotif opened with rasterio src = rasterio.open(raster_path) ...
2
votes
1answer
48 views

GeoTIFF is stretched sideway when translating CRS to EPSG:4326 from EPSG:32654

I want to convert a GeoTIFF's coordinate reference system to EPSG:4326 from EPSG:32654. But the output image is stretched to the side. I have tried two different methods (gdalwarp and rasterio), but ...
1
vote
1answer
136 views

Merging multiple TIFF files into one TIFF file with multiple bands using Python

I am trying to merge multiple TIFF files into one multi-band TIFF using Python. I used subprocess.checkoutput('python gdal.merge.py') and it was working well. But I am looking for another way to do ...
1
vote
1answer
32 views

How to raster calc on rasterio with two image not on the same band

I want to compute for an NDVI using rasterio. I must use two raster images that are adjacent to each other. They do not have the same sizes. They have a great overlap area which I can calculate NDVI ...
0
votes
2answers
36 views

Export numpy array with rasterio

I have made some processing on some satellite images as numpy arrays. I want to export the data as tif images again to see the result I read ùy image with rasterio sentinel2 = rasterio.open('sentinel2....
2
votes
1answer
43 views

Create a raster from polygon

I have a shapefile of thousands of polygons. I'm looking to loop through each polygon and create a raster of the shapefiles boundaries for each polygon. I'm looking for each raster to have the value ...
5
votes
0answers
81 views

Georeference and warp a drone image based on sensor orientation and location

I have been flying some drone surveys over the ocean and need to properly project and georeference my images. I have all the information I think I need: lat, lon, altitude, yaw, pitch, and roll along ...
2
votes
0answers
28 views

How to calculate Multispectral Vegetation Indices using Python

I am trying to calculate Multispectral Vegetation Indices from multi spectral photos, using Python. So far, I've managed to calculate the NDVI, which is easy to implement as there are many examples ...
0
votes
1answer
37 views

Inaccurate georeferencing when plotting raster files using rasterio

I am trying to develop a plot of a raster image with a background map. I used rasterio for reading the raster file and contextily for obtaining the background map following this tutorial. The plotted ...
1
vote
1answer
56 views

Write numpy ndarray as TIFF with rasterio does not work

I have ndarray with shape of (12, 773, 1231) ((12 bands)). I want to save it as array in order to reproject it. I have image with the same shape and image but reprojected so I baiscally want my ...
0
votes
1answer
79 views

How to create a GeoPandas GeoDataFrame from rasterio features?

I try to create a GeoDataFrame of paches of same values in a binary raster using rasterio and GeoPandas. data_file is a binary TIFF raster with 0 where there is no deforestation and 1 if there is a ...
1
vote
0answers
8 views

Rasterio showing a blue (blank) image wrong [closed]

I am trying to open a raster in my Jupyter Notebook using rasterio. I began with two Landsat 8 images, which I processed in QGIS to calculate the NDVI. I want to plot the original images used for the ...
1
vote
1answer
15 views

Rasterio symbology

I am having a problem with a raster dataset. I am trying to use a symbology for a continuous raster type but the result is as shown in the image. The code is: import os import numpy as np import ...
2
votes
1answer
253 views

Georeferencing of PNG and Convert to TIFF using Python

I have a PNG image which I am trying to georeference using four corners of coordinate information of the defined input image. When I am trying to convert PNG to TIFF, I am getting 3 bands (R,G,B) ...
0
votes
1answer
53 views

Using “raster.transform” function of “rasterio” in Python

When I execute the "raster.transform" function in Python it returns me a matrix. What I can understand is that it tells me my data has a 10 m pixel resolution, It also tells me that my left ...
1
vote
1answer
57 views

Aligning Rasters With Different Resolutions and CRS

I have two rasters. Let's call them "Green" and "Red". The details for the "Green" raster are: The details for the "Red" raster are: There is a small skew ...
2
votes
1answer
129 views

Determining the Unit of Spatial Resolution of a raster image in Python

I have some raster images, and I would like to determine the GSD using Python. I know that I can use rasterio.transform() or gdal.GetGeoTransform() to extract the spatial resolution of the image. ...
0
votes
0answers
21 views

How can I combine USGS GeoTIFF quadrangles into a single GeoTIFF using `rasterio`?

There are several similar questions about this but most as about QGIS and are non-specific about the data involved. I have a specific data source/format and I need to use Python, and preferably ...
0
votes
2answers
46 views

Rendering single-band raster in Python with set color ramp

I have a set of single-band gray-scale rasters that I want to save as a rendered GeoTIFF/image that is colored according to a specific color ramp. For example, if I had some NDVIs that range from a ...
1
vote
0answers
24 views

Cut NetCDF files by shapefile [duplicate]

I have a large dataset of global .nc files and I am trying to clip them to a smaller area. I have this area stored as a .shp file. I have tried using GDAL from QGIS but needs to do this by converting ...
-1
votes
1answer
40 views

GeoJSON to masks [closed]

I need to use the GeoJSON file and TIFF images to produce masks. Is there a Python program that takes GeoJSON file and TIFF image as input and produces masks?
0
votes
1answer
67 views

Rasterio doesn't show the coordinates when using “imshow ”

I have sentinel 2 image and I use rasterio to display it. I am using "imshow" to display it. when I display it, it doesn't show any coordinates: src=rasterio.open('14072020.tif') #Display ...

1
2 3 4 5
10