Description Usage Arguments Value Author(s) References See Also Examples
Given a data.frame (x.gis
) with the spatial coordinates of a set of measurement points (e.g., gauging stations) and the measurements in those stations (x.ts
) this function merges the measurements in x.ts
with the corresponding spatial location in x.gis
, even if they are not in the same order.
If the spatial coordinates X
and Y
are given for x.gis
, the resulting object will be a SpatialPointsDataFrame-class with coordinates given by the X
and Y
fields
If p4s
is given, the resulting object will be projected according to the specification provided by p4s
.
1 2 |
x.gis |
data.frame with the spatial information for all the measurement points in |
x.ts |
numeric or data.frame with the measured value at each station for a given time. Each value of |
sname |
character, field name in |
bname |
OPTIONAL. character, field name in |
X |
character, field name in |
Y |
character, field name in |
elevation |
OPTIONAL. character, field name |
catchment.name |
name of the catchment that will be analysed. Possible values are: |
p4s |
Character with information about the projection of the GIS files, usually created by the CRS function of the sp package |
na.rm |
a logical value indicating whether 'NA' values should be stripped before delivering the resulting object. |
If p4s
is given, the returning object will be a SpatialPointsDataFrame-class, if not, it will be a data.frame
Mauricio Zambrano-Bigiarini, mzb.devel@gmail
Applied Spatial Data Analysis with R. Series: Use R. Bivand, Roger S., Pebesma, Edzer J., Gomez-Rubio, Virgilio. 2008. ISBN: 978-0-387-78170-9
http://rspatial.r-forge.r-project.org/
krige, spplot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ############
## Loading the monthly time series of precipitation within the Ebro River basin.
data(EbroPPtsMonthly)
## Loading the gis data
data(EbroPPgis)
## Putting the measurements of the first row of 'EbroPPtsMonthly' into their
## corresponding spatial location given by 'x.gis'
require(sp)
x.spt <- gists2spt(x.ts=EbroPPtsMonthly[1,], x.gis=EbroPPgis, X="EAST_ED50",
Y="NORTH_ED50", na.rm=FALSE, sname="ID")
## Plotting the measured values (only the first row of 'EbroPPtsMonthly') at their
## corresponding spatial location
spplot(x.spt, zcol="value")
|
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Loading required package: xts
Loading required package: sp
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.