All Questions
102 questions
0
votes
0
answers
32
views
DLL load failed while importing _version --- rasterio and gdal
I work on Spyder. I need to import 'rasterio', but I always get this error when trying to import it:
import rasterio
Traceback (most recent call last):
Cell In[2], line 1
import rasterio
...
0
votes
1
answer
31
views
Gdal.translate produces map with latitude axis upside-down
I am trying to process rain radar images of the UK MET weather service for a particular catchment area.
I am stitiching the image together from several png files before georeferencing it with gdal....
0
votes
0
answers
107
views
Convert CH1903+/LV95 projection (EPSG:2056) to EPSG:4326 (WGS84) with vertical correction
I am currently trying to use elevation data data from the Swiss Alti3D DEM and compare it to another set of data that I have acquired in WGS 84 (EPSG: 4326). As such, I tried to reproject the Swiss ...
0
votes
0
answers
71
views
Making RGB tiff files from red,green,and blue bands
i have three geotiff orthomosaic images which i have processed from pix4d mapper. one is red band, one is blue band, one is green band. I have to combine these three images to form an rgb geotiff ...
0
votes
0
answers
83
views
Convert GIS Raster to CSV and plot as points on the grid using Python
I'm trying to convert raster to CSV file with coordinates and plot them and encounter a problem.
I have a raster .tif file with some buildings in Denmark projected in EPSG:7416 CRS.
I read .tif file ...
0
votes
1
answer
274
views
How to change the resampling method in rasterio's rio.reproject_match function (python)?
I wanted to apply to raster 1 the resolution and origin of raster 2. I found the rasterio's
"rio.reproject_match" function. This take the transformation correctly but I couldn't change the ...
0
votes
0
answers
107
views
rasterio doesn't import to local dask cluster
I am running an analysis on a large number of rasters with Dask in a Jupyter Lab notebook on a Windows computer. When I run my analysis using Coiled (cloud cluster), the analysis runs fine. However, ...
0
votes
1
answer
125
views
How to find how many times each pixel is covered in several GeoTIFFs?
I have a few GeoTIFFs which might have overlap, I want to find how many times each pixel is covered in several GeoTIFFs. I thought it is best to create a heat map in Python (using Gdal or Rasterio) ...
2
votes
1
answer
1k
views
rasterio - set compression quality
I know about the possibility in the rasterio module to set a compression "family" like webp or JPEG by using the respective profile. But I want to have more control over the compression ...
1
vote
1
answer
351
views
geotiff exported all black with rasterio
I'm developing a workflow for satellite imagery processing with Python, using rasterio (1.3.6) and earthpy libraries.
The idea is to generate some raster algebra, make a composition (sabinsRatio), and ...
0
votes
1
answer
217
views
How to use rasterio to store raster data with coordinate system information?
I use the following code to save the modified raster data. The original data has a complete coordinate system, but the coordinate system information cannot be saved to the new raster data when saving. ...
1
vote
1
answer
969
views
Rasterizing a large image with Rasterio
I am rasterizing polygons in a large raster using the following code:
import rasterio.features
from shapely.geometry import Polygon
p1 = Polygon([[0,0], [32000,0], [32000,32000], [0,0]])
out_shape = (...
0
votes
1
answer
280
views
How to solve "TypeError: invalid path or file .."?
I am using the rasterstats python module zonal_stats to calculate the mean solar irradiance value (taken from a raster) inside each land particle (contained in a shapefile).
If I
print(irradiance.read(...
0
votes
0
answers
208
views
GDAL GetGeoTransform() precision
I need to read extent of tif file with larger number of signs after point.
Example:
when I open tif image in QGis I got these numbers:
enter image description here
but with GDAL GetGeoTransform() I ...
0
votes
1
answer
87
views
From numpy to geotif having a georeferenced box
I created a numpy array by calculating the density of dwellings within an area through the following code:
def myplot(x, y, z, s, bins=10000):
heatmap, xedges, yedges = np.histogram2d(x, y, bins=...
0
votes
1
answer
648
views
Rasterio reproject using from_gcps moves raster boundaries but not pixels
Raster was misaligned with ground truth (as observed in google earth) so I used rasterio.warp.reproject with some manually obtained GCPs to try to align it. This is the code to do so (somewhat ...
1
vote
0
answers
1k
views
extract raster values into each polygon in a shapefile in Python
I have a Gtiff layer and a shapefile with 5 polygons that are placed across the Gtiff (both have the same crs). I'm trying to create a NumPy array for each polygon that contains the pixels that are ...
1
vote
1
answer
857
views
How to read s3 rasters with accompanying ".aux.xml" metadata file using rasterio?
Suppose a GeoTIFF raster on a S3 bucket which has - next to the raw TIF file - an associated .aux.xml metadata file:
s3://my_s3_bucket/myraster.tif
s3://my_s3_bucket/myraster.tif.aux.xml
I'm trying ...
0
votes
0
answers
385
views
Wrong min value for a geo tif file
I am working on pre-processing a few geo-tif files. I want to obtain the minimum value for my raster image. My OS is Linux and Rasterio version 1.3.3. When I run my script in a conda environment, I ...
0
votes
0
answers
315
views
How to compare two geotiff datasets
I have two geotiff with the same projection and the same dimension. One dataset is related to population and the other one to distances. I want to count the population only in the pixels where the ...
1
vote
0
answers
145
views
Memory leak -- rasterio.MemoryFile()?
Code:
import numpy as np
import os
import psutil
import rasterio
from memory_profiler import profile
@profile
def main():
profile = dict(
count=1,
height=30000,
width=30000,
...
0
votes
0
answers
358
views
Plot geopandas dataframe on top of raster using matplotlib/gdal(numpy)/geopandas
I want to plot my geopandas objects on top of a raster. Other people have asked this question here before and all answers seems to be:
convert numpy array(raster) into Rasterio object.
Is there a ...
0
votes
0
answers
77
views
Raster in Spyder about save, export etc
I have a problem about with Spyder. I want to saving the raster output to created with rasterio module. But where is the Created output in Spyder? I must find Because I cant export the raster
Thanks :)...
-1
votes
1
answer
500
views
Why all the data is Nan when I load NDVI image by rasterio or gdal [duplicate]
I calculated NDVI value and saved single band images following this page; https://developers.planet.com/docs/planetschool/calculate-an-ndvi-in-python/. After that I wanted to load those images on ...
0
votes
1
answer
763
views
Python3.8 GDAL Could not find gdal-config
Error
[enter image description here][1]
[1]: https://i.sstatic.net/c3qQr.png
× Getting requirements to build wheel did not run successfully.
#8 17.82 │ exit code: 1
#8 17.82 ╰─> [2 lines of ...
-1
votes
1
answer
204
views
Getting basic stats from Np.array within a for loop in python
I don't have a lot of python experience and I'm trying something rather complicated for me, so excuse my messy code. I have a few arrays that were generated with rasterio from raster layers (tif), ...
0
votes
0
answers
405
views
Geotiff image plotting in Python
I am new geotif image ploting in python. I have two Geotiff images of the same region. However, after plotting these two images they are not matching. The below is the meta information for both the ...
0
votes
0
answers
350
views
How can I obtain pixel value from map co-ordinate [longitude, latitude] for image of band count 1?
so I am using Landsat-8 image of band-4. I want to obtain the n-array index for given longitude and latitude values. I have tried below code
xs=np.array([92.8])
ys=np.array([26.6])
row,col=rasterio....
1
vote
2
answers
2k
views
Georeferencing using boundingbox coordinates for a Geotiff file that got converted from a JPEG
I'm currently working with aerial imagery that is only available as a JPEG. I got the data using a boundingbox with coordinate system EPSG:28992. Therefore, I thought I could georeference it with gdal ...
0
votes
1
answer
307
views
How to change numpy array to geotiff array without saving on computer?
I am using gdal.translate() to make the image but its saving the formed image on local machine, I don't want to save it anywhere in my local machine and use it on run time only without saving it.
0
votes
1
answer
268
views
Can't import modules in python even if they are "successfully" installed
I'm new to this and I've had trouble starting to practice my code because of the libraries and python versions, first I must explain that I had python 3 installed and was trying to install the ...
0
votes
1
answer
952
views
Creating georeference geotiff image
I have tried to create a geotiff image after extracting texture feature of a grayscale geotiff image using the below codes.
#Creating texture images
Texture_Contrast = Image.fromarray(Contrast)
#...
0
votes
0
answers
326
views
'str' object has no attribute 'get' when creating a mask on dataset
i am trying to make a mask on a dataset as follows:
out_image, g= rasterio.mask.mask(dataset=NDVIsTIFFAsDataset, shapes=bufferedTreatmentAsGeoJSONInEPSG3857)
the value of the shapes parameter is ...
0
votes
1
answer
323
views
Reprojection of North Polar Stereographic binary to Lon/Lat grid (rasterio or gdal in python)
Now, I am working on Stage IV dataset (Precipitation dataset in CONUS).
https://data.eol.ucar.edu/dataset/21.093
This is a binary data that shapes (1121 x 881) array and local 4km polar-stereographic ...
1
vote
1
answer
509
views
Build Shapely point objects from .TIF
I would like to convert an image (.tiff) into Shapely points. There are 45 million pixels, I need a way to accomplish this without a loop (currently taking 15+ hours)
For example, I have a .tiff file ...
0
votes
1
answer
381
views
Copy raster exif in GDAL
I have two images with the same size - first one is an image from a drone and the second - a mask. I need to subtract both images and of course translate the exif data from the original image into the ...
0
votes
0
answers
3k
views
How to write tiff file using rasterio?
In the code below, I am trying to write a dataset. The GTiff file has data and the image is clear but when I run the below code, the result of
dataset.write(total.astype(rasterio.uint16), 1)
is a ...
-1
votes
2
answers
1k
views
Plot 2 dimensional numpy array in .npy file using matplotlib?
I have numpy file stored as "test.npy" which is a 2 dimensional Synthetic Aperture Radar(SAR) image data with VV and VH polarization bands. How do I plot this 2 dimensional image array using ...
1
vote
0
answers
1k
views
Average thousands of partially overlapping rasters with GDAL
I have thousands of partially overlapping rasters that are each about 6500 x 6500 px, with a 500 px overlap on each of the four edges.
I am trying to merge them into one geotiff and average the ...
1
vote
1
answer
989
views
Kernel died with rasterio.open().read() on geo tiff images
When I tried to open and read a certain geo tiff image with gdal and rasterio, I can read and do things like img.meta and img.descriptions. But when I tried to do img.read() with rasterio or img....
2
votes
0
answers
236
views
Problems with GDAL, Libspatialite, Rasterio and Sumo (ImportError, Symbol _GEOSArea not found, Referencing from libspatialite.7.dylib)
I'm new to using gdal/libspatialite/rasterio/sumo and all the family of library and packages that is related to geographical, time and space. But I was just wondering what's this error here? Does ...
3
votes
0
answers
594
views
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-...
0
votes
1
answer
923
views
Combining rasters with a slightly different size
I have two rasters that I clipped using the same shapefile. I then used gdal to resample them into the same resolution but now I have an issue where the shapes are very similar but not quite the same. ...
2
votes
0
answers
203
views
Rasterio instalation error on aws lambda sam build
I'm trying to use lambGeo docker-lambda (https://github.com/lambgeo/docker-lambda) but when I try to build with sam in Cloud9 it's give the error
#include "cpl_conv.h"
^~~~~~~~~~~~
...
2
votes
1
answer
2k
views
What is the correct way to reproject a raster from a CRS to another using Python?
I have a raster of Land Cover data (specifically this one /eodata/auxdata/S2GLC/2017/S2GLC_T32TMS_2017 in https://finder.creodias.eu) that uses 'epsg:32632' as CRS. I want to reproject this raster on '...
0
votes
1
answer
1k
views
Using rasterio (python) in Visual Studio Code - "does not exist in the file system, and is not recognized as a supported dataset name."
I am trying to use rasterio in Visual Studio Code for Windows. I downloaded the rasterio and GDAL binaries from: https://www.lfd.uci.edu/~gohlke/pythonlibs/ and installed them using "py -m pip ...
0
votes
1
answer
919
views
Rasterio MemoryFile to Pillow image (Or base64 output)
I'm trying to write an AWS Lambda function that takes a TIFF, converts it to JPEG, then outputs it in base64 so that lambda can serve it. But I keep running into malformed response, or issues with ...
2
votes
1
answer
2k
views
windowed read and write of raster using rasterio
I am trying to read a raster with overlapping windows and doing some calculations on those windows. I am using the code from this answer. I want to do calucations on overlapping windows but want to ...
0
votes
1
answer
3k
views
Rasterio equivalent for GDAL's GetProjection() and GetGeoTransform()?
I have a GeoTIFF that I've done a lot of processing with in OpenCV. After processing, its lost its spatial information so I need to insert it back in. In GDAL, I would just extract that from the ...
0
votes
1
answer
2k
views
Geotiff Rotation Python/GDAL/QGIS
I am trying to rotate geotifs by different amounts in python, GDAl and/or QGIS and keep the georeference information the same.
Is there a way to do this?