2

I have a text file with 360 columns and 180 lines, each number indicating a value for a one-degree cell.

1.32    1.43    1.67    1.61    1.57    1.39    1.22    ...
1.19    1.28    1.22    1.07    0.94    0.76    0.69    ...
0.83    0.83    0.77    0.67    0.58    0.55    0.62    ...
...

I haven't found any indication on how such a file can be imported into QGIS. How can I do this?

2
  • 4
    The easiest might be to add an ASCII raster header with "NCOLS 360 NROWS 180 XLLCORNER -180 YLLCORNER -90 CELLSIZE 1"
    – Vince
    Commented Jan 15, 2020 at 16:11
  • @Vince: Ah, great, that helped me to find my way through. Replacing the NaN with -9999 then in the next step, I could drag & drop it into QGIS. Thanks a lot! Commented Jan 15, 2020 at 17:08

1 Answer 1

2

You nearly have a raster in ASCII raster format, all you need is to prepend the header lines:

NCOLS 360 
NROWS 180 
XLLCORNER -180 
YLLCORNER -90 
CELLSIZE 1

If there are NODATA values in the file which are not "-9999", you can either replace them with "-9999", or use the NODATA_VALUE header keyword to specify that value instead, for example:

NODATA_VALUE -98765

Most GIS packages will process the resulting file.

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.