4

I have an SRTM elevation map. How do I get the elevation of each point in the map? I am using GRASS. Is there a GRASS script to do such?

3 Answers 3

3

You can also query with r.what or export the map to an ASCII matrix with r.out.ascii.

2
  • I used r.what input=rastermap < input.txt The input.txt file contains one point: 121:01:04.9939E 14:53:22.1299N I got the point arbitrarily by hovering the cursor on the map and saved its coordinates in input.txt. After running the grass script, it displayed: 121:01:04.9939E|14:53:22.1299N||90 I was wondering why it did not display the level. Is the value 90 the elevation of that particular point given that what I loaded is an SRTM map? Is there an easier way to extract and store all the coordinates of a raster map? Thanks!
    – teamAngat
    Feb 1, 2011 at 16:46
  • 1
    90 is the elevation, yes. Remember that SRTM is integer only... For storing all, see r.out.ascii comment above. Or use r.stats -1g mapname
    – markusN
    Feb 1, 2011 at 21:48
2

Maybe this answer to "Calculating difference in altitude along lines using GRASS" can help you too.

2

There is a command that do just what you want:

v.what.rast "Uploads raster values at positions of vector points to the table"

You need a vector file with points and a table attached to it. In the table you need to create a column to receive the values from the raster. Then run v.what.rast. It will read the raster value in the position below each point and put that number in the table.

3
  • It is stated in grass.osgeo.org/gdp/html_grass63/v.what.rast.html, that "v.what.rast reads raster value for each point in the vector and updates col column in vector attribute table by this value.". What does the phrase "each point in the vector" means? Where does the location of the raster value bases from? Is it from the "cat" column in the vector table? I used the script: v.what.rast vect=vmap rast=rmap col=ID_0 and it displayed: No record for category 0 in table <table1>
    – teamAngat
    Feb 1, 2011 at 16:58
  • 1
    I've included some explanations in the answer above. No record for category 0 in table <table1> means that the feature with cat=0 has no record in the table. You may use v.to.db option=cat ... to put values in the table.
    – Pablo
    Feb 1, 2011 at 17:29
  • If there is anything to improve in the GRASS documentation, please say so (ideally, suggest text snippets...). Thanks.
    – markusN
    Feb 10, 2011 at 18:25

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.