Learn R Programming

Watersheds (version 1.1)

RiverStation: Intersection of SpatialPoints and SpatialLinesDataFrame

Description

The function intersects objects SpatialPoints and SpatialLinesDataFrame. Identyfies the closer stretch(es) to a station. The SpatialPoints must be length 1.

Usage

RiverStation(x, y, window = 100)

Arguments

x
An object of class SpatialPoints as is defined in package sp and length 1.
y
An object of class SpatialLinesDataFrame as is defined in package sp.
window
A numeric value that represents the size of the square (window) around the x object.

Value

An object SpatialLinesDataFrame that is a subsect of th object x that represents the current intersection withe object x.

Details

window value magnifies the object x in order to certainly secure the intersection with the object y. The greater value the more intersection area is defined.

Examples

Run this code
library(Watersheds)
data(WatershedsData)

station1 = WatershedsData$station
river1 = WatershedsData$river

tributary = RiverStation(station1, river1)
plot(tributary, col="blue")
plot(station1,pch=21,bg="red",cex=.8,add=TRUE)
plot.PolyLineAttribute(x=tributary, y="OBJECTID", dist=100, cex=.8)
title(main="Point station and tributary rivers")

Run the code above in your browser using DataLab