Further to my earlier question, I have .nc and .asc files of crop area and production for maize, rice and wheat. It says here, about QGIS importing .asc files:

QGIS has native support for this format. ESRI grid (.asc) files can be directly opened in QGIS by selecting Layers >>> Add Raster Layer. The .asc file can also be dragged and dropped into the QGIS session, rather than using the Add Raster Layer option.

But when I do either, I get this error: ".asc is not a supported raster data source". Same issue reported here. I'm using version 2.0.1-Dufour.

  • it is a problem of GDAL. What is your OS (Windows, Linux, Mac) ? (GDAL raster format) – gene Dec 7 '14 at 19:18
  • Windows 7, 8Gb RAM. But I just noticed something weird about these files. They're about 100 MB and they contain (looked with Textpad) nothing but endless rows of -9999.000, -9999.000, -9999.000 -9999.000 -9999.000. Not sure what that means (oceans?). Got them from here: geog.mcgill.ca/landuse/pub/Data/175crops2000/ArcASCII-Zip – plugincontainer Dec 7 '14 at 19:30
  • Look at the header NODATA_value -9999.000: there are empty asc files. The format is described in ESRI grid – gene Dec 7 '14 at 19:47

I just downloaded one of the files in the repository that you linked to (brazil_yield.asc) and tried to import the file into another GIS program. I also ran into an import error. I finally tracked the error down to an attempt to convert a blank cell to a numerical type. In other words, there are blanks in the file because they have been improperly formatted. Rewriting the import tool to ignore blank cells resulted in a successful import. There are several places in the file that have two spaces in a row. See the figure below.

enter image description here

For a proper space delimited file, there can only be one space between each number.

  • Well done, it works – gene Dec 7 '14 at 21:14
  • Yes, scrolling (very slowly) with Textpad I noticed those odd spaces. – plugincontainer Dec 7 '14 at 22:04
  • 2
    @plugincontainer You can probably just do a find and replace in textpad to replace the multiple spaces to a single space and it'll import successfully. Good luck. – WhiteboxDev Dec 7 '14 at 22:16
  • Hey @WhiteboxDev - I tried global search-and-replace with Textpad, Word and OpenOfficeWriter and they can't handle that many replaces ("program is not responding"). Started doing it in blocks in Word and it's neverending - thousands of spaces to fix. Do you know how I can tell QGIS to do what you did, i.e. "ignore blank cells"? – plugincontainer Dec 8 '14 at 6:27
  • @gene ... finally got rid of all double spaces. But QGIS won't accept it. What is the GDAL issue? – plugincontainer Dec 8 '14 at 10:51

QGIS will not import ESRI ASCII format if the header contains leading whitespace of any kind. Remove leading whitespace and QGIS will load the file correctly.


I had similar difficulties to import an ASCII file into QGIS. I opened it with a texteditor to have a look on it. There was a header with information about the author, coordinate system, etc. I removed this part, so that the file had the following structure given from ESRI:

-999  -999  -999  -999  -999  -999 ...

Finally, I was able to open the file in QGIS with 'Add Raster Layer'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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