Friday, 8 January 2016

csv - Converting point grid to raster using GRASS?


If I load the original .csv file, I then have a map of the African continent represented by 14069 data points covering it at 40x40km resolution. Each data point shows solar radiation means across the year, (jan, feb, etc).


What I want to be able to do is convert that vector into a raster using GRASS.



What I have managed to do already, is import the .csv (tab delimited) file into the GRASS mapset using v.in.ascii. However, when I try use v.to.rast.constant to convert that vector into a raster, I get a solid square covering Africa, that cannot be edited. I.e. there is no data from the vector within the created raster.


What am I doing wrong?



Answer



Two things you could check:


First make sure that your resolution is set correctly. This you do with the "Edit Current Grass Region" button. You mentioned that the original csv file had points every 40 km. If you want to stay with that, then assuming your points are in a projected coordinate system you should set the resolution to 40,000. If the points are Lat/Lon then the cell size should be about 0.4 (4/10ths of a degree).


Next, I doubt that you want to use v.to.rast. That's for making a raster with individual pixel values matching the individual point values. (BTW, when you set use=val and value=1, you're telling grass to set all pixels to a value of 1. Not what you want...)


A better option might be to import the points directly into a raster using r.in.xyz. Of course, you'll need to create separate rasters for each month. The "Column of data values" will be one of the columns in the ascii file with the data for one of the months. And for the "Statistic" you'll want "mean".


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...