Touch function for spatial objects

Share:

Description

The SpatialDataFrame Touch function. Identifies which nodes has touching lines and retrives a list with two elements.

Usage

1
SpDF_Touch(x, y)

Arguments

x

An spatial object as is described in package sp.

y

An spatial object as is described in package sp.

Value

A list with two elements:

comp1

A matrix with the OBJECTID of the node (column 1), the maximum number of lines that are touching the node (column 2), and the elevation of that node (column 3).

comp2

A matrix with the OBJECTID of the lines that are touching the node.

Author(s)

J.A. Torres

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(Watersheds)
data(WatershedsData)

station1 = WatershedsData$station
subbasin1 = WatershedsData$subbasin
zhyd1 = WatershedsData$zhyd
river1 = WatershedsData$river
node1 = WatershedsData$node	

station1 = SpatialPoints(coords=cbind(4328448.74, 3118576.86), 
	proj4string=slot(subbasin1,"proj4string"))
watershed = new("Watershed",station=station1,subbasin=subbasin1,
	zhyd=zhyd1,river=river1,c1=subbasin1,node=node1)

a = Watershed.Order(watershed)
c1 = a[[1]]
riverIO = a[[8]]
nodeIO = a[[9]]			

touch = SpDF_Touch(nodeIO, riverIO)
touch1 = touch[[1]]; touch1