Clean and fast and geospatial raster I/O for Python programmers who use Numpy
Questions tagged [rasterio]
440 questions
0
votes
0 answers
Assign masked array to new raster
In Python I am trying to reconvert the array obtained by masking a raster file to a raster.
More specifically: I have two rasters a) data raster with deforestation year b) mask raster where are reported the area mapped (=1), the null areas and the…
0
votes
1 answer
How to get pixel locations of 4 corner white pixels in a binary image
I have a binary raster image as shown below:
import rasterio
import numpy as np
path = r'D:\LE07_L1TP_147048_20070221_20170105_01_T1\LE07_L1TP_147048_20070221_20170105_01_T1_B1.tif'
with rasterio.open(path) as dataset:
image =…

RRSC
- 257
- 2
- 15
0
votes
0 answers
rasterio Unable to open EPSG support file gcs.csv
I'm using geemap to display a raster on a created map.
This lib use xarray_leaflet to display the raster and this lib will end up using rasterio to manipulate the .tif file.
When I launch my display :
m = geemap.Map()
m.add_raster(clip_map,…

Pierrick Rambaud
- 1,726
- 1
- 20
- 47
0
votes
1 answer
Resample image rasterio/gdal, Python
How can I resample a single band GeoTIFF using Bilinear interpolation?
import os
import rasterio
from rasterio.enums import Resampling
from rasterio.plot import show,show_hist
import numpy as np
if __name__ == "__main__":
input_Dir =…

azis511
- 13
- 1
- 4
0
votes
1 answer
rasterio pass custom properties in profile
I am trying to construct rasterio files, starting from a numpy array which contains multiple bands, and a profile:
meta = {
'driver': 'GTiff',
'dtype': rasterio.float32,
'nodata': None,
'width': 100,
…

cristi.calugaru
- 571
- 10
- 22
0
votes
1 answer
Using Rasterio to save window image (as jpg)
I'm trying to open an jpg (01.jpg) using Python Rasterio and save the Window as a jpg
I can do it for 1 band, not not for the 3 bands of the RGB source image.
the issue is with the band rearranging.
below my code and the error :
Source shape (2000,…

Gil
- 77
- 1
- 2
- 8
0
votes
1 answer
How to rasterize a pandas dataframe with many points per pixel?
I am using rasterio to convert a geopandas dataframe of points to a geotif raster.
For that I am using this python code:
with rasterio.open("somepath/rasterized.tif", 'w+', **meta) as out:
out.nodata = 0
out_arr = out.read(1)
# this is…

Zombiefied
- 1
- 1
0
votes
1 answer
Visualising geospatial .tiff images with Rasterio
I am trying to visualise a .tiff image in Jupiter Notebook using Rasterio. I am a Junior Data Scientist for an AgriTech company and we just got access to 8 data layers (NDVI etc.) for two farms in .tiff format.
Here is the metadata for one…

Thabied Majal
- 27
- 1
- 5
0
votes
0 answers
Apply function to Xarray dataset
I am trying to apply a function to an Xarray dataset, using dataset.where mask to decide where to apply it. I am not sure how to do it.
Some context: the dataset has two variables (A and B), which are two overlapping raster images (same size and…

ffgg
- 134
- 1
- 8
0
votes
0 answers
How to draw such a picture with Python?
Spatial changes in the average center and error ellipse of PM2.5 concentrations in China

huahua520
- 41
- 2
0
votes
2 answers
How to speed up extracting data from raster file for points using GDAL python
I have 366 raster image files (MODIS satellite daily data) in tif format containing snow data and another csv file containing 19,000 locations (latitude and longitudes). I need to collect the snow data from raster files. I have tried collecting the…

srinivas
- 301
- 1
- 9
0
votes
0 answers
Errors trying to conda install packages that are dependent on gdal (rasterio , geopandas, etc.)
When I try to pip install rasterio I get this error:
ERROR: Command errored out with exit status 1:
command: 'C:\Users\jones\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe'…

bbamjm
- 1
0
votes
1 answer
Error while installing gdal on Azure Databricks
Working on raster files and need to gdal package. Trying to install on Azure Databricks is throwing below errors. Any clue how to get this installed on Databricks
Collecting gdal Using cached GDAL-3.0.4.tar.gz (577 kB) ERROR: Command errored out…

Sreedhar
- 29,307
- 34
- 118
- 188
0
votes
1 answer
Converting GeoJSON to a raster image using rasterio
I am hoping for advice as to how I can convert GeoJSON geometry into a tif image using rasterio. I have tried a lot of things, but all of them do not rasterize all the shapes found in the GeoJSON (more like 80% of the file is rasterized). How can I…

DarkDrassher34
- 69
- 3
- 15
0
votes
0 answers
Generate heat map from 2D data
I have a set of X,Y data points(from Remote sensing image),and I drew a scatter plot through the tutorial, the link is as follows:Generate a heatmap in MatPlotLib using a scatter data set
But when I try to draw a heat map, an error occurs:Heatmap…

Flyinfish
- 1
- 2