Commit 0dd8ad8e authored by Sébastien Villemot's avatar Sébastien Villemot

Merge tag 'upstream/1.2-5'

Upstream version 1.2-5
parents 3966857e cdb43510
Package: sp
Version: 1.2-5
Title: Classes and Methods for Spatial Data
Authors@R: c(person("Edzer", "Pebesma", role = c("aut", "cre"),
email = "edzer.pebesma@uni-muenster.de"),
person("Roger", "Bivand", role = "aut",
email = "Roger.Bivand@nhh.no"),
person("Barry", "Rowlingson", role = "ctb"),
person("Virgilio", "Gomez-Rubio", role = "ctb"),
person("Robert", "Hijmans", role = "ctb"),
person("Michael", "Sumner", role = "ctb"),
person("Don", "MacQueen", role = "ctb"),
person("Jim", "Lemon", role = "ctb"),
person("Josh", "O'Brien", role = "ctb"))
Depends: R (>= 3.0.0), methods
Imports: utils, stats, graphics, grDevices, lattice, grid
Suggests: RColorBrewer, rgdal (>= 0.8-7), rgeos (>= 0.3-13), gstat,
maptools, deldir
Description: Classes and methods for spatial
data; the classes document where the spatial location information
resides, for 2D or 3D data. Utility functions are provided, e.g. for
plotting data as maps, spatial selection, as well as methods for
retrieving coordinates, for subsetting, print, summary, etc.
License: GPL (>= 2)
URL: https://github.com/edzer/sp/ https://edzer.github.io/sp/
BugReports: https://github.com/edzer/sp/issues
Collate: bpy.colors.R AAA.R Class-CRS.R CRS-methods.R Class-Spatial.R
Spatial-methods.R projected.R Class-SpatialPoints.R
SpatialPoints-methods.R Class-SpatialPointsDataFrame.R
SpatialPointsDataFrame-methods.R Class-SpatialMultiPoints.R
SpatialMultiPoints-methods.R
Class-SpatialMultiPointsDataFrame.R
SpatialMultiPointsDataFrame-methods.R Class-GridTopology.R
Class-SpatialGrid.R Class-SpatialGridDataFrame.R
Class-SpatialLines.R SpatialLines-methods.R
Class-SpatialLinesDataFrame.R SpatialLinesDataFrame-methods.R
Class-SpatialPolygons.R Class-SpatialPolygonsDataFrame.R
SpatialPolygons-methods.R SpatialPolygonsDataFrame-methods.R
GridTopology-methods.R SpatialGrid-methods.R
SpatialGridDataFrame-methods.R SpatialPolygons-internals.R
point.in.polygon.R SpatialPolygons-displayMethods.R zerodist.R
image.R stack.R bubble.R mapasp.R select.spatial.R gridded.R
asciigrid.R spplot.R over.R spsample.R recenter.R dms.R
gridlines.R spdists.R rbind.R flipSGDF.R chfids.R loadmeuse.R
compassRose.R surfaceArea.R spOptions.R subset.R disaggregate.R
sp_spat1.R merge.R aggregate.R
NeedsCompilation: yes
Packaged: 2017-06-27 12:59:17 UTC; edzer
Author: Edzer Pebesma [aut, cre],
Roger Bivand [aut],
Barry Rowlingson [ctb],
Virgilio Gomez-Rubio [ctb],
Robert Hijmans [ctb],
Michael Sumner [ctb],
Don MacQueen [ctb],
Jim Lemon [ctb],
Josh O'Brien [ctb]
Maintainer: Edzer Pebesma <edzer.pebesma@uni-muenster.de>
Repository: CRAN
Date/Publication: 2017-06-29 09:07:36 UTC
This diff is collapsed.
useDynLib(sp,
bboxCalcR_c,
pointsInBox,
Polygon_c,
Polygon_validate_c,
Polygons_c,
R_point_in_polygon_sp,
sp_zerodist,
sp_duplicates,
SpatialPolygons_c,
SpatialPolygons_getIDs_c,
SpatialPolygons_plotOrder_c,
SpatialPolygons_validate_c,
tList
)
importFrom(graphics, plot, hist, polygon, par, polypath, lines, strheight,
text, contour, axTicks, axis, rasterImage, image, box, plot.new,
plot.window, rect, segments, points, locator, identify, title,
layout, lcm)
importFrom(stats, aggregate, na.omit, aggregate.data.frame, complete.cases,
quantile, as.formula, dist, runif, model.frame, na.fail)
import(utils)
importFrom(grid, grid.polygon, grid.path, grid.rect, polygonGrob, gpar,
grid.layout, unit, frameGrob, placeGrob, rectGrob, grid.locator,
grid.raster)
importFrom(grDevices, rgb, heat.colors)
import(methods)
import(lattice)
export(
CRS,
identicalCRS,
# print.CRS, -> S3Method()
# bbox,
getGridIndex,
points2grid,
bpy.colors,
bubble,
mapasp,
point.in.polygon,
spmap.to.lev,
zerodist,
zerodist2,
remove.duplicates,
degAxis,
"%over%",
get_ll_warn,
set_ll_warn,
get_ll_TOL,
set_ll_TOL,
get_ReplCRS_warn,
set_ReplCRS_warn,
get_Polypath,
set_Polypath,
get_PolypathRule,
set_PolypathRule,
set_col_regions,
get_col_regions,
coordinatevalues,
dimensions,
Spatial,
SpatialPoints,
SpatialPointsDataFrame,
SpatialMultiPoints,
SpatialMultiPointsDataFrame,
Line,
Lines,
SpatialLines,
SpatialLinesDataFrame,
as.SpatialLines.SLDF,
LineLength,
LinesLength,
SpatialLinesLengths,
layout.scale.bar,
layout.north.arrow,
sp.theme,
mapLegendGrob,
spplot.key,
panel.ggmap,
panel.gridplot,
panel.polygonsplot,
panel.pointsplot,
panel.RgoogleMaps,
sp.polygons,
sp.lines,
sp.text,
sp.points,
sp.grid,
SpatialPolygonsRescale,
spplot.locator,
sp.panel.layout,
degreeLabelsEW,
degreeLabelsNS,
longlat.scales,
bbexpand,
compassRose,
as.image.SpatialGridDataFrame,
image2Grid,
imageScale,
gridparameters,
SpatialPixels,
SpatialPixelsDataFrame,
SpatialGrid,
SpatialGridDataFrame,
GridTopology,
getGridTopology,
areaSpatialGrid,
gridlines,
gridat,
gridIndex2nb,
getSLlinesSlot,
getLinesLinesSlot,
getLinesIDSlot,
getSLLinesIDSlots,
getSpatialLinesMidPoints,
getPolygonCoordsSlot,
getPolygonLabptSlot,
getPolygonAreaSlot,
getPolygonHoleSlot,
getPolygonsPolygonsSlot,
getPolygonsplotOrderSlot,
getPolygonsLabptSlot,
getPolygonsIDSlot,
getSpPpolygonsSlot,
getSpPplotOrderSlot,
getSpPPolygonsLabptSlots,
getSpPPolygonsIDSlots,
getSpPnParts,
getSpPnHoles,
getSpatialPolygonsLabelPoints,
select.spatial,
as.SpatialPolygons.PolygonsList,
# as.SpatialPolygonsDataFrame.SpatialPolygons, -> use coerce()
# DMS:
dd2dms,
print.DMS,
char2dms,
as.character.DMS,
as.double.DMS,
as.numeric.DMS,
# is coerce, but needed to add proj4string:
as.SpatialPolygons.GridTopology,
# as.SpatialPolygons.SpatialPixels, -> is a coerce(), but plotKML uses it
IDvaluesGridTopology,
IDvaluesSpatialPixels,
HexPoints2SpatialPolygons,
flipHorizontal,
flipVertical,
loadMeuse,
makegrid,
overDF_for_rgeos, # for rgeos only!
read.asciigrid,
Polygon,
Polygons,
cbind.Spatial,
rbind.SpatialPoints,
rbind.SpatialPointsDataFrame,
rbind.SpatialMultiPoints,
rbind.SpatialMultiPointsDataFrame,
rbind.SpatialPixels,
rbind.SpatialPixelsDataFrame,
rbind.SpatialPolygons,
rbind.SpatialPolygonsDataFrame,
rbind.SpatialLines,
rbind.SpatialLinesDataFrame,
# sample.Spatial, -> coerce()...
# sample.Line,
# sample.Polygon,
# sample.Polygons,
# sample.Sgrid,
# ShowSpatialPointsDataFrame -> coerce()...
SpatialPolygons,
SpatialPolygonsDataFrame,
spDistsN1,
spDists,
write.asciigrid
)
exportClasses(
DMS,
CRS,
GridTopology,
Line,
Lines,
Polygon,
Polygons,
Spatial,
SpatialGrid,
SpatialGridDataFrame,
SpatialLines,
SpatialLinesDataFrame,
SpatialPixels,
SpatialPixelsDataFrame,
SpatialPoints,
SpatialPointsDataFrame,
SpatialMultiPoints,
SpatialMultiPointsDataFrame,
SpatialPolygons,
SpatialPolygonsDataFrame,
# spatstat classes:
ppp, im, owin, psp
)
exportMethods(
"[", "[[", "$", "$<-",
addAttrToGeom,
bbox,
coerce,
coordinates,
"coordinates<-",
coordnames,
"coordnames<-",
dimensions,
disaggregate,
fullgrid,
"fullgrid<-",
geometry,
"geometry<-",
gridded,
"gridded<-",
is.projected,
merge,
over,
# overlay,
plot,
polygons,
"polygons<-",
proj4string,
"proj4string<-",
recenter,
show,
spChFIDs,
"spChFIDs<-",
split,
sppanel,
spplot,
spsample,
summary,
surfaceArea,
spTransform
)
S3method(as.array, SpatialGridDataFrame)
S3method(as.character, DMS)
S3method(as.data.frame, SpatialPoints)
S3method(as.data.frame, SpatialMultiPoints)
S3method(as.data.frame, SpatialPixels)
S3method(as.data.frame, SpatialGrid)
S3method(as.data.frame, SpatialPointsDataFrame)
S3method(as.data.frame, SpatialMultiPointsDataFrame)
S3method(as.data.frame, SpatialPixelsDataFrame)
S3method(as.data.frame, SpatialGridDataFrame)
S3method(as.data.frame, SpatialLinesDataFrame)
S3method(as.data.frame, SpatialPolygonsDataFrame)
S3method(as.data.frame, GridTopology)
S3method(as.double, DMS)
S3method(as.numeric, DMS)
S3method(as.matrix, SpatialGridDataFrame)
S3method(as.matrix, SpatialPixelsDataFrame)
S3method(aggregate, Spatial)
S3method(cbind, Spatial)
S3method(cbind, SpatialGridDataFrame)
S3method(contour, SpatialPixelsDataFrame)
S3method(contour, SpatialGridDataFrame)
S3method(dim, SpatialPointsDataFrame)
S3method(dim, SpatialMultiPointsDataFrame)
S3method(dim, SpatialLinesDataFrame)
S3method(dim, SpatialPolygonsDataFrame)
S3method(dim, SpatialPixelsDataFrame)
S3method(dim, SpatialGridDataFrame)
S3method(head, Spatial)
S3method(image, SpatialPixelsDataFrame)
S3method(image, SpatialPixels)
S3method(image, SpatialGridDataFrame)
S3method(labels, SpatialLines)
S3method(length, SpatialGrid)
S3method(length, SpatialLines)
S3method(length, SpatialPixels)
S3method(length, SpatialPoints)
S3method(length, SpatialMultiPoints)
S3method(length, SpatialPolygons)
S3method(length, SpatialGridDataFrame)
S3method(length, SpatialLinesDataFrame)
S3method(length, SpatialPixelsDataFrame)
S3method(length, SpatialPointsDataFrame)
S3method(length, SpatialMultiPointsDataFrame)
S3method(length, SpatialPolygonsDataFrame)
S3method(lines, Line)
S3method(lines, Lines)
S3method(lines, SpatialLines)
S3method(lines, SpatialLinesDataFrame)
S3method(names, SpatialPointsDataFrame)
S3method(names, SpatialMultiPointsDataFrame)
S3method(names, SpatialPixelsDataFrame)
S3method(names, SpatialGridDataFrame)
S3method(names, SpatialLinesDataFrame)
S3method(names, SpatialPolygonsDataFrame)
S3method(names, SpatialLines)
S3method(names, SpatialPolygons)
S3method(names, SpatialMultiPoints)
S3method("names<-", SpatialPointsDataFrame)
S3method("names<-", SpatialPolygonsDataFrame)
S3method("names<-", SpatialLinesDataFrame)
S3method("names<-", SpatialPixelsDataFrame)
S3method("names<-", SpatialGridDataFrame)
S3method(row.names, SpatialPoints)
S3method(row.names, SpatialMultiPoints)
S3method(row.names, SpatialLines)
S3method(row.names, SpatialPolygons)
S3method(row.names, SpatialPixels)
S3method(row.names, SpatialGrid)
S3method(row.names, SpatialPointsDataFrame)
S3method(row.names, SpatialLinesDataFrame)
S3method(row.names, SpatialPolygonsDataFrame)
S3method(row.names, SpatialGridDataFrame)
S3method("row.names<-", SpatialPoints)
S3method("row.names<-", SpatialMultiPoints)
S3method("row.names<-", SpatialPointsDataFrame)
S3method("row.names<-", SpatialPolygons)
S3method("row.names<-", SpatialPolygonsDataFrame)
S3method("row.names<-", SpatialLines)
S3method("row.names<-", SpatialLinesDataFrame)
S3method(points, SpatialPoints)
S3method(points, SpatialPointsDataFrame)
S3method(points, SpatialMultiPoints)
S3method(points, SpatialMultiPointsDataFrame)
S3method(print, CRS)
S3method(print, DMS)
S3method(print, GridTopology)
S3method(print, SpatialPoints)
S3method(print, SpatialMultiPoints)
S3method(print, SpatialPixels)
S3method(print, SpatialLines)
S3method(print, SpatialPointsDataFrame)
S3method(print, SpatialMultiPointsDataFrame)
S3method(print, SpatialPixelsDataFrame)
S3method(print, SpatialLinesDataFrame)
S3method(print, summary.Spatial)
S3method(print, summary.GridTopology)
S3method(rbind, SpatialLines)
S3method(rbind, SpatialLinesDataFrame)
S3method(rbind, SpatialMultiPoints)
S3method(rbind, SpatialMultiPointsDataFrame)
S3method(rbind, SpatialPixels)
S3method(rbind, SpatialPixelsDataFrame)
S3method(rbind, SpatialPoints)
S3method(rbind, SpatialPointsDataFrame)
S3method(rbind, SpatialPolygons)
S3method(rbind, SpatialPolygonsDataFrame)
S3method(split, SpatialPoints)
S3method(stack, SpatialPointsDataFrame)
S3method(stack, SpatialPixelsDataFrame)
S3method(stack, SpatialGridDataFrame)
S3method(subset, Spatial)
S3method(tail, Spatial)
S3method(text, SpatialPointsDataFrame)
#.onLoad <- function(lib, pkg) {
# require(methods)
#}
.spOptions <- new.env(FALSE, globalenv())
assign("ll_warn", FALSE, envir = .spOptions)
assign("ll_TOL", 0.25, envir = .spOptions)
assign("ReplCRS_warn", TRUE, envir = .spOptions)
assign("Polypath", TRUE, envir = .spOptions)
assign("PolypathRule", "winding", envir = .spOptions)
assign("col.regions", bpy.colors(), envir = .spOptions)
.onUnload <- function(libpath)
library.dynam.unload("sp", libpath)
# Copyright (c) 2003-8 by Barry Rowlingson and Roger Bivand
if (!is.R()) {
strsplit <- function(a,b) {
if (a == as.character(NA))
return(as.character(NA))
else list(unlist(unpaste(a, b)))
}
}
"CRS" <- function(projargs=NA_character_, doCheckCRSArgs=TRUE) {
# cautious change BDR 150424
if (!is.na(projargs) && !nzchar(projargs)) projargs <- NA_character_
# condition added 140301
stopifnot(is.logical(doCheckCRSArgs))
stopifnot(length(doCheckCRSArgs) == 1L)
stopifnot(is.character(projargs))
if (!is.na(projargs)) {
if (length(grep("^[ ]*\\+", projargs)) == 0)
stop(paste("PROJ4 argument-value pairs must begin with +:",
projargs))
}
if (!is.na(projargs)) {
if (length(grep("latlon", projargs)) != 0)
stop("northings must follow eastings: ", projargs)
if (length(grep("lonlat", projargs)) != 0) {
projargs <- sub("lon", "long", projargs)
warning("'lonlat' changed to 'longlat': ", projargs)
}
}
if (is.na(projargs))
uprojargs <- projargs
else uprojargs <- paste(unique(unlist(strsplit(projargs, " "))),
collapse=" ")
if (length(grep("= ", uprojargs)) != 0)
stop(paste("No spaces permitted in PROJ4 argument-value pairs:",
uprojargs))
if (length(grep(" [:alnum:]", uprojargs)) != 0)
stop(paste("PROJ4 argument-value pairs must begin with +:",
uprojargs))
# if (length(grep("rgdal", search()) > 0) &&
# (sessionInfo()$otherPkgs$rgdal$Version > "0.4-2")) {
# sessionInfo()/read.dcf() problem in loop 080307
if (doCheckCRSArgs) {
if (!is.na(uprojargs) && requireNamespace("rgdal", quietly = TRUE)) {
res <- rgdal::checkCRSArgs(uprojargs)
if (!res[[1]])
stop(res[[2]])
uprojargs <- res[[2]]
}
}
res <- new("CRS", projargs=uprojargs)
res
}
"print.CRS" <- function(x, ...)
{
pst <- paste(strwrap(x@projargs), collapse="\n")
if (nchar(pst) < 40) cat(paste("CRS arguments:", pst, "\n"))
else cat(paste("CRS arguments:\n", pst, "\n"))
invisible(pst)
}
setMethod("show", "CRS", function(object) print.CRS(object))
identicalCRS = function(x, y) {
if (! missing(y))
identical(CRS(proj4string(x)), CRS(proj4string(y)))
else { # x has to be list:
stopifnot(is.list(x))
if (length(x) > 1) {
p1 = CRS(proj4string(x[[1]]))
!any(!sapply(x[-1], function(p2) identical(CRS(proj4string(p2)), p1)))
} else
TRUE
}
}
# Copyright (c) 2003-7 by Barry Rowlingson and Roger Bivand
setClass("CRS", slots = c(projargs = "character"),
prototype = list(projargs = character(1)),
validity = function(object) {
if (length(object@projargs) != 1)
return("projargs must be of length 1")
}
)
setClass("GridTopology",
slots = c(cellcentre.offset = "numeric",
cellsize = "numeric",
cells.dim = "integer"),
validity = function(object) {
n = length(na.omit(object@cellcentre.offset))
if (length(na.omit(object@cellsize)) != n)
return("cellsize has incorrect dimension")
if (sum(object@cells.dim > 0) != n)
return("cells.dim has incorrect dimension")
return(TRUE)
}
)
# Lancaster, Thu Nov 4 14:44:00 GMT 2004, fresh start from icelfloe
setClass("Spatial",
slots = c(bbox = "matrix", proj4string = "CRS"),
validity = function(object) {
# print("Entering validation: Spatial")
bb = bbox(object)
if (!is.matrix(bb))
return("bbox should be a matrix")
if (!mode(bb) == "numeric")
return("bbox should be a numeric matrix")
n = dimensions(object)
if (n < 2)
return("spatial.dimension should be 2 or more")
if (any(is.na(bb)))
return("bbox should never contain NA values")
if (any(!is.finite(bb)))
return("bbox should never contain infinite values")
if (any(bb[,"max"] < bb[,"min"]))
return("invalid bbox: max < min")
if (!is(object@proj4string, "CRS"))
return("proj4string slot should be of class CRS")
p4str <- object@proj4string@projargs
if (!is.na(p4str) && !nzchar(p4str)) {
res <- grep("longlat", p4str, fixed=TRUE)
if (length(res) != 0) {# unprojected,
ll_sanity_res <- .ll_sanity(bb)
if (!ll_sanity_res) {
lst <- sapply(attr(ll_sanity_res, "details"),
attr, "out")
out <- paste(format(unlist(lst), digits=12), collapse=" ")
mess <- paste("Geographical CRS given to",
"non-conformant data:", out)
if (get_ll_warn())
warning(mess)
else
stop(mess)
}
}
# split out from proj4string<- and Spatial validity to cover numerical fuzz
# RSB 070216
# && any(bb[1,1] < -180 || bb[1,2] > 360 ||
# bb[2,1] < -90 || bb[2,2] > 90))
# return("Geographical CRS given to non-conformant data")
}
# validate proj4string here? -- no, that's rdgal's business
return(TRUE)
}
)
setClass("SpatialPixels",
contains = "SpatialPoints",
slots = c(grid = "GridTopology", grid.index = "integer"),
validity = function(object) {
if (nrow(object@coords) != length(object@grid.index))
return("grid.index should have length equal to nrow(coords)")
if (length(object@grid.index) > 0) {
if (max(object@grid.index) > .NumberOfCells(object@grid))
return("grid.index max value too large")
if (min(object@grid.index) < 0)
return("grid.index min value too small")
}
return(TRUE)
}
)
setClass("SpatialGrid",
contains = "Spatial",
slots = c(grid = "GridTopology"),
validity = function(object) {
return(TRUE)
}
)
setClass("SpatialPixelsDataFrame",
contains = c("SpatialPixels", "SpatialPointsDataFrame"),
slots = c(data = "data.frame", coords.nrs = "numeric"),
validity = function(object) {
if (length(object@grid.index) != nrow(object@data))
return("grid.index should have length equal to data slot")
if (nrow(object@coords) != nrow(object@data))
return("unequal number of objects in points and data.frame")
return(TRUE)
}
)