Quantcast
Channel: Question and Answer » gdal
Viewing all articles
Browse latest Browse all 397

Python and gdalwarp: change resolution of raster

$
0
0

I am new to GDAL and have been having some hard time figuring out how to change a raster’s resolution and how to align it to another existing raster.

I have come to the point where I have a raster made of a numpy array class. I exported it into an ASCII file. It looks similar to this (as an example, this is the ascii file)…

test.txt:

ncols 4
nrows 4
xllcorner 20
yllcorner 8.5
cellsize 0.5
nodata_value -9999
0.1 0.2 0.3 0.4
0.2 0.3 0.4 0.5
0.3 0.4 0.5 0.6
0.4 0.5 0.6 0.7

As you can see, it contains no projection information.
On the other side I have an existing raster saved on the computer which is in WGS84 UTM32N, and has a different resolution.

I tried to google around to find how I can use GDAL to change resolution of the ASCII raster while aligning it to the existing raster on my computer.

Does the ASCII raster need to have some projection data or other kind of information? Could somebody explain to me how to use gdalwarp with Python?


Viewing all articles
Browse latest Browse all 397

Trending Articles