From 8d817cd0bedc22fd09ffbda404642f7b46993436 Mon Sep 17 00:00:00 2001 From: Tomislav Hengl Date: Thu, 7 Oct 2021 13:43:01 +0200 Subject: [PATCH] fixes for CRAN --- DESCRIPTION | 78 ++++++++-------- man/baranja.Rd | 182 ++++++++++++++++++------------------- man/eberg.Rd | 152 +++++++++++++++---------------- man/spMetadata.Rd | 226 +++++++++++++++++++++++----------------------- plotKML.Rproj | 38 ++++---- 5 files changed, 338 insertions(+), 338 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 207cd7c..ae22851 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,39 +1,39 @@ -Package: plotKML -Version: 0.8-1 -Date: 2021-04-12 -Title: Visualization of Spatial and Spatio-Temporal Objects in Google Earth -Author: Tomislav Hengl [cre, aut], Andrea Gilardi [ctb], Pierre Roudier [ctb], Dylan Beaudette [ctb], Edzer Pebesma [ctb], Michael Blaschek [ctb] -Authors@R: c(person("Tomislav", "Hengl", role = c("cre", "aut"), - email = "tom.hengl@opengeohub.org"), - person("Andrea", "Gilardi", role = "ctb"), - person("Pierre", "Roudier", role = "ctb"), - person("Dylan", "Beaudette", role = "ctb"), - person("Edzer", "Pebesma", role = "ctb"), - person("Michael", "Blaschek", role = "ctb")) -Maintainer: Tomislav Hengl -Depends: R (>= 3.5.0) -Imports: methods, tools, utils, XML, landmap, sp, raster, rgdal, aqp, gstat, spacetime, colorspace, plotrix, dismo, pixmap, plyr, stringr, colorRamps, scales, zoo, RColorBrewer, RSAGA, classInt, sf, stars -Suggests: - adehabitatLT, - maptools, - fossil, - rjson, - animation, - spatstat, - spatstat.linnet, - spatstat.geom, - RCurl, - rgbif, - Hmisc, - uuid, - intervals, - reshape, - gdalUtils, - snowfall, - parallel, - tinytex, - testthat -Description: Writes sp-class, spacetime-class, raster-class and similar spatial and spatio-temporal objects to KML following some basic cartographic rules. -License: GPL -URL: https://github.com/Envirometrix/plotKML -LazyLoad: yes +Package: plotKML +Version: 0.8-2 +Date: 2021-10-06 +Title: Visualization of Spatial and Spatio-Temporal Objects in Google Earth +Author: Tomislav Hengl [cre, aut], Andrea Gilardi [ctb], Pierre Roudier [ctb], Dylan Beaudette [ctb], Edzer Pebesma [ctb], Michael Blaschek [ctb] +Authors@R: c(person("Tomislav", "Hengl", role = c("cre", "aut"), + email = "tom.hengl@opengeohub.org"), + person("Andrea", "Gilardi", role = "ctb"), + person("Pierre", "Roudier", role = "ctb"), + person("Dylan", "Beaudette", role = "ctb"), + person("Edzer", "Pebesma", role = "ctb"), + person("Michael", "Blaschek", role = "ctb")) +Maintainer: Tomislav Hengl +Depends: R (>= 3.5.0) +Imports: methods, tools, utils, XML, landmap, sp, raster, rgdal, aqp, gstat, spacetime, colorspace, plotrix, dismo, pixmap, plyr, stringr, colorRamps, scales, zoo, RColorBrewer, RSAGA, classInt, sf, stars +Suggests: + adehabitatLT, + maptools, + fossil, + rjson, + animation, + spatstat, + spatstat.linnet, + spatstat.geom, + RCurl, + rgbif, + Hmisc, + uuid, + intervals, + reshape, + gdalUtils, + snowfall, + parallel, + tinytex, + testthat +Description: Writes sp-class, spacetime-class, raster-class and similar spatial and spatio-temporal objects to KML following some basic cartographic rules. +License: GPL +URL: https://github.com/Envirometrix/plotKML +LazyLoad: yes diff --git a/man/baranja.Rd b/man/baranja.Rd index 125b08a..2dcf3ef 100644 --- a/man/baranja.Rd +++ b/man/baranja.Rd @@ -1,91 +1,91 @@ -\name{baranja} -\docType{data} -\encoding{latin1} -\alias{barxyz} -\alias{bargrid} -\alias{barstr} -\title{Baranja hill case study} -\description{Baranja hill is a 4 by 4 km large study area in the Baranja region, eastern Croatia (corresponds to a size of an aerial photograph). This data set has been extensively used to describe various DEM modelling and analysis steps (see \href{http://geomorphometry.org/book}{Hengl and Reuter, 2008}; Hengl et al., 2010; \doi{10.5194/hess-14-1153-2010}). Object \code{barxyz} contains 6370 precise observations of elevations (from field survey and digitized from the stereo images); \code{bargrid} contains \emph{observed} probabilities of streams (digitized from the 1:5000 topo map); \code{barstr} contains 100 simulated stream networks (\code{"SpatialLines"}) using \code{barxyz} point data as input (see examples below).} -\usage{data(bargrid)} -\format{ -The \code{bargrid} data frame (regular grid at 30 m intervals) contains the following columns: - \describe{ - \item{\code{p.obs}}{observed probability of stream (0-1)} - \item{\code{x}}{a numeric vector; x-coordinate (m) in the MGI / Balkans zone 6 } - \item{\code{y}}{a numeric vector; y-coordinate (m) in the MGI / Balkans zone 6 } -} -} -\author{ Tomislav Hengl } -\references{ -\itemize{ -\item Hengl, T., Reuter, H.I. (eds), (2008) \href{http://geomorphometry.org/book}{Geomorphometry: Concepts, Software, Applications}. Developments in Soil Science, vol. 33, Elsevier, 772 p. -\item Hengl, T., Heuvelink, G. B. M., van Loon, E. E., (2010) On the uncertainty of stream networks derived from elevation data: the error propagation approach. Hydrology and Earth System Sciences, 14:1153-1165. \doi{10.5194/hess-14-1153-2010} -\item \url{http://geomorphometry.org/content/baranja-hill} -} -} -\note{Consider using the 30 m resolution grid (see \code{bargrid}) as the target resolution (output maps). -} -\examples{ -library(sp) -library(gstat) -## sampled elevations: -data(barxyz) -prj = "+proj=tmerc +lat_0=0 +lon_0=18 +k=0.9999 +x_0=6500000 +y_0=0 +ellps=bessel +units=m -+towgs84=550.499,164.116,475.142,5.80967,2.07902,-11.62386,0.99999445824" -coordinates(barxyz) <- ~x+y -proj4string(barxyz) <- CRS(prj) -## grids: -data(bargrid) -data(barstr) -coordinates(bargrid) <- ~x+y -gridded(bargrid) <- TRUE -proj4string(bargrid) <- barxyz@proj4string -bargrid@grid -\dontrun{## Example with simulated streams: -data(R_pal) -library(rgdal) -library(RSAGA) -pnt = list("sp.points", barxyz, col="black", pch="+") -spplot(bargrid[1], sp.layout=pnt, - col.regions = R_pal[["blue_grey_red"]]) -## Deriving stream networks using geostatistical simulations: -Z.ovgm <- vgm(psill=1831, model="Mat", range=1051, nugget=0, kappa=1.2) -sel <- runif(length(barxyz$Z))<.2 -N.sim <- 5 -## geostatistical simulations: -DEM.sim <- krige(Z~1, barxyz[sel,], bargrid, model=Z.ovgm, nmax=20, - nsim=N.sim, debug.level=-1) -## Note: this operation can be time consuming - -stream.list <- list(rep(NA, N.sim)) -## derive stream networks in SAGA GIS: -for (i in 1:N.sim) { - writeGDAL(DEM.sim[i], paste("DEM", i, ".sdat", sep=""), - drivername = "SAGA", mvFlag = -99999) - ## filter the spurious sinks: - rsaga.fill.sinks(in.dem=paste("DEM", i, ".sgrd", sep=""), - out.dem="DEMflt.sgrd", check.module.exists = FALSE) - ## extract the channel network SAGA GIS: - rsaga.geoprocessor(lib="ta_channels", module=0, - param=list(ELEVATION="DEMflt.sgrd", - CHNLNTWRK=paste("channels", i, ".sgrd", sep=""), - CHNLROUTE="channel_route.sgrd", - SHAPES="channels.shp", - INIT_GRID="DEMflt.sgrd", - DIV_CELLS=3, MINLEN=40), - check.module.exists = FALSE, - show.output.on.console=FALSE) - stream.list[[i]] <- readOGR("channels.shp", "channels", - verbose=FALSE) - proj4string(stream.list[[i]]) <- barxyz@proj4string -} -# plot all derived streams at top of each other: -streams.plot <- as.list(rep(NA, N.sim)) -for(i in 1:N.sim){ - streams.plot[[i]] <- list("sp.lines", stream.list[[i]]) -} -spplot(DEM.sim[1], col.regions=grey(seq(0.4,1,0.025)), scales=list(draw=T), -sp.layout=streams.plot) -} -} -\keyword{datasets} +\name{baranja} +\docType{data} +\encoding{latin1} +\alias{barxyz} +\alias{bargrid} +\alias{barstr} +\title{Baranja hill case study} +\description{Baranja hill is a 4 by 4 km large study area in the Baranja region, eastern Croatia (corresponds to a size of an aerial photograph). This data set has been extensively used to describe various DEM modelling and analysis steps (see \href{https://geomorphometry.org/geomorphometry-concepts-software-applications/}{Hengl and Reuter, 2008}; Hengl et al., 2010; \doi{10.5194/hess-14-1153-2010}). Object \code{barxyz} contains 6370 precise observations of elevations (from field survey and digitized from the stereo images); \code{bargrid} contains \emph{observed} probabilities of streams (digitized from the 1:5000 topo map); \code{barstr} contains 100 simulated stream networks (\code{"SpatialLines"}) using \code{barxyz} point data as input (see examples below).} +\usage{data(bargrid)} +\format{ +The \code{bargrid} data frame (regular grid at 30 m intervals) contains the following columns: + \describe{ + \item{\code{p.obs}}{observed probability of stream (0-1)} + \item{\code{x}}{a numeric vector; x-coordinate (m) in the MGI / Balkans zone 6 } + \item{\code{y}}{a numeric vector; y-coordinate (m) in the MGI / Balkans zone 6 } +} +} +\author{ Tomislav Hengl } +\references{ +\itemize{ +\item Hengl, T., Reuter, H.I. (eds), (2008) \href{https://geomorphometry.org/geomorphometry-concepts-software-applications/}{Geomorphometry: Concepts, Software, Applications}. Developments in Soil Science, vol. 33, Elsevier, 772 p. +\item Hengl, T., Heuvelink, G. B. M., van Loon, E. E., (2010) On the uncertainty of stream networks derived from elevation data: the error propagation approach. Hydrology and Earth System Sciences, 14:1153-1165. \doi{10.5194/hess-14-1153-2010} +\item \url{https://geomorphometry.org/baranja-hill/} +} +} +\note{Consider using the 30 m resolution grid (see \code{bargrid}) as the target resolution (output maps). +} +\examples{ +library(sp) +library(gstat) +## sampled elevations: +data(barxyz) +prj = "+proj=tmerc +lat_0=0 +lon_0=18 +k=0.9999 +x_0=6500000 +y_0=0 +ellps=bessel +units=m ++towgs84=550.499,164.116,475.142,5.80967,2.07902,-11.62386,0.99999445824" +coordinates(barxyz) <- ~x+y +proj4string(barxyz) <- CRS(prj) +## grids: +data(bargrid) +data(barstr) +coordinates(bargrid) <- ~x+y +gridded(bargrid) <- TRUE +proj4string(bargrid) <- barxyz@proj4string +bargrid@grid +\dontrun{## Example with simulated streams: +data(R_pal) +library(rgdal) +library(RSAGA) +pnt = list("sp.points", barxyz, col="black", pch="+") +spplot(bargrid[1], sp.layout=pnt, + col.regions = R_pal[["blue_grey_red"]]) +## Deriving stream networks using geostatistical simulations: +Z.ovgm <- vgm(psill=1831, model="Mat", range=1051, nugget=0, kappa=1.2) +sel <- runif(length(barxyz$Z))<.2 +N.sim <- 5 +## geostatistical simulations: +DEM.sim <- krige(Z~1, barxyz[sel,], bargrid, model=Z.ovgm, nmax=20, + nsim=N.sim, debug.level=-1) +## Note: this operation can be time consuming + +stream.list <- list(rep(NA, N.sim)) +## derive stream networks in SAGA GIS: +for (i in 1:N.sim) { + writeGDAL(DEM.sim[i], paste("DEM", i, ".sdat", sep=""), + drivername = "SAGA", mvFlag = -99999) + ## filter the spurious sinks: + rsaga.fill.sinks(in.dem=paste("DEM", i, ".sgrd", sep=""), + out.dem="DEMflt.sgrd", check.module.exists = FALSE) + ## extract the channel network SAGA GIS: + rsaga.geoprocessor(lib="ta_channels", module=0, + param=list(ELEVATION="DEMflt.sgrd", + CHNLNTWRK=paste("channels", i, ".sgrd", sep=""), + CHNLROUTE="channel_route.sgrd", + SHAPES="channels.shp", + INIT_GRID="DEMflt.sgrd", + DIV_CELLS=3, MINLEN=40), + check.module.exists = FALSE, + show.output.on.console=FALSE) + stream.list[[i]] <- readOGR("channels.shp", "channels", + verbose=FALSE) + proj4string(stream.list[[i]]) <- barxyz@proj4string +} +# plot all derived streams at top of each other: +streams.plot <- as.list(rep(NA, N.sim)) +for(i in 1:N.sim){ + streams.plot[[i]] <- list("sp.lines", stream.list[[i]]) +} +spplot(DEM.sim[1], col.regions=grey(seq(0.4,1,0.025)), scales=list(draw=T), +sp.layout=streams.plot) +} +} +\keyword{datasets} diff --git a/man/eberg.Rd b/man/eberg.Rd index f8f4447..beccb12 100644 --- a/man/eberg.Rd +++ b/man/eberg.Rd @@ -1,76 +1,76 @@ -\name{eberg} -\docType{data} -\encoding{latin1} -\alias{eberg} -\alias{eberg_grid} -\alias{eberg_grid25} -\alias{eberg_zones} -\alias{eberg_contours} -\title{Ebergotzen --- soil mapping case study} -\description{\enc{Ebergötzen}{Ebergoetzen} is 10 by 10 km study area in the vicinity of the city of \enc{Göttingen}{Goettingen} in Central Germany. This area has been extensively surveyed over the years, mainly for the purposes of developing operational digital soil mapping techniques (Gehrt and \enc{Böhner}{Boehner}, 2001), and has been used by the SAGA GIS development team to demonstrate various processing steps.\cr -\code{eberg} table contains 3670 observations (augers) of soil textures at five depths (0--10, 10--30, 30--50, 50--70, and 70--90), and field records of soil types according to the German soil classification system. \code{eberg_grid} contains gridded maps at 100 m resolution that can be used as covariates for spatial prediction of soil variables. \code{eberg_grid25} contains grids at finer resolution (25 m). \code{eberg_zones} is a polygon map showing the distribution of parent material (Silt and sand, Sandy material, Clayey derivats, Clay and loess). \code{eberg_contours} shows contour lines derived from the 25 m DEM of the area using 10 m equidistance.} -\usage{data(eberg)} -\format{ -The \code{eberg} data frame (irregular points) contains the following columns: - \describe{ - \item{\code{ID}}{universal identifier} - \item{\code{soiltype}}{a vector containing factors; soil classes according to the German soil classification system: \code{"A"} (Auenboden), \code{"B"} (Braunerde), \code{"D"} (Pelosol), \code{"G"} (Gley), \code{"Ha"} (Moor), \code{"Hw"} (HMoor), \code{"K"} (Kolluvisol), \code{"L"} (Parabraunerde), \code{"N"} (Ranker), \code{"Q"} (Regosol), \code{"R"} (Rendzina), \code{"S"} (Pseudogley), \code{"Z"} (Pararendzina)} - \item{\code{TAXGRSC}}{a vector containing factors; full soil class names according to the German soil classification system (see \code{soiltype} column)} - \item{\code{X}}{a numeric vector; x-coordinate (m) in DHDN / Gauss-Krueger zone 3 (German coordinate system) } - \item{\code{Y}}{a numeric vector; y-coordinate (m) in DHDN / Gauss-Krueger zone 3 (German coordinate system) } - \item{\code{UHDICM_*}}{a numeric vector; upper horizon depth in cm per horizon} - \item{\code{LHDICM_*}}{a numeric vector; lower horizon depth in cm per horizon} - \item{\code{SNDMHT_*}}{a numeric vector; sand content estimated by hand per horizon (0-100 percent); see Ad-hoc-AG Boden (2005) for more details} - \item{\code{SLTMHT_*}}{a numeric vector; silt content estimated by hand per horizon (0-100 percent)} - \item{\code{CLYMHT_*}}{a numeric vector; clay content estimated by hand per horizon (0-100 percent)} -} -The \code{eberg_grid} data frame (regular grid at 100 m resolution) contains the following columns: - \describe{ - \item{\code{PRMGEO6}}{a vector containing factors, parent material classes from the geological map (mapping units)} - \item{\code{DEMSRT6}}{a numeric vector; elevation values from the SRTM DEM} - \item{\code{TWISRT6}}{a numeric vector; Topographic Wetness Index derived using the SAGA algorithm} - \item{\code{TIRAST6}}{a numeric vector; Thermal Infrared (TIR) reflection values from the ASTER L1 image band 14 (2010-06-05T10:26:50Z) obtained via the NASA's \href{https://glovis.usgs.gov}{GloVis browser}} - \item{\code{LNCCOR6}}{a vector containing factors; \href{https://www.eea.europa.eu/data-and-maps/data/clc-2006-raster-1}{Corine Land Cover 2006} classes} - \item{\code{x}}{a numeric vector; x-coordinate (m) in DHDN / Gauss-Krueger zone 3 (German coordinate system)} - \item{\code{y}}{a numeric vector; y-coordinate (m) in DHDN / Gauss-Krueger zone 3 (German coordinate system)} -} -The \code{eberg_grid25} data frame (regular grid at 25 m resolution) contains the following columns: - \describe{ - \item{\code{DEMTOPx}}{a numeric vector; elevation values from the topographic map} - \item{\code{HBTSOLx}}{a vector containing factors; main soil type according to the German soil classification system (see column "soiltype" above) estimated per crop field} - \item{\code{TWITOPx}}{a numeric vector; Topographic Wetness Index derived using the SAGA algorithm } - \item{\code{NVILANx}}{a numeric vector; NDVI image derived using the Landsat image from the \href{https://ec.europa.eu/jrc/en}{Image 2000 project}} - \item{\code{x}}{a numeric vector; x-coordinate (m) in DHDN / Gauss-Krueger zone 3 (German coordinate system) } - \item{\code{y}}{a numeric vector; y-coordinate (m) in DHDN / Gauss-Krueger zone 3 (German coordinate system) } -} -} -\author{The \enc{Ebergötzen}{Ebergoetzen} dataset is courtesy of Gehrt Ernst (\email{Ernst.Gehrt@niedersachsen.de}), the State Authority for Mining, Energy and Geology, Hannover, Germany and Olaf Conrad, University of Hamburg (\email{conrad@geowiss.uni-hamburg.de}). The original data set has been prepared for this exercise by Tomislav Hengl (\email{tom.hengl@opengeohub.org}).} -\references{ -\itemize{ -\item Ad-hoc-AG Boden, (2005) Bodenkundliche Kartieranleitung. 5th Ed, Bundesanstalt \enc{für}{fur} Geowissenschaften und Rohstoffe und Niedersaechsisches Landesamt \enc{für}{fur} Bodenforshung, Hannover, p. 423. -\item \enc{Böhner}{Boehner}, J., McCloy, K. R. and Strobl, J. (Eds), (2006) \href{http://www.saga-gis.org/}{SAGA --- Analysis and Modelling Applications}. \enc{Göttinger}{Goettinger} Geographische Abhandlungen, Heft 115. Verlag Erich Goltze GmbH, \enc{Göttingen}{Goettingen}, 117 pp. -\item Gehrt, E., \enc{Böhner}{Boehner}, J., (2001) Vom punkt zur flache --- probleme des 'upscaling' in der bodenkartierung. In: Diskussionsforum Bodenwissenschaften: Vom Bohrstock zum Bildschirm. FH, \enc{Osnabrück}{Osnabruck}, pp. 17-34. -\item Skaggs, T. H., Arya, L. M., Shouse, P. J., Mohanty, B. P., (2001) Estimating Particle-Size Distribution from Limited Soil Texture Data. Soil Science Society of America Journal 65 (4): 1038-1044. \doi{10.2136/sssaj2001.6541038x} -\item \url{http://geomorphometry.org/content/ebergotzen} -} -} -\note{Texture by hand method can be used to determine the content of soil earth fractions only to an accuracy of \enc{±}{+-}5--10\% (Skaggs et al., 2001). A surveyor distinguishes to which of the 32 texture classes a soil samples belongs to, and then estimates the content of fractions; e.g. texture class \code{St2} has 10\% clay, 25\% silt and 65\% sand (Ad-hoc-AG Boden, 2005).} -\examples{ -data(eberg) -data(eberg_grid) -data(eberg_zones) -data(eberg_contours) -library(sp) -coordinates(eberg) <- ~X+Y -proj4string(eberg) <- CRS("+init=epsg:31467") -gridded(eberg_grid) <- ~x+y -proj4string(eberg_grid) <- CRS("+init=epsg:31467") -# visualize the maps: -data(SAGA_pal) -l.sp <- list("sp.lines", eberg_contours, col="black") -\dontrun{ -spplot(eberg_grid["DEMSRT6"], col.regions = SAGA_pal[[1]], sp.layout=l.sp) -spplot(eberg_zones, sp.layout=list("sp.points", eberg, col="black", pch="+")) -} -} -\keyword{datasets} +\name{eberg} +\docType{data} +\encoding{latin1} +\alias{eberg} +\alias{eberg_grid} +\alias{eberg_grid25} +\alias{eberg_zones} +\alias{eberg_contours} +\title{Ebergotzen --- soil mapping case study} +\description{\enc{Ebergötzen}{Ebergoetzen} is 10 by 10 km study area in the vicinity of the city of \enc{Göttingen}{Goettingen} in Central Germany. This area has been extensively surveyed over the years, mainly for the purposes of developing operational digital soil mapping techniques (Gehrt and \enc{Böhner}{Boehner}, 2001), and has been used by the SAGA GIS development team to demonstrate various processing steps.\cr +\code{eberg} table contains 3670 observations (augers) of soil textures at five depths (0--10, 10--30, 30--50, 50--70, and 70--90), and field records of soil types according to the German soil classification system. \code{eberg_grid} contains gridded maps at 100 m resolution that can be used as covariates for spatial prediction of soil variables. \code{eberg_grid25} contains grids at finer resolution (25 m). \code{eberg_zones} is a polygon map showing the distribution of parent material (Silt and sand, Sandy material, Clayey derivats, Clay and loess). \code{eberg_contours} shows contour lines derived from the 25 m DEM of the area using 10 m equidistance.} +\usage{data(eberg)} +\format{ +The \code{eberg} data frame (irregular points) contains the following columns: + \describe{ + \item{\code{ID}}{universal identifier} + \item{\code{soiltype}}{a vector containing factors; soil classes according to the German soil classification system: \code{"A"} (Auenboden), \code{"B"} (Braunerde), \code{"D"} (Pelosol), \code{"G"} (Gley), \code{"Ha"} (Moor), \code{"Hw"} (HMoor), \code{"K"} (Kolluvisol), \code{"L"} (Parabraunerde), \code{"N"} (Ranker), \code{"Q"} (Regosol), \code{"R"} (Rendzina), \code{"S"} (Pseudogley), \code{"Z"} (Pararendzina)} + \item{\code{TAXGRSC}}{a vector containing factors; full soil class names according to the German soil classification system (see \code{soiltype} column)} + \item{\code{X}}{a numeric vector; x-coordinate (m) in DHDN / Gauss-Krueger zone 3 (German coordinate system) } + \item{\code{Y}}{a numeric vector; y-coordinate (m) in DHDN / Gauss-Krueger zone 3 (German coordinate system) } + \item{\code{UHDICM_*}}{a numeric vector; upper horizon depth in cm per horizon} + \item{\code{LHDICM_*}}{a numeric vector; lower horizon depth in cm per horizon} + \item{\code{SNDMHT_*}}{a numeric vector; sand content estimated by hand per horizon (0-100 percent); see Ad-hoc-AG Boden (2005) for more details} + \item{\code{SLTMHT_*}}{a numeric vector; silt content estimated by hand per horizon (0-100 percent)} + \item{\code{CLYMHT_*}}{a numeric vector; clay content estimated by hand per horizon (0-100 percent)} +} +The \code{eberg_grid} data frame (regular grid at 100 m resolution) contains the following columns: + \describe{ + \item{\code{PRMGEO6}}{a vector containing factors, parent material classes from the geological map (mapping units)} + \item{\code{DEMSRT6}}{a numeric vector; elevation values from the SRTM DEM} + \item{\code{TWISRT6}}{a numeric vector; Topographic Wetness Index derived using the SAGA algorithm} + \item{\code{TIRAST6}}{a numeric vector; Thermal Infrared (TIR) reflection values from the ASTER L1 image band 14 (2010-06-05T10:26:50Z) obtained via the NASA's \href{https://glovis.usgs.gov}{GloVis browser}} + \item{\code{LNCCOR6}}{a vector containing factors; \href{https://www.eea.europa.eu/data-and-maps/data/clc-2006-raster-1}{Corine Land Cover 2006} classes} + \item{\code{x}}{a numeric vector; x-coordinate (m) in DHDN / Gauss-Krueger zone 3 (German coordinate system)} + \item{\code{y}}{a numeric vector; y-coordinate (m) in DHDN / Gauss-Krueger zone 3 (German coordinate system)} +} +The \code{eberg_grid25} data frame (regular grid at 25 m resolution) contains the following columns: + \describe{ + \item{\code{DEMTOPx}}{a numeric vector; elevation values from the topographic map} + \item{\code{HBTSOLx}}{a vector containing factors; main soil type according to the German soil classification system (see column "soiltype" above) estimated per crop field} + \item{\code{TWITOPx}}{a numeric vector; Topographic Wetness Index derived using the SAGA algorithm } + \item{\code{NVILANx}}{a numeric vector; NDVI image derived using the Landsat image from the \href{https://ec.europa.eu/jrc/en}{Image 2000 project}} + \item{\code{x}}{a numeric vector; x-coordinate (m) in DHDN / Gauss-Krueger zone 3 (German coordinate system) } + \item{\code{y}}{a numeric vector; y-coordinate (m) in DHDN / Gauss-Krueger zone 3 (German coordinate system) } +} +} +\author{The \enc{Ebergötzen}{Ebergoetzen} dataset is courtesy of Gehrt Ernst (\email{Ernst.Gehrt@niedersachsen.de}), the State Authority for Mining, Energy and Geology, Hannover, Germany and Olaf Conrad, University of Hamburg (\email{conrad@geowiss.uni-hamburg.de}). The original data set has been prepared for this exercise by Tomislav Hengl (\email{tom.hengl@opengeohub.org}).} +\references{ +\itemize{ +\item Ad-hoc-AG Boden, (2005) Bodenkundliche Kartieranleitung. 5th Ed, Bundesanstalt \enc{für}{fur} Geowissenschaften und Rohstoffe und Niedersaechsisches Landesamt \enc{für}{fur} Bodenforshung, Hannover, p. 423. +\item \enc{Böhner}{Boehner}, J., McCloy, K. R. and Strobl, J. (Eds), (2006) \href{http://www.saga-gis.org/}{SAGA --- Analysis and Modelling Applications}. \enc{Göttinger}{Goettinger} Geographische Abhandlungen, Heft 115. Verlag Erich Goltze GmbH, \enc{Göttingen}{Goettingen}, 117 pp. +\item Gehrt, E., \enc{Böhner}{Boehner}, J., (2001) Vom punkt zur flache --- probleme des 'upscaling' in der bodenkartierung. In: Diskussionsforum Bodenwissenschaften: Vom Bohrstock zum Bildschirm. FH, \enc{Osnabrück}{Osnabruck}, pp. 17-34. +\item Skaggs, T. H., Arya, L. M., Shouse, P. J., Mohanty, B. P., (2001) Estimating Particle-Size Distribution from Limited Soil Texture Data. Soil Science Society of America Journal 65 (4): 1038-1044. \doi{10.2136/sssaj2001.6541038x} +\item \url{https://geomorphometry.org/ebergotzen/} +} +} +\note{Texture by hand method can be used to determine the content of soil earth fractions only to an accuracy of \enc{±}{+-}5--10\% (Skaggs et al., 2001). A surveyor distinguishes to which of the 32 texture classes a soil samples belongs to, and then estimates the content of fractions; e.g. texture class \code{St2} has 10\% clay, 25\% silt and 65\% sand (Ad-hoc-AG Boden, 2005).} +\examples{ +data(eberg) +data(eberg_grid) +data(eberg_zones) +data(eberg_contours) +library(sp) +coordinates(eberg) <- ~X+Y +proj4string(eberg) <- CRS("+init=epsg:31467") +gridded(eberg_grid) <- ~x+y +proj4string(eberg_grid) <- CRS("+init=epsg:31467") +# visualize the maps: +data(SAGA_pal) +l.sp <- list("sp.lines", eberg_contours, col="black") +\dontrun{ +spplot(eberg_grid["DEMSRT6"], col.regions = SAGA_pal[[1]], sp.layout=l.sp) +spplot(eberg_zones, sp.layout=list("sp.points", eberg, col="black", pch="+")) +} +} +\keyword{datasets} diff --git a/man/spMetadata.Rd b/man/spMetadata.Rd index 3ae5613..8fdc411 100644 --- a/man/spMetadata.Rd +++ b/man/spMetadata.Rd @@ -1,114 +1,114 @@ -\name{spMetadata-methods} -\docType{methods} -\alias{spMetadata} -\alias{spMetadata,RasterLayer-method} -\alias{spMetadata,Spatial-method} -\alias{spMetadata.Raster} -\alias{spMetadata.Spatial} -\alias{metadata} -\alias{metadata.env} -\alias{read.metadata} -\title{Methods to generate spatial metadata} -\description{ -The \code{spMetadata} function will try to generate missing metadata (bounding box, location info, session info, metadata creator info and similar) for any \code{Spatial*} object (from the sp package) or \code{Raster*} object (from the raster package). The resulting object of class \code{\link{SpatialMetadata-class}} can be used e.g. to generate a Layer description documents (\code{} tag).\cr -The \code{read.metadata} function reads the formatted metadata (\code{.xml}), prepared following e.g. the \href{http://www.fgdc.gov/metadata/csdgm/}{Federal Geographic Data Committee (FGDC) Content Standard for Digital Geospatial Metadata} or \href{http://inspire.ec.europa.eu/}{INSPIRE} standard, and converts them to a data frame. -} -\usage{ -\S4method{spMetadata}{RasterLayer}(obj, bounds, color, \dots ) -\S4method{spMetadata}{Spatial}(obj, xml.file, out.xml.file, - md.type = c("FGDC", "INSPIRE")[1], - generate.missing = TRUE, GoogleGeocode = FALSE, - signif.digit = 3, colour_scale, color = NULL, bounds, - legend_names, icons, validate.schema = FALSE, \dots) -} -\arguments{ - \item{obj}{some \code{"Spatial"} or \code{"Raster"} class object with \code{"data"} slot} - \item{xml.file}{character; optional input XML metadata file} - \item{out.xml.file}{character; optional output XML metadata file} - \item{md.type}{character; metadata standard \href{http://geology.usgs.gov/tools/metadata/}{FGDC} or \href{http://inspire.ec.europa.eu/}{INSPIRE}} - \item{generate.missing}{logical; specifies whether to automatically generate missing fields} - \item{GoogleGeocode}{logical; specifies whether the function should try to use GoogleGeocoding functionality to determine the location name} - \item{signif.digit}{integer; the default number of significant digits (in the case of rounding)} - \item{colour_scale}{the color scheme used to visualize this data} - \item{color}{character; list of colors (\code{rgb()}) that can be passed instead of using the pallete} - \item{bounds}{numeric vector; upper and lower bounds used for visualization} - \item{legend_names}{character; legend names in the order of bounds} - \item{icons}{character; file name or URL used for icons (if applicable)} - \item{validate.schema}{logical; specifies whether to validate the schema using the \code{xmlSchemaValidate}} - \item{\dots}{additional arguments to be passed e.g. via the \code{metadata.env()}} -} -\details{ -\code{spMetadata} tries to locate a metadata file in the working directory (it looks for a metadata file with the same name as the object name). If no \code{.xml} file exists, it will load the template xml file available in the system folder (e.g. \code{system.file("FGDC.xml", package="plotKML")} or \code{system.file("INSPIRE_ISO19139.xml", package="plotKML")}). The \code{FGDC.xml}/\code{INSPIRE_ISO19139.xml} files contain typical metadata entries with description and examples. For practical purposes, one metadata object in plotKML can be associated with only one variable i.e. one column in the \code{"data"} slot (the first column by default). To prepare a metadata xml file following the FGDC standard, consider using e.g. the \href{http://geology.usgs.gov/tools/metadata/tools/doc/tkme.html}{Tkme} software: Another editor for formal metadata, by Peter N. Schweitzer (U.S. Geological Survey). Before commiting the metadata file, try also running a \href{https://mrdata.usgs.gov/validation/}{validation test}. Before committing the metadata file following the INSPIRE standard, try running the \href{http://inspire.ec.europa.eu/validator/about/}{INSPIRE Geoportal Metadata Validator}.\cr -\code{spMetadata} tries to automatically generate the most usefull information, so that a user can easily find out about the input data and procedures followed to generate the visualization (KML). Typical metadata entries include e.g. (FGDC): -\itemize{ -\item \code{metadata[["idinfo"]][["native"]]} --- Session info e.g.: Produced using R version 2.12.2 (2011-02-25) running on Windows 7 x64. -\item \code{metadata[["spdoinfo"]][["indspref"]]} --- Indirect spatial reference estimated using the \href{https://developers.google.com/maps/documentation}{Google Maps API Web Services}. -\item \code{metadata[["idinfo"]][["spdom"]][["bounding"]]} --- Bounding box in the WGS84 geographical coordinates estimated by reprojecting the original bounding box. -} -and for INSPIRE metadata: -\itemize{ -\item \code{metadata[["fileIdentifier"]][["CharacterString"]]} --- Metadata file identifier (not mandatory for INSPIRE-compl.) created by UUIDgenerate from package UUID (version 4 UUID). -\item \code{metadata[["dateStamp"]][["Date"]]} --- Metadata date stamp created using Sys.Date(). -\item \code{metadata[["identificationInfo"]][["MD_DataIdentification"]] -[["extent"]][["EX_Extent"]][["geographicElement"]][["EX_GeographicBoundingBox"]]} --- Bounding box in the WGS84 geographical coordinates estimated by reprojecting the original bounding box. -} -By default, plotKML uses the Creative Commons license, but this can be adjusted by setting the \code{Use_Constraints} argument. -} -\references{ -\itemize{ -\item The Federal Geographic Data Committee, (2006) FGDC Don't Duck Metadata --- A short reference guide for writing quality metadata. Vers. 1, \url{http://www.fgdc.gov/metadata/documents/MetadataQuickGuide.pdf} -\item Content Standard for Digital Geospatial Metadata (\url{http://www.fgdc.gov/metadata/csdgm/}) -\item Tkme metadata editor (\url{http://geology.usgs.gov/tools/metadata/tools/doc/tkme.html}) -\item INSPIRE, INS MD, Commission Regulation (EC) No 1205/2008 of 3 December 2008 implementing Directive 2007/2/EC of the European Parliament and of the Council as regards metadata (Text with EEA relevance). See also Corrigendum to INSPIRE Metadata Regulation. -\item INSPIRE, INS MDTG, (2013) INSPIRE Metadata Implementing Rules: Technical Guidelines based on EN ISO 19115 and EN ISO 19119, v1.3 -} -} -\author{Tomislav Hengl and Michael Blaschek} -\seealso{ \code{\link{kml_metadata}}, \code{\link{SpatialMetadata-class}}, \code{sp::Spatial}, \code{\link{kml_open}} } -\examples{ -\dontrun{ -library(sp) -library(uuid) -library(rjson) -## read metadata from the system file: -x <- read.metadata(system.file("FGDC.xml", package="plotKML")) -str(x) -## generate missing metadata -data(eberg) -coordinates(eberg) <- ~X+Y -proj4string(eberg) <- CRS("+init=epsg:31467") -## no metadata file specified: -eberg.md <- spMetadata(eberg["SNDMHT_A"]) -## this generates some metadata automatically e.g.: -xmlRoot(eberg.md@xml)[["eainfo"]][["detailed"]][["attr"]] -## combine with localy prepared metadata file: -eberg.md <- spMetadata(eberg["SNDMHT_A"], - xml.file=system.file("eberg.xml", package="plotKML")) -## Additional metadat entries can be added by using e.g.: -eberg.md <- spMetadata(eberg["SNDMHT_A"], - md.type="INSPIRE", - CI_Citation_title = 'Ebergotzen data set', - CI_Online_resource_URL = 'http://geomorphometry.org/content/ebergotzen') -## the same using the FGDC template: -eberg.md <- spMetadata(eberg["SNDMHT_A"], - Citation_title = 'Ebergotzen data set', - Citation_URL = 'http://geomorphometry.org/content/ebergotzen') -## Complete list of names: -mdnames <- read.csv(system.file("mdnames.csv", package="plotKML")) -mdnames$field.names -## these can be assigned to the "metadata" environment by using: -metadata.env(CI_Citation_title = 'Ebergotzen data set') -get("CI_Citation_title", metadata) - -## write data and metadata to a file: -library(rgdal) -writeOGR(eberg["SNDMHT_A"], "eberg_SAND.shp", ".", "ESRI Shapefile") -saveXML(eberg.md@xml, "eberg_SAND.xml") -## export to SLD format: -metadata2SLD(eberg.md, "eberg.sld") -## plot the layer with the metadata: -kml(eberg, file.name = "eberg_md.kml", colour = SNDMHT_A, metadata = eberg.md, kmz = TRUE) -} -} -\keyword{spatial} +\name{spMetadata-methods} +\docType{methods} +\alias{spMetadata} +\alias{spMetadata,RasterLayer-method} +\alias{spMetadata,Spatial-method} +\alias{spMetadata.Raster} +\alias{spMetadata.Spatial} +\alias{metadata} +\alias{metadata.env} +\alias{read.metadata} +\title{Methods to generate spatial metadata} +\description{ +The \code{spMetadata} function will try to generate missing metadata (bounding box, location info, session info, metadata creator info and similar) for any \code{Spatial*} object (from the sp package) or \code{Raster*} object (from the raster package). The resulting object of class \code{\link{SpatialMetadata-class}} can be used e.g. to generate a Layer description documents (\code{} tag).\cr +The \code{read.metadata} function reads the formatted metadata (\code{.xml}), prepared following e.g. the \href{http://www.fgdc.gov/metadata/csdgm/}{Federal Geographic Data Committee (FGDC) Content Standard for Digital Geospatial Metadata} or \href{http://inspire.ec.europa.eu/}{INSPIRE} standard, and converts them to a data frame. +} +\usage{ +\S4method{spMetadata}{RasterLayer}(obj, bounds, color, \dots ) +\S4method{spMetadata}{Spatial}(obj, xml.file, out.xml.file, + md.type = c("FGDC", "INSPIRE")[1], + generate.missing = TRUE, GoogleGeocode = FALSE, + signif.digit = 3, colour_scale, color = NULL, bounds, + legend_names, icons, validate.schema = FALSE, \dots) +} +\arguments{ + \item{obj}{some \code{"Spatial"} or \code{"Raster"} class object with \code{"data"} slot} + \item{xml.file}{character; optional input XML metadata file} + \item{out.xml.file}{character; optional output XML metadata file} + \item{md.type}{character; metadata standard \href{http://geology.usgs.gov/tools/metadata/}{FGDC} or \href{http://inspire.ec.europa.eu/}{INSPIRE}} + \item{generate.missing}{logical; specifies whether to automatically generate missing fields} + \item{GoogleGeocode}{logical; specifies whether the function should try to use GoogleGeocoding functionality to determine the location name} + \item{signif.digit}{integer; the default number of significant digits (in the case of rounding)} + \item{colour_scale}{the color scheme used to visualize this data} + \item{color}{character; list of colors (\code{rgb()}) that can be passed instead of using the pallete} + \item{bounds}{numeric vector; upper and lower bounds used for visualization} + \item{legend_names}{character; legend names in the order of bounds} + \item{icons}{character; file name or URL used for icons (if applicable)} + \item{validate.schema}{logical; specifies whether to validate the schema using the \code{xmlSchemaValidate}} + \item{\dots}{additional arguments to be passed e.g. via the \code{metadata.env()}} +} +\details{ +\code{spMetadata} tries to locate a metadata file in the working directory (it looks for a metadata file with the same name as the object name). If no \code{.xml} file exists, it will load the template xml file available in the system folder (e.g. \code{system.file("FGDC.xml", package="plotKML")} or \code{system.file("INSPIRE_ISO19139.xml", package="plotKML")}). The \code{FGDC.xml}/\code{INSPIRE_ISO19139.xml} files contain typical metadata entries with description and examples. For practical purposes, one metadata object in plotKML can be associated with only one variable i.e. one column in the \code{"data"} slot (the first column by default). To prepare a metadata xml file following the FGDC standard, consider using e.g. the \href{http://geology.usgs.gov/tools/metadata/tools/doc/tkme.html}{Tkme} software: Another editor for formal metadata, by Peter N. Schweitzer (U.S. Geological Survey). Before commiting the metadata file, try also running a validation test (https://mrdata.usgs.gov/validation/). Before committing the metadata file following the INSPIRE standard, try running the \href{http://inspire.ec.europa.eu/validator/about/}{INSPIRE Geoportal Metadata Validator}.\cr +\code{spMetadata} tries to automatically generate the most usefull information, so that a user can easily find out about the input data and procedures followed to generate the visualization (KML). Typical metadata entries include e.g. (FGDC): +\itemize{ +\item \code{metadata[["idinfo"]][["native"]]} --- Session info e.g.: Produced using R version 2.12.2 (2011-02-25) running on Windows 7 x64. +\item \code{metadata[["spdoinfo"]][["indspref"]]} --- Indirect spatial reference estimated using the \href{https://developers.google.com/maps/documentation}{Google Maps API Web Services}. +\item \code{metadata[["idinfo"]][["spdom"]][["bounding"]]} --- Bounding box in the WGS84 geographical coordinates estimated by reprojecting the original bounding box. +} +and for INSPIRE metadata: +\itemize{ +\item \code{metadata[["fileIdentifier"]][["CharacterString"]]} --- Metadata file identifier (not mandatory for INSPIRE-compl.) created by UUIDgenerate from package UUID (version 4 UUID). +\item \code{metadata[["dateStamp"]][["Date"]]} --- Metadata date stamp created using Sys.Date(). +\item \code{metadata[["identificationInfo"]][["MD_DataIdentification"]] +[["extent"]][["EX_Extent"]][["geographicElement"]][["EX_GeographicBoundingBox"]]} --- Bounding box in the WGS84 geographical coordinates estimated by reprojecting the original bounding box. +} +By default, plotKML uses the Creative Commons license, but this can be adjusted by setting the \code{Use_Constraints} argument. +} +\references{ +\itemize{ +\item The Federal Geographic Data Committee, (2006) FGDC Don't Duck Metadata --- A short reference guide for writing quality metadata. Vers. 1, \url{http://www.fgdc.gov/metadata/documents/MetadataQuickGuide.pdf} +\item Content Standard for Digital Geospatial Metadata (\url{http://www.fgdc.gov/metadata/csdgm/}) +\item Tkme metadata editor (\url{http://geology.usgs.gov/tools/metadata/tools/doc/tkme.html}) +\item INSPIRE, INS MD, Commission Regulation (EC) No 1205/2008 of 3 December 2008 implementing Directive 2007/2/EC of the European Parliament and of the Council as regards metadata (Text with EEA relevance). See also Corrigendum to INSPIRE Metadata Regulation. +\item INSPIRE, INS MDTG, (2013) INSPIRE Metadata Implementing Rules: Technical Guidelines based on EN ISO 19115 and EN ISO 19119, v1.3 +} +} +\author{Tomislav Hengl and Michael Blaschek} +\seealso{ \code{\link{kml_metadata}}, \code{\link{SpatialMetadata-class}}, \code{sp::Spatial}, \code{\link{kml_open}} } +\examples{ +\dontrun{ +library(sp) +library(uuid) +library(rjson) +## read metadata from the system file: +x <- read.metadata(system.file("FGDC.xml", package="plotKML")) +str(x) +## generate missing metadata +data(eberg) +coordinates(eberg) <- ~X+Y +proj4string(eberg) <- CRS("+init=epsg:31467") +## no metadata file specified: +eberg.md <- spMetadata(eberg["SNDMHT_A"]) +## this generates some metadata automatically e.g.: +xmlRoot(eberg.md@xml)[["eainfo"]][["detailed"]][["attr"]] +## combine with localy prepared metadata file: +eberg.md <- spMetadata(eberg["SNDMHT_A"], + xml.file=system.file("eberg.xml", package="plotKML")) +## Additional metadat entries can be added by using e.g.: +eberg.md <- spMetadata(eberg["SNDMHT_A"], + md.type="INSPIRE", + CI_Citation_title = 'Ebergotzen data set', + CI_Online_resource_URL = 'http://geomorphometry.org/content/ebergotzen') +## the same using the FGDC template: +eberg.md <- spMetadata(eberg["SNDMHT_A"], + Citation_title = 'Ebergotzen data set', + Citation_URL = 'http://geomorphometry.org/content/ebergotzen') +## Complete list of names: +mdnames <- read.csv(system.file("mdnames.csv", package="plotKML")) +mdnames$field.names +## these can be assigned to the "metadata" environment by using: +metadata.env(CI_Citation_title = 'Ebergotzen data set') +get("CI_Citation_title", metadata) + +## write data and metadata to a file: +library(rgdal) +writeOGR(eberg["SNDMHT_A"], "eberg_SAND.shp", ".", "ESRI Shapefile") +saveXML(eberg.md@xml, "eberg_SAND.xml") +## export to SLD format: +metadata2SLD(eberg.md, "eberg.sld") +## plot the layer with the metadata: +kml(eberg, file.name = "eberg_md.kml", colour = SNDMHT_A, metadata = eberg.md, kmz = TRUE) +} +} +\keyword{spatial} \keyword{methods} \ No newline at end of file diff --git a/plotKML.Rproj b/plotKML.Rproj index 4143064..a4d72a0 100644 --- a/plotKML.Rproj +++ b/plotKML.Rproj @@ -1,19 +1,19 @@ -Version: 1.0 - -RestoreWorkspace: Default -SaveWorkspace: Default -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: pdfLaTeX - -BuildType: Package -PackageUseDevtools: Yes -PackageInstallArgs: --no-multiarch --with-keep.source -PackageBuildArgs: --compact-vignettes=both -PackageCheckArgs: --as-cran +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source +PackageBuildArgs: --compact-vignettes=both +PackageCheckArgs: --as-cran