My input is this file which gives me an output file through the code:


which has other extent and other resolution. So, why I get this?


1 Answer 1


Your input file has different height and width for pixels

Pixel Size = (0.002914560266800,0.002632654436743)

The comment in a the source code https://github.com/OSGeo/gdal/blob/master/frmts/pcraster/pcrasterdataset.cpp says that PCRaster does not support that.

"only the same width and height for cells is supported."

What you did should probably give an error but PCRaster is rather exotic format and probably not thoroughly tested.

You have a few options, maybe the easiest is to convert the source data to have square pixels with gdalwarp

gdalwarp input_file.tif input_modified_file.tif

and then

gdal_translate -of PCRaster input_modified_file.tif output_file3.map

Now both files have same values

Size is 1259, 1138
Pixel Size = (0.002777186609872,-0.002777186609872)
Corner Coordinates:
Upper Left  (  42.4506362,  55.4787962) ( 42d27' 2.29"E, 55d28'43.67"N)
Lower Left  (  42.4506362,  52.3183578) ( 42d27' 2.29"E, 52d19' 6.09"N)
Upper Right (  45.9471142,  55.4787962) ( 45d56'49.61"E, 55d28'43.67"N)
Lower Right (  45.9471142,  52.3183578) ( 45d56'49.61"E, 52d19' 6.09"N)
Center      (  44.1988752,  53.8985770) ( 44d11'55.95"E, 53d53'54.88"N)
  • Although I don't understand the reason why the second tif file with squared pixels doesn't give the proper result, but your idea with processing it with Warp helped. Thanks. Commented Feb 9, 2022 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.