Clean and fast and geospatial raster I/O for Python programmers who use Numpy
Questions tagged [rasterio]
440 questions
3
votes
1 answer
ValueError: Input shapes do not overlap raster. Geopandas/Rasterio, possible CRS error when masking
I'm using this dataset:
https://sedac.ciesin.columbia.edu/data/set/gpw-v4-population-density-rev11/data-download
(Gridded population density of the world)
With this…

Bigboss01
- 438
- 6
- 21
3
votes
0 answers
ImportError: dlopen(...), Symbol not found: _GEOSArea, Referenced From ..., Expected in: flat namespace
I'm trying to load in rasterio but for some reason gets this weird error. Anyone knows what this is, what this means and what's the best solution for it?
File "/opt/homebrew/lib/python3.9/site-packages/rasterio/__init__.py", line 9, in
…

M. Fire
- 117
- 2
- 6
3
votes
2 answers
Python: how to convert geotiff to geopandas?
I have a geotiff file.
import xarray as xr
urbanData = xr.open_rasterio('myGeotiff.tif')
plt.imshow(urbanData)
Here the link to the file.
I can convert the file as a dataframe with coordinates as points
ur = xr.DataArray(urbanData,…

emax
- 6,965
- 19
- 74
- 141
3
votes
2 answers
produce vector output from a dask array
I have a large dask array (labeled_arr) that is actually a labeled raster image (dtype is int64). I want to use rasterio to turn the labeled regions into polygons and combine them into a single list of polygons (or geoseries with just a geometry…

Jessica
- 505
- 1
- 3
- 11
3
votes
2 answers
Regrid geostationary GOES satellite data to a cartesian grid
I am working with GOES satellite data, which is gridded in radians and has the standard projection of geostationary. I am aware of several methods that can reproject the data such that it can be plotted in a cartesian sense. However, I have not been…

Eli Turasky
- 981
- 2
- 11
- 28
3
votes
1 answer
Adding band description to rioxarray to_raster()
I've seen that one can add band descriptions to a geotiff image using rasterio [1]. How would I do the same thing when saving an array to a raster with rioxarray?
I tried adding the names as coords, but when I save an re-open the raster, the bands…

user8188435
- 191
- 5
- 14
3
votes
1 answer
How to place a shapefile on top of raster file in one plot, and then save the plot in a Jpeg file format
I am posting this question after three days searching the net but no success. Hope can get the answer here. Please do NOT delete the post as I did not find an answer for it here also. Thanks.
I have 2 files:
A raster image file (i.e., Air…

Canada2015
- 187
- 1
- 12
3
votes
0 answers
How do I take care of GDALDatasetShadow TypeError when reprojecting and writing GEOTIFF multi-band raster to GEOTIFF 3-band raster?
I've been trying to reproject an input (multi-band) GEOTIFF file to a destination transformation/projection and write these reprojected bands to a new 3 band GEOTIFF file (since I don't need the other bands). I've tried combining 2 blocks of code…

RS_student
- 31
- 1
- 3
3
votes
3 answers
Interpolate dataArray missing data using xarray
I am using xarray/rasterio to do some operations on a set of GeoTiff files. The data that I am dealing with contain missing values (-9999) at some grid points. Is there any efficient pythonic way to replace these values with interpolated data using…

Monobakht
- 193
- 1
- 11
3
votes
1 answer
Module error: Rasterio has no attribute open
I installed rasterio with pip install rasterio and tried running a simple command like rasterio.open(path/file) but get the following error message:
module 'rasterio' has no attribute 'open'
I tried uninstalling and reinstalling but to no avail.…

PKKR_26
- 53
- 5
3
votes
2 answers
Add projection imported .asc file
I'm trying to import an .asc file in python to clip it with a shapefile. For the clipping I'll use:
import earthpy.clip as cl
clip = cl.clip_shp(shp_file, asc_file)
However this won't work since my .asc doesn't have a CRS. This is how the header of…

Dylan_w
- 472
- 5
- 19
3
votes
1 answer
can't open jp2 (from sentinel) with python rasterio,gdal
I am trying to open the jp2 rasters products in python as raster, without success when we use the "raterio" and "gdal" packages.
I get this errors:
RasterioIOError: 'b4.jp2' not recognized as a supported file format.
RuntimeError: `b4.jp2' not…

Alon8200
- 151
- 1
- 2
- 8
3
votes
2 answers
Plotting a rasterio raster on a Cartopy GeoAxes
I've seen a few other questions on this topic, but the library has changed enough that the answers to those no longer seem to apply.
Rasterio used to include an example for plotting a rasterio raster on a Cartopy GeoAxes. The example went roughly…

Translunar
- 3,739
- 33
- 55
3
votes
1 answer
is it possible to make a join between a geotiff image with a geopandas dataframe?
I have a shapfile and a geotiff image.
import geopandas as gpd
import rasterio
from rasterio.plot import show
df = gpd.read_file('myShape.shp')
fileI = 'myFile.tiff'
data = rasterio.open(fileI)
show((data), cmap='terrain', ax=ax)
p1 =…

emax
- 6,965
- 19
- 74
- 141
3
votes
1 answer
Overlap error using Rasterio mask in Python
I have a satellite image raster file and a Shapefile consisting of several discrete polygons. I would like to individually extract (or mask) the Numpy image array for each of these polygons from the raster file.
Currently, I import the Shapefile…

Will000
- 31
- 1
- 4