GIS - Class Notes
GIS - Class Notes
➢ Following dialog box will appear on the screen. Select Polygon option from Geometry type.
➢ The CRS dialog box will appear on screen. Click on the WGS84 option and it will be selected
as follows. click on OK
➢ Set style for polygon by using property window(Right click on Matunga Layer)
➢ Following screen will appear on the screen. Select pattern as you want and click on OK.
➢ Same way we can add one more polygon layer for Gardens.
➢ Once you are done then right click on map (Dotted line turn into solid line)
➢ To label your roads Right click on Road layer .Go to properties window then select label and
set single label property
➢ Following window will appear on the screen
Final output:
d) Calculating line lengths and statistics
➢ Go to Layer → Add Layer → Add Vector Layer
➢ Add the following file to project
"\GIS_Workshop\Practicals\Practical_01\D\DATA\IND_rrd\IND_rails.shp"
Press “ADD”
➢ Also add India Administrative Map
“GIS_Workshop\Practicals\Practical_01\D\DATA\IND_adm\IND_adm0.shp”
➢ Double Click on IND_adm0
Press OK
➢ The display window will appear like
➢ In Layer Pane, Right click on IND_rails → Open Attribute Table
➢ Press Toggle Editing button using button, on Attribute table window toolbar.
➢ Press Open Field Calculator using button.
➢ Set the output field as “Track_Len”, field type to “Decimal Number”.
➢ Set expression as
Press “OK”
➢ A new column is added to the attribute table with value representing the length of track in KM.
➢ Press CTRL+S or click on Save Edits option on tool bar
➢ Close the attribute table window.
➢ For calculating the total length of Railway tracks in India.
➢ Select Vector→ Analysis Tools→ Basic Statics for Fields
➢ Select IND_rails layer from input layer. And select Track_Len in “Field to Calculate statistics
on”
➢ Press RUN
➢ The Result is
➢ Select Gridded Population of the World (GPW) v3 dataset from Columbia University,
Population Density Grid for the entire globe in ASCII format and for the year 1990 and 2000.
“\GIS_Workshop\Practicals\Practical_02\A\Data\gl_gpwv3_pdens_90_ascii_one\glds90ag60.asc”
“\GIS_Workshop\Practicals\Practical_02\A\Data\gl_gpwv3_pdens_90_ascii_one\glds00ag60.asc”
➢ To start with analysis of population data, convert the pixel from grayscale to Color.
➢ Select “glds90ag60.asc” Layer form layer Pane → select property OR double click on it.
➢ Select
➢ Press “APPLY”
➢ Repeat the same for “glds00ag60.asc” Layer
Layer output after applying style.
➢ The objective this experiment is to analyze raster data, as an example we will find areas with
largest population change between 1990 and 2000, by calculating the difference between each
pixel values.
➢ Go to Raster → Raster Calculator
➢ Select
➢ Set Render Type to “Single band Pseudo color”, Interpolation as Discrete, and remove all
classification and add as shown in figure above using button. After all settings press
“OK”.
➢ Layer will appear like
➢ Explore an area of your choice and check the raster band value using to verify the
classification rule.
➢ The red pixel shows negative changes and blue shows positive changes.
c) Raster Mosaicking and Clipping
A mosaic is a combination or merge of two or more images.
In GIS, a single raster dataset can be created from multiple raster datasets by mosaicking them
together.
In many cases, there will be some overlap of the raster dataset edges that are being mosaicked
together, as shown below.
These overlapping areas can be handled in several ways; for example, you can choose to only keep
raster data from the first or last dataset, you can blend the overlapping cell values using a weight-
based algorithm, you can take the mean of the overlapping cell values, or you can take the
minimum or maximum value. When mosaicking discrete data, the First, Minimum, or Maximum
options give the most meaningful results. The Blend and Mean options are best suited for
continuous data. If any of the input rasters are floating point, the output is floating point. If all the
inputs are integer and First, Minimum, or Maximum is used, the output is integer.
➢ Press open
➢ In data source manager | Raster window click Add.
➢ In Merge dialog window select a file name and location to save merged images.
➢ Save the file to “GIS_Workshop/Practicals/Practical_02/C/” location with the name as
Merge_Files.tif
➢ Press Run and after completion of operation close the Merge window dialog box.
➢ You can now deselect individual layers from layer pane and only keep the merged raster file.
➢ Select the merge raster image as input and Ind_adm0 as mask layer.
➢ Press RUN.
After
Clipping
PRACTICAL - 3
a) Making a Map
➢ Create a new Thematic Map or open and existing one
➢ Consider the following map as an example map
This will ensure that if any change in layers or change their styles, the Print Layout view will not
change.
➢ Go to Add Item → Add Picture → Place a picture box at appropriate location.
➢ Also adjust Image Rotation to its appropriate value.
➢ Item Properties → Image Rotation
➢ Add an inset Using Add Item → Add Picture → Select an area to be highlighted on main Map.
➢ Set a frame for Inset by enabling the check box for Frame.
➢ Add Item → Add Legend→ Place the legend indicator at appropriate location.
➢ Uncheck auto update and use suitable legend indicator label.
➢ The Print Layout will appear
➢ To enable a plugin, check on the checkbox next to Plugin. This will enable the plugin to use it.
➢ External plugins are available in the QGIS Plugins Repository and need to be installed by the users
before using them.
➢ Click on Not Installed or Install from ZIP.
➢ Once the plugin is downloaded and installed, you will see a confirmation dialog.
➢ Click on Plugins → <<new Plugin Name>>
➢ The Plugin if marked Experimental plugin can be installed, from Setting→ check on
or
➢ Double click on the desired place in OSM Place search Panel or Click and press
Output:
PRACTICAL - 4
A. Working with attributes
➢ Start a new project.
➢ Go to Layer → Add Layer → Add Vector Layer
➢ Select “\GIS_Workshop\Practicals\Practical_04\A\Data\ne_10m_populated_places_simple.zip”
➢ On clicking the Select feature using expression button the following window will appear.
➢ Enter pop_max>100 and pop_max<10000 and click button to get all the places with
population between 100 and 10000.
➢ The places matching the criteria will appear in different color.
Will give
➢ Use the deselect button to deselect the feature to be rendered in original color.
b) Terrain Data and Hill shade analysis
A terrain dataset is a multiresolution, TIN-based surface built from measurements stored as features
in a geodatabase. Terrain or elevation data is useful for many GIS Analysis like, to generate various
products from elevation data such as contours, hillshade etc.
https://www.google.com/maps/@27.9857765,86.9285378,14.75z/data=!5m1!1e4?hl=en-US
➢ Go to Layer → Add Raster Layer → select “10n060e_20101117_gmted_mea300.tif”, from
Data folder
➢ The Lower altitude regions are shown using dark color and higher using light shade as seen on
top region containing Himalaya and Mt Everest.
➢ Mt. Everest - is located at the coordinates 27.9881° N, 86.9253° E.
➢ Enter 86.92, 27.98 in the coordinate field, Scale 900000 and Magnifier 100% at the bottom of
QGIS.
➢ Crop the raster layer only for the region under study.
➢ Go to Raster → Extraction→ Clip Raster by Extent
➢ Select the raster layer (if project contains multiple layers).
➢ Select the clipping area by selecting the option Use Canvas Extends if the visible part of map
is to be selected or manually select an area on canvas by using Select Extent on Canvas.
➢ Select the location and file name for storing clipped raster layer.
➢ Press RUN.
➢ Deselect the original layer and keep the clipped one.
➢ The Clipped raster layer is representing altitude are from 103 Meters.
➢ Select the input raster layer name. Set contour interval 100.00 meters, select the output file
name & location and check the option to add output file to project after processing.
➢ Press “RUN”.
➢ The contour layer will appear like this
➢ Label the layer using “ELEV” field and set appropriate symbols for line.
➢ In the Layer panel right click on Contour Raster Layer and select “Open Attribute table”,
➢ Arrange the table in descending order based on the value of “ELEV” column.
➢
Compare the above counter line raster layer with the previous Google map image or visit
https://www.google.com/maps/@27.9857765,86.9285378,14.75z/data=!5m1!1e4?hl=en-US
➢ To verify the above contour files using Google Map
➢ Make a copy of Contour Layer, Go to Layer →Save As
➢ Select file format as “Keyhole Markup Language”, set file name, location and Layer Name.
➢ Also set CRS to WGS 84 EPSG:4326
➢ Go to the stored location on Hard Disk and open the “Himalayan_Google_Map_File.kml” with
Google Map.\
A Hillshade is a grayscale 3D representation of the surface, showing the topographical shape of hills
and mountains using shading (levels of gray) on a map, just to indicate relative slopes, mountain ridges,
not absolute height.
➢ For Hill Shade surface analysis
➢ Go to Plugin → Install Georeferencer GADL.
➢ After successful installation of plugin Go to Raster → Analysis → Hill Shade
➢ Select the input raster layer, select file name and location for storing Hill Shade output file.
➢ Press “RUN” and Close the Hill Shape Dialog window.
➢ After Raster styling the Output will appear like this.
PRACTICAL - 5
Working with Projections and WMS Data
A Web Map Service (WMS) is a standard protocol developed by the Open Geospatial Consortium in
1999 for serving georeferenced map images over the Internet. These images are typically produced by a
map server from data provided by a GIS database
➢ Start a new Project.
➢ Layer → Add Layer →Vector Layer
➢ Select “ne_10m_admin_0_countries.zip” Layer from data folder.
➢ Go to Layer → Save As
Select format as ESRI Shape File
Select folder location and file name
Set CRS North_America_Albers_Equal_Area_Conic EPSG: 102008
➢ Press “OK”.
➢ Deselect the original Image and keep the projected layer visible.
➢ Select Layer → Add Layer → Add Raster Layer → Select MiniScale_(standard)_R17.tif from
Location
“GIS_Workshop\Practicals\Practical_05\DATA\minisc_gb\minisc_gb\data\RGB_TIF_compres
sed\MiniScale_(standard)_R17.tif”
➢ The Layer appears on a different location than the location where Great Britain is shown on
Map.
➢ Open Layer Properties→CRS → Search bri → select British National Grid EPSG 27700.
➢ Processing may take some time.
➢ Locate United Kingdom on Layer; the vector layer exactly coincides by the raster layer
covering United Kingdom.
PRACTICAL - 6
➢ Georeferencing
A. Georeferencing Topo Sheets and Scanned Maps
➢ Start a new project
➢ Go to Layers → Add Layer → Add vector Layer
➢ Select GIS_Workshop\Manual\Prac06\IND_adm0.shp
➢ Zoom in to Mumbai region in the layer.
➢ The canvas area will now have the scanned map of Mumbai referenced with control points.
➢ Select the newly added layer in Layer Panel Right click and go to property.
➢ QGIS offers a simple solution to make raster load much faster by using Image Pyramids.
➢ Right-click the Christchurch Topo50 map.tif layer and select Properties.
➢ Choose the Pyramids tab. Hold the Ctrl key and select all the resolutions offered in the
Resolutions panel.
➢ Click Build pyramids. Then click OK.
➢ Go to Settings →Options .... Select the Digitizing tab in the Options dialog.
➢ Press OK.
➢ Once the layer is loaded, click the Toggle Editing button to put the layer in editing mode.
➢ Click the Add feature button. Click on the map canvas to add a new vertex.
Add new vertices along the road feature. Once you have digitized a road segment, right-click to
end the feature.
➢ On Layer Panel Right Click on Digitze_Road, Select the Style tab in the Layer Properties
dialog.
Result
➢ Select appropriate style to see the digitized road feature clearly.
➢ This file will have only 1 row specifying data types for each column. Save this file as
ca_tracts_pop.csvt in the same directory as the original .csv file.
➢ Go to Layer → Add Layer → Add Delimited Text Layer
And add I:\GIS_Workshop\Practicals\Practical_07\A\Data\ca_tacts_pop.csv”
➢ In the layer panel, Right click on “tl_2013_06_tract”, layer and select Properties
➢ Select the option in Properties, and click on button to add new table join.
➢ In the Add Vector Join window set the following properties and click OK.
➢ For more clear output, select “tl_2013_06_tact” from Layer Panel, right click and select
properties. Go to Symbology and set the following properties.
➢ A detailed and accurate population map of California can be seen as the result. Same technique
can be used to create maps based on variety of census data.
b) spatial joins
➢ Go to Layer → Add Layer → Add Vector Layer → Select
“I:\GIS_Workshop\Practicals\Practical_07\B\Data\nybb_12c\nybb_13c_av\nybb.shp” and
“I:\GIS_Workshop\Practicals\Practical_07\B\Data\OEM_NursingHomes_001\OEM_NursingHo
mes_001.shp”, from data folder.
➢ Use the Identify Feature Button to select a region to view join data on map Layer.
➢ Output
c) Points in polygon analysis
➢ Go to Layer → Add Layer → Add Delimited Text Layer
Select “EarthQuakeDatabase.txt”
→
➢ Use the select Feature button to check country wise counting of Earthquakes.
➢ Also a new column is added to attribute table “NumPoints” indicating number of earth quake
points in each country.
d) Performing spatial queries
➢ Go to Layer → Add Layer → Add Vector Layer and load
“\GIS_Workshop\Practicals\Practical_07\D\Data\ne_10m_populated_places_simple\ne_10m_popul
ated_places_simple.shp” and
“I:\GIS_Workshop\Practicals\Practical_07\D\Data\ne_10m_rivers_lake_centerlines\ne_10m_rivers
_lake_centerlines.shp” from project data folder.
➢ Open project Properties → Set CRS “World_Azimuthal_Equidistant EPSG 54032” . The map will
be re-projected as
➢ Go to Vector → Geoprocessing Tool → Buffer
➢ This will highlight only those rivers containing a populated place within 2 KM
PRACTICAL - 8
A) Nearest Neighbor Analysis
• Click on Project -> New
• Click on Layer -> Add Layer -> Add vector Layer
Click on Processing -> Toolbox -> Type distance in search box ->Click on Distance to nearest
Hub(Line to Hub)
Select Source -> Select Destination -> Select name attribute -> measurement unit(kms) ->In
Hub Distance -> Click on Save to File
Click on RUN
Many scientific and environmental datasets come as gridded rasters. Elevation data (DEM) is
also distributed as raster files. In these raster files, the parameter that is being represented is
encoded as the pixel values of the raster. Often, one needs to extract the pixel values at certain
locations or aggregate them over some area. This functionality is available in QGIS via two
plugins - Point SamplingTool and Zonal Statistics plugin.
Procedure :
1. Go to Layer ‣A d d Raster Layer and browse to the
downloaded us.tmax_nohads_ll_{YYYYMMDD}_float.tif file and click Open.
2. Once the layer is loaded, select the Identify tool and click anywhere on the layer. You will see
the temperature value in celsius as the value or Band 1 at that location.
6. Open the plugin dialog from Plugins ‣Analyses ‣Point sampling tool.
7. In the Point Sampling Tool dialog, select 2013_Gaz_ua_national as the Layer containing
sampling points. We must explicitely pick the fields from the input layer that we want in the
output layer. Choose GEOID and NAME fields from the2013_Gaz_ua_national layer. We can
sample values from multiple raster band at once, but since our raster has only 1 band, choose
the us.tmax_nohads_ll_{YYYYMMDD}_float: Band 1. Name the output vector layer
as max_temparature_at_urban_locations.shp. Click the OK to start the sampling process.
Click Close once the process finishes.
10. Go to Layer ‣A d d Vector Layer. Browse to the downloaded tl_2013_us_county.zip file and
click Open. Select thetl_2013_us_county.shp as the layer and click OK.
11. The tl_2013_us_county will be added to QGIS. This layer is in EPSG:4269 NAD83 projection.
This doesn’t match the projection of the raster layer. We will re-project this layer
to EPSG:4326 WGS84 projection.
12. Right-click the tl_2013_us_county layer and select Save As...
13. In the Save Vector layer as.. dialog, click Browse and name the output file as counties.shp.
Choose Selected CRS from the CRS dropdown menu. Click Browse and select WGS 84 as the
CRS. Check the Add saved file to map and click OK.
18. The analysis may take some time depending on the size of the dataset.
19. Once the processing finishes, select the counties layer. Use the Identify tool and click on any
county polygon. You will see three new attributes added to the
layer: ZS_count, ZS_mean and ZS_sum. These attributes contain the count of raster pixels,
mean of raster pixel values and sum of raster pixel values respectively. Since we are interested
in average temperature, the ZS_meanfield will be the one to use.
20. Let’s style this layer to create a temperature map. Right-click the counties layer and
select Properties.
21. Switch to the Style tab. Choose Graduated style and select ZS_mean as the Column. Choose
a Color Ramp and Mode of your chose. Click Classify to create the classes. Click OK.
22. You will see the county polygons styled using average maximum temperature extracted from
the raster grid.
c) Interpolating Point Data
Procedure :
1. Open QGIS. Go to Layer ‣A d d Layer ‣A d d Vector Layer..
2. Browse to the downloaded Shapefiles.zip file and select it. Click Open.
3. In the Select layers to add... dialog, hold the Shift key and
select Arlington_Soundings_2007_stpl83.shp andBoundary2004_550_stpl83.shp layers.
Click OK.
4. You will see the 2 layers loaded in QGIS. The Boundary2004_550_stpl83 layer represents the
boundary of the lake. Un-check the box next to it in the Table of Contents.
5. This will reveal the data from the second layer Arlington_Soundings_2007_stpl83. Though the
data looks like lines, it is a series of points that are very close.
6. Click the Zoom icon and select a small area on the screen. As you zoom closer, you will see the
points. Each point represents a reading taken by a Depth Sounder at the location recorded by
a DGPS equipment.
7. Select the Identify tool and click on a point. You will see the Identify Results panel show up on
the left with the attribute value of the point. In this case, the ELEVATION attribute contains the
depth of the lake at the location. As our task is to create a depth profile and elevation contours,
we will use this values as input for the interpolation.
8. Make sure you have the Interpolation plugin enabled. See Using Plugins for how to enable
plugins. Once enabled, go toRaster‣Interpolation ‣Interpolation.
9. In the Interpolation dialog, select Arlington_Soundings_2007_stpl83 as the Vector layers in
the Input panel. Select ELEVATION as the Interpolation attribute. Click Add. Change
the Cellsize X and Cellsize Y values to 5. This value is the size of each pixel in the output grid.
Since our source data is in a projected CRS with Feet-US as units, based on our selection, the
grid size will be 5 feet. Click on the ... button next to Output file and name the output file
as elevation_tin.tif. CLick OK.
10. You will see the new later elevation_tin loaded in QGIS. Right-click the layer and select Zoom
to layer.
11. Now you will see the full extent of the created surface. Interpolation does not give accurate
results outside the collection area. Let’s clip the resulting surface with the lake boundary. Go
to Raster ‣Extraction ‣Clipper.
12. Name the Output file as elevation_tin_clipped.tif. Select the Cliiped mode as Mask layer.
Select Boundary2004_550_stpl83 as the Mask layer`. Click OK.
13. A new raster elevation_tin_clipped will be loaded in QGIS. We will now style this layer to
show the difference in elevations. Note the min and max elevation values from
the elevation_tin layer. Right-click the elevation_tin_clipped layer and select Properties.
14. Go to the Style tab. Select Render type as Singleband pseudocolor. In the Generate new color
map panel, select Spectralcolor ramp. As we want to create a depth-map as opposed to a height-
map, check the Invert box. This will assign blues to deep areas and reds to shallow areas.
Click Classify.
15. Switch to the Tranparency tab. We want to remove the black-pixels from our output. Enter 0 as
the Additional no data value. Click OK.
16. Now you have a elevation relief map for the lake generated from the individual depth readings.
Let’s generate contours now. Go to Raster ‣Extraction ‣Contours.
17. In the Contour dialog, enter contours as the Output file for contour lines. We will generate
contour lines at 5ft intervals, so enter 5.00 as the Interval between contour lines. Check
the Attribute name box. Click OK.
18. The contour lines will be loaded as contours layer once the processing is finished. Right-click
the layer and select Properties.
19. Go to the Labels tab. Check the Label this layer with box and select ELEV as the field.
Select Curved as the Placement type and click OK.
20. You will see that each contour line will be appropriately labeled with the elevation along the
line.