[GIS] Contour lines (*.shp) into XYZ

elevationqgisxyz

I downloaded a TIFF image from USGS Earth Explorer from which I determined the contour lines and saved them in a shapefile (see tutorial http://www.qgistutorials.com/en/docs/working_with_terrain.html).

I would like to convert these features to points (just as this ArcGIS tool http://pro.arcgis.com/en/pro-app/tool-reference/data-management/feature-to-point.htm).

Each point should contain xyz information (simple CSV file or similar) which I can import as a surface elevation into FEFLOW (groundwater modelling)

I tried with MMQGIS which gives me the following output:

"shapeid","x","y"
"1","-7.4266662066","37.1800028654"
"1","-7.42583287327","37.1800083477"
"1","-7.42582462244","37.1800000968"
"2","-7.42583287327","37.1799959509"
"3","-7.4266662066","37.1799959509"
"3","-7.42749953994","37.1797223191"
"3","-7.42833287327","37.1795834302"
"3","-7.4291662066","37.1797917635"
"4","-7.42999953994","37.1797223191"
"4","-7.43083287327","37.1799959509"
"4","-7.43083701921","37.1800000968"
"4","-7.4316662066","37.1805556524"
"4","-7.43208287327","37.1808334302"

What I want however is:

"x","y","z"
"Latitude","Longitude","Elevation"

Best Answer

In two steps:

  1. Extract nodes. Vector | Geometry Tools | Extract nodes (or from Processing Toolbox QGIS geoalgorithms | Vector geometry tools | Extract nodes
  2. Save As... the produced Nodes layer as csv file. By default, the Geometry type would be Automatic . Make sure the Layer Options is set to GEOMETRY= AS_XY. (So, basically, leave it as is).

NB the extracted nodes can create a big file. Please consider decimating it before saving it to csv.