January 2019
Beginner
164 pages
3h 15m
English
Let's build another script to load raster data. Copy the following code:
Hillshade_layer = iface.addRasterLayer('D:/QGIS_quickstart/qgis_sample_data/raster/SR_50M_alaska_nad.tif','Hillshade')Landcover_layer = iface.addRasterLayer('D:/QGIS_quickstart/qgis_sample_data/raster/landcover.img','Landcover')## print the layer namesprint (Hillshade_layer.name())print (Landcover_layer.name())## print the image dimensionsprint (Hillshade_layer.width(), Hillshade_layer.height())print (Landcover_layer.width(), Landcover_layer.height())
The code in this script is loading in two layers, Hillshade and Landcover, printing the names to the console, and printing the image dimensions.
You can download data from here: https://github.com/PacktPublishing/QGIS-Quick-Start-Guide/blob/master/Chapter07/02_Loading_data_raster.py ...
Read now
Unlock full access