[GRASSLIST:9282] Re: How to extract elevation of sites?

Dylan Beaudette dylan.beaudette at gmail.com
Sat Dec 3 15:47:48 EST 2005


On 12/2/05, odoardo.zecca at libero.it <odoardo.zecca at libero.it> wrote:
> Hi all.
>
> I need to extract the elevation of 85 sites from a DEM. How could I do that
> giving a list of coordinates (from a file or standard input) instead of
> interactively use d.what.rast?
>
> Thank you
>
> --
> Odoardo Zecca
> via Vallescuropasso, 50         tel.: 328 2883121
> 27043 Broni (PV)                email: odoardo.zecca at libero.it
>
>

Hi,

Here are two ways that I would go about doing it.

My locations are stored as UTM coordinates in the file coords.txt,
fields are separated by "," . My DEM is called elev.

in GRASS61-CVS

#import the ascii records into a new vector called 'coords'
v.in.ascii in=coords.txt fs="," out=coords

#associate each point in coords with its elevation from the DEM 'elev'
g.region rast=elev

#the extent of 'coords' should be smaller than that of 'elev'
v.drape type=point rast=elev method=cubic out=coords_3d

or if you do not want to set the z-coord of each point in 'coords' you
could use v.sample. Note  that the raster sampling algorithms are the
same in v.sample and v.drape.

Cheers,

Dylan




More information about the grass-user mailing list