Working with Terrain Data in QGIS
Download, process, visualize, and analyze elevation data using QGIS
Tutorial: Working with Terrain Data in QGIS
Master the art of downloading, processing, and visualizing elevation data for professional GIS analysis.
Learning Objectives
Workflow Summary
This tutorial follows these key steps:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 1: Download & Prepare Data β
β What: Acquire terrain data from USGS β
β Time: ~20 min β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 2: Extract Contour Lines β
β What: Create elevation contours from raster β
β Time: ~25 min β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 3: Create Cross-Sections β
β What: Generate terrain profile graphs β
β Time: ~20 min β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β STEP 4: 3D Visualization β
β What: Create interactive 3D terrain views β
β Time: ~25 min β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RESULT: Complete terrain analysis package β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Prerequisites & Requirements
Data & Resources
Key resources youβll need:
| Resource | Source | Purpose |
|---|---|---|
| USGS EarthExplorer | https://earthexplorer.usgs.gov | Download SRTM elevation data |
| Study Area Shapefile | Provided in tutorial materials | Define your area of interest |
| QGIS Plugins | Built-in Plugin Manager | Profile Tool, Qgis2threejs |
Optional supporting resources: - USGS Documentation: https://lpdaac.usgs.gov - SRTM Dataset Info: https://earthexplorer.usgs.gov - QGIS Manual: https://docs.qgis.org
β οΈ Registration required: Create a free USGS account at https://earthexplorer.usgs.gov
Step-by-Step Instructions
Step 1: Download & Prepare Terrain Data
What youβll do: Access USGS EarthExplorer, upload your study area, and download SRTM elevation data tiles.
1.1 - Register and Access USGS EarthExplorer
Create a free USGS account and log in to the EarthExplorer platform. This is a critical first step as you cannot download data without authentication.
Navigation Steps
- Visit <https://earthexplorer.usgs.gov/
- Click βRegisterβ (if you donβt have an account)
- Fill in your details and verify your email
- Log in with your credentials

1.2 - Prepare and Upload Your Study Area
Before downloading data, you need to define the extent of your area of interest. Youβll convert your shapefile to KML format and upload it to EarthExplorer.
In QGIS:
QGIS Menu Sequence
Layers Panel β Right-click "study_area" layer
β Export β Save Layer As...
This opens the export dialog. Configure as follows:
- Format: Keyhole Markup Language [KML]
- Filename: Study_area.kml
- CRS: Keep default (WGS 84)
- Click OK
On EarthExplorer Website:
Web Browser Steps
Search Criteria
β KML/Shapefile Upload
β Select File
β Choose your Study_area.kml
The map will update to show your study area boundary (typically highlighted in blue or green).

1.3 - Search and Download SRTM Data
Now search for elevation data within your study area boundaries.
Search for SRTM Data:
SRTM Data Search Process
Data Sets
β Search "Digital Elevation"
β Select "SRTM 1 Arc-Second Global"
β Click Results
The system will display available tiles that intersect your study area. Youβll typically see 2-4 tiles depending on your area size.
Review and Download:
- Click the foot icon to see each tileβs extent
- Choose GeoTIFF 1 Arc-second
- Download all tiles that cover your area
Save the GeoTIFF files to a dedicated folder (e.g., data/elevation_raw/)

Step 2: Process and Merge Elevation Data
What youβll do: Merge multiple raster tiles into a single DEM and reproject to your working coordinate system.
2.1 - Build Virtual Raster
The downloaded SRTM data comes as separate tiles. First, create a virtual raster that merges them.
In QGIS:
QGIS Raster Menu
Raster
β Miscellaneous
β Build Virtual Raster
Configuration:
| Parameter | Setting |
|---|---|
| Input layers | All 4 SRTM tiles |
| Place each input file into a separate band | β Unchecked |
| Allow projection difference | β Checked |
| Nodata value | -9999 |
| Output file | dem_virtual.vrt |
Click Run to merge the tiles into a single virtual raster.
2.2 - Reproject to UTM Coordinates
The SRTM data is in geographic coordinates (WGS 84). Reproject it to a projected coordinate system for accurate area-based analysis.
QGIS Raster Menu
Raster
β Projections
β Warp (Reproject)
Configuration:
| Parameter | Setting |
|---|---|
| Input layer | dem_virtual.vrt |
| Target CRS | WGS 84 / UTM zone 32 N |
| Output file | dem_reprojected.tif |
Note: Adjust the UTM zone based on your location (32N for Europe, etc.)
2.3 - Clip to Study Area
Extract only the data for your study area to reduce file size and processing time.
QGIS Raster Menu
Raster
β Extraction
β Clip Raster by Extent
Configuration:
| Parameter | Setting |
|---|---|
| Input layer | dem_reprojected.tif |
| Clipping extent | Use Layer Extent β study_area |
| Nodata value | -9999 |
| Output file | dem_clipped.tif |
Your processed DEM is now ready for analysis!
Step 3: Extract Contour Lines
What youβll do: Generate contour lines from the elevation raster to visualize terrain topology.
3.1 - Apply Gaussian Filter (Optional but Recommended)
The Gaussian filter smooths the elevation data, creating cleaner, more aesthetically pleasing contour lines by removing noise.
QGIS Processing Toolbox
Search for βGaussian filterβ in the Processing Toolbox.
Configuration:
| Parameter | Setting |
|---|---|
| Grid | dem_clipped.tif |
| Search Mode | Circle |
| Standard Deviation | 1.0 (default) |
| Output file | dem_clipped_gauss.tif |
Click Run. The result is a smoothed elevation model.
3.2 - Generate Contour Lines
Now create vector contour lines from your elevation data.
QGIS Raster Menu
Raster
β Extraction
β Contour (Vector)
Configuration:
| Parameter | Setting | Notes |
|---|---|---|
| Input layer | dem_clipped.tif | Use original or smoothed DEM |
| Interval between contours | 10 | Meters (adjust for your area) |
| Output file | contour_lines_10m.shp | Vector shapefile |
| Attribute name | elevation | Field storing elevation values |
Click Run. You now have contour lines showing terrain elevation!
Pro Tip: For larger areas (>1000 kmΒ²), use a 20 or 25m interval to avoid overcrowding. For smaller areas (<100 kmΒ²), 5m intervals provide good detail.

Step 4: Create Cross-Sections
What youβll do: Install the Profile Tool plugin and create terrain elevation profiles.
4.1 - Install Profile Tool Plugin
The Profile Tool creates interactive terrain cross-sections that show elevation changes along a line.
In QGIS:
QGIS Plugin Menu
Plugins
β Manage and Install Plugins
In the Search box: - Type: βProfile toolβ - Select: βProfile toolβ (by Borys Jurgiel) - Click: Install Plugin
Wait for installation to complete, then click OK.
4.2 - Activate and Configure Profile Tool
QGIS Menu Sequence
Plugins
β Profile tool
β Terrain profile
A new Profile panel appears on the right side of QGIS.
Setup:
- In the Layers panel, select your DEM raster
- In the Profile panel, click βAdd Layerβ
- Select βTemporary polylineβ (or βActive layer polylineβ)
- On the map, draw a line across the terrain where you want the cross-section
The elevation profile graph appears automatically in the Profile panel!

Customize the Graph:
- Right-click the graph to access export and configuration options
- Adjust Y-axis to emphasize terrain relief
- Export as PNG, PDF, or SVG for reports
Step 5: 3D Visualization
What youβll do: Install Qgis2threejs plugin and create interactive 3D terrain views.
5.1 - Install Qgis2threejs Plugin
This plugin generates stunning 3D visualizations of your terrain data.
In QGIS:
QGIS Plugin Menu
Plugins
β Manage and Install Plugins
In the Search box: - Type: βQgis2threejsβ - Select the plugin by Minoru Akagi - Click: Install Plugin
The plugin installation may take 30-45 seconds. Click OK when complete.
5.2 - Create 3D Terrain View
Once installed, a new Web toolbar appears above your map.
QGIS Qgis2threejs Menu
Web
β Qgis2threejs
β Qgis2threejs Exporter
Configuration:
- DEM layer: Select dem_clipped.tif
- Color layer: Optional (use contour_lines for additional detail)
- Vertical exaggeration: 1.5-2.0 (exaggerates relief for visibility)
- Export format: HTML (for web) or Three.js (for advanced use)
- Output filename: terrain_3d.html
Click Export. Your 3D visualization opens in a web browser!
Interact with 3D view: - Click and drag - Scroll wheel - Right-click and drag

Result & Expected Outcome
What you should have now:
β
Processed DEM ready for analysis
β
Vector contour lines showing terrain topology
β
Terrain cross-sections for elevation profiles
β
Interactive 3D visualization for presentations
Your final data package includes:
study_area_terrain/
βββ raw_data/
β βββ SRTM_tile_N50_E005.tif
β βββ SRTM_tile_N50_E006.tif
β βββ SRTM_tile_N51_E005.tif
β βββ SRTM_tile_N51_E006.tif
βββ processed/
β βββ dem_virtual.vrt
β βββ dem_reprojected.tif
β βββ dem_clipped.tif
β βββ dem_clipped_gauss.tif
βββ vectors/
β βββ contour_lines_10m.shp
β βββ contour_lines_10m.dbf
β βββ contour_lines_10m.shx
β βββ contour_lines_10m.prj
βββ visualizations/
β βββ terrain_profile_section_A.png
β βββ terrain_profile_section_B.png
β βββ terrain_3d.html
βββ analysis_results/
βββ elevation_statistics.csv
βββ slope_analysis.tif
What you can do next: - Perform slope and aspect analysis - Calculate watershed boundaries - Model hydrological flows - Plan infrastructure projects - Generate professional map layouts
Exercises & Challenges
Challenge 1: Intermediate - Extract Multiple Contour Intervals
π‘ Create Multi-Scale Contours Intermediate
Objective: Create contour maps at different intervals to understand when each is appropriate.
Your task:
- Generate contour lines at 5m interval and save as
contour_5m.shp - Generate contour lines at 25m interval and save as
contour_25m.shp - Compare both visually in QGIS
- Document which is better for your area and why
Hint: Use smaller intervals for detailed small-area analysis, larger intervals for regional overviews.
Solution (click to reveal):
For 5m contours:
Raster > Extraction > Contour
Input: dem_clipped.tif
Interval: 5
Output: contour_5m.shp
For 25m contours:
Raster > Extraction > Contour
Input: dem_clipped.tif
Interval: 25
Output: contour_25m.shp
Comparison: The 5m contours show detailed terrain variation ideal for engineering and detailed planning. The 25m contours are clearer for regional analysis and printed maps.
Challenge 2: Intermediate - Calculate Slope from DEM
π‘ Slope and Aspect Analysis Intermediate
Objective: Derive slope and aspect rasters from the DEM for terrain analysis.
Your task:
- Use Raster > Analysis > Slope on your DEM
- Use Raster > Analysis > Aspect on your DEM
- Apply a color ramp to visualize slope categories
- Identify areas of steep terrain (>30Β°)
Resources: - QGIS Raster Analysis: <https://docs.qgis.org/latest/en/docs/user_manual/processing_algs/qgis/rasteranalysis.html
Hint: Slope values >30Β° indicate steep terrain unsuitable for building but good for hydropower studies.
Tips, Tricks & Warnings
π‘ Pro Tips
β οΈ Common Pitfalls
π΄ Critical Warnings
These mistakes could corrupt your analysis:
β οΈ Always backup original SRTM tiles before processing. Download once, work with copies:
# Recommended directory structure
βββ data_original/ β Original SRTM (never modify)
β βββ SRTM_*.tif
βββ data_working/ β Your processed versions
βββ dem_virtual.vrt
βββ dem_reprojected.tif
βββ dem_clipped.tifβ οΈ Verify your projection before publishing maps. Mistakes here are costly:
Check: Raster > Properties > Source
β
Verify CRS shows "WGS 84 / UTM zone 32 N"
β Do NOT report results if CRS is uncertain
β οΈ Test contour extraction on small areas first before processing entire datasets. A failed 500MB process wastes hours.
References & Further Reading
Questions or Issues?
If you encounter problems:
- Check QGIS compatibility - Ensure youβre running QGIS 3.0 or newer
- Verify USGS account - Registration required for all downloads
- Check internet connection - EarthExplorer requires stable connection
- Search QGIS Documentation - https://docs.qgis.org/
- Ask on GIS Stack Exchange - https://gis.stackexchange.com/
Common issues:
| Issue | Solution |
|---|---|
| Plugin wonβt install | Update QGIS to latest version |
| βNodataβ artifacts in contours | Check nodata value is set to -9999 |
| 3D visualization very slow | Use larger contour intervals (25-50m) |
| Projection mismatches | Always reproject to UTM before analysis |
Tutorial Version: 1.0
Last Updated: February 5, 2025
Difficulty: Intermediate
Estimated Duration: 90 minutes
Status: β
Complete and tested in QGIS 3.28.0