I know how to generate contour lines from a DEM file once the file is loaded in QGIS and I also know how to open the attribute table for the contour lines which show elevation against IDs. Is there a way to look at elevation values against sets of longitude and latitude values in QGIS? In other words, is there a way to extract and look at XYZ data from a DEM file in QGIS?
Asked
Active
Viewed 1.8k times
1
-
You could export the DEM as text XYZ but it wouldn't load in most text viewers.. what are you trying to do with the Z for an X,Y? Are you trying to script this? How are you going to determine the X,Y to sample with, a point from a feature class, a mouse click..? You could have a look at https://gis.stackexchange.com/questions/120555/get-value-of-clicked-raster-cell and see if that suits your needs. – Michael Stimson Apr 27 '17 at 05:19
-
I was planning to use a mouse click to get the elevation value – Salman Ahmed Apr 27 '17 at 05:54
-
2Using a mouseclick for elevation can be done with the 'identify' tool, which gives you the pixel values for locations you click. – Kersten Apr 27 '17 at 06:59
2 Answers
1
If I understand correctly, you want to export elevation attributes from a DEM to a point layer?
To do that, you can use the Point Sampling Tool plugin to do just that. Make sure both layers have the same CRS, and run the tool.
The result is a new point layer with an elevation attribute field
HDunn
- 8,626
- 3
- 40
- 71
-
For now, I only have the DEM file (raster). How do I get a points layer? Do I just make a new vector layer and add random points to it? – Salman Ahmed Apr 28 '17 at 06:30
0
Two possible solutions come to mind: In QGIS there's the plugin "Point Sampling Tool", and in GRASS the module: v.what.rast.
Both of these extract values from a raster for each feature in a point layer.
Micha
- 15,555
- 23
- 29
