2

I have a .csv-file containing x and y-coordinates as well as different variables with attributes (var1 to var3). The csv looks like that:

enter image description here

Loading the data into QGIS with Add Layer → Add Delimited Text Layer then results in a point layer covering the whole world with the points lying about 1/4 degree apart from each other. Filtering by variable attributes (show only points where var1 is not NULL) gives me a point layer where each point hits some parcel of land. This looks like this (point layer over some polygon layer):

Point layer over vector layer

What I want is to rasterize the point layer into equally sized rasters in order to be able to calculate zonal statistics and do other operations.

  • What have you tried so far, and where are you stuck? – Erik Jun 14 at 9:10
  • I've referred to this post: gis.stackexchange.com/questions/189655/… but could not determine whether to use IDW or TIN interpolation. How to choose which one suits my needs and which settings shall I choose? Furthermore, those tools do not allow to use my point layer. Then, I have read that I could add an header to transform the data to .ascii but the data does not seem to be in suitable format for that. – philsch Jun 14 at 9:38
  • We don't know, whether TIN or IDW suits your needs, since we don't know your needs. Inform yourself on the differences between the two. Then make sure you saved your points as a shapefile and run the interpolation. – Erik Jun 14 at 9:46
  • My needs are to calculate zonal statistics from the produced rasters. As can be seen in the second picture, I have a map with administrative polygon units for which I want e.g. the mean value of the variable from the table in picture 1. I am working with EPSG4326 WGS84 as projection and I have a world map with those administrative boundaries. I guess I would choose the IDW method as I have equidistant points?! – philsch Jun 14 at 9:56
  • 1
    If you load all data (incl. those with var = 0) - do you have whole rectangular area covered? If yes, you could slightly "tweak" the data structure and "convert" them to Esri ASC (ARC/INFO ASCII GRID) grid file which can also be loaded in QGIS and other tools. See this for details: en.wikipedia.org/wiki/Esri_grid – Juhele Jun 14 at 13:51
2

As your data points are regularly distributed (0.25 x 0.25 degrees), you can just rasterize (or "burn") to create a raster layer... you do not have to perform gridding task,

About the the linked question in your comment, unfortunately, the interval between data points were only slightly irregular (like 0.1666 vs. 0.1667) which required to be gridded (by IDW or TIN methods).


Rasterize (Vector to Raster) tool can be found from the menu Raster > Conversion (or in the Processing Toolbox GDAL > Vector Conversion)

The interface is easy and self-explanatory.

enter image description here wrong picture

enter image description here revised picture


If you want to try gridding (IDW / TIN), my suggestion (just an opinion) is:

  1. When you are interested in large structure of data ==>> TIN
  2. When you want to see local variations, or find anomalies ==> IDW
  • I would have tried Rasterize even in the case of the lined question... I don't know but the extent (including its origin) was hard to define in that question. In your case the origin -180, -90 (or something like that) is not hard to imagine. – Kazuhito Jun 14 at 12:20
  • Thank's for the answer! However, I always get an error message when applying the command. I first imported the csv to QGIS, converted it to a point shapefile and saved it. Then I performed the task. The error says something about Wrong value for -outsize parameter. As Output extent I used the layer extent of the point layer. Doing the task on the imported .csv also did not work.. – philsch Jun 17 at 7:41
  • @philsch I am terribly sorry as I inadvertently posted wrong picture, which has shown pixel for the output raster size units. It sets the resolution at 0.25 pixel... which makes no sense. Please choose Georeferenced units, so that the resolution reflects degrees, so that the cell size is set to 0.25 degrees. – Kazuhito Jun 17 at 10:43
  • That does the job, thanks! – philsch Jun 17 at 10:49

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.