Professional Documents
Culture Documents
Week 11
Week 11
P T
Geographic Information Systems
N
Dr. Bharath Haridas Aithal
Ranbir and Chitra Gupta School of Infrastructure Design and Management,
IIT KHARAGPUR
Module 11: GIS As a Software
Lecture 51 & 52: Data Acquisition and Raster Functions – Part I & Part II
Hands on By: Chandan M C
E L
P T
Data Acquisition
DEM visualization
N
Terrain analysis – Slope, Aspect, Hillshade and Contour
Raster calculator
Interpolation
Clipping raster using layer (Masking)
E L
Data Acquisition
Satellite Data can be downloaded
T
from https://earthexplorer.usgs.gov/
First time users, click on register tab
P
Once registration is done you can
login
N
On the search criteria tab enter
interested place name. For ex.
Bangalore
E L
Data Acquisition
T
range. For ex. 01/04/2000 to 03/23/2015
Now, click on Data Sets tab and choose
P
Digital Elevation in the “SELECT YOUR
DATA SET” tab
N
Under SRTM dropdown, Check SRTM 1
Arc‐Second Global and click on Results
Note: Alternatively you can select any other
data. For instance, Landsat, Sentinel‐2 etc.)
E L
Data Acquisition 1. Show Footprint 2. Show Browse Overlay
1. Show Footprint
2. Show Browse Overlay
3. Show Content
T
4. Show Metadata
5. Download Options
6. Add to Bulk Download
P
7. Exclude Scene from Results
N
4. Show Metadata
5. Download Options
T
Layer > Add Layer > Add Raster
Layer..
P
Right click on DEM layer and select
properties
N
From the information tab, observe
CRS, Extent and unit
Close properties tab
For further analysis, let us first
convert the DEM into UTM CRS
E L
DEM Visualization Right click on DEM layer > Export > Save As…
Browse to location and save layer with a new name
T
(In this case BLR_DEM_UTM.tif)
Note: Bangalore
P
belongs to UTM
Zone 43. From the
filter tab search for
43N
N
E L
DEM Visualization Right click on BLR_DEM_UTM.tif > Properties >
Symbology
T
Perform these changes in symbology tab
1. Render type = Singleband Pseudocolor
P
2. Interpolation = Linear
3. Color ramp = Spectral (inverted)
N
4. Label suffix = m
5. Mode = Equal interval
6. Classes = 6 (Or any number)
7. Apply and press OK
E L
DEM Visualization
DEM finally looks like the picture to
T
the left
Here, Blue indicates lower elevation
P
(237m above MSL) and Red
indicates higher elevation (1483m)
N
E L
Terrain analysis – Slope
Menubar > Raster > Analysis > Slope
T
Select Input layer as BLR_DEM_UTM.tif
Browse to location where slope layer needs to be
P
saved and provide name as BLR_Slope.tif for the
output
N
Click on Run
• Slope is expressed in
terms of degrees
• In this case, 0 – 60
degrees
E L
Terrain analysis – Aspect
Menubar > Raster > Analysis > Aspect
T
Select Input layer as BLR_DEM_UTM.tif
Browse to location where slope layer needs to be
P
saved and provide name as BLR_Aspect.tif for the
output
N
Click on Run
• Aspect gives direction of
slope
• It is expressed in terms of
degrees
• In this case, 0 – 360
degrees
E L
Terrain analysis – Hillshade
Menubar > Raster > Analysis > Hillshade
T
Select Input layer as BLR_DEM_UTM.tif
Browse to location where slope layer needs to be
P
saved and provide name as BLR_Hillshade.tif for the
output
Click on Run
N
• Hillshade is a grayscale 3D
representation of the earth’s
surface, with the sun's relative
position (for shading the image)
• This function uses the altitude
and azimuth properties to
specify the sun's position
• In this case, 0 – 360 degrees
E L
Raster Calculator
Rasters are essentially grids of pixels that have a specific value assigned to them
T
By performing mathematical operations on these values, one can do some interesting
analysis
P
QGIS has some basic mathematical logics and analysis capabilities built‐in via Raster
Calculator such as:
N
1. Mathematical (+, ‐, *, /)
2. Trigonometric (sin, cos, tan, asin, acos, atan)
3. Comparison (<, >, =, <=, >=)
4. Logical (AND, OR)
The raster calculator can apply mathematical operations on the raster pixels
E L
Raster Calculator
Menubar > Raster > Raster calculator
T
Output location and layer
Raster Bands: Name of
name to be saved as
the band to be
P
operated
Output CRS: Keeping source
CRS is suggested
N
Operators:
Mathematical logic and
operators
Expression/Formula tab
E L
Raster Calculator
Open Raster Calculator with
T
BLR_DEM_UTM loaded in QGIS
layer panel
P
Task is to perform a mathematical
operation on DEM image to
N
separate out pixels with elevation
values greater than 800m
Double click on DEM file and type
expression as
"BLR_DEM_UTM@1" > 800
E L
Raster Calculator
Select output location and file
T
name to be saved (in this case,
BLR_Elev_800m.tif)
P
Click on Run
Output map will be a binary map
N
with
Elevation < 800m = 0
Elevation > 800m = 1
E L
Interpolation
Interpolation is the process of using points
T
with known values or sample points to
estimate values at other unknown points
P
Load Rainfall.shp and Dist.shp to QGIS
Point Rainfall values indicates raingauge
N
readings recorded at various places in
Mysore district
Task is to interpolate these values, create a
continuous raster map and clip according
to district boundary
E L
Interpolation
Menubar > Raster > Interpolation
T
If you do not find Interpolation
under Raster menu, then
P
processing tool box and search for
IDW* interpolation
N
Use layer extent:
Dist
Set Output
resolution: 30m
*IDW = Inverse Distance Weight
E L
Interpolation
Output of Interpolation looks
T
similar to picture on the right
Next task is to crop the
P
interpolated map according to
Mysore District boundary
N
Menubar > Raster > Extraction >
Clip Raster by Mask Layer…
E L
Clipping a Raster
Input layer: Interpolated.tif
T
Mask layer: Dist.shp
Clipped layer: Interpolate_MYS.tif
NP
E L
Adding Style to Interpolated and Clipped Map
T
Symbology
Perform these changes in symbology tab
P
1. Render type = Singleband Pseudocolor
2. Interpolation = Linear
N
3. Color ramp = Spectral (Blue to Red)
4. Label suffix = mm
5. Mode = Equal interval
6. Classes = 5 (Or any number)
7. Apply and press OK
E L
Adding Style to Interpolated and Clipped Map
P T
N
• To add labels of raingauge stations,
Right click on Rainfall.shp >
Properties > Labels > Single labels >
Label with : Raingauge > Apply > OK
E L
Summary
Data Acquisition – USGS Earth Explorer
T
DEM visualization – Changing Symbology
Terrain analysis – Slope, Aspect, Hillshade and Contour
P
Raster calculator – Mathematical expressions and logics
Interpolation – IDW method
N
Clipping raster using layer (Masking) – Mysore District
In the next session, we shall discuss about downloading and installing QGIS
plugins
E L
P T
N
E L
P T
Geographic Information Systems
N
Dr. Bharath Haridas Aithal
Ranbir and Chitra Gupta School of Infrastructure Design and Management
IIT KHARAGPUR
Module 11: GIS As a Software
Lecture 53 : Map composition
Hands on By: Prakash P S
E L
P T
Styling in QGIS
N
Labeling in QGIS
Map elements
Map composition
E L
Styling in QGIS
Styling maps in QGIS
Open a vector layer
T
Right click on the layer
Click on Properties
P
Click on Style
Set the style properties
N
Click OK
E L
Styling in QGIS
P T
N
E L
Labelling in QGIS
Labelling maps in QGIS
Open a vector layer
T
Right click on the layer
Click on Properties
Click on Labels
Select show labels for the vector
P
Chose an attribute as label with
Click OK
N
E L
Labelling in QGIS
P T
N
E L
Composing maps – Compose manager
Map composition in QGIS
Open a vector layer
T
Style and label as required
Click on Project>Compose
Manager>Add
Give Composer title
P
Click OK
N
E L
Composing maps – Compose manager
…Map composition in QGIS
Click on Add new map
T
Drag the map on the white
space given
NP
E L
Composing maps – Compose manager
P T
N
E L
Composing maps – Adding map elements
Map composition in QGIS
Add map elements by
T
clicking on Layout
Adjust scale using item
properties
NP
E L
Composing maps – Adding map elements
Map elements
T
Map title
North arrow
P
Scale bar
Legend
N
E L
Composing maps – Exporting the maps to PDF/IMAGE
T
Open Export as image option
Mention the dimension and DPI
Press on Save
NP
E L
Composing maps – Composed map
P T
N
E L
Summary
T
Styling
Labeling
P
Map composition
Adding map elements
N
Exporting map as image/pdf
E L
P T
N
E L
P T
Geographic Information Systems
N
Dr. Bharath Haridas Aithal
Ranbir and Chitra Gupta School of Infrastructure Design and Management
IIT KHARAGPUR
Module 11: GIS As a Software
Lecture 54 : Bhuvan geoportal and Google earth
Hands on By: Prakash P S
E L
P T
Introduction to Bhuvan geoportal
N
Utilities in Bhuvan
Open data achieve in Bhuvan
Introduction to Google earth
Data preparation using Google earth
Importing data to QGIS
E L
Bhuvan geoportal
Bhuvan, is a web based utility which allows users to explore a set of map
T
based content prepared by Indian Space Research Organization (ISRO)
The content includes thematic maps related to
P
Disasters
Agriculture
N
Water resources
Land cover
Processed satellite data of ISRO
E L
Bhuvan geoportal
T
It offers high resolution imagery of Indian locations with spatial resolution up to 1 meter
Currently, 177 cities are covered with high resolution (1 meter) datasets and remaining
P
part of country is covered with 2.5 meter resolution imagery
Satellite including
N
Resourcesat‐1,2
Cartosat‐1
Cartosat‐2
E L
Bhuvan geoportal
https://bhuvan.nrsc.gov.in
P T
N
E L
Bhuvan geoportal Application sectors
Agriculture
T
Forestry
E‐governance
P
Water
Tourism
N
Urban
Rural
E L
Bhuvan geoportal Services
Bhuvan 2D
T
Bhuvan 3D
Open data archieve
P
Climate and Environment
Thematic services
N
Disaster management and support services
Ocean services
Creating custom maps/GIS
E L
Examples of Bhuvan’s Collaborators
T
Punjab Remote Sensing Centre
Ludhiana Municipal Corporation
P
Karnataka Forest Department
Himachal Pradesh Forest Department
N
AIBP
India Meteorological Department(IMD)
E L
Bhuvan draw tool
T
Long in to portal
Click on Bhuvan 2D>
Tools draw tool
P
Select
point/line/polygon
Draw on the map
Click on create
N
Click on download
E L
Bhuvan: Open data achieve
Download the Resourcesat/LISS III/Landsat/CartoDem data
T
Long in to portal
Click on Open data
achieve>
Select the category
P
Select the subcategory
Select Area
Click on download
N
Applications
E L
P T
N
E L
Google earth
Search for a specific place and zoom
P T
N
E L
Google earth vector data digitization
Right click on My Places and Add folder
P T
N
E L
Google earth vector data digitization
Right click on My Places>Add>Path/Polygon/Placemark
P T
N
E L
• After creating required features right click on the folder and save places as .kml file
T
• The saved file can be opened in QGIS by using add vector layer button
NP
E L
• After opening in QGIS, verify the places by adding Google earth as base layer
P T
N
Area calculation/length
E L
P T
N
Length calculation
E L
P T
N
Area calculation
E L
P T
N
E L
Summary
T
Introduction to Bhuvan geoportal
Utilities in Bhuvan
P
Open data achieve in Bhuvan
Introduction to Google earth
N
Data preparation using Google earth
Importing data to QGIS
E L
P T
N
E L
P T
Geographic Information Systems
N
Dr. Bharath Haridas Aithal
Ranbir and Chitra Gupta School of Infrastructure Design and Management
IIT KHARAGPUR
Module 11: GIS As a Software
Lecture 55 : Introduction to R (Part ‐ I)
Hands on By: Prakash P S
E L
P T
Introduction to R
Downloading and installing R
N
R interface
Data types in R
Basic tasks and functionalities
E L
Introduction to R
T
R is a development environment rather than just a programming language
It is a handy and popular tool for statistical calculations, analyzing data and creating graphs
P
Popularity of R among data scientists and researchers is because of its ease of learning,
N
availability of packages, and compatibility across various operating systems
Also, it is a free software
E L
Installation of R
T
https://cran.r‐project.org/bin/windows/base/
P
Download R Studio software using this link
https://www.rstudio.com/products/rstudio/download/
N
E L
R studio environment
P T
N
E L
Data types
Object classes
T
Character c = “RCGSIDM”; c = “52.5”
P
Numeric x = 52.5
Integer y = 50
N
Complex m = 1+2i
Logical (true or false) g = x>y
E L
Data types
T
Vectors Lists
P
class(x) class(x[[1]])
[1] "character" [1] "character"
N
y = c(1,2,3,4,5) class(x[[2]])
[1] "numeric"
class(y)
[1] "numeric" class(x[[3]])
[1] "logical"
E L
Data types
Matrix
T
• Matrix is a collection of multiple vectors or it is a two dimensional vector.
• Both rows and columns of the matrix should include elements of the same class.
P
• Two methods are shown here to create matrix.
matrix_a = c(1,2,3,4,5,6)
N
dim(matrix_a) = c(3,2)
matrix_a
[,1] [,2]
[1,] 1 4
[2,] 2 5
[3,] 3 6
E L
Data types
Data frames
T
Data frames are used to store data in table format.
It can contain data of different types on each column and logical constraint is that each column
P
can only contain objects of same class. Data frame is created using a function data.frame()
x = c("Shiv","Raj","Krish")
N
y = c(35,25,15)
z = c(TRUE,TRUE,FALSE)
data_frame = data.frame(username=x, age=y, adult=z)
data_frame
username age adult
1 Shiv 35 TRUE
2 Raj 25 TRUE
3 Krish 15 FALSE
E L
Importing CSV data to R
Employ_data = read.csv(file.choose())
T
Employ_data = read.csv(“Directory and file path”)
NP
E L
Data subset
T
Employ_data_1 <‐ Employ_data[1:8,1:4]
NP
E L
Subset
x = 15:25
T
>x
P
[1] 15 16 17 18 19 20 21 22 23 24 25
N
> x[1:4]
[1] 15 16 17 18
> x[2:5]
[1] 16 17 18 19
E L
Sequence creation
x = 1:10
>x
T
[1] 1 2 3 4 5 6 7 8 9 10
P
> y = ‐6:4
>y
[1] ‐6 ‐5 ‐4 ‐3 ‐2 ‐1 0 1 2 3 4
N
> z = seq(from=2,to=20,by=3)
>z
[1] 2 5 8 11 14 17 20
> m = rep(1:4,3)
>m
[1] 1 2 3 4 1 2 3 4 1 2 3 4
E L
Set working directory
T
setwd("H:/Lab Works/R_Course/DataSets")
P
Note that windows operating system uses need to use backward
slash “/” instead of forward slach “\” while giving working
directory path.
N
E L
Help from the Console
T
R provides help in its console using symbol “?”, programmer could
use ? followed by function to get help in R help tab.
P
Examples:
> ?vector
N
> ?matrix
> ?read.csv
E L
Summary
T
Introduction to R
Downloading and installing R
P
R interface
Data types in R
N
Basic tasks and functionalities
E L
P T
N
E L
P T
Geographic Information Systems
N
Dr. Bharath Haridas Aithal
Ranbir and Chitra Gupta School of Infrastructure Design and Management
IIT KHARAGPUR
Module 11: GIS As a Software
Lecture 56 : Introduction to R (Part ‐ II)
Hands on By: Prakash P S
E L
P T
Package installations in R
N
Reading Spatial data
Raster functions
Plotting maps
FCC preparation
E L
Package installation
R has several ready‐made packages to perform various functions. A new package installation can
T
be made with the function install.packages. It needs to be loaded to every R session with the
library function.
P
Examples:
> install.packages("Utils")
N
> install.packages("rgdal")
> install.packages("raster")
> library(RStoolbox)
> library(utils)
> library(raster)
> library(rgdal)
> library(RStoolbox)
E L
Spatial functions
T
R supports various spatial functions using raster and vector data models.
P
Various spatial functions are available in packages such as
raster
rgdal
N
sp
RStoolbox etc….
E L
Read raster data
• A function raster() is used from package “raster” to import satellite image from the
T
directory to the R environment. Here file.choose() is a function can be used for choosing
file instead of giving file path.
P
• Function brick() is a multilayer raster object, this function is used to call raster with
multiple bands.
N
> quick_bird = raster(file.choose())
Or
> quick_bird = brick(file.choose())
E L
Cell statistics
To calculate minimum or maximum pixel value from a raster function cellStats() is used. This function
T
also can be used to find mean and standard deviation from a raster object.
P
> min = cellStats(quick_bird, stat='min', na.rm=TRUE, asSample=TRUE)
> min
[1] 123
N
> max = cellStats(image1, stat='max', na.rm=TRUE, asSample=TRUE)
> max
[1] 1263
Plotting a raster can be done using plot() function, adding of title, labels to x and y directions is
T
possible.
> DEM = raster(file.choose())
P
> plot(DEM, main = "Digital Elevation Model", xlab = "Longitute",ylab = "Latitude")
N
E L
Preparation of histogram of a raster
Histogram of a raster file can be plotted with hist() function. Provision to customize
T
the color, breaks and other parameters are incorporated in the function itself.
P
hist(DEM,main = "Distribution of surface elevation values",
+ xlab = "Elevation (meters)",ylab = "Frequency",
N
+ col = "springgreen",breaks=25,
+ labels=TRUE,warn.unused=FALSE)
E L
False Color Composite (FCC) preparation
Color composites from bands of satellite images can be formed by stacking the layers together in
T
particular order and exporting or writing to various other formats is performed by using
writeRaster() function.
P
a <‐ raster(file.choose())
> b <‐ raster(file.choose())
N
> c <‐ raster(file.choose())
> d <‐ stack(c,b,a)
> plotRGB(d, r=1, g=2, b=3, stretch='lin')
> writeRaster(d,"fcc.tiff",format="GTiff",overwrite=TRUE)
E L
Summary
T
Package installations in R
Reading Spatial data
P
Raster functions
Plotting maps
N
FCC preparation
E L
P T
N