Friday 21 April 2017

esri ascii raster - Opening.asc files in QGIS?



Further to Where do I find the legend for netCDF files in QGIS?, 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.



which has been reported at Is .asc supported raster data source for QGIS?


I am using version 2.0.1-Dufour.




Answer



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.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...