[gdal-dev] Having difficulties using gdalwarp

Simon Knapp sleepingwell at gmail.com
Wed Oct 3 17:06:05 PDT 2012


Hi List,

This is my first post here so please let me know if my question would
be better placed elsewhere. I am struggling with re-projecting integer
grids using gdalwarp and would appreciate some help.

I have two grids containing land use data at different scales:

grid 1) a 50m (esri binary) grid in albers,
grid 2) a 1km (ascii) grid in geographics.

I would like to project these to a common coordinate system with
resolution corresponding to grid 1 so I can perform cross tabulations
and alike. I have tried going in both directions

The calls I have tried are:



call 1) re-project and re-sample grid 2 to the same projection as grid
1. I have obtained the parameters from the property pages of grid 1 in
QGIS:

gdalwarp ^
-t_srs "+proj=aea +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=132 +x_0=0
+y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs" ^
-te -1888000 -4847000 2122000 -1010000 ^
-tr 50 -50 ^
-dstnodata -32768 ^
nlum.asc nlum_warped.tif


call 2) re-project grid 1 to have the same projection as grid 2. Here
I have not specified the resolution and was planning to also re-sample
grid 2 to the resolution of the result. I get the parameters from the
QGIS property pages of grid 2:

gdalwarp ^
-t_srs "+proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs" ^
-te 112.505 -44.0055 154.005 -9.995 ^
-dstnodata -32768 ^
clumfill clum_warped.tif



In the first call I get 24Gb of complete rubbish. When I open the
result in QGIS noting is shown (visually) and the cell values contain
what appears to be uninitialised junk.

In the second call, I get a grid that looks similar to what I want,
but the cell value ranges are different ([100, 663] in the input and
[0, 663] in the result) and the histograms are different. I thought
that by (implicitly) choosing nearest neighbour the values in the
output must be a subset of those in the input.

Can anyone suggest what might be going wrong?



Thanks in advance,
Simon Knapp


More information about the gdal-dev mailing list