Questions tagged [rasterio]

open source Python library for reading and writing geospatial raster data

Filter by
Sorted by
Tagged with
1 vote
0 answers
16 views

How to preserve scale in rasterio

I am masking a GeoTiFF using rasterio. I have datasets to clip. Some images are not scaled properly when loaded to QGIS. How do you preserve the scale of the input image to the masked image using ...
  • 463
1 vote
1 answer
25 views

Masking in rasterio changes the values the output file

I am masking a raster file using rasterio. I am doing this using the mask function. The result of the masking changes the value of the pixels when loaded to GIS. import fiona import rasterio import ...
  • 463
1 vote
1 answer
24 views

How to write a single band colored PNG in rasterio?

I am trying to convert a single band GeoTIFF file to PNG with pseudocolor. What I am trying to achieve is not a thumbnail but an image with geospatial reference that I can serve as an Image Overlay in ...
  • 463
0 votes
1 answer
28 views

Using rasterio to read NDVI data from GIMMS's COG products

I try to retrieve some NDVI data from GIMMS' cloud-optimised geotiffs using rasterio. However, when I use the following code I always get back this 403 error: rasterio.errors.RasterioIOError: HTTP ...
  • 487
0 votes
1 answer
23 views

Load, georeference (from list of 2D stacked coordinates) and convert ungeoreferenced GRD files with python

I have a list of GRD files that are not georeferenced, they come with a TXT file containing 2d stacked coordinates. I am wondering if anyone would know how to load, georeference and convert those GRD ...
2 votes
1 answer
75 views

Gaps between tiles after merging

I have some TIFF tiles that belongs to Sentinel 2. I downloaded them by using Sentinelsat library. Their coordinates system is mixed; that is why I need to reproject them for a common coordinate ...
  • 33
0 votes
0 answers
17 views

Rasterio does not merge correctly

I downloaded some Sentinel-2 data by using python sentinelsat library. Then I grouped the tiles and processed same tiles due to obtain one tile for each groups. To merge these tiles I used rasterio....
  • 33
0 votes
1 answer
30 views

Different spatial coverage in scenes downloaded from USGS LANDSAT data

I am using M2M Python API to download scenes of Landsat 8 data for North America region, as shown in the code snippet below. datasetName = "landsat_band_files_c2_l1" spatialFilter = {'...
0 votes
0 answers
34 views

Generate points inside polygons in Python

I have one raster image and one vector field. I cut the raster image according to the vector area. I want to get the coordinates of each pixel of the cut image, but I couldn't. While the expected ...
0 votes
0 answers
73 views

y dimension not found while converting NetCDF to Raster with rasterio

So I have a NetCDF file from the TROPOSIF website and converted it to xarray dataset that looks like this: And I'm trying to convert it to a tif file but while I'm trying to export the SIF_735 ...
  • 49
2 votes
0 answers
34 views

Calculation of downscale factor for downsampling image using Rasterio

I have image with resolution of 30cm in WGS84 EPSG 4326. I want to down-scale the image to get the same image but with 50cm size of pixel. I have used Rasterio documentation (pages 80-81) in order to ...
  • 1,917
1 vote
1 answer
57 views

Rasterio forces me to write intermediate files which I don't need

I would like to first merge rasters and then clip the resulting raster using geopandas and rasterio. Here's what I came up with so far: import rasterio import glob from rasterio import merge from ...
  • 3,392
0 votes
0 answers
32 views

Getting error out of bounds when it is not out of bounds

I have a raster and a shapefile. The shapefile bounds is within the raster bounds but I'm getting error related to bounds when I use the buffer method. Performing the following operations on it >&...
  • 169
0 votes
0 answers
26 views

Speeding up WarpedVRT in rasterio (change CRS + resample)

Given a source GeoTIFF of some unknown resolution (better than the target), what is the quickest way to re-project it in-memory to the desired GSD? Masking in the input data should be preserved. ...
  • 101
0 votes
0 answers
24 views

Edit pixels in a GeoTIFF while preserving ALL metadata

I'm having an issue where I need to read in a GeoTIFF, modify some pixel values (setting specific locations to the NODATA value), and then overwrite the original GeoTIFF. The trick is I want to ...
  • 141
1 vote
1 answer
47 views

Extract raster value using multipolygon shapefile 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 ...
  • 101
1 vote
1 answer
58 views

Extract the raster values for geometry using Python

I tried to extract the pixel value of the raster for the points with the following code. for point in df['geometry']: x = point.xy[0][0] y = point.xy[1][0] row, col = raster.index(x,y) ...
0 votes
0 answers
91 views

Rasterio S3 read: does not exist in the file system, and is not recognized as a supported dataset name

I am unable to read data from S3 using rasterio. This is the public resource I am trying access which is successful when using AWS CLI https://registry.opendata.aws/deafrica-sentinel-1/ import os ...
0 votes
1 answer
53 views

Reclassify Raster array using new values from a list array - shape mismatch error

I am trying to reclassify some raster values using new values stored in an array. Below is my code: import rasterio import numpy as np # path to the raster data in_img = "...\raster.tif" # ...
0 votes
0 answers
16 views

raster2pgsql -C generates incorrect extent constraint

I am trying to load multiple rasters into the same table with the raster2pgsql. I verified via rasterio's dataset.profile that all of my rasters have the same bounds, centroid, and dimensions. Using ...
0 votes
2 answers
138 views

Installing rasterio python package

I am trying to install 'rasterio' package in my conda environment. It is throwing below error Collecting rasterio Using cached rasterio-1.2.10.tar.gz (2.3 MB) Installing build dependencies ... ...
  • 119
0 votes
2 answers
48 views

How does one convert a raster from 0 to 360 to -180 to 180 using rasterio

I'm curious if there is a way to reproject a raster to have 0 as the center longitude rather than 180. I am trying to convert this raster. I've been able to do this in gdal, but I'd like the solution ...
  • 584
0 votes
1 answer
22 views

How to convert a Rasterio merge command into a GDAL merge command

My understanding is that Rasterio is mostly a python wrapper for GDAL functions to make them easier to use. That certainly seems the case for me because I'm having a lot of trouble duplicating with ...
1 vote
2 answers
155 views

Crop raster with shapefile

I want to crop a geo raster image with a geo shapefile using rasterio and geopandas. I struggle to properly create a mask so that the cropped areas actually display as transparent (and not black or ...
0 votes
0 answers
30 views

Rasterio merge results is 1 pixel wider than input rasters

I'm trying to overlay one georeferenced map onto another georeferenced map (and then apply a mask). I can use rasterio's merge function to do this, but the result is one pixel wider than the first ...
0 votes
1 answer
38 views

Rasterio to Postgis without save file in disk

Does anyone know how to upload a rasterio object to PostGIS using Python? I have checked: https://rasterio.readthedocs.io Sadly, there is not too much info about PostGIS. I know it can use GDAL ...
  • 61
2 votes
0 answers
55 views

Reprojecting NASA MODIS LST Data from ESRI:54008 to EPSG:4326 with RasterIO

Let me preface by saying I'm a bit new to GIS. I'm doing some exploration of MODIS Land Surface Temperature data (MOD11) that is supplied by NASA and trying to become more proficient with Geospatial ...
0 votes
0 answers
41 views

Getting Error while clip raster using shapefile

I am trying to clip the raster file with the shapefile file. Both files have the same coordinates system. I am getting the error: TypeError: can't multiply sequence by non-int of type 'Affine' This ...
2 votes
0 answers
52 views

Use rasterio to write 4 band image with rgba photometric

I am trying to write a four band rgba tif-file using rasterio. With the following code, I'm able to write four bands. #load data ras = rio.open(os.path.join(path, file_in)) arr = ras.read() # load ...
  • 167
0 votes
1 answer
40 views

rasterio plot and QGIS display different colours

I created a script to separate individual bands from two multiband .tif files in order to combine them in a "custom" multiband .tif. I also clip them into 3 smaller study areas. When I ...
0 votes
0 answers
48 views

How to embed hyperspectral image in Qlabel using PyQt5 in Python?

I have used Qpixmap for embedding a normal image in Qlabel in user interface and its working totally fine but when I'm trying to embed a hyperspectral image its showing error. Following is the code ...
0 votes
0 answers
40 views

Working with rasters from GCS is very heavy

I have many rasters stored on GCS (Google Cloud Storage). Whenever I want to do any process on them using rasterio, for example: import rasterio src1=rasterio.open('gs://path_to_imgs/img1.tiff') src2=...
  • 1,917
1 vote
1 answer
109 views

Permission denied when writing new Rasterio file

I asked this on the general stack overflow but not the GIS one. If that is against the rules I apologize: I am writing a script to reproject rasters using rasterio and get the following error: ...
0 votes
1 answer
20 views

Modify .TIF and then export it as .ASC with Rasterio several times

First time asking here in Gis StackExchange. I'm working with a .tif file that I read with rasterio, then I take its values as a numpy array and then I have to modify it several times. I can do that ...
0 votes
1 answer
111 views

Raster Calculation with Rasters of Different Extent using Rasterio

I am looking for a way to perform raster calculations with two DEMs using rasterio. Basically, what the 'QGIS Raster Calculator' does. My problem is, that they do not have the same extent. Therefore, ...
  • 167
0 votes
0 answers
9 views

Rasterio how to find same values in excel

I have two geographical tiff files, the difference is 20 years. There are some values ​​in the pixels of these drawings. I need to find differences between the second file and the first one. I tried ...
1 vote
2 answers
96 views

Rasterio.open() is only getting a single band from RGB image

I am trying to combine several tiles into a single background image. I am using code from here to do the tile retrieval and merging. I've used it before on Aerial Imagery, and it worked great. Now I'm ...
1 vote
1 answer
292 views

Clipping Raster (GeoTIFF) with a Vector (shapefile) in Python

I am trying to clip or mask a raster with some vector data using Python. But my output produces no clipped area. I have plotted the raster and vector together after transforming the vector to match ...
0 votes
2 answers
138 views

Prevent rasterio to read nodata value as nan?

When reading a raster dataset with rasterio 1.3.3, nodata values are replaced by nan. How to read the raster dataset so that nodata cells are having their true value in the resulting numpy array from ...
  • 8,811
4 votes
1 answer
198 views

How do you reproject a raster using Rasterio in-memory

I'm trying to optimize my code a bit because I'm tired of having intermediate files. I use rasterio to reproject grib files in the following manner: def reproject_raster(in_path, out_path): # ...
  • 584
0 votes
1 answer
44 views

rasterio.fill.fillnodata doesn't work as expected

I have a DEM of a lake bottom, that contains a few holes (nodata) which I'd like to fill. For that purpose i'm using rasterio's fillnodata with a mask. Unfortunatly, I don't get the results I am ...
  • 167
1 vote
1 answer
117 views

How to fix CHECK_DISK_FREE_SPACE problem while writing a file with rioxarray?

I get this warning when I try to write out a raster using rioxarray: Free disk space available is 0 bytes, whereas 1152072000 are at least necessary. You can disable this check by defining the ...
  • 657
1 vote
1 answer
79 views

Rasterio merge creates white stripes when rasters overlap and one of them has null value

I'm trying to merge 4 rasters I have in order to create mosaic. However, when I merge them, I get white stripes on the area where they overlap,despite the fact that one of them has non-null values on ...
  • 1,917
3 votes
1 answer
47 views

Slight error after converting coordinates between CRS

I have two rasters of the same geographic area, but using different CRS. My aim is to match them so I can stack them and perform per-pixel analysis between the two. To do that, I'm trying to convert ...
1 vote
0 answers
58 views

Convert dataframe showing points inside a polygon to GeoTIFF raster using Python

I have a point shapefile with 0.01 degrees spacing. The points are confined within an irregular shapefile boundary for example Alaska state boundary. I have used the point shapefile and retrieved some ...
1 vote
0 answers
60 views

rasterio memoryfile has no attribute profile

I am trying to write a function in rasterio that has equivalent functionality to a function I wrote in rioxarray. To avoid creating excessive files to the disk I am trying to use a MemoryFile, ...
1 vote
0 answers
56 views

Change values of pixels of a GeoTIFF in Python with conditions

I would like to change the values of pixels based on some conditions. I am using rasterio and python to modify the values. This is what I am doing import nunpy as np import raterio def changeLabel(arr)...
  • 229
1 vote
0 answers
37 views

Extent incorrect after using affine and rasterio to write image

I'm using rasterio to write data to a TIFF image. The original data was extracted from a TIFF image, that was projected in UTM 17 North, or EPSG 32617. I'm writing the data to EPSG 4326, and am also ...
0 votes
1 answer
112 views

How to apply a function on two rasters in Python?

I would like to cell-wise function operation on two rasters. While I saw some examples of adding or subtracting two rasters, I'm yet to come across a complex example of how to manipulate rasters using ...
  • 407
1 vote
1 answer
88 views

Normalize images for Sentinel [closed]

I want to join different bands from Sentinel-2 to create index images (such NDVI, EVI...). I know how to open, mix and save the stack using rasterio. However, I have a technical question related with ...

1
2 3 4 5
15