3

First let me say that I am novice in GIS department. As archaeologist I had only some courses 8 years back when i was still studying.

Now, the problem:

When I try to import .asc as raster layer I get this message:

ngridded dataset: At line 3, X spacing was 0.000000. Expected >0 value

I know this is a problem because "Cells with same Y coordinates must be placed on consecutive lines"

But my format viewed in Notepad++ is like this:

426000.78;55000.15;562.24 
426000.78;55001.15;562.22 
426000.78;55002.15;562.20
426000.78;55003.15;562.30
426000.78;55004.15;562.21
426000.78;55005.15;562.21
426000.78;55006.15;562.27

And my question - How do I change it to readable format. Any quick solutions?

2
  • Have you tried installing the LASTools Qgis plugin: For usage and installation, you can follow a tutorial : Follow this link Or the Qgis docs and this link And then import ur dataset using this tools Hope that helps Commented Apr 17, 2015 at 12:31
  • I have tired this and it works on zLAS format of data. Thnks! But i would also like to know how to work with DMR in .asc format.
    – Jost Hobic
    Commented Apr 22, 2015 at 15:22

2 Answers 2

2

The quickest solution would be to load the data into LibreOffice Calc, and sort the data on the second column, then the first one ascending. The result should look like:

426000.78;55000.15;562.24 
426001.78;55000.15;562.22 
426002.78;55000.15;562.20
426003.78;55000.15;562.30
426004.78;55000.15;562.21
426005.78;55000.15;562.21
426006.78;55000.15;562.27
....
426000.78;55001.15;562.96
426001.78;55001.15;562.22 

Saving to csv should give you the right format for GDAL.

See http://www.gdal.org/frmt_xyz.html for more details.


UPDATE

Looking at the whole dataset, your grid has no constant cell size, maybe due to reprojection from another CRS.

So your only chance to use the data is to round the data to full meter cell size, or import it as delimited text point layer, then run Raster -> Interpolation -> Interpolation on it.

12
  • Thanks. What should I do with GDAL? DO i need to download program, which will transform csv to .asc format? How do i do this? Am noob in this field :D
    – Jost Hobic
    Commented Apr 18, 2015 at 9:45
  • GDAL works in the background of QGIS. So if your data has a format that GDAL can read, QGIS is able to dispay it.
    – AndreJ
    Commented Apr 18, 2015 at 14:17
  • Im really sorry but i just cant get my head around this. I have sorted data in second column (i used extended selection) and then sorted first one ascending (also used extend selection). When i open csv save in QGIS i get this Ungridded dataset: At line 2, X spacing was 0.000000. Expected >0 value
    – Jost Hobic
    Commented Apr 22, 2015 at 13:25
  • I am not sure if notepad++ can sort on two columns in one step (which I had in mind using LibreOfficeCalc). With the two sortings your result would look the same as in your question?
    – AndreJ
    Commented Apr 22, 2015 at 18:09
  • I did sort out both columns as you said in LibreOFfice Calc...and i get error as i posed it yesterday... im i doing something wrong?
    – Jost Hobic
    Commented Apr 23, 2015 at 7:52
1

This is an old question but I just ran into this same problem with the same dataset.

I just want to mention that problem here:

UPDATE

Looking at the whole dataset, your grid has no constant cell size, maybe due to > > reprojection from another CRS.

Is easily resolved by rounding all the X/Y values to the nearest decimeter.

I did this in R:

library(tidyverse)
read_delim("GK1_426_55.asc", delim=";", col_names=FALSE)  %>% 
  transmute(X=round(X1, 1),
            Y=round(X2, 1),
            Z=X3) %>% 
  arrange(Y, X) %>% 
  write_delim(path="GK1_426_55_fixed.asc", delim=";")

Afterwards GDAL/QGIS has no problem reading it. You just need to give it the CRS.

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.