SlideShare a Scribd company logo
1 of 16
Excerpts from the Course
February 1, 2019
1 Methods for Spatial Watershed Aggregation and Spatial Drainage
Network Analysis
Dependencies: Watersheds, methods, sp, maptools, rgeos, sp, splancs, ggplot2, geojson, rgdal
Disclaimer : The data has been sourced from the example dataset of the ECRINS database for
the river Weser basin, Germany as included in the Spatial Watershed Aggregation and Spatial
Drainage Network Analysis (Watersheds) package obtained from the Comprehensive R Archive
Network (CRAN). The source code and data was obtained for academic use under the GNU Gen-
eral Public License v3 as released by the author of the package.
Spatial analysis on watersheds using tributary network to aggregate and order as per the run-
off outlet points and size of tributary watersheds based on the specific watershed.
• Identification of the locations of inlet for catchment and outlet for Runoff area are important
for creating the sub-sub basin area.
• Creation of sub-sub basin watersheds with identifying nodes of intersections of river and
tributes
• Implementation of R functions for determining the actual inlet and outlet nodes from tribu-
taries
1.1 Outline of Watershed Analysis
• Installation of required R packages (geojson, ggplot2, maptools, sp, and Watershed)
• Assign values to variables as per the requirement of each function as per the documentation
and the data.
• Use of data visualisation methods using appropriate plotting methods
1.2 Description of Dataset
The dataset contains the following subsets:
• basin : an object SpatialPolygonsDataFrame as is defined in package sp that represents the
river Weser basin. The data slot contains 6 variables as attributes of 1 observation.
1
• ctry : an object SpatialPolygonsDataFrame as is defined in package sp that represents the
administrative boundary of Germany. The data slot contains 6 variables as attributes of 1
observation.
• node: an object SpatialPointsDataFrame as is defined in package sp that represents the
nodes of the ECRINS river network of the river Weser basin. The data slot contains 13 vari-
ables as attributes of 3882 observations.
• rAller : an object SpatialLinesDataFrame as is defined in package sp that represents the
basin of the river Aller, a major tributary of the river Weser. The data slot contains 74 vari-
ables as attributes of 88 observations.
• rDiemel : an object SpatialLinesDataFrame as is defined in package sp that represents the
basin of the river Diemel, a major tributary of the river Weser. The data slot contains 74
variables as attributes of 39 observations.
• rFulda : an object SpatialLinesDataFrame as is defined in package sp that represents the
basin of the river Fulda, a major tributary of the river Weser. The data slot contains 74
variables as attributes of 82 observations.
• rHunte : an object SpatialLinesDataFrame as is defined in package sp that represents the
basin of the river Hunte, a major tributary of the river Weser. The data slot contains 74
variables as attributes of 34 observations.
• river : an object SpatialLinesDataFrame as is defined in package sp that represents the
ECRINS river network of the river Weser basin. The data slot contains 52 variables as at-
tributes of 3874 observations.
• rWerra : an object SpatialLinesDataFrame as is defined in package sp that represents the
basin of the river Werra, a major tributary of the river Weser. The data slot contains 74
variables as attributes of 120 observations.
• rWeser : an object SpatialLinesDataFrame as is defined in package sp that represents the
basin of the river Weser. The data slot contains 74 variables as attributes of 104 observations.
• rWiumme : an object SpatialLinesDataFrame as is defined in package sp that represents the
basin of the river Wiumme, a major tributary of the river Weser. The data slot contains 74
variables as attributes of 18 observations.
• station : an object SpatialPoints as is defined in package sp that represents a point of
interest for which the watershed will be aggregated an ordered. Could be a point with the
coordinates of a measurement station.
• subbasin : an object SpatialPolygonsDataFrame as is defined in package sp that represents
the subbasins of the tributaries of the river Weser. The data slot contains 4 variables as
attributes of 4 observations.
• zhyd : an object SpatialPolygonsDataFrame as is defined in package sp that contains the
primary hydrological units of the river Weser basin accordingly with ECRINS. The data slot
contains 50 variables as attributes and 915 observations.
1.3 Importing Dependencies
In [1]: library(sp)
library(Watersheds)
library(ggplot2)
library(geojson)
data(WatershedsData)
Loading required package: maptools
2
Checking rgeos availability: TRUE
Loading required package: rgeos
rgeos version: 0.4-2, (SVN revision 581)
GEOS runtime version: 3.6.1-CAPI-1.10.1
Linking to sp version: 1.3-1
Polygon checking: TRUE
Loading required package: lattice
Loading required package: splancs
Spatial Point Pattern Analysis Code in S-Plus
Version 2 - Spatial and Space-Time analysis
Attaching package: 'geojson'
The following object is masked from 'package:graphics':
polygon
1.4 Mapping of River Station and Tributaries-River Interactions
In [2]: station1 = WatershedsData$station
subbasin1 = WatershedsData$subbasin
zhyd1 = WatershedsData$zhyd
river1 = WatershedsData$river
node1 = WatershedsData$node
River Station shall be the intersection of spatial points station1 and the SpatialLines-
Dataframe river1
In [3]: tributary = RiverStation(
station1,
river1
)
plot(
tributary,
col = "blue"
)
plot(
station1,
pch = 21,
bg = "red",
cex = .8,
add = TRUE
3
)
plot.PolyLineAttribute(
x = tributary,
y="OBJECTID",
dist = 100,
cex = .8
)
title(
main="River Station and Tributary-River intersection"
)
4
1.5 Plotting of Primary Watershed / River Sub-basin
In [4]: id = list(
gIntersects(
WatershedsData$rWerra,
WatershedsData$subbasin,
byid=TRUE)
)
subbasin_rWerra = SpDF_Subset(
id,
WatershedsData$subbasin
)
plot(
subbasin_rWerra
)
title(
"Pimary Watershed / River Sub-Basin"
)
5
1.6 Mapping of River Sub-Basin and tributory Watershed
Subsetting the river Werra zhyd watersheds on the primary river basin.
In [5]: id = list(
gIntersects(
WatershedsData$rWerra,
WatershedsData$zhyd,
byid = TRUE
)
)
plot(
subbasin_rWerra
6
)
zhyd_rWerra = SpDF_Subset(
id,
WatershedsData$zhyd
)
plot(
WatershedsData$rWerra,
col = "blue",
lwd = 1,
add = TRUE
)
plot(
zhyd_rWerra,col="green3",
add = TRUE
)
title(
"River Sub-Basin and Tributory Watersheds"
)
7
1.7 Creation of Drainage Networks within Primary Watershed (River Basin)
Subsetting the river Werra river drainage watersheds on the primary river basin.
In [6]: id = list(
gIntersects(
subbasin_rWerra,
WatershedsData$river,
byid = TRUE
)
)
river_rWerra = SpDF_Subset(
id,
8
WatershedsData$river
)
plot(
subbasin_rWerra
)
plot(
WatershedsData$rWerra,
col = "blue",
lwd = 3,
add = TRUE
)
plot(
river_rWerra,
col = "blue1",
add = TRUE
)
title(
"River Sub-Basin and Drainage Network"
)
9
1.7.1 Generation of Tibutary Watershed using River-Tributary Interscection (Case-1)
The Watersheds.IOR1 function determines the inlet and outlet nodes for zhyd watershed ob-
jects in Case 1 for those watersheds whose length between river inlet and outlet is unity
i.e. length(riverIO)=1
In [7]: station1 = SpatialPoints(
coords = cbind(
4232972,
3327634
),
proj4string = slot(
subbasin1,
10
"proj4string"
)
)
watershed = new(
"Watershed",
station = station1,
subbasin = subbasin1,
zhyd = zhyd1,
river = river1,
c1 = subbasin1,
node = node1
)
a = Watershed.Order(
watershed
)
c1 = a[[1]]
nodeIO = a[[9]]
c1_river = a[[10]]
[1] "length(riverIO) == 1"
Determining inlet and outlet watershed nodes, and distances of nodeIO to c1
In [8]: boundary = gBoundary(
c1
)
dist = gDistance(
nodeIO,
boundary,
byid = TRUE
)
a = Watershed.IOR1(
x = nodeIO,
dist = dist
)
c1_inlet = a$inlet; c1_inlet
c1_outlet = a$outlet; c1_outlet
0
coordinates OBJECTID ID WSO_ID SOURCE LEN_TOM NUM_SEG ELEV
143 (4234350, 3330950) 25485 587506 7 N 57980 9 2
WINDOW WXSOID NodID Is_2Keep LENK_FRS LENK_TOM
143 2000 <NA> Y000587506 -1 0 57.98
In [9]: plot(
c1,
11
col = "gray50"
)
plot(
station1,
pch = 24,
bg = "blue",
add = TRUE
)
plot(
c1_river,
col = "blue",
add = TRUE
)
plot(
c1_outlet,
pch = 21,
bg = "red",
add = TRUE
)
plot.PointAttribute(
c1_outlet,
"ELEV",
700,
.8
)
title(
"Case I : Generation of Tributary Watershed using outlet 2"
)
12
1.7.2 Generation of Tibutary Watershed using River-Tributary Interscection (Case-2)
The Watersheds.IOR2 function determines the inlet and outlet nodes for zhyd watershed ob-
jects in Case 2 for those watersheds whose length between river inlet and outlet object is 2
i.e. length(riverIO)=2
In [10]: station1 = SpatialPoints(
coords = cbind(
4330341.36,
3284797.06
),
proj4string = slot(
subbasin1,
13
"proj4string"
)
)
watershed = new(
"Watershed",
station = station1,
subbasin = subbasin1,
zhyd = zhyd1,
river = river1,
c1 = subbasin1,
node = node1
)
a = Watershed.Order(
watershed
)
c1 = a[[1]]
nodeIO = a[[9]]
c1_river = a[[10]]
c1_node = a[[11]]
[1] "length(riverIO) == 2"
Determining inlet and outlet watershed nodes, and determining distances of nodeIO to c1
In [11]: boundary = gBoundary(
c1
)
dist = gDistance(
nodeIO,
boundary,
byid = TRUE
)
a = Watershed.IOR2(x=nodeIO, dist=dist, node=c1_node)
c1_inlet = a$inlet; c1_inlet
c1_outlet = a$outlet; c1_outlet
0
coordinates OBJECTID ID WSO_ID SOURCE LEN_TOM NUM_SEG ELEV
508 (4322650, 3280950) 29656 599477 7 N 210109 57 41
WINDOW WXSOID NodID Is_2Keep LENK_FRS LENK_TOM
508 2000 <NA> Y000599477 -1 0 210.109
In [12]: plot(
c1,
col = "gray60"
)
14
plot(
station1,
pch = 24,
bg = "blue",
add = TRUE
)
plot(
c1_river,
col = "blue",
add = TRUE
)
plot(
c1_outlet,
pch = 21,
bg = "red",
add = TRUE
)
plot.PointAttribute(
c1_outlet,
"ELEV",
700,
.8)
title(
"Case II : Generation of Tributary Watershed using outlet 3"
)
15
continued .. .
16

More Related Content

What's hot

New Microsoft Word Document
New Microsoft Word DocumentNew Microsoft Word Document
New Microsoft Word Document
Farhan Shariff
 
My mapreduce1 presentation
My mapreduce1 presentationMy mapreduce1 presentation
My mapreduce1 presentation
Noha Elprince
 

What's hot (11)

New Microsoft Word Document
New Microsoft Word DocumentNew Microsoft Word Document
New Microsoft Word Document
 
a SICAP: Shared-Segment based Inter-domain Control Aggregation Protocol.
a SICAP: Shared-Segment based Inter-domain Control Aggregation Protocol.a SICAP: Shared-Segment based Inter-domain Control Aggregation Protocol.
a SICAP: Shared-Segment based Inter-domain Control Aggregation Protocol.
 
Hive query optimization infinity
Hive query optimization infinityHive query optimization infinity
Hive query optimization infinity
 
Catt Manual
Catt ManualCatt Manual
Catt Manual
 
QRAS: SIMPLE TOOL FOR HEC-RAS GEOMETRY DATA PREPARATION A S QGIS CAN BECOME A...
QRAS: SIMPLE TOOL FOR HEC-RAS GEOMETRY DATA PREPARATION A S QGIS CAN BECOME A...QRAS: SIMPLE TOOL FOR HEC-RAS GEOMETRY DATA PREPARATION A S QGIS CAN BECOME A...
QRAS: SIMPLE TOOL FOR HEC-RAS GEOMETRY DATA PREPARATION A S QGIS CAN BECOME A...
 
Lwrb linkers
Lwrb linkersLwrb linkers
Lwrb linkers
 
CellCoverage
CellCoverageCellCoverage
CellCoverage
 
My mapreduce1 presentation
My mapreduce1 presentationMy mapreduce1 presentation
My mapreduce1 presentation
 
Time series Analysis & fpp package
Time series Analysis & fpp packageTime series Analysis & fpp package
Time series Analysis & fpp package
 
Web Based Gis For Land Administration 20090629
Web Based Gis For Land Administration 20090629Web Based Gis For Land Administration 20090629
Web Based Gis For Land Administration 20090629
 
Cardinality Estimation through Histogram in Apache Spark 2.3 with Ron Hu and ...
Cardinality Estimation through Histogram in Apache Spark 2.3 with Ron Hu and ...Cardinality Estimation through Histogram in Apache Spark 2.3 with Ron Hu and ...
Cardinality Estimation through Histogram in Apache Spark 2.3 with Ron Hu and ...
 

Similar to Excerpts from Spatial Data Analysis using R and QGIS

CH2 Hydraulics and hydrology of HP.pptx
CH2 Hydraulics and hydrology of HP.pptxCH2 Hydraulics and hydrology of HP.pptx
CH2 Hydraulics and hydrology of HP.pptx
Dawit Girma
 
dahlstrom_doherty_MODFLOW98
dahlstrom_doherty_MODFLOW98dahlstrom_doherty_MODFLOW98
dahlstrom_doherty_MODFLOW98
Dave Dahlstrom
 
ERFEG Seminar Fall 2008
ERFEG Seminar Fall 2008ERFEG Seminar Fall 2008
ERFEG Seminar Fall 2008
shirabay
 

Similar to Excerpts from Spatial Data Analysis using R and QGIS (20)

Jgrassnewage digital-watershed-model-component
Jgrassnewage digital-watershed-model-componentJgrassnewage digital-watershed-model-component
Jgrassnewage digital-watershed-model-component
 
CH2 Hydraulics and hydrology of HP.pptx
CH2 Hydraulics and hydrology of HP.pptxCH2 Hydraulics and hydrology of HP.pptx
CH2 Hydraulics and hydrology of HP.pptx
 
3D Analyst - Watershed and Stream Network
3D Analyst - Watershed and Stream Network3D Analyst - Watershed and Stream Network
3D Analyst - Watershed and Stream Network
 
Lezione master Proidro - Modellazione idrologica con GRASS GIS 17/12/2010
Lezione master Proidro - Modellazione idrologica con GRASS GIS 17/12/2010Lezione master Proidro - Modellazione idrologica con GRASS GIS 17/12/2010
Lezione master Proidro - Modellazione idrologica con GRASS GIS 17/12/2010
 
Flood plain mapping
Flood plain mappingFlood plain mapping
Flood plain mapping
 
2016 conservation track: evaluating lidar derived synthetic streams as a ...
2016 conservation track: evaluating   lidar derived   synthetic streams as a ...2016 conservation track: evaluating   lidar derived   synthetic streams as a ...
2016 conservation track: evaluating lidar derived synthetic streams as a ...
 
Watershed analysis using GIS
Watershed analysis using GISWatershed analysis using GIS
Watershed analysis using GIS
 
dahlstrom_doherty_MODFLOW98
dahlstrom_doherty_MODFLOW98dahlstrom_doherty_MODFLOW98
dahlstrom_doherty_MODFLOW98
 
ERFEG Seminar Fall 2008
ERFEG Seminar Fall 2008ERFEG Seminar Fall 2008
ERFEG Seminar Fall 2008
 
Wavelet estimation for a multidimensional acoustic or elastic earth
Wavelet estimation for a multidimensional acoustic or elastic earthWavelet estimation for a multidimensional acoustic or elastic earth
Wavelet estimation for a multidimensional acoustic or elastic earth
 
Wavelet estimation for a multidimensional acoustic or elastic earth- Arthur W...
Wavelet estimation for a multidimensional acoustic or elastic earth- Arthur W...Wavelet estimation for a multidimensional acoustic or elastic earth- Arthur W...
Wavelet estimation for a multidimensional acoustic or elastic earth- Arthur W...
 
Haiti hydropower potential-Appendix-F
Haiti hydropower potential-Appendix-FHaiti hydropower potential-Appendix-F
Haiti hydropower potential-Appendix-F
 
JGrass-NewAge water budget
JGrass-NewAge water budget JGrass-NewAge water budget
JGrass-NewAge water budget
 
R Spatial Analysis using SP
R Spatial Analysis using SPR Spatial Analysis using SP
R Spatial Analysis using SP
 
Advancing Scientific Data Support in ArcGIS
Advancing Scientific Data Support in ArcGISAdvancing Scientific Data Support in ArcGIS
Advancing Scientific Data Support in ArcGIS
 
Seg d
Seg dSeg d
Seg d
 
Data exploration and graphics with R
Data exploration and graphics with RData exploration and graphics with R
Data exploration and graphics with R
 
Jgrass-Newage net radiation component
Jgrass-Newage  net radiation component Jgrass-Newage  net radiation component
Jgrass-Newage net radiation component
 
2018 GIS in Conservation: An Introduction to NHDplus High Resolution Value Ad...
2018 GIS in Conservation: An Introduction to NHDplus High Resolution Value Ad...2018 GIS in Conservation: An Introduction to NHDplus High Resolution Value Ad...
2018 GIS in Conservation: An Introduction to NHDplus High Resolution Value Ad...
 
GIS PROCEDURE FOR PRELIMINARY EVALUATION OF POTENTIAL HYDROPOWER SITES
GIS PROCEDURE FOR PRELIMINARY EVALUATION OF POTENTIAL HYDROPOWER SITESGIS PROCEDURE FOR PRELIMINARY EVALUATION OF POTENTIAL HYDROPOWER SITES
GIS PROCEDURE FOR PRELIMINARY EVALUATION OF POTENTIAL HYDROPOWER SITES
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Recently uploaded (20)

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

Excerpts from Spatial Data Analysis using R and QGIS

  • 1. Excerpts from the Course February 1, 2019 1 Methods for Spatial Watershed Aggregation and Spatial Drainage Network Analysis Dependencies: Watersheds, methods, sp, maptools, rgeos, sp, splancs, ggplot2, geojson, rgdal Disclaimer : The data has been sourced from the example dataset of the ECRINS database for the river Weser basin, Germany as included in the Spatial Watershed Aggregation and Spatial Drainage Network Analysis (Watersheds) package obtained from the Comprehensive R Archive Network (CRAN). The source code and data was obtained for academic use under the GNU Gen- eral Public License v3 as released by the author of the package. Spatial analysis on watersheds using tributary network to aggregate and order as per the run- off outlet points and size of tributary watersheds based on the specific watershed. • Identification of the locations of inlet for catchment and outlet for Runoff area are important for creating the sub-sub basin area. • Creation of sub-sub basin watersheds with identifying nodes of intersections of river and tributes • Implementation of R functions for determining the actual inlet and outlet nodes from tribu- taries 1.1 Outline of Watershed Analysis • Installation of required R packages (geojson, ggplot2, maptools, sp, and Watershed) • Assign values to variables as per the requirement of each function as per the documentation and the data. • Use of data visualisation methods using appropriate plotting methods 1.2 Description of Dataset The dataset contains the following subsets: • basin : an object SpatialPolygonsDataFrame as is defined in package sp that represents the river Weser basin. The data slot contains 6 variables as attributes of 1 observation. 1
  • 2. • ctry : an object SpatialPolygonsDataFrame as is defined in package sp that represents the administrative boundary of Germany. The data slot contains 6 variables as attributes of 1 observation. • node: an object SpatialPointsDataFrame as is defined in package sp that represents the nodes of the ECRINS river network of the river Weser basin. The data slot contains 13 vari- ables as attributes of 3882 observations. • rAller : an object SpatialLinesDataFrame as is defined in package sp that represents the basin of the river Aller, a major tributary of the river Weser. The data slot contains 74 vari- ables as attributes of 88 observations. • rDiemel : an object SpatialLinesDataFrame as is defined in package sp that represents the basin of the river Diemel, a major tributary of the river Weser. The data slot contains 74 variables as attributes of 39 observations. • rFulda : an object SpatialLinesDataFrame as is defined in package sp that represents the basin of the river Fulda, a major tributary of the river Weser. The data slot contains 74 variables as attributes of 82 observations. • rHunte : an object SpatialLinesDataFrame as is defined in package sp that represents the basin of the river Hunte, a major tributary of the river Weser. The data slot contains 74 variables as attributes of 34 observations. • river : an object SpatialLinesDataFrame as is defined in package sp that represents the ECRINS river network of the river Weser basin. The data slot contains 52 variables as at- tributes of 3874 observations. • rWerra : an object SpatialLinesDataFrame as is defined in package sp that represents the basin of the river Werra, a major tributary of the river Weser. The data slot contains 74 variables as attributes of 120 observations. • rWeser : an object SpatialLinesDataFrame as is defined in package sp that represents the basin of the river Weser. The data slot contains 74 variables as attributes of 104 observations. • rWiumme : an object SpatialLinesDataFrame as is defined in package sp that represents the basin of the river Wiumme, a major tributary of the river Weser. The data slot contains 74 variables as attributes of 18 observations. • station : an object SpatialPoints as is defined in package sp that represents a point of interest for which the watershed will be aggregated an ordered. Could be a point with the coordinates of a measurement station. • subbasin : an object SpatialPolygonsDataFrame as is defined in package sp that represents the subbasins of the tributaries of the river Weser. The data slot contains 4 variables as attributes of 4 observations. • zhyd : an object SpatialPolygonsDataFrame as is defined in package sp that contains the primary hydrological units of the river Weser basin accordingly with ECRINS. The data slot contains 50 variables as attributes and 915 observations. 1.3 Importing Dependencies In [1]: library(sp) library(Watersheds) library(ggplot2) library(geojson) data(WatershedsData) Loading required package: maptools 2
  • 3. Checking rgeos availability: TRUE Loading required package: rgeos rgeos version: 0.4-2, (SVN revision 581) GEOS runtime version: 3.6.1-CAPI-1.10.1 Linking to sp version: 1.3-1 Polygon checking: TRUE Loading required package: lattice Loading required package: splancs Spatial Point Pattern Analysis Code in S-Plus Version 2 - Spatial and Space-Time analysis Attaching package: 'geojson' The following object is masked from 'package:graphics': polygon 1.4 Mapping of River Station and Tributaries-River Interactions In [2]: station1 = WatershedsData$station subbasin1 = WatershedsData$subbasin zhyd1 = WatershedsData$zhyd river1 = WatershedsData$river node1 = WatershedsData$node River Station shall be the intersection of spatial points station1 and the SpatialLines- Dataframe river1 In [3]: tributary = RiverStation( station1, river1 ) plot( tributary, col = "blue" ) plot( station1, pch = 21, bg = "red", cex = .8, add = TRUE 3
  • 4. ) plot.PolyLineAttribute( x = tributary, y="OBJECTID", dist = 100, cex = .8 ) title( main="River Station and Tributary-River intersection" ) 4
  • 5. 1.5 Plotting of Primary Watershed / River Sub-basin In [4]: id = list( gIntersects( WatershedsData$rWerra, WatershedsData$subbasin, byid=TRUE) ) subbasin_rWerra = SpDF_Subset( id, WatershedsData$subbasin ) plot( subbasin_rWerra ) title( "Pimary Watershed / River Sub-Basin" ) 5
  • 6. 1.6 Mapping of River Sub-Basin and tributory Watershed Subsetting the river Werra zhyd watersheds on the primary river basin. In [5]: id = list( gIntersects( WatershedsData$rWerra, WatershedsData$zhyd, byid = TRUE ) ) plot( subbasin_rWerra 6
  • 7. ) zhyd_rWerra = SpDF_Subset( id, WatershedsData$zhyd ) plot( WatershedsData$rWerra, col = "blue", lwd = 1, add = TRUE ) plot( zhyd_rWerra,col="green3", add = TRUE ) title( "River Sub-Basin and Tributory Watersheds" ) 7
  • 8. 1.7 Creation of Drainage Networks within Primary Watershed (River Basin) Subsetting the river Werra river drainage watersheds on the primary river basin. In [6]: id = list( gIntersects( subbasin_rWerra, WatershedsData$river, byid = TRUE ) ) river_rWerra = SpDF_Subset( id, 8
  • 9. WatershedsData$river ) plot( subbasin_rWerra ) plot( WatershedsData$rWerra, col = "blue", lwd = 3, add = TRUE ) plot( river_rWerra, col = "blue1", add = TRUE ) title( "River Sub-Basin and Drainage Network" ) 9
  • 10. 1.7.1 Generation of Tibutary Watershed using River-Tributary Interscection (Case-1) The Watersheds.IOR1 function determines the inlet and outlet nodes for zhyd watershed ob- jects in Case 1 for those watersheds whose length between river inlet and outlet is unity i.e. length(riverIO)=1 In [7]: station1 = SpatialPoints( coords = cbind( 4232972, 3327634 ), proj4string = slot( subbasin1, 10
  • 11. "proj4string" ) ) watershed = new( "Watershed", station = station1, subbasin = subbasin1, zhyd = zhyd1, river = river1, c1 = subbasin1, node = node1 ) a = Watershed.Order( watershed ) c1 = a[[1]] nodeIO = a[[9]] c1_river = a[[10]] [1] "length(riverIO) == 1" Determining inlet and outlet watershed nodes, and distances of nodeIO to c1 In [8]: boundary = gBoundary( c1 ) dist = gDistance( nodeIO, boundary, byid = TRUE ) a = Watershed.IOR1( x = nodeIO, dist = dist ) c1_inlet = a$inlet; c1_inlet c1_outlet = a$outlet; c1_outlet 0 coordinates OBJECTID ID WSO_ID SOURCE LEN_TOM NUM_SEG ELEV 143 (4234350, 3330950) 25485 587506 7 N 57980 9 2 WINDOW WXSOID NodID Is_2Keep LENK_FRS LENK_TOM 143 2000 <NA> Y000587506 -1 0 57.98 In [9]: plot( c1, 11
  • 12. col = "gray50" ) plot( station1, pch = 24, bg = "blue", add = TRUE ) plot( c1_river, col = "blue", add = TRUE ) plot( c1_outlet, pch = 21, bg = "red", add = TRUE ) plot.PointAttribute( c1_outlet, "ELEV", 700, .8 ) title( "Case I : Generation of Tributary Watershed using outlet 2" ) 12
  • 13. 1.7.2 Generation of Tibutary Watershed using River-Tributary Interscection (Case-2) The Watersheds.IOR2 function determines the inlet and outlet nodes for zhyd watershed ob- jects in Case 2 for those watersheds whose length between river inlet and outlet object is 2 i.e. length(riverIO)=2 In [10]: station1 = SpatialPoints( coords = cbind( 4330341.36, 3284797.06 ), proj4string = slot( subbasin1, 13
  • 14. "proj4string" ) ) watershed = new( "Watershed", station = station1, subbasin = subbasin1, zhyd = zhyd1, river = river1, c1 = subbasin1, node = node1 ) a = Watershed.Order( watershed ) c1 = a[[1]] nodeIO = a[[9]] c1_river = a[[10]] c1_node = a[[11]] [1] "length(riverIO) == 2" Determining inlet and outlet watershed nodes, and determining distances of nodeIO to c1 In [11]: boundary = gBoundary( c1 ) dist = gDistance( nodeIO, boundary, byid = TRUE ) a = Watershed.IOR2(x=nodeIO, dist=dist, node=c1_node) c1_inlet = a$inlet; c1_inlet c1_outlet = a$outlet; c1_outlet 0 coordinates OBJECTID ID WSO_ID SOURCE LEN_TOM NUM_SEG ELEV 508 (4322650, 3280950) 29656 599477 7 N 210109 57 41 WINDOW WXSOID NodID Is_2Keep LENK_FRS LENK_TOM 508 2000 <NA> Y000599477 -1 0 210.109 In [12]: plot( c1, col = "gray60" ) 14
  • 15. plot( station1, pch = 24, bg = "blue", add = TRUE ) plot( c1_river, col = "blue", add = TRUE ) plot( c1_outlet, pch = 21, bg = "red", add = TRUE ) plot.PointAttribute( c1_outlet, "ELEV", 700, .8) title( "Case II : Generation of Tributary Watershed using outlet 3" ) 15