All Questions
12
questions
3
votes
1
answer
275
views
How to cut a raster exactly to Geometry of a irregular polygon?
To cut a raster I saw some solutions suggesting gdalwarp with cropToCutline and cutlineSQL options.
poly = item.geometry.asWkt()
ds = 'raster.tif'
sql = f"select ST_GeomFromText('{poly}',4326)&...
0
votes
1
answer
358
views
Multiple Selection and clip raster by mask in QGIS using PyQGIS
I am doing raster by mask on multiple polygons. Selection on the basis of "CONTCD='AFR'" is running fine. Second selection and looping to for mask is only showing all.
layer=QgsVectorLayer(&...
0
votes
2
answers
1k
views
gdalWarp : Assigning more than one nodata value
I am working with a single band raster file in pyQgis and want to assign multiple Nodata values while reprojecting. I tried doing this but it took only the first value 32761 as Nodata value:
gdal.Warp(...
1
vote
1
answer
419
views
QGIS Python not resampling when using gdal warp reproject
I've got a Python script which, so far, is creating a nice DEM. I need to reproject it and then run a slope analysis on it.
For the reprojection part, as I've found in a few places, I'm using gdal:...
1
vote
0
answers
147
views
Unable to execute QGIS algorithm while taking Input raster directly from AWS S3 account
I have a raster file (.TIF) in my AWS S3 account. I am using GDAL to open that .TIF file and to save the reprojected .TIF file to my local computer using QGIS GDAL 'Warp (reproject)' algorithm as ...
1
vote
0
answers
42
views
Warping a GeoTIFF File (Error1: Cannot open CSV)
Here is my code for the script :
import os
import subprocess as sub
# get your files
path = r'C:\Users\User\Downloads\jalna\pdf\test'
files = [os.path.join(path, f) for f in os.listdir(path) if f....
3
votes
0
answers
588
views
Match Projection & Extent Using GDAL
I am looking to match both the projection and extent of two separate .tif files. The file I want all other .tif files introduced into raster calculations is as follows:
The other raster image covers ...
3
votes
1
answer
659
views
How to populate gdalwarp with a dynamic value in QGIS geoprocessing?
I am attempting to call gdalwarp (python binding gdal.Warp()) as a script inside QGIS modeler (QGIS 2.18.10, gdal 2.2.0). The goal is to correlate any loaded raster with a UTM zone grid, get the ...
1
vote
1
answer
781
views
How to resample a raster with gdalogr:warpreproject or gdalogr:translate with non-default method
I would like to resample a raster to multiple rasters of a certain amount of pixels in width and height based on a bilinear resampling method.
However, I am not sure if the available syntax allows ...
12
votes
1
answer
2k
views
PyQGIS save raster as rendered image, then use GDAL tools on it
I have tried to use the code from QGis Save Raster as Rendered Image. i is a raster layer:
pipelayer = i
pipeextent = pipelayer.extent()
pipewidth, pipeheight = (pipelayer.width(),
...
0
votes
1
answer
313
views
polygonize giving duplicated polygons?
I am trying to reproject some ascii files and convert them into shapefiles. I am new to python but looking at some code online and help files I was able to write the following code to run on Python ...
10
votes
4
answers
9k
views
For looping folder to batch clip rasters by polygon using python and QGIS?
I am using Python and QGIS 2.0.
I am trying to clip rasters in a folder by one polygon feature.
It's the first time for me using PyQGIS; I was used to ArcPy before.
How do I get my script to work?
...