[r-cran-maptools] 09/20: Import Upstream version 0.7-38
Andreas Tille
tille at debian.org
Sun Jan 15 18:55:43 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository r-cran-maptools.
commit 95a1fd9569ae694f4a736e537b3e5aad43806299
Author: Andreas Tille <tille at debian.org>
Date: Sun Jan 15 19:53:27 2017 +0100
Import Upstream version 0.7-38
---
ChangeLog | 31 ++++++++++++++++++++++++++++++-
DESCRIPTION | 8 ++++----
R/Rgshhs.R | 9 +++++----
R/SpatialLines-methods.R | 30 +++++++++++++++++++++++++++---
R/kmlLine.R | 2 +-
R/maptools.R | 12 ++++++++----
R/readGPS.R | 2 +-
R/shapelib.R | 5 ++++-
R/sp2pbs.R | 8 ++++----
R/sp_spat1.R | 6 +++++-
R/union.R | 2 +-
inst/ChangeLog | 31 ++++++++++++++++++++++++++++++-
man/holepolys.Rd | 11 +++++------
man/readShapeLines.Rd | 3 ++-
man/readShapePoly.Rd | 2 +-
man/readShapeSpatial.Rd | 2 +-
16 files changed, 129 insertions(+), 35 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4d898cc..74327f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,35 @@
+2010-09-08 18:36 rsbivand
+
+ * DESCRIPTION, R/SpatialLines-methods.R, man/readShapeLines.Rd,
+ man/readShapePoly.Rd, man/readShapeSpatial.Rd: zero nParts for
+ lines
+
+2010-08-28 12:34 rsbivand
+
+ * R/Rgshhs.R, R/maptools.R, R/shapelib.R, R/sp2pbs.R, R/sp_spat1.R,
+ R/union.R, ChangeLog, inst/ChangeLog: as.double to storage.mode
+
+2010-08-26 12:36 rsbivand
+
+ * ChangeLog, inst/ChangeLog: check Sys.which value
+
+2010-08-26 12:32 rsbivand
+
+ * DESCRIPTION, R/readGPS.R: check Sys.which value
+
+2010-08-12 17:08 rsbivand
+
+ * R/kmlLine.R, man/holepolys.Rd, DESCRIPTION, ChangeLog,
+ inst/ChangeLog: data docs fix
+
+2010-04-22 04:47 rsbivand
+
+ * DESCRIPTION, R/shapelib.R, ChangeLog, inst/ChangeLog: read.shape
+ filen without extension
+
2010-04-12 08:55 rsbivand
- * DESCRIPTION: tidy
+ * DESCRIPTION, ChangeLog, inst/ChangeLog: tidy
2010-04-05 12:42 rsbivand
diff --git a/DESCRIPTION b/DESCRIPTION
index 6f44954..a8d5e8a 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: maptools
-Version: 0.7-34
-Date: 2010-04-12
+Version: 0.7-38
+Date: 2010-09-08
Title: Tools for reading and handling spatial objects
Encoding: latin1
Author: Nicholas J. Lewin-Koh and Roger Bivand, contributions by Edzer
@@ -19,6 +19,6 @@ Description: Set of tools for manipulating and reading geographic data,
with packages such as PBSmapping, spatstat, maps, RArcInfo,
Stata tmap, WinBUGS, Mondrian, and others.
License: GPL (>= 2)
-Packaged: 2010-04-12 07:10:58 UTC; rsb
+Packaged: 2010-09-08 17:15:01 UTC; rsb
Repository: CRAN
-Date/Publication: 2010-04-12 09:41:40
+Date/Publication: 2010-09-09 11:04:35
diff --git a/R/Rgshhs.R b/R/Rgshhs.R
index c5c7a05..acdca1f 100644
--- a/R/Rgshhs.R
+++ b/R/Rgshhs.R
@@ -10,18 +10,19 @@ Rgshhs <- function(fn, xlim=NULL, ylim=NULL, level=4, minarea=0,
else lim <- c(-180, 360)
if (!is.null(ylim)) lim <- c(lim, ylim)
else lim <- c(lim, c(-90, 90))
+ storage.mode(minarea) <- "double"
polydata <- .Call("Rgshhs", as.character(fn), as.integer(1),
as.logical(dolim), as.numeric(lim), as.integer(level),
- as.double(minarea), PACKAGE="maptools")
+ minarea, PACKAGE="maptools")
line <- median(polydata$line)
if (verbose) cat("Data are", ifelse(line == 0, "polygon", "line"),
"data\n")
chosen_0 <- .Call("Rgshhs", as.character(fn), as.integer(2),
as.logical(dolim), as.numeric(lim), as.integer(level),
- as.double(minarea), PACKAGE="maptools")
+ minarea, PACKAGE="maptools")
if (dolim) clip <- .Call("Rgshhs", as.character(fn), as.integer(3),
as.logical(dolim), as.numeric(lim), as.integer(level),
- as.double(minarea), PACKAGE="maptools")
+ minarea, PACKAGE="maptools")
else clip <- NULL
rgeosI <- rgeosStatus()
if (rgeosI) {
@@ -32,7 +33,7 @@ Rgshhs <- function(fn, xlim=NULL, ylim=NULL, level=4, minarea=0,
}
polys <- .Call("Rgshhs", as.character(fn), as.integer(5),
as.logical(dolim), as.numeric(lim), as.integer(level),
- as.double(minarea), PACKAGE="maptools")
+ minarea, PACKAGE="maptools")
Antarctica <- which(polydata$area[(chosen_0+1)] > 1.3e+07 &
polydata$area[(chosen_0+1)] < 1.4e+07)
diff --git a/R/SpatialLines-methods.R b/R/SpatialLines-methods.R
index 607e1b0..c96775c 100644
--- a/R/SpatialLines-methods.R
+++ b/R/SpatialLines-methods.R
@@ -1,8 +1,9 @@
readShapeLines <- function(fn, proj4string=CRS(as.character(NA)),
- verbose=FALSE, repair=FALSE) {
+ verbose=FALSE, repair=FALSE, delete_null_obj=FALSE) {
suppressWarnings(Map <- read.shape(filen=fn, verbose=verbose,
repair=repair))
- suppressWarnings(.shp2LinesDF(Map, proj4string=proj4string))
+ suppressWarnings(.shp2LinesDF(Map, proj4string=proj4string,
+ delete_null_obj=delete_null_obj))
}
writeLinesShape <- function(x, fn, factor2char = TRUE, max_nchar=254) {
@@ -14,11 +15,34 @@ writeLinesShape <- function(x, fn, factor2char = TRUE, max_nchar=254) {
}
-.shp2LinesDF <- function(shp, proj4string=CRS(as.character(NA)), IDs) {
+.shp2LinesDF <- function(shp, proj4string=CRS(as.character(NA)), IDs,
+ delete_null_obj=FALSE) {
if (class(shp) != "Map") stop("shp not a Map object")
shp.type <- attr(shp$Shapes, "shp.type")
if (!shp.type %in% c("arc", "poly"))
stop("not an arc or poly Map object")
+# birds NULL part Allen H. Hurlbert 090610 copied from .Map2PolyDF
+# Harlan Harris 100907
+ nullParts <- sapply(shp$Shapes, function(x) x$nParts) == 0
+ if (delete_null_obj) {
+ nullParts <- which(nullParts)
+ if (length(nullParts) > 0) {
+ for (i in length(nullParts):1)
+ shp$Shapes[[nullParts[i]]] <- NULL
+ attr(shp$Shapes,'nshps') <- attr(shp$Shapes,'nshps') -
+ length(nullParts)
+ shp$att.data <- shp$att.data[-nullParts,]
+ warning(paste("Null objects with the following",
+ "indices deleted:", paste(nullParts, collapse=", ")))
+ }
+ } else {
+# birds NULL part Allen H. Hurlbert 090610
+# Harlan Harris 100907
+ if (any(nullParts))
+ stop(paste("NULL geometry found:", paste(which(nullParts),
+ collapse=", "),
+ "\n consider using delete_null_obj=TRUE"))
+ }
df <- shp$att.data
shapes <- shp$Shapes
n <- length(shapes)
diff --git a/R/kmlLine.R b/R/kmlLine.R
index 377aa9d..9be1031 100755
--- a/R/kmlLine.R
+++ b/R/kmlLine.R
@@ -13,7 +13,7 @@ kmlLine <- function(obj = NULL, kmlfile = NULL, name = "R Line",
stop("obj must be of class 'Lines' or 'SpatialLinesDataFrame' [package 'sp']")
if (class(obj) == "SpatialLinesDataFrame") {
if (length(obj at lines) > 1)
- warning(paste("Only the first Polygons object with the ID '",
+ warning(paste("Only the first Lines object with the ID '",
obj at lines[[1]]@ID, "' is taken from 'obj'",
sep = ""))
obj <- obj at lines[[1]]
diff --git a/R/maptools.R b/R/maptools.R
index 04f58a1..f12407a 100644
--- a/R/maptools.R
+++ b/R/maptools.R
@@ -424,7 +424,8 @@ Map2poly1 <- function(Map, region.id=NULL, raw=TRUE) {
n <- length(pl)
bbs <- matrix(0, nrow=n, ncol=4)
for (i in 1:n) bbs[i,] <- bbox1(pl[[i]])
- res <- .Call("mtInsiders", as.integer(n), as.double(bbs),
+ storage.mode(bbs) <- "double"
+ res <- .Call("mtInsiders", as.integer(n), bbs,
PACKAGE="maptools")
res1 <- vector(mode="list", length=n)
@@ -881,8 +882,9 @@ convert.pl <- function(pl) {
.RingCentrd_2d <- function(plmat) {
nVert <- nrow(plmat)
- res <- .C("RFindCG", as.integer(nVert), as.double(plmat[,1]),
- as.double(plmat[,2]), as.double(0), as.double(0),
+ storage.mode(plmat) <- "double"
+ res <- .C("RFindCG", as.integer(nVert), plmat[,1],
+ plmat[,2], as.double(0), as.double(0),
as.double(0), PACKAGE="maptools")
# x_base <- plmat[1,1]
@@ -910,6 +912,8 @@ convert.pl <- function(pl) {
.ringDirxy <- function(xy) {
a <- xy[,1]
b <- xy[,2]
+ storage.mode(a) <- "double"
+ storage.mode(b) <- "double"
nvx <- length(b)
# if((a[1] == a[nvx]) && (b[1] == b[nvx])) {
@@ -943,7 +947,7 @@ convert.pl <- function(pl) {
# }
# v3 = ( (dx0 * dy1) - (dx1 * dy0) )
- res <- .C("RFindCG", as.integer(nvx), as.double(a), as.double(b),
+ res <- .C("RFindCG", as.integer(nvx), a, b,
as.double(0), as.double(0), as.double(0), PACKAGE="maptools")
if ( res[[6]] > 0 ) return(as.integer(-1))
diff --git a/R/readGPS.R b/R/readGPS.R
index a9e5f91..3ece6f4 100644
--- a/R/readGPS.R
+++ b/R/readGPS.R
@@ -2,7 +2,7 @@
readGPS <- function(i="garmin", f="usb:", type="w", invisible=TRUE, ...) {
GB <- Sys.which("gpsbabel")
- if (nchar(GB) == 0) stop("gpsbabel not found")
+ if (nchar(GB) == 0 || !file.exists(GB)) stop("gpsbabel not found")
if (.Platform$OS.type == "windows")
gpsdata <- system(paste(GB, " -", type, " -i ", i, " -f ", f,
" -o tabsep -F -", sep=""), intern=TRUE, invisible=invisible)
diff --git a/R/shapelib.R b/R/shapelib.R
index 11a4cb1..9a16131 100644
--- a/R/shapelib.R
+++ b/R/shapelib.R
@@ -7,6 +7,8 @@
read.shape <- function(filen, dbf.data=TRUE, verbose=TRUE, repair=FALSE) {
filen <- path.expand(filen)
.Deprecated("", package="maptools", msg="use readShapeSpatial:\nobjects other than Spatial objects defined in the sp package are deprecated")
+ if (length(grep("\\.shp$", tolower(filen))) == 0)
+ filen <- paste(filen, "shp", sep=".")
shinfo <- getinfo.shape(filen)
if (dbf.data) {
# library(foreign)
@@ -89,7 +91,8 @@ write.pointShape <- function(coordinates, df, file, factor2char=TRUE,
stop("different number of rows in coordinates and data frame")
# library(foreign)
write.dbf(df, paste(file, ".dbf", sep=""), factor2char=factor2char, max_nchar=max_nchar)
- res <- .Call("shpwritepoint", as.character(file), as.double(coordinates),
+ storage.mode(coordinates) <- "double"
+ res <- .Call("shpwritepoint", as.character(file), coordinates,
as.integer(ncolcrds), PACKAGE="maptools")
invisible(res)
}
diff --git a/R/sp2pbs.R b/R/sp2pbs.R
index 15b71f8..6208f79 100644
--- a/R/sp2pbs.R
+++ b/R/sp2pbs.R
@@ -25,8 +25,8 @@ SpatialPolygons2PolySet <- function(SpP) {
PID <- as.integer(PID)
SID <- as.integer(SID)
POS <- as.integer(POS)
- X <- as.double(X)
- Y <- as.double(Y)
+ storage.mode(X) <- "double"
+ storage.mode(Y) <- "double"
require(PBSmapping)
pj <- .pbsproj(SpP)
zn <- NULL
@@ -64,8 +64,8 @@ SpatialLines2PolySet <- function(SL) {
PID <- as.integer(PID)
SID <- as.integer(SID)
POS <- as.integer(POS)
- X <- as.double(X)
- Y <- as.double(Y)
+ storage.mode(X) <- "double"
+ storage.mode(Y) <- "double"
require(PBSmapping)
pj <- .pbsproj(SL)
zn <- NULL
diff --git a/R/sp_spat1.R b/R/sp_spat1.R
index 80a7abd..f9c1deb 100644
--- a/R/sp_spat1.R
+++ b/R/sp_spat1.R
@@ -19,7 +19,11 @@ as.SpatialPoints.ppp = function(from) {
mult <- 1
if (!is.null(from$window$units) && !is.null(from$window$units$multiplier))
mult <- from$window$units$multiplier
- crds <- cbind(mult*as.double(from$x), mult*as.double(from$y))
+ mx <- mult*from$x
+ storage.mode(mx) <- "double"
+ my <- mult*from$y
+ storage.mode(my) <- "double"
+ crds <- cbind(mx, my)
if (from$window$type == "rectangle") {
ow <- from$window
bbox <- rbind(mult*as.double(ow$xrange), mult*as.double(ow$yrange))
diff --git a/R/union.R b/R/union.R
index ebd306c..449df2e 100644
--- a/R/union.R
+++ b/R/union.R
@@ -3,7 +3,7 @@ unionSpatialPolygons <- function(SpP, IDs, threshold=NULL, avoidGEOS=FALSE) {
rgeosI <- rgeosStatus()
if (rgeosI && !avoidGEOS) {
# require(rgeos)
-# res <- unionSpatialPolygonsGEOS(SpP=SpP, IDs=IDs, threshold=threshold)
+# res <- gUnionCascaded(SpP=SpP, IDs=IDs)
} else {
stopifnot(isTRUE(gpclibPermitStatus()))
require(gpclib)
diff --git a/inst/ChangeLog b/inst/ChangeLog
index 4d898cc..74327f2 100644
--- a/inst/ChangeLog
+++ b/inst/ChangeLog
@@ -1,6 +1,35 @@
+2010-09-08 18:36 rsbivand
+
+ * DESCRIPTION, R/SpatialLines-methods.R, man/readShapeLines.Rd,
+ man/readShapePoly.Rd, man/readShapeSpatial.Rd: zero nParts for
+ lines
+
+2010-08-28 12:34 rsbivand
+
+ * R/Rgshhs.R, R/maptools.R, R/shapelib.R, R/sp2pbs.R, R/sp_spat1.R,
+ R/union.R, ChangeLog, inst/ChangeLog: as.double to storage.mode
+
+2010-08-26 12:36 rsbivand
+
+ * ChangeLog, inst/ChangeLog: check Sys.which value
+
+2010-08-26 12:32 rsbivand
+
+ * DESCRIPTION, R/readGPS.R: check Sys.which value
+
+2010-08-12 17:08 rsbivand
+
+ * R/kmlLine.R, man/holepolys.Rd, DESCRIPTION, ChangeLog,
+ inst/ChangeLog: data docs fix
+
+2010-04-22 04:47 rsbivand
+
+ * DESCRIPTION, R/shapelib.R, ChangeLog, inst/ChangeLog: read.shape
+ filen without extension
+
2010-04-12 08:55 rsbivand
- * DESCRIPTION: tidy
+ * DESCRIPTION, ChangeLog, inst/ChangeLog: tidy
2010-04-05 12:42 rsbivand
diff --git a/man/holepolys.Rd b/man/holepolys.Rd
index 1aa7114..1a21acf 100644
--- a/man/holepolys.Rd
+++ b/man/holepolys.Rd
@@ -1,17 +1,16 @@
\name{gpcholes}
\alias{gpcholes}
-\alias{hole1pl}
-\alias{hole2pl}
+\alias{h1pl}
+\alias{h2pl}
\docType{data}
\title{Hisaji Ono's lake/hole problem}
\description{
How to plot polygons with holes - holes are encoded by coordinates going anticlockwise, and overplotting is avoided by re-ordering the order in which polygons are plotted.
+
+This example is retained for historical interest only, other solutions are present in the sp package.
}
\usage{data(gpcholes)}
-\format{
- The format is class \code{"polylist"}.
-}
\details{
@@ -30,7 +29,7 @@ example script.
Does anyone know how to solve this situation?"
-*(hole1pl has reversed the y component of polygon 1, to make its ring direction clockwise, hole2pl reverses the order of the two polygons in holepoly1 at pts)*
+*(h1pl has reversed the y component of polygon 1, to make its ring direction clockwise, h2pl reverses the order of the two polygons in holepoly1 at pts)*
}
diff --git a/man/readShapeLines.Rd b/man/readShapeLines.Rd
index f3fb889..013731c 100644
--- a/man/readShapeLines.Rd
+++ b/man/readShapeLines.Rd
@@ -8,7 +8,7 @@
}
\usage{
readShapeLines(fn, proj4string=CRS(as.character(NA)), verbose=FALSE,
- repair=FALSE)
+ repair=FALSE, delete_null_obj=FALSE)
writeLinesShape(x, fn, factor2char = TRUE, max_nchar=254)
}
%- maybe also 'usage' for other objects documented here.
@@ -17,6 +17,7 @@ writeLinesShape(x, fn, factor2char = TRUE, max_nchar=254)
\item{proj4string}{Object of class \code{CRS}; holding a valid proj4 string}
\item{verbose}{default TRUE - report type of shapefile and number of shapes}
\item{repair}{default FALSE: some shapefiles provided by Geolytics Inc. have values of object sizes stored in the *.shx index file that are eight bytes too large, leading the function to try to read past the end of file. If repair=TRUE, an attempt is made to repair the internal values, permitting such files to be read.}
+ \item{delete_null_obj}{if TRUE, null geometries will be removed together with their data.frame rows}
\item{x}{a \code{SpatialLinesDataFrame} object}
\item{factor2char}{logical, default TRUE, convert factor columns to character}
\item{max_nchar}{default 254, may be set to a higher limit and passed through to the DBF writer, please see Details in \code{\link[foreign]{write.dbf}}}
diff --git a/man/readShapePoly.Rd b/man/readShapePoly.Rd
index 63e3516..c384cd8 100644
--- a/man/readShapePoly.Rd
+++ b/man/readShapePoly.Rd
@@ -20,7 +20,7 @@ writePolyShape(x, fn, factor2char = TRUE, max_nchar=254)
\item{verbose}{default TRUE - report type of shapefile and number of shapes}
\item{repair}{default FALSE: some shapefiles provided by Geolytics Inc. have values of object sizes stored in the *.shx index file that are eight bytes too large, leading the function to try to read past the end of file. If repair=TRUE, an attempt is made to repair the internal values, permitting such files to be read.}
\item{force_ring}{if TRUE, close unclosed input rings}
- \item{delete_null_obj}{if TRUE, null geometries inserted by ABS will be removed together with their data.frame rows}
+ \item{delete_null_obj}{if TRUE, null geometries will be removed together with their data.frame rows}
\item{retrieve_ABS_null}{default FALSE, if TRUE and delete\_null\_obj also
TRUE, the function will return a data frame containing the data from any
null geometries inserted by ABS}
diff --git a/man/readShapeSpatial.Rd b/man/readShapeSpatial.Rd
index 1c5b029..7543d73 100644
--- a/man/readShapeSpatial.Rd
+++ b/man/readShapeSpatial.Rd
@@ -20,7 +20,7 @@ writeSpatialShape(x, fn, factor2char = TRUE, max_nchar=254)
\item{repair}{default FALSE: some shapefiles provided by Geolytics Inc. have values of object sizes stored in the *.shx index file that are eight bytes too large, leading the function to try to read past the end of file. If repair=TRUE, an attempt is made to repair the internal values, permitting such files to be read.}
\item{IDvar}{a character string: the name of a column in the shapefile DBF containing the ID values of the shapes - the values will be converted to a character vector (Polygons only)}
\item{force_ring}{if TRUE, close unclosed input rings (Polygons only)}
- \item{delete_null_obj}{if TRUE, null geometries inserted by ABS will be removed together with their data.frame rows (Polygons only)}
+ \item{delete_null_obj}{if TRUE, null geometries inserted by ABS will be removed together with their data.frame rows (Polygons and Lines)}
\item{retrieve_ABS_null}{default FALSE, if TRUE and delete\_null\_obj also
TRUE, the function will return a data frame containing the data from any
null geometries inserted by ABS (Polygons only)}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/r-cran-maptools.git
More information about the debian-science-commits
mailing list