[GRASS-user] Making contours from a table of x,y,z coordinates

Michael Barton michael.barton at asu.edu
Mon Mar 2 12:08:23 EST 2009

On Mar 2, 2009, at 10:00 AM, <grass-user-request at lists.osgeo.org> wrote:

> Message: 1
> Date: Mon, 2 Mar 2009 14:49:38 +0000 (GMT)
> From: Dr Barry MacEvoy <b.macevoy at imperial.ac.uk>
> Subject: [GRASS-user] Making contours from a table of x,y,z
> 	coordinates
> To: grass-user at lists.osgeo.org
> Cc: Dr D J Colling <d.colling at imperial.ac.uk>
> Message-ID: <alpine.LRH.2.00.0903021439570.28349 at lx07.hep.ph.ic.ac.uk>
> Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
> Folks,
> Firstly, I've only just started to use GRASS, so I hope this isn't
> too painful to read for experienced users.
> I've got a csv table of data with x,y,z coordinates representing
> around 40 points in 3D space. z is the dependent variable (in fact,
> it's the percentage of carbon found in soil samples at various
> locations).
> I'd like to make some contour lines for the z data, so I've carried
> out the following steps:
> 1.Convert .csv file to a vector map
> v.in.ascii -z
> input=/Users/bcmac/Desktop/test/final_data_for_contours.csv
> output=vector_xyz format=point fs=, skip=0 x=1 y=2 z=3 cat=1
> 2.Match region to vector map
> g.region vect=vector_xyz at test
> 3.Check that region is sensible
> g.region -p
> 4.Create an interpolated raster surface from the vector map
> v.surf.idw --overwrite input=vector_xyz at test output=raster npoints=12
> layer=0
> 5.Create vector map of specified contours from raster map layer
> r.contour --overwrite input=raster at test output=contours
> minlevel=0 maxlevel=90 step=5
> 6.Export vector map as .dxf
> v.out.dxf --overwrite input=contours at sophie
> output=/Users/bcmac/Desktop/test/final.dxf
> But when I look at the contours, they don't seem to follow the
> original data - which I've plotted up in ArcGIS in the (x,y) plane
> with the symbol size proportional to the value of z.
> Have I gone horribly wrong? If so, where?
> Thanks in advance for your help,
> Barry.


The overall procedure you outline is OK. However, I'd use v.surf.rst  
for interpolation (or maybe v.surf.bspline) instead of v.surf.idw.  
Having done such maps with both ArcView idw interpolation (I think its  
+/- the same as in ArcGIS) and GRASS, they can produce somewhat  
different results. The GRASS results seem to better represent the  
data. I also have created a mask that is a little bigger than the  
points field to constrain the interpolation to that region.

If you have a LOT of points, you might try r.in.xyz to create a raster.


More information about the grass-user mailing list