Tuesday, January 23, 2018

Make DEM and Contours From Google Earth using QGIS

Digital Elevation Models (DEM) and Contours are always important for spatial analysis and difficult to obtain always as required. In this post we will use Google Earth to download Elevation data and QGIS to develop DEM and Contours.


Step 1,



Open Google Earth and Select "Add Path" tool


Step 2,


Draw point cloud as shown in the image.. Add much as possible to get higher accurate DEM. 


Step 3,



Once finished drawing point cloud change the name as you required and hit ok.



Save the file as Kml.




Step 4, 

We have to convert KML to CSV file format and have to update the altitude values of the KML. here I am using open source software "TCX converter" which is freely available to download, 


Download the .exe file which is supported to your operating system, 



Open TCX converter and default language will be "Dutch",




Change the language to English and the Select "Open File"option to open KML file,


Add ML file to the TCX converter,


Once KML uploaded to the TCX converter you can see Altitude field is containing "0" values. Hence we have to update the Altitude field and user must have internet connection for this.  


Select "Track Modify" tab and then select "Update Altitude" tab,


Now you can see updated Altitude field, Now we have to extract these data as CSV file, Select "Export"Tab and then Select "Save CSV File".


If you are using Ms Excel 2013 or a higher version select "No" option or else select "Yes",


Now all the data has been saved in to Excel as CSV file and we can delete unnecessary fields and must keep Lat, Long and Altitude  fields.


Step 5,

Launch QGIS  and select "Add Delimited Text Layer" option,


Browse for the CSV file created and select "CSV" option, the select "First record has field names" option and select X field as "LONG" and Y field as "LAT"


Press "OK" to add data to the QGIS


Step 6,


Your point cloud data will display in QGIS, now we have to assign the coordinate system,


Right Click on the layer and select "General" tab and the select required coordinate system (WGS 84 might be selected as default coordinate system)


Step 6,

Then we have to convert this vector layer into ESRI shape file,


Right click on the vector layer and select "save as" option,



Press "OK" and ESRI shapefile will create and automatically displays in the QGIS, remove the vector layer which we used to develop shapefile which no longer required,


Step 7,

Now we have to create Digital Elevation Model (DEM) using created ESRI Shapefile,
 Select SAGA (geoalgorithms) --> Natural Neighbour



Select  output extent as "Use layer/Canvas extent"


Select your shapefile as layer extent,


Set the cell size as 0,0005. the unit is degree due to layer coordinate been assigned as WGS 84.
Then set output path for DEM.


DEM will create and added to the QGIS,


You can reclassify the raster,  


Right click on the raster and select properties, Select "Single pseudocolor" as render type, X in Invert box and select number of classes you required and hit "Classify" button.

Step 8,

Now we have to extract contours from developed DEM, select "Raster" tab --> Extraction --> Contour


Set output file path and set the contour intervals as required and X attribute name and type the field name for the elevation attribute.



We can add labels to contour lines, Right click on the contour shapefile and select "label" tab, select "Show labels for this layer" option and select your elevation field as "label with" option.