[r-cran-maptools] 05/20: Import Upstream version 0.7-29

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 35198e6d42bb03a6a14f0187e2a57d4a6df27419
Author: Andreas Tille <tille at debian.org>
Date:   Sun Jan 15 19:53:26 2017 +0100

    Import Upstream version 0.7-29
---
 ChangeLog                                    |  66 ++++++++-
 DESCRIPTION                                  |  18 +--
 INDEX                                        |  17 +--
 NAMESPACE                                    |  26 ++--
 R/CCmaps.R                                   | 195 +++++++++++++++++++++++++++
 R/DP.R                                       | 128 ++++++++++++++++++
 R/dotsinpolys.R                              |   4 +-
 R/sp_bind.R                                  |  49 -------
 data/gpcholes.rda                            | Bin 405 -> 354 bytes
 inst/ChangeLog                               |  66 ++++++++-
 {man => inst/old_man}/Map2poly.Rd            |   0
 {man => inst/old_man}/get.Pcent.Rd           |   0
 {man => inst/old_man}/maptools.Rd            |   0
 {man => inst/old_man}/plot.Map.Rd            |   0
 {man => inst/old_man}/plot.polylist.Rd       |   0
 {man => inst/old_man}/read.shape.Rd          |   0
 {man => inst/old_man}/subset.polylist.Rd     |   0
 {man => inst/old_man}/write.linelistShape.Rd |   0
 {man => inst/old_man}/write.pointShape.Rd    |   0
 {man => inst/old_man}/write.polylistShape.Rd |   0
 inst/share/gshhs_c.b                         | Bin 163512 -> 184528 bytes
 inst/share/wdb_borders_c.b                   | Bin 71448 -> 84912 bytes
 man/CCmaps.Rd                                |  61 +++++++++
 man/Rgshhs.Rd                                |  11 +-
 man/dotsInPolys.Rd                           |  12 +-
 man/getinfo.shape.Rd                         |  35 +++++
 man/holepolys.Rd                             |   6 +-
 man/leglabs.Rd                               |  35 +++++
 man/readShapeLines.Rd                        |   2 +-
 man/readShapePoints.Rd                       |   2 +-
 man/readShapePoly.Rd                         |   2 +-
 man/readShapeSpatial.Rd                      |   6 +-
 man/spCbind-methods.Rd                       |   2 +-
 man/spChFIDs-methods.Rd                      |  39 ------
 man/spRbind-methods.Rd                       |  19 ++-
 man/symbolsInPolys.Rd                        |   9 +-
 man/thinnedSpatialPoly.Rd                    |  41 ++++++
 src/Rgshhs.c                                 |  29 +++-
 src/Rgshhs.h                                 |  49 +++++--
 39 files changed, 751 insertions(+), 178 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9882e7d..5920e07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,72 @@
+2009-12-21 13:39  rsbivand
+
+	* ChangeLog, INDEX: adding CCmaps
+
+2009-12-21 13:35  rsbivand
+
+	* DESCRIPTION, NAMESPACE, R/CCmaps.R, man/CCmaps.Rd, src/Rgshhs.c:
+	  adding CCmaps
+
+2009-12-18 22:56  rsbivand
+
+	* inst/share/gshhs_c.b, inst/share/wdb_borders_c.b, man/Rgshhs.Rd,
+	  man/spRbind-methods.Rd, src/Rgshhs.c, src/Rgshhs.h: GSHHS upgrade
+	  to 2.0
+
+2009-12-03 08:34  rsbivand
+
+	* INDEX, ChangeLog, inst/ChangeLog: hole example format change
+
+2009-12-03 08:31  rsbivand
+
+	* ChangeLog, DESCRIPTION, data/gpcholes.rda, man/holepolys.Rd,
+	  inst/ChangeLog: hole example format change
+
+2009-11-23 12:49  rsbivand
+
+	* man/getinfo.shape.Rd, ChangeLog, inst/ChangeLog: reinstate
+	  getinfo.shape
+
+2009-11-23 12:45  rsbivand
+
+	* NAMESPACE: reinstate getinfo.shape
+
+2009-11-20 13:26  rsbivand
+
+	* DESCRIPTION, NAMESPACE, R/dotsinpolys.R,
+	  inst/old_man/Map2poly.Rd, inst/old_man/get.Pcent.Rd,
+	  inst/old_man/maptools.Rd, inst/old_man/plot.Map.Rd,
+	  inst/old_man/plot.polylist.Rd, inst/old_man/read.shape.Rd,
+	  inst/old_man/subset.polylist.Rd,
+	  inst/old_man/write.linelistShape.Rd,
+	  inst/old_man/write.pointShape.Rd,
+	  inst/old_man/write.polylistShape.Rd, man/Map2poly.Rd,
+	  man/dotsInPolys.Rd, man/get.Pcent.Rd, man/holepolys.Rd,
+	  man/maptools.Rd, man/plot.Map.Rd, man/plot.polylist.Rd,
+	  man/read.shape.Rd, man/readShapeLines.Rd, man/readShapePoints.Rd,
+	  man/readShapePoly.Rd, man/readShapeSpatial.Rd,
+	  man/subset.polylist.Rd, man/symbolsInPolys.Rd,
+	  man/write.linelistShape.Rd, man/write.pointShape.Rd,
+	  man/write.polylistShape.Rd, man/leglabs.Rd, ChangeLog,
+	  inst/ChangeLog: moving deprecated functions from namespace
+
+2009-11-19 21:11  rsbivand
+
+	* DESCRIPTION, NAMESPACE, R/DP.R, man/spCbind-methods.Rd,
+	  man/spRbind-methods.Rd, man/thinnedSpatialPoly.Rd, ChangeLog,
+	  inst/ChangeLog: adding thinnedSpatialPoly
+
+2009-11-05 17:26  edzer
+
+	* R/sp_bind.R, man/spChFIDs-methods.Rd: moved spChFID method,
+	  functions and docs to package sp
+
 2009-09-17 10:22  rsbivand
 
 	* DESCRIPTION, man/GE_SpatialGrid.Rd, man/Map2poly.Rd,
 	  man/SpatialLines2PolySet.Rd, man/asciigrid.Rd, man/kmlLine.Rd,
-	  man/kmlOverlay.Rd, man/nowrapRecenter.Rd: fix documentation links
+	  man/kmlOverlay.Rd, man/nowrapRecenter.Rd, ChangeLog,
+	  inst/ChangeLog: fix documentation links
 
 2009-07-14 11:17  rsbivand
 
diff --git a/DESCRIPTION b/DESCRIPTION
index 12c9b06..c576ca4 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,16 +1,16 @@
 Package: maptools
-Version: 0.7-26
-Date: 2009-09-17
+Version: 0.7-29
+Date: 2009-12-21
 Title: Tools for reading and handling spatial objects
 Encoding: latin1
 Author: Nicholas J. Lewin-Koh and Roger Bivand, contributions by Edzer
         J. Pebesma, Eric Archer, Adrian Baddeley, Hans-Jörg Bibiko,
-        Stéphane Dray, David Forrest, Patrick Giraudoux, Duncan
-        Golicher, Virgilio Gómez Rubio, Patrick Hausmann, Thomas
-        Jagger, Sebastian P. Luque, Don MacQueen, Andrew Niccolai and
-        Tom Short
+        Stéphane Dray, David Forrest, Michael Friendly, Patrick
+        Giraudoux, Duncan Golicher, Virgilio Gómez Rubio, Patrick
+        Hausmann, Thomas Jagger, Sebastian P. Luque, Don MacQueen,
+        Andrew Niccolai, Tom Short and Ben Stabler
 Maintainer: Roger Bivand <Roger.Bivand at nhh.no>
-Depends: R (>= 2.4), foreign (>= 0.8), sp (>= 0.9-7), methods
+Depends: R (>= 2.4), foreign (>= 0.8), sp (>= 0.9-47), methods, lattice
 Suggests: spatstat, PBSmapping, maps, gpclib, RArcInfo
 Description: Set of tools for manipulating and reading geographic data,
         in particular ESRI shapefiles; C code used from shapelib. It
@@ -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: 2009-09-17 08:31:29 UTC; rsb
+Packaged: 2009-12-21 12:42:44 UTC; rsb
 Repository: CRAN
-Date/Publication: 2009-09-18 20:25:13
+Date/Publication: 2009-12-21 17:43:10
diff --git a/INDEX b/INDEX
index 512cc13..c7a312d 100644
--- a/INDEX
+++ b/INDEX
@@ -1,6 +1,7 @@
 as.owin.SpatialGridDataFrame
                         coercion between sp objects and spatstat
                         objects
+CCmaps                  Conditioned choropleth maps
 checkPolygonsHoles      Check holes in Polygons objects
 ContourLines2SLDF       Converter functions to build
                         SpatialLinesDataFrame objects
@@ -10,8 +11,8 @@ elide-methods           Methods for Function elide in Package
                         'maptools'
 gcDestination           Find destination in geographical coordinates
 GE_SpatialGrid          Create SpatialGrid for PNG output to GE
+getinfo.shape           Get shapefile header information
 getKMLcoordinates       Get a list of coordinates out of a KML file
-get.Pcent               Polygon centroids
 gpcholes                Hisaji Ono's lake/hole problem
 gzAzimuth               Find azimuth for geographical coordinates
 kmlLine                 Create and write a KML file on the basis of a
@@ -19,20 +20,15 @@ kmlLine                 Create and write a KML file on the basis of a
 kmlOverlay              Create and write KML file for PNG image overlay
 kmlPolygon              Create and write a KML file on the basis of a
                         given Polygons object
-Map2poly                Create polygon lists and bounding boxes from
-                        imported shapefiles
+leglabs                 Make legend labels
 map2SpatialPolygons     Convert map objects to sp classes
-maptools                Report version information and changes
 nowrapRecenter          Break polygons at meridian for recentering
 pal2SpatialPolygons     Making SpatialPolygons objects from RArcInfo
                         input
-plot.Map                Plot a Map object (deprecated)
-plot.polylist           Plot polygons
 pointLabel              Label placement for points to avoid overlaps
 ppp-class               Virtual class "ppp"
 readAsciiGrid           read/write to/from (ESRI) asciigrid format
 readGPS                 GPSbabel read interface
-read.shape              Read shapefile into Map object
 readShapeLines          Read arc shape files into SpatialLinesDataFrame
                         objects
 readShapePoints         Read points shape files into
@@ -50,12 +46,9 @@ sp2WB                   Export SpatialPolygons object as S-Plus map for
 SpatialLines2PolySet    Convert sp line and polygon objects to
                         PBSmapping PolySet objects
 spCbind-methods         cbind for spatial objects
-spChFIDs-methods        change feature IDs in spatial objects
 spRbind-methods         rbind for spatial objects
-subset.polylist         Subset polygon list objects
 symbolsInPolys          Place grids of points over polygons
+thinnedSpatialPoly      Douglas-Peuker line generalization for Spatial
+                        Polygons
 unionSpatialPolygons    Aggregate Polygons in a SpatialPolygons object
-write.linelistShape     Write a arc-type shapefile
-write.pointShape        Write a point-type shapefile
-write.polylistShape     Write a polygon-type shapefile
 wrld_simpl              Simplified world country polygons
diff --git a/NAMESPACE b/NAMESPACE
index 1f18220..868d71e 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -2,13 +2,15 @@ useDynLib(maptools)
 
 import(sp)
 import(foreign)
+importFrom(lattice, strip.custom)
 
-export(leglabs, plotpolys, shape2poly, shape2lines, 
-	shape2points, shape2bbs, Map2poly, Map2poly1, Map2lines, Map2points, 
-	Map2bbs, convert.pl, get.Pcent, read.shape, getinfo.shape,
-	plot.Map, plot.polylist, subset.polylist, maptools, dotsInPolys,
-	symbolsInPolys, write.pointShape, write.polylistShape, 
-	write.linelistShape, print.shapehead)
+export(leglabs, dotsInPolys, symbolsInPolys, getinfo.shape, print.shapehead) 
+        # plotpolys, shape2poly, shape2lines, 
+	# shape2points, shape2bbs, Map2poly, Map2poly1, Map2lines, Map2points, 
+	# Map2bbs, convert.pl, get.Pcent, read.shape,
+	# plot.Map, plot.polylist, subset.polylist, maptools, dotsInPolys,
+	# symbolsInPolys, write.pointShape, write.polylistShape, 
+	# write.linelistShape)
 
 export(readShapePoints, readShapeLines, readShapePoly)
 
@@ -41,7 +43,10 @@ export(unionSpatialPolygons, nowrapSpatialPolygons, nowrapRecenter, checkPolygon
 
 export(Rgshhs)
 
-exportMethods(coerce, spCbind, spRbind, spChFIDs)
+export(CCmaps)
+
+exportMethods(coerce, spCbind, spRbind)
+
 exportMethods(elide)
 
 export(GE_SpatialGrid, kmlOverlay, Sobj_SpatialGrid)
@@ -49,10 +54,11 @@ export(GE_SpatialGrid, kmlOverlay, Sobj_SpatialGrid)
 export(kmlPolygon, kmlLine, getKMLcoordinates)
 
 export(pointLabel, gcDestination)
+export(thinnedSpatialPoly)
 
-S3method(plot, Map)
-S3method(plot, polylist)
-S3method(subset, polylist)
+#S3method(plot, Map)
+#S3method(plot, polylist)
+#S3method(subset, polylist)
 S3method(print, shapehead)
 #S3method(as.ppp, SpatialPoints)
 #S3method(as.ppp, SpatialPointsDataFrame)
diff --git a/R/CCmaps.R b/R/CCmaps.R
new file mode 100644
index 0000000..9b0ebe1
--- /dev/null
+++ b/R/CCmaps.R
@@ -0,0 +1,195 @@
+CCmaps <- function(obj, zcol=NULL, cvar=NULL, cvar.names=NULL,
+	..., names.attr, scales = list(draw = FALSE), 
+	xlab = NULL, ylab = NULL, aspect = mapasp(obj, xlim, ylim), 
+	sp.layout = NULL, xlim = bbox(obj)[1,], ylim = bbox(obj)[2,]) {
+	stopifnot(is(obj, "SpatialPolygonsDataFrame")) 
+	stopifnot(!is.null(zcol), !is.null(cvar))
+	n <- length(slot(obj, "polygons"))
+	stopifnot(length(zcol) == 1)
+	ncc <- length(cvar)
+	stopifnot(ncc <= 2, ncc > 0)
+	if (is.null(cvar.names)) cvar.names <- names(cvar)
+	nlcc <- integer(ncc)
+	lcc <- vector(mode="list", length=ncc)
+	fcc <- logical(nlcc)
+	for (i in 1:ncc) {
+	    ccc <- class(cvar[[i]])
+	    stopifnot(ccc %in% c("factor", "shingle"))
+	    fcc[i] <- ccc == "factor"
+	    stopifnot(length(cvar[[i]]) == n)
+	    nlcc[i] <- nlevels(cvar[[i]])
+	    lcc[[i]] <- levels(cvar[[i]])
+	}
+	obj <- obj[zcol]
+	zcol <- names(obj)
+	Outside <- function(x, y, z) (x < y | x > z)
+	if (ncc == 1) {
+		if (fcc[1]) {
+	            for (j in 1:nlcc[1]) {
+		        vn <- paste(cvar.names[1], lcc[[1]][j], sep="_")
+		        io <- as.character(cvar[[1]]) != lcc[[1]][j]
+		        obj[[vn]] <- obj[[zcol]]
+		        is.na(obj[[vn]]) <- io
+	            }
+   	        } else {
+		    ilcc <- do.call("rbind", lcc[[1]])
+	            for (j in 1:nlcc[1]) {
+		        vn <- paste(cvar.names[1], j, sep="_")
+			io <- Outside(cvar[[1]], ilcc[j,1], ilcc[j,2]) 
+		        obj[[vn]] <- obj[[zcol]]
+		        is.na(obj[[vn]]) <- io
+		    }
+	    }
+	    nms <- names(obj)
+	    nms <- nms[-(match(zcol, nms))]
+	    if (fcc[1]) {
+	        print(spplot(obj, zcol=nms, ..., scales = scales, 
+		    xlab = xlab, ylab = ylab, aspect = aspect, 
+		    sp.layout = sp.layout, xlim = xlim, ylim = ylim, 
+		    strip=strip.custom(which.given=1, 
+		    factor.levels=lcc[[1]], par.strip.text=list(cex=0.8), 
+		    bg="grey95")))
+	    } else {
+	        print(spplot(obj, zcol=nms, ..., scales = scales, 
+		    xlab = xlab, ylab = ylab, aspect = aspect, 
+		    sp.layout = sp.layout, xlim = xlim, ylim = ylim, 
+		    strip=strip.custom(which.given=1, 
+		    shingle.intervals=as.matrix(lcc[[1]]), 
+		    var.name=cvar.names[1], par.strip.text=list(cex=0.8), 
+		    bg="grey95", fg="grey75")))
+	    }
+	} else {
+	    if (all(fcc)) {
+	        for (i in 1:nlcc[1]) {
+		    for (j in 1:nlcc[2]) {
+		        vn <- paste(cvar.names[1], lcc[[1]][i], cvar.names[2], 
+			    lcc[[2]][j], sep="_")
+		        obj[[vn]] <- obj[[zcol]]
+			ioi <- as.character(cvar[[1]]) != lcc[[1]][i] 
+			ioj <- as.character(cvar[[2]]) != lcc[[2]][j]
+			io <- ioi | ioj
+		        is.na(obj[[vn]]) <- io
+		    }
+		}
+	        nms <- names(obj)
+	        nms <- nms[-(match(zcol, nms))]
+		lcc1 <- lcc[[1]]
+		xlcc <- NULL
+		for (i in 1:nlcc[1]) {
+		    xlcc <- c(xlcc, rep(lcc1[i], nlcc[2]))
+		}
+		lcc2 <- lcc[[2]]
+		xlcc2 <- rep(lcc2, nlcc[1])
+	        print(spplot(obj, zcol=nms, ..., scales = scales, 
+		    xlab = xlab, ylab = ylab, aspect = aspect, 
+		    sp.layout = sp.layout, xlim = xlim, ylim = ylim, 
+		    strip=strip.custom(which.given=1,
+		    factor.levels=xlcc, 
+		    par.strip.text=list(cex=0.8), bg="grey95"), 
+		    strip.left=strip.custom(which.given=1, 
+		    factor.levels=xlcc2, 
+		    par.strip.text=list(cex=0.8), bg="grey95")))
+	    } else if (any(fcc)) {
+	      if (fcc[1]) {
+		jlcc <- do.call("rbind", lcc[[2]])
+	        for (i in 1:nlcc[1]) {
+		    for (j in 1:nlcc[2]) {
+		        vn <- paste(cvar.names[1], lcc[[1]][i], cvar.names[2], 
+			    j, sep="_")
+		        obj[[vn]] <- obj[[zcol]]
+			ioi <- as.character(cvar[[1]]) != lcc[[1]][i] 
+			ioj <- Outside(cvar[[2]], jlcc[j,1], jlcc[j,2])
+			io <- ioi | ioj
+		        is.na(obj[[vn]]) <- io
+		    }
+		}
+	        nms <- names(obj)
+	        nms <- nms[-(match(zcol, nms))]
+		lcc1 <- lcc[[1]]
+		xlcc <- NULL
+		for (i in 1:nlcc[1]) {
+		    xlcc <- c(xlcc, rep(lcc1[i], nlcc[2]))
+		}
+		lcc2 <- matrix(unlist(lcc[[2]]), ncol=2, byrow=TRUE)
+		xlcc2 <- matrix(rep(t(lcc2), nlcc[1]), byrow=TRUE, ncol=2)
+	        print(spplot(obj, zcol=nms, ..., scales = scales, 
+		    xlab = xlab, ylab = ylab, aspect = aspect, 
+		    sp.layout = sp.layout, xlim = xlim, ylim = ylim, 
+		    strip=strip.custom(which.given=1,
+		    factor.levels=xlcc, 
+		    par.strip.text=list(cex=0.8), bg="grey95"), 
+		    strip.left=strip.custom(which.given=1, 
+		    shingle.intervals=xlcc2, var.name=cvar.names[2], 
+		    par.strip.text=list(cex=0.8), bg="grey95", fg="grey75")))
+	      } else {
+		ilcc <- do.call("rbind", lcc[[1]])
+	        for (i in 1:nlcc[1]) {
+		    for (j in 1:nlcc[2]) {
+		        vn <- paste(cvar.names[1], i, cvar.names[2], 
+			    lcc[[2]][j], sep="_")
+		        obj[[vn]] <- obj[[zcol]]
+			ioi <- Outside(cvar[[1]], ilcc[i,1], ilcc[i,2])
+			ioj <- as.character(cvar[[2]]) != lcc[[2]][j]
+			io <- ioi | ioj
+		        is.na(obj[[vn]]) <- io
+		    }
+		}
+	        nms <- names(obj)
+	        nms <- nms[-(match(zcol, nms))]
+		lcc1 <- matrix(unlist(lcc[[1]]), ncol=2, byrow=TRUE)
+		xlcc <- matrix(ncol=2)
+		for (i in 1:nlcc[1]) {
+		    xlcc <- rbind(xlcc, matrix(rep(lcc1[i,], nlcc[2]), 
+			ncol=2, byrow=TRUE))
+		}
+		xlcc <- xlcc[-1,]
+		lcc2 <- lcc[[2]]
+		xlcc2 <- rep(lcc2, nlcc[1])
+	        print(spplot(obj, zcol=nms, ..., scales = scales, 
+		    xlab = xlab, ylab = ylab, aspect = aspect, 
+		    sp.layout = sp.layout, xlim = xlim, ylim = ylim, 
+		    strip=strip.custom(which.given=1, 
+		    shingle.intervals=xlcc, var.name=cvar.names[1], 
+		    par.strip.text=list(cex=0.8), bg="grey95", fg="grey75"), 
+		    strip.left=strip.custom(which.given=1,
+		    factor.levels=xlcc2, 
+		    par.strip.text=list(cex=0.8), bg="grey95")))
+	      }
+	    } else {
+		ilcc <- do.call("rbind", lcc[[1]])
+		jlcc <- do.call("rbind", lcc[[2]])
+	        for (i in 1:nlcc[1]) {
+		    for (j in 1:nlcc[2]) {
+		        vn <- paste(cvar.names[1], i, cvar.names[2], j, sep="_")
+		        obj[[vn]] <- obj[[zcol]]
+			ioi <- Outside(cvar[[1]], ilcc[i,1], ilcc[i,2]) 
+			ioj <- Outside(cvar[[2]], jlcc[j,1], jlcc[j,2])
+			io <- ioi | ioj
+		        is.na(obj[[vn]]) <- io
+		    }
+		}
+	        nms <- names(obj)
+	        nms <- nms[-(match(zcol, nms))]
+		lcc1 <- matrix(unlist(lcc[[1]]), ncol=2, byrow=TRUE)
+		xlcc <- matrix(ncol=2)
+		for (i in 1:nlcc[1]) {
+		    xlcc <- rbind(xlcc, matrix(rep(lcc1[i,], nlcc[2]), 
+			ncol=2, byrow=TRUE))
+		}
+		xlcc <- xlcc[-1,]
+		lcc2 <- matrix(unlist(lcc[[2]]), ncol=2, byrow=TRUE)
+		xlcc2 <- matrix(rep(t(lcc2), nlcc[1]), byrow=TRUE, ncol=2)
+	        print(spplot(obj, zcol=nms, ..., scales = scales, 
+		    xlab = xlab, ylab = ylab, aspect = aspect, 
+		    sp.layout = sp.layout, xlim = xlim, ylim = ylim, 
+		    strip=strip.custom(which.given=1,
+		    shingle.intervals=xlcc, var.name=cvar.names[1], 
+		    par.strip.text=list(cex=0.8), bg="grey95", fg="grey75"), 
+		    strip.left=strip.custom(which.given=1, 
+		    shingle.intervals=xlcc2, var.name=cvar.names[2], 
+		    par.strip.text=list(cex=0.8), bg="grey95", fg="grey75")))
+	    }
+	}
+	invisible(obj)
+}
+
diff --git a/R/DP.R b/R/DP.R
new file mode 100644
index 0000000..ffdabe5
--- /dev/null
+++ b/R/DP.R
@@ -0,0 +1,128 @@
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#Douglas-Peucker Polyline Simplification
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# Copied from shapefiles/R/shapefiles.R 091119 RSB
+#Ben Stabler, bstabler at ptvamerica.com, March 2005
+#Douglas, D. and Peucker, T. (1973). "Algorithms for 
+#the reduction of the number of points required to 
+#represent a digitized line or its caricature." 
+#The Canadian Cartographer 10(2). 112-122.
+
+#Currently uses the line, not the line segment to 
+#determine the distance of the points from the line.
+#See http://www.lgc.com/resources/Doug_Peucker.pdf
+#for more information.  This can result in the 
+#omission of extreme "outlier-like" points.
+####################################################
+
+dp_func <- function(points, tolerance) {
+
+ #Convert to lowercase
+ names(points) <- tolower(names(points))
+
+ #Calculate distance between two points
+ distance <- function(x1,x2,y1,y2) {
+ 	sqrt((x2-x1)^2 + (y2-y1)^2)
+ }
+ 
+ #Calculate equation of a line from two points
+ equationOfLine <- function(x1,x2,y1,y2) {
+ 	slope <- (y2-y1)/(x2-x1)
+ 	b <- y1 - slope * x1
+ 	c(slope,b)
+ }
+ 
+ #Calculate y-intercept from a point and a slope
+ calcB <- function(slope, px, py) {
+ 	py - (slope * px) 
+ }
+ 
+ #Calculate intercept of two lines from their slope and y-intercept
+ intercept <- function(s1,b1,s2,b2) {
+ 	x1 <- (b2-b1)/(s1-s2)
+ 	y1 <- s1 * x1 + b1
+ 	c(x1,y1)
+ }
+
+ #Setup vector to mark points to keep
+ keep <- rep(FALSE, length(points$x))
+ keep[1] <- TRUE
+ keep[length(keep)] <- TRUE
+
+ #Function definition to simplify points
+ simplify <- function(start, end, tol=tolerance) {
+
+  #Calculate intermediate point distances 
+  if (length(points$x[start:end]) > 2) {
+
+ 	#Avoid Inf slope
+ 	if( points$x[start] ==  points$x[end] )  
+            points$x[start] <- points$x[start] - 0.0000001
+ 	if( points$y[start] ==  points$y[end])  
+            points$y[start] <- points$y[start] - 0.0000001
+ 
+	#Calculate equation of line of middle points
+ 	line <- equationOfLine( points$x[start], points$x[end],
+            points$y[start], points$y[end])
+	
+	#Calculate y-intercepts
+ 	b <- mapply(function(x,y) calcB(-1/line[1], x, y),
+            points$x[(start+1):(end-1)], points$y[(start+1):(end-1)])
+	
+	#Calculate intercepts with with start-end line
+ 	ints <- sapply(b, function(x)
+            intercept(line[1], line[2], -1/line[1], x), simplify=FALSE)
+
+	#Calculate distances of points from line
+ 	distances <- mapply(function(x,y,z) distance(x[[1]], y, x[[2]], z),
+            ints, points$x[(start+1):(end-1)], points$y[(start+1):(end-1)])
+
+	#If any point greater than tolerance split at max distance point 
+        #and apply to each side
+ 	if (any(distances >= tol)) {
+		keep[which.max(distances)+start] <<- TRUE
+		#print(which.max(distances)+start)
+		
+		simplify(start, which.max(distances)+start)
+		simplify(which.max(distances)+start, end)
+	}
+
+  }
+
+ }
+
+ #Start simplification 
+ simplify(1, length(points$x))
+
+ #Return simplified points
+ list(x=points$x[keep], y=points$y[keep])
+}
+
+
+thinnedSpatialPoly <- function(SP, tolerance, minarea=0) {
+    stopifnot(inherits(SP, "SpatialPolygons"))
+    pls <- slot(SP, "polygons")
+    pls_dp <- vector(mode="list", length=length(pls))
+    for (i in 1:length(pls)) {
+        Pls <- slot(pls[[i]], "Polygons")
+        Pls_dp <- vector(mode="list", length=length(Pls))
+        for (j in 1:length(Pls)) {
+            crds <- slot(Pls[[j]], "coords")
+            crds_s <- dp_func(list(x=crds[,1], y=crds[,2]), tolerance=tolerance)
+            crds_s <- do.call("cbind", crds_s)
+            if(!identical(crds_s[1,], crds_s[nrow(crds_s),]))
+            crds_s <- rbind(crds_s, crds_s[1,])
+            Pls_dp[[j]] <- Polygon(crds_s)
+        }
+        areas <- sapply(Pls_dp, slot, "area")
+        Keep <- areas > minarea  
+        if (all(!Keep)) Keep[which.max(areas)] <- TRUE
+        Pls_dp <- Pls_dp[Keep]
+        pls_dp[[i]] <- Polygons(Pls_dp, ID=slot(pls[[i]], "ID"))
+    }
+    res <- SpatialPolygons(pls_dp, proj4string=CRS(proj4string(SP)))
+    if (is(SP, "SpatialPolygonsDataFrame"))
+        res <- SpatialPolygonsDataFrame(res, data=slot(SP, "data"))
+    res
+}
+
diff --git a/R/dotsinpolys.R b/R/dotsinpolys.R
index 4a8a7b7..b594af9 100644
--- a/R/dotsinpolys.R
+++ b/R/dotsinpolys.R
@@ -3,7 +3,7 @@
 dotsInPolys <- function(pl, x, f="random", offset, compatible=FALSE) {
     if (!is.character(f)) stop("f must be a character string")
     if (f != "random" && f != "regular") stop(paste(f, "not supported"))
-    if (inherits(pl, "polylist")) pl <- .polylist2SpP(pl)
+#    if (inherits(pl, "polylist")) pl <- .polylist2SpP(pl)
     if (!is(pl, "SpatialPolygons")) stop("unknown class of input polygons")
     pls <- slot(pl, "polygons")
     IDs <- sapply(pls, function(i) slot(i, "ID"))
@@ -49,7 +49,7 @@ dotsInPolys <- function(pl, x, f="random", offset, compatible=FALSE) {
 }
 
 symbolsInPolys <- function(pl, dens, symb="+", compatible=FALSE) {
-    if (inherits(pl, "polylist")) pl <- .polylist2SpP(pl)
+#    if (inherits(pl, "polylist")) pl <- .polylist2SpP(pl)
     if (!is(pl, "SpatialPolygons")) stop("unknown class of input polygons")
     if (!is(pl, "SpatialPolygons")) stop("unknown class of input polygons")
     pls <- slot(pl, "polygons")
diff --git a/R/sp_bind.R b/R/sp_bind.R
index bbff274..842c2f5 100644
--- a/R/sp_bind.R
+++ b/R/sp_bind.R
@@ -154,52 +154,3 @@ setMethod("spRbind", signature(obj="SpatialPolygonsDataFrame",
 
 
 
-if (!isGeneric("spChFIDs"))
-	setGeneric("spChFIDs", function(obj, x)
-		standardGeneric("spChFIDs"))
-
-chFIDsSpatialLines <- function(obj, x) {
-    nl <- length(slot(obj, "lines"))
-    if (length(x) != nl) stop("lengths differ")
-    if (length(x) > length(unique(x))) stop("duplicate IDs")
-    for (i in 1:nl) slot(slot(obj, "lines")[[i]], "ID") <- x[i]
-    obj
-}
-
-setMethod("spChFIDs", signature(obj="SpatialLines", x="character"),
-    chFIDsSpatialLines)
-
-chFIDsSpatialLinesDataFrame <- function(obj, x) {
-    SL <- as(obj, "SpatialLines")
-    SLx <- spChFIDs(SL, x)
-    df <- as(obj, "data.frame")
-    row.names(df) <- sapply(slot(SLx, "lines"), function(x) slot(x, "ID"))
-    SpatialLinesDataFrame(SLx, data=df)
-}
-
-setMethod("spChFIDs", signature(obj="SpatialLinesDataFrame", x="character"),
-    chFIDsSpatialLinesDataFrame)
-
-chFIDsSpatialPolygons <- function(obj, x) {
-    np <- length(slot(obj, "polygons"))
-    if (length(x) != np) stop("lengths differ")
-    if (length(x) > length(unique(x))) stop("duplicate IDs")
-    for (i in 1:np) slot(slot(obj, "polygons")[[i]], "ID") <- x[i]
-    obj
-}
-
-setMethod("spChFIDs", signature(obj="SpatialPolygons", x="character"),
-    chFIDsSpatialPolygons)
-
-chFIDsSpatialPolygonsDataFrame <- function(obj, x) {
-    SP <- as(obj, "SpatialPolygons")
-    SPx <- spChFIDs(SP, x)
-    df <- as(obj, "data.frame")
-    row.names(df) <- sapply(slot(SPx, "polygons"), function(x) slot(x, "ID"))
-    SpatialPolygonsDataFrame(SPx, data=df)
-}
-
-setMethod("spChFIDs", signature(obj="SpatialPolygonsDataFrame", x="character"),
-    chFIDsSpatialPolygonsDataFrame)
-
-
diff --git a/data/gpcholes.rda b/data/gpcholes.rda
index f4aad6b..28d1d34 100644
Binary files a/data/gpcholes.rda and b/data/gpcholes.rda differ
diff --git a/inst/ChangeLog b/inst/ChangeLog
index 9882e7d..5920e07 100644
--- a/inst/ChangeLog
+++ b/inst/ChangeLog
@@ -1,8 +1,72 @@
+2009-12-21 13:39  rsbivand
+
+	* ChangeLog, INDEX: adding CCmaps
+
+2009-12-21 13:35  rsbivand
+
+	* DESCRIPTION, NAMESPACE, R/CCmaps.R, man/CCmaps.Rd, src/Rgshhs.c:
+	  adding CCmaps
+
+2009-12-18 22:56  rsbivand
+
+	* inst/share/gshhs_c.b, inst/share/wdb_borders_c.b, man/Rgshhs.Rd,
+	  man/spRbind-methods.Rd, src/Rgshhs.c, src/Rgshhs.h: GSHHS upgrade
+	  to 2.0
+
+2009-12-03 08:34  rsbivand
+
+	* INDEX, ChangeLog, inst/ChangeLog: hole example format change
+
+2009-12-03 08:31  rsbivand
+
+	* ChangeLog, DESCRIPTION, data/gpcholes.rda, man/holepolys.Rd,
+	  inst/ChangeLog: hole example format change
+
+2009-11-23 12:49  rsbivand
+
+	* man/getinfo.shape.Rd, ChangeLog, inst/ChangeLog: reinstate
+	  getinfo.shape
+
+2009-11-23 12:45  rsbivand
+
+	* NAMESPACE: reinstate getinfo.shape
+
+2009-11-20 13:26  rsbivand
+
+	* DESCRIPTION, NAMESPACE, R/dotsinpolys.R,
+	  inst/old_man/Map2poly.Rd, inst/old_man/get.Pcent.Rd,
+	  inst/old_man/maptools.Rd, inst/old_man/plot.Map.Rd,
+	  inst/old_man/plot.polylist.Rd, inst/old_man/read.shape.Rd,
+	  inst/old_man/subset.polylist.Rd,
+	  inst/old_man/write.linelistShape.Rd,
+	  inst/old_man/write.pointShape.Rd,
+	  inst/old_man/write.polylistShape.Rd, man/Map2poly.Rd,
+	  man/dotsInPolys.Rd, man/get.Pcent.Rd, man/holepolys.Rd,
+	  man/maptools.Rd, man/plot.Map.Rd, man/plot.polylist.Rd,
+	  man/read.shape.Rd, man/readShapeLines.Rd, man/readShapePoints.Rd,
+	  man/readShapePoly.Rd, man/readShapeSpatial.Rd,
+	  man/subset.polylist.Rd, man/symbolsInPolys.Rd,
+	  man/write.linelistShape.Rd, man/write.pointShape.Rd,
+	  man/write.polylistShape.Rd, man/leglabs.Rd, ChangeLog,
+	  inst/ChangeLog: moving deprecated functions from namespace
+
+2009-11-19 21:11  rsbivand
+
+	* DESCRIPTION, NAMESPACE, R/DP.R, man/spCbind-methods.Rd,
+	  man/spRbind-methods.Rd, man/thinnedSpatialPoly.Rd, ChangeLog,
+	  inst/ChangeLog: adding thinnedSpatialPoly
+
+2009-11-05 17:26  edzer
+
+	* R/sp_bind.R, man/spChFIDs-methods.Rd: moved spChFID method,
+	  functions and docs to package sp
+
 2009-09-17 10:22  rsbivand
 
 	* DESCRIPTION, man/GE_SpatialGrid.Rd, man/Map2poly.Rd,
 	  man/SpatialLines2PolySet.Rd, man/asciigrid.Rd, man/kmlLine.Rd,
-	  man/kmlOverlay.Rd, man/nowrapRecenter.Rd: fix documentation links
+	  man/kmlOverlay.Rd, man/nowrapRecenter.Rd, ChangeLog,
+	  inst/ChangeLog: fix documentation links
 
 2009-07-14 11:17  rsbivand
 
diff --git a/man/Map2poly.Rd b/inst/old_man/Map2poly.Rd
similarity index 100%
rename from man/Map2poly.Rd
rename to inst/old_man/Map2poly.Rd
diff --git a/man/get.Pcent.Rd b/inst/old_man/get.Pcent.Rd
similarity index 100%
rename from man/get.Pcent.Rd
rename to inst/old_man/get.Pcent.Rd
diff --git a/man/maptools.Rd b/inst/old_man/maptools.Rd
similarity index 100%
rename from man/maptools.Rd
rename to inst/old_man/maptools.Rd
diff --git a/man/plot.Map.Rd b/inst/old_man/plot.Map.Rd
similarity index 100%
rename from man/plot.Map.Rd
rename to inst/old_man/plot.Map.Rd
diff --git a/man/plot.polylist.Rd b/inst/old_man/plot.polylist.Rd
similarity index 100%
rename from man/plot.polylist.Rd
rename to inst/old_man/plot.polylist.Rd
diff --git a/man/read.shape.Rd b/inst/old_man/read.shape.Rd
similarity index 100%
rename from man/read.shape.Rd
rename to inst/old_man/read.shape.Rd
diff --git a/man/subset.polylist.Rd b/inst/old_man/subset.polylist.Rd
similarity index 100%
rename from man/subset.polylist.Rd
rename to inst/old_man/subset.polylist.Rd
diff --git a/man/write.linelistShape.Rd b/inst/old_man/write.linelistShape.Rd
similarity index 100%
rename from man/write.linelistShape.Rd
rename to inst/old_man/write.linelistShape.Rd
diff --git a/man/write.pointShape.Rd b/inst/old_man/write.pointShape.Rd
similarity index 100%
rename from man/write.pointShape.Rd
rename to inst/old_man/write.pointShape.Rd
diff --git a/man/write.polylistShape.Rd b/inst/old_man/write.polylistShape.Rd
similarity index 100%
rename from man/write.polylistShape.Rd
rename to inst/old_man/write.polylistShape.Rd
diff --git a/inst/share/gshhs_c.b b/inst/share/gshhs_c.b
index 35b9a09..bf2c031 100644
Binary files a/inst/share/gshhs_c.b and b/inst/share/gshhs_c.b differ
diff --git a/inst/share/wdb_borders_c.b b/inst/share/wdb_borders_c.b
index 7afbb2f..c535c8d 100644
Binary files a/inst/share/wdb_borders_c.b and b/inst/share/wdb_borders_c.b differ
diff --git a/man/CCmaps.Rd b/man/CCmaps.Rd
new file mode 100644
index 0000000..dcf9d3f
--- /dev/null
+++ b/man/CCmaps.Rd
@@ -0,0 +1,61 @@
+\name{CCmaps}
+\alias{CCmaps}
+%- Also NEED an '\alias' for EACH other topic documented here.
+\title{Conditioned choropleth maps}
+\description{
+Conditioned choropleth maps permit the conditioning of a map of a variable on the values of one or two other variables coded as factors or shingles. This function uses \link[sp]{spplot} after constructing multiple subsets of the variable of interest defined by the intervals given by the conditioning variables.
+}
+
+\usage{
+CCmaps(obj, zcol = NULL, cvar = NULL, cvar.names = NULL, ..., names.attr, scales = list(draw = FALSE), xlab = NULL, ylab = NULL, aspect = mapasp(obj, xlim, ylim), sp.layout = NULL, xlim = bbox(obj)[1, ], ylim = bbox(obj)[2, ])
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+  \item{obj}{ object of class \link[sp]{SpatialPolygonsDataFrame}}
+  \item{zcol}{single variable name as string}
+  \item{cvar}{a list of one or two conditioning variables, which should be of class factor or shingle}
+  \item{cvar.names}{names for conditioning variables, if not given, the names of the variables in the \code{cvar} list}
+  \item{\dots}{other arguments passed to \link[sp]{spplot} and \link[lattice]{levelplot}}
+  \item{names.attr}{names to use in panel, if different from zcol names}
+  \item{scales}{scales argument to be passed to Lattice plots; use
+\code{list(draw = TRUE)} to draw axes scales}
+  \item{xlab}{label for x-axis}
+  \item{ylab}{label for y-axis}
+  \item{aspect}{aspect ratio for spatial axes; defaults to "iso" (one unit
+on the x-axis equals one unit on the y-axis) but may be set to more
+suitable values if the data are e.g. if coordinates are latitude/longitude}
+  \item{sp.layout}{NULL or list; see \link[sp]{spplot}}
+  \item{xlim}{numeric; x-axis limits}
+  \item{ylim}{numeric; y-axis limits}
+}
+
+\value{
+ The function returns a \link[sp]{SpatialPolygonsDataFrame} object with the \code{zcol} variable and the partitions of the \code{cvars} list variables invisibly.
+}
+\references{
+Carr D, Wallin J, Carr D (2000) Two new templates for epidemiology applications: linked micromap plots and conditioned choropleth maps. \emph{Statistics in Medicine} 19(17-18): 2521-2538
+Carr D, White D, MacEachren A (2005) Conditioned choropleth maps and hypothesis generation. \emph{Annals of the Association of American Geographers} 95(1): 32-53
+Friendly M (2007) A.-M. Guerry's Moral Statistics of France: challenges for multivariable spatial analysis. \emph{Statistical Science} 22(3): 368-399
+}
+\author{ Roger Bivand }
+
+\seealso{\code{\link[sp]{spplot}}}
+
+\examples{
+nc.sids <- readShapeSpatial(system.file("shapes/sids.shp",
+ package="maptools")[1], IDvar="FIPSNO",
+ proj4string=CRS("+proj=longlat +ellps=clrk66"))
+nc.sids$ft.SID74 <- sqrt(1000)*(sqrt(nc.sids$SID74/nc.sids$BIR74) +
+ sqrt((nc.sids$SID74+1)/nc.sids$BIR74))
+nc.sids$ft.NWBIR74 <- sqrt(1000)*(sqrt(nc.sids$NWBIR74/nc.sids$BIR74) +
+ sqrt((nc.sids$NWBIR74+1)/nc.sids$BIR74))
+library(lattice)
+sh_nw4 <- equal.count(nc.sids$ft.NWBIR74, number=4, overlap=1/5)
+CCmaps(nc.sids, "ft.SID74", list("Nonwhite_births"=sh_nw4),
+ col.regions=colorRampPalette(c("yellow1", "brown3"))(20),
+ main="Transformed SIDS rates 1974-8")
+}
+% Add one or more standard keywords, see file 'KEYWORDS' in the
+% R documentation directory.
+\keyword{spatial}
+
diff --git a/man/Rgshhs.Rd b/man/Rgshhs.Rd
index bdc3893..358451f 100644
--- a/man/Rgshhs.Rd
+++ b/man/Rgshhs.Rd
@@ -3,7 +3,7 @@
 %- Also NEED an '\alias' for EACH other topic documented here.
 \title{Read GSHHS data into sp object}
 \description{
-  If the data are polygon data, the function will read GSHHS polygons into SpatialPolygons object for a chosen region, using binary shorelines from Global Self-consistant Hierarchical High-resolution Shorelines, release 1.11 of July 3, 2008 (\url{ftp://ftp.soest.hawaii.edu/pwessel/gshhs/gshhs_1.11.zip}). If the data are line data, the borders or river lines will be read into a SpatialLines object. The data are provided in integer form as millionths of decimal degrees. Reading of much ear [...]
+  If the data are polygon data, the function will read GSHHS polygons into SpatialPolygons object for a chosen region, using binary shorelines from Global Self-consistant Hierarchical High-resolution Shorelines, release 2.0 of July 15, 2009 (\url{ftp://ftp.soest.hawaii.edu/pwessel/gshhs/gshhs_2.0.zip}). If the data are line data, the borders or river lines will be read into a SpatialLines object. The data are provided in integer form as millionths of decimal degrees. Reading of much earl [...]
 }
 \usage{
 Rgshhs(fn, xlim = NULL, ylim = NULL, level = 4, minarea = 0, shift=FALSE, 
@@ -11,7 +11,7 @@ verbose = TRUE, no.clip = FALSE)
 }
 %- maybe also 'usage' for other objects documented here.
 \arguments{
-  \item{fn}{filename or full path to GSHHS 1.11 file to be read}
+  \item{fn}{filename or full path to GSHHS 2.0 file to be read}
   \item{xlim}{longitude limits within 0-360 in most cases, negative longitudes are also found east of the Atlantic, but the Americas are recorded as positive values}
   \item{ylim}{latitude limits}
   \item{level}{maximum GSHHS level to include, defaults to 4 (everything), setting 1 will only retrieve land, no lakes}
@@ -34,12 +34,7 @@ verbose = TRUE, no.clip = FALSE)
   for line data, a list with the following component:
   \item{SP}{a SpatialLines object}
 }
-\references{\url{http://www.soest.hawaii.edu/wessel/gshhs/gshhs.html}, 
-
-
-\url{http://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html} (only old format - use for information only); data downloaded from 
-
-\url{ftp://ftp.soest.hawaii.edu/pwessel/gshhs/gshhs_1.10.zip}; Wessel, P., and W. H. F. Smith, A Global Self-consistent, Hierarchical, High-resolution Shoreline Database, J. Geophys. Res., 101, 8741-8743, 1996.}
+\references{\url{http://www.soest.hawaii.edu/pwessel/gshhs/index.html}, \url{ftp://ftp.soest.hawaii.edu/pwessel/gshhs/gshhs_2.0.zip}; Wessel, P., and W. H. F. Smith, A Global Self-consistent, Hierarchical, High-resolution Shoreline Database, J. Geophys. Res., 101, 8741-8743, 1996.}
 \author{Roger Bivand}
 
 \note{
diff --git a/man/dotsInPolys.Rd b/man/dotsInPolys.Rd
index 96c3f2f..adab75d 100644
--- a/man/dotsInPolys.Rd
+++ b/man/dotsInPolys.Rd
@@ -10,7 +10,7 @@ dotsInPolys(pl, x, f = "random", offset, compatible = FALSE)
 }
 %- maybe also 'usage' for other objects documented here.
 \arguments{
-  \item{pl}{list of polygons of class \code{polylist}, or an object of class SpatialPolygons or SpatialPolygonsDataFrame}
+  \item{pl}{an object of class SpatialPolygons or SpatialPolygonsDataFrame}
   \item{x}{integer vector of counts of same length as pl for dots}
   \item{f}{type of sampling used to place points in polygons, either "random" or "regular"}
 \item{offset}{ for regular sampling only: the offset (position) of the regular
@@ -31,16 +31,6 @@ not random}
 
 \seealso{\code{\link[sp]{spsample}}}
 \examples{
-x <- read.shape(system.file("shapes/sids.shp", package="maptools")[1])
-ncpolys <- Map2poly(x)
-try1 <- dotsInPolys(ncpolys, as.integer(x$att.data$SID74), compatible=TRUE)
-plot(ncpolys)
-xx <- lapply(try1, function(x) {if (!is.null(x)) points(as.matrix(rbind(x)),
- pch=18, col="red")}) # added as.matrix(rbind(x)), thanks to Nicholas Grassly
-try2 <- dotsInPolys(ncpolys, as.integer(x$att.data$SID74), f="regular", compatible=TRUE)
-plot(ncpolys)
-xx <- lapply(try2, function(x) {if (!is.null(x)) points(as.matrix(rbind(x)),
- pch=18, col="red")})
 nc_SP <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1],
  proj4string=CRS("+proj=longlat  +ellps=clrk66"))
 \dontrun{
diff --git a/man/getinfo.shape.Rd b/man/getinfo.shape.Rd
new file mode 100644
index 0000000..50372f8
--- /dev/null
+++ b/man/getinfo.shape.Rd
@@ -0,0 +1,35 @@
+\name{getinfo.shape}
+\alias{getinfo.shape}
+\alias{print.shapehead}
+
+\title{Get shapefile header information}
+\description{
+  Get shapefile  header information; the file should be given including its ".shp" extension, and the function will reconstruct the names of the database (dbf) file and the index (shx) file from these.
+}
+\usage{
+getinfo.shape(filen)
+\method{print}{shapehead}(x, ...)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+  \item{filen}{name of file with *.shp extension}
+  \item{x}{a shapehead list as returned by getinfo.shape}
+  \item{...}{other arguments passed to print}
+}
+\details{
+  The function calls code from shapelib to read shapefiles, a file format used by ESRI GIS software among others
+}
+\value{
+The function returns a list of class shapehead.
+}
+\references{\url{http://shapelib.maptools.org/}}
+\author{Roger Bivand \email{Roger.Bivand at nhh.no}; shapelib by Frank Warmerdam}
+
+
+\examples{
+res <- getinfo.shape(system.file("shapes/fylk-val.shp", package="maptools")[1])
+res
+str(res)
+}
+\keyword{spatial}
+
diff --git a/man/holepolys.Rd b/man/holepolys.Rd
index 1b1b016..1aa7114 100644
--- a/man/holepolys.Rd
+++ b/man/holepolys.Rd
@@ -40,8 +40,10 @@ example script.
 
 \examples{
 data(gpcholes)
-plot(hole2pl, col="red", pbg="white", border="blue", forcefill=FALSE)
-plot(hole1pl, col="red", pbg="white", border="blue", forcefill=FALSE)
+opar <- par(mfrow=c(1,2))
+plot(SpatialPolygons(list(h2pl)), col="red", pbg="white", border="blue")
+plot(SpatialPolygons(list(h1pl)), col="red", pbg="white", border="blue")
+par(opar)
 }
 
 \keyword{datasets}
diff --git a/man/leglabs.Rd b/man/leglabs.Rd
new file mode 100644
index 0000000..459698d
--- /dev/null
+++ b/man/leglabs.Rd
@@ -0,0 +1,35 @@
+% Copyright 2001-4 by Roger S. Bivand
+\name{leglabs}
+\alias{leglabs}
+\title{Make legend labels}
+\description{
+\code{leglabs} makes character strings from the same break points. The \code{plot.polylist()} function may be used as a generic S3 method. }
+\usage{
+leglabs(vec, under="under", over="over", between="-")
+}
+
+\arguments{
+  \item{vec}{vector of break values}
+  \item{under}{character value for under}
+  \item{over}{character value for over}
+  \item{between}{character value for between}
+%  \item{y}{numeric vector to be broken into class intervals}
+%  \item{rightmost.closed}{as in findInterval()}
+%  \item{all.inside}{as in findInterval()}
+}
+\author{Roger Bivand \email{Roger.Bivand at nhh.no}}
+
+\seealso{\code{\link{findInterval}}}
+
+\examples{
+mappolys <- readShapeSpatial(system.file("shapes/columbus.shp", package="maptools")[1], ID="NEIGNO")
+brks <- round(quantile(mappolys$CRIME, probs=seq(0,1,0.2)), digits=2)
+colours <- c("salmon1", "salmon2", "red3", "brown", "black")
+plot(mappolys, col=colours[findInterval(mappolys$CRIME, brks,
+ all.inside=TRUE)])
+legend(x=c(5.8, 7.1), y=c(13, 14.5), legend=leglabs(brks),
+  fill=colours, bty="n")
+invisible(title(main=paste("Columbus OH: residential burglaries and vehicle",
+ "thefts per thousand households, 1980", sep="\n")))
+}
+\keyword{spatial}
diff --git a/man/readShapeLines.Rd b/man/readShapeLines.Rd
index f3fb889..2a9859b 100644
--- a/man/readShapeLines.Rd
+++ b/man/readShapeLines.Rd
@@ -39,7 +39,7 @@ xxx <- xx[xx$LENGTH > 30000,]
 plot(xxx, col="red", add=TRUE)
 tmpfl <- paste(tempdir(), "xxline", sep="/")
 writeLinesShape(xxx, tmpfl)
-getinfo.shape(paste(tmpfl, ".shp", sep=""))
+maptools:::getinfo.shape(paste(tmpfl, ".shp", sep=""))
 axx <- readShapeLines(tmpfl, proj4string=CRS("+proj=utm +zone=33 +datum=WGS84"))
 plot(xxx, col="black", lwd=4)
 plot(axx, col="yellow", lwd=1, add=TRUE)
diff --git a/man/readShapePoints.Rd b/man/readShapePoints.Rd
index ec35c1e..c476b1c 100644
--- a/man/readShapePoints.Rd
+++ b/man/readShapePoints.Rd
@@ -36,7 +36,7 @@ summary(xx)
 xxx <- xx[xx$PRICE < 40,]
 tmpfl <- paste(tempdir(), "xxpts", sep="/")
 writePointsShape(xxx, tmpfl)
-getinfo.shape(paste(tmpfl, ".shp", sep=""))
+maptools:::getinfo.shape(paste(tmpfl, ".shp", sep=""))
 axx <- readShapePoints(tmpfl)
 plot(axx, col="red", add=TRUE)
 unlink(paste(tmpfl, ".*", sep=""))
diff --git a/man/readShapePoly.Rd b/man/readShapePoly.Rd
index 63e3516..cdcd161 100644
--- a/man/readShapePoly.Rd
+++ b/man/readShapePoly.Rd
@@ -47,7 +47,7 @@ xxx <- xx[xx$SID74 < 2,]
 plot(xxx, border="red", add=TRUE)
 tmpfl <- paste(tempdir(), "xxpoly", sep="/")
 writePolyShape(xxx, tmpfl)
-getinfo.shape(paste(tmpfl, ".shp", sep=""))
+maptools:::getinfo.shape(paste(tmpfl, ".shp", sep=""))
 axx <- readShapePoly(tmpfl, proj4string=CRS("+proj=longlat +ellps=clrk66"))
 plot(xxx, border="black", lwd=4)
 plot(axx, border="yellow", lwd=1, add=TRUE)
diff --git a/man/readShapeSpatial.Rd b/man/readShapeSpatial.Rd
index 1c5b029..1543a70 100644
--- a/man/readShapeSpatial.Rd
+++ b/man/readShapeSpatial.Rd
@@ -43,7 +43,7 @@ summary(xx)
 xxx <- xx[xx$SID74 < 2,]
 tmpfl <- paste(tempdir(), "xxpoly", sep="/")
 writeSpatialShape(xxx, tmpfl)
-getinfo.shape(paste(tmpfl, ".shp", sep=""))
+maptools:::getinfo.shape(paste(tmpfl, ".shp", sep=""))
 unlink(paste(tmpfl, ".*", sep=""))
 xx <- readShapeSpatial(system.file("shapes/fylk-val.shp",
  package="maptools")[1], proj4string=CRS("+proj=utm +zone=33 +datum=WGS84"))
@@ -52,14 +52,14 @@ xxx <- xx[xx$LENGTH > 30000,]
 plot(xxx, col="red", add=TRUE)
 tmpfl <- paste(tempdir(), "xxline", sep="/")
 writeSpatialShape(xxx, tmpfl)
-getinfo.shape(paste(tmpfl, ".shp", sep=""))
+maptools:::getinfo.shape(paste(tmpfl, ".shp", sep=""))
 unlink(paste(tmpfl, ".*", sep=""))
 xx <- readShapeSpatial(system.file("shapes/baltim.shp", package="maptools")[1])
 summary(xx)
 xxx <- xx[xx$PRICE < 40,]
 tmpfl <- paste(tempdir(), "xxpts", sep="/")
 writeSpatialShape(xxx, tmpfl)
-getinfo.shape(paste(tmpfl, ".shp", sep=""))
+maptools:::getinfo.shape(paste(tmpfl, ".shp", sep=""))
 unlink(paste(tmpfl, ".*", sep=""))
 }
 \keyword{spatial}
diff --git a/man/spCbind-methods.Rd b/man/spCbind-methods.Rd
index 00eec66..caf8d3e 100644
--- a/man/spCbind-methods.Rd
+++ b/man/spCbind-methods.Rd
@@ -30,7 +30,7 @@
 
 \author{Roger Bivand}
 
-\seealso{\code{\link{spChFIDs-methods}}, \code{\link{spRbind-methods}}}
+\seealso{\code{\link[sp]{spChFIDs-methods}}, \code{\link{spRbind-methods}}}
 
 \examples{
 xx <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], 
diff --git a/man/spChFIDs-methods.Rd b/man/spChFIDs-methods.Rd
deleted file mode 100644
index de2ca83..0000000
--- a/man/spChFIDs-methods.Rd
+++ /dev/null
@@ -1,39 +0,0 @@
-\name{spChFIDs-methods}
-\docType{methods}
-\alias{spChFIDs-methods}
-\alias{spChFIDs,SpatialLines,character-method}
-\alias{spChFIDs,SpatialLinesDataFrame,character-method}
-\alias{spChFIDs,SpatialPolygons,character-method}
-\alias{spChFIDs,SpatialPolygonsDataFrame,character-method}
-\title{change feature IDs in spatial objects}
-\alias{spChFIDs}
-\description{
- When the feature IDs need to be changed in SpatialLines* or SpatialPolygons* objects, these methods may be used. The new IDs should be a character vector of unique IDs of the correct length.
-}
-\section{Methods}{
-\describe{
-
-\item{obj = "SpatialLines", x = "character"}{replace IDs in a SpatialLines object}
-
-\item{obj = "SpatialLinesDataFrame", x = "character"}{replace IDs in a SpatialLinesDataFrame object}
-
-\item{obj = "SpatialPolygons", x = "character"}{replace IDs in a SpatialPolygons object}
-
-\item{obj = "SpatialPolygonsDataFrame", x = "character"}{replace IDs in a SpatialPolygonsDataFrame object}
-}}
-
-\note{It is usually sensible to keep a copy of the original feature IDs in the object, but this should be done by the user.}
-
-\author{Roger Bivand}
-
-\seealso{\code{\link{spCbind-methods}}, \code{\link{spRbind-methods}}}
-
-\examples{
-xx <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], 
-  IDvar="FIPSNO", proj4string=CRS("+proj=longlat +ellps=clrk66"))
-row.names(as(xx, "data.frame"))
-xx1 <- spChFIDs(xx, as.character(xx$CNTY_ID))
-row.names(as(xx1, "data.frame"))
-}
-\keyword{methods}
-\keyword{spatial}
diff --git a/man/spRbind-methods.Rd b/man/spRbind-methods.Rd
index 40e22ef..eca28e9 100644
--- a/man/spRbind-methods.Rd
+++ b/man/spRbind-methods.Rd
@@ -28,9 +28,26 @@
 \item{obj = "SpatialPolygonsDataFrame", x = "SpatialPolygonsDataFrame"}{rbind two SpatialPolygonsDataFrame objects}
 }}
 
+\note{
+In addition to the \code{spRbind}-methods, there are also 
+\code{rbind}-methods for Spatial* objects. The differences are:
+
+\enumerate{
+ \item{\code{spRbind}-methods can bind 2 objects, whereas \code{rbind}-methods 
+     can bind multiple object}
+ \item{some \code{rbind} can accept objects with duplicated IDs, for all 
+     \code{spRbind}-methods these have to be modified explicitly, e.g. by 
+     calling \code{\link[sp]{spChFIDs-methods}}}
+ \item{in \code{spRbind} for \code{Spatial*DataFrame}s, data is extracted
+     by \code{as(x,"data.frame")}. Because of this, the coordinates will
+     be added back to the new object when applying \code{spRbind} on 
+     \code{SpatialPointsDataFrame}s. }
+}
+}
+
 \author{Roger Bivand}
 
-\seealso{\code{\link{spChFIDs-methods}}, \code{\link{spCbind-methods}}}
+\seealso{\code{\link[sp]{spChFIDs-methods}}, \code{\link{spCbind-methods}}}
 
 \examples{
 xx <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1], 
diff --git a/man/symbolsInPolys.Rd b/man/symbolsInPolys.Rd
index 8cc94b5..d69ba4c 100644
--- a/man/symbolsInPolys.Rd
+++ b/man/symbolsInPolys.Rd
@@ -10,7 +10,7 @@ symbolsInPolys(pl, dens, symb = "+", compatible = FALSE)
 }
 %- maybe also 'usage' for other objects documented here.
 \arguments{
-  \item{pl}{list of polygons of class \code{polylist}}
+  \item{pl}{an object of class SpatialPolygons or SpatialPolygonsDataFrame}
   \item{dens}{number of symbol plotting points per unit area; either a single numerical value for all polygons, or a numeric vector the same length as pl with values for each polygon}
   \item{symb}{plotting symbol; either a single value for all polygons, or a vector the same length as pl with values for each polygon}
   \item{compatible}{what to return, if TRUE a a list of matrices of point coordinates, one matrix for each member of pl, with a \code{symb} attribute, if false a SpatialPointsDataFrame with a \code{symb} column}
@@ -30,13 +30,6 @@ The function returns a list of matrices of point coordinates, one matrix for eac
 \seealso{\code{\link[sp]{spsample}}}
 
 \examples{
-x <- read.shape(system.file("shapes/sids.shp", package="maptools")[1])
-ncpolys <- Map2poly(x)
-np <- sapply(ncpolys, function(x) attr(x, "nPart"))
-symbs <- c("-", "+", "x")
-try1 <- symbolsInPolys(ncpolys, 100, symb=symbs[np], compatible=TRUE)
-plot(ncpolys)
-xx <- lapply(try1, function(x) {if (!is.null(x)) points(x, pch=attr(x, "symb"))})
 nc_SP <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1],
  proj4string=CRS("+proj=longlat +ellps=clrk66"))
 \dontrun{
diff --git a/man/thinnedSpatialPoly.Rd b/man/thinnedSpatialPoly.Rd
new file mode 100644
index 0000000..cac705f
--- /dev/null
+++ b/man/thinnedSpatialPoly.Rd
@@ -0,0 +1,41 @@
+\name{thinnedSpatialPoly}
+\alias{thinnedSpatialPoly}
+%- Also NEED an '\alias' for EACH other topic documented here.
+\title{Douglas-Peuker line generalization for Spatial Polygons}
+
+\description{
+The function applies the implementation of the Douglas-Peuker algorithm for line generalization or simplification (originally from shapefiles) to objects inheriting from Spatial Polygons. It does not preserve topology, so is suitable for visualisation, but not for the subsequent analysis of the polygon boundaries, as artefacts may be created, and boundaries of neighbouring entities may be generalized differently.
+}
+\usage{
+thinnedSpatialPoly(SP, tolerance, minarea=0)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+  \item{SP}{an object inheriting from the SpatialPolygons class}
+  \item{tolerance}{the tolerance value in the metric of the input object}
+  \item{minarea}{the smallest area of Polygon objects to be retained}
+}
+\value{An object of the same class as the input object}
+\references{Douglas, D. and Peucker, T. (1973). Algorithms for 
+the reduction of the number of points required to 
+represent a digitized line or its caricature. 
+\emph{The Canadian Cartographer} 10(2). 112-122.}
+\author{Ben Stabler, Michael Friendly, Roger Bivand}
+
+\note{Warnings reporting: Non-finite label point detected and replaced, reflect the changes in the geometries of the polygons induced by line generalization.}
+
+\examples{
+xx <- readShapeSpatial(system.file("shapes/sids.shp", package="maptools")[1],
+      IDvar="FIPSNO", proj4string=CRS("+proj=longlat +ellps=clrk66"))
+object.size(as(xx, "SpatialPolygons"))
+xxx <- thinnedSpatialPoly(xx, tolerance=0.05, minarea=0.001)
+object.size(as(xxx, "SpatialPolygons"))
+par(mfrow=c(2,1))
+plot(xx)
+plot(xxx)
+par(mfrow=c(1,1))
+}
+% Add one or more standard keywords, see file 'KEYWORDS' in the
+% R documentation directory.
+\keyword{spatial}
+
diff --git a/src/Rgshhs.c b/src/Rgshhs.c
index 0347996..d3d5386 100644
--- a/src/Rgshhs.c
+++ b/src/Rgshhs.c
@@ -1,4 +1,7 @@
-/*	$Id: Rgshhs.c,v 1.5 2008/05/24 16:27:26 rsbivand Exp $
+/*	$Id: Rgshhs.c,v 1.7 2009/12/21 12:37:45 rsbivand Exp $
+ *
+ *	Copyright (c) 1996-2009 by P. Wessel and W. H. F. Smith
+ *	See COPYING file for copying and redistribution conditions.
  *
  * PROGRAM:	gshhs.c
  * AUTHOR:	Paul Wessel (pwessel at hawaii.edu)
@@ -16,6 +19,11 @@
  *		1.7 11-NOV-2006: Fixed bug in computing level (&& vs &)
  *		1.8 31-MAR-2007: Updated to deal with latest GSHHS database (1.5)
  *		1.9 27-AUG-2007: Handle line data as well as polygon data
+ *		1.10 15-FEB-2008: Updated to deal with latest GSHHS database (1.6)
+ *		1.12 15-JUN-2009: Now contains information on container polygon,
+ *				the polygons ancestor in the full resolution, and
+ *				a flag to tell if a lake is a riverlake.
+ *				Updated to deal with latest GSHHS database (2.0)
  *
  *	Copyright (c) 1996-2004 by P. Wessel and W. H. F. Smith
  *	See COPYING file for copying and redistribution conditions.
@@ -32,7 +40,7 @@
  *	Contact info: www.soest.hawaii.edu/pwessel */
 
 /*
- * This modification of gshhs.c is Copyright (c) 2005-7 Roger Bivand
+ * This modification of gshhs.c is Copyright (c) 2005-9 Roger Bivand
  * Modification to swap function taken from Rsystat.c in foreign 071117
 */
 
@@ -71,8 +79,9 @@ SEXP Rgshhs(SEXP fn, SEXP mode, SEXP dolim, SEXP lim, SEXP level, SEXP minarea)
 {
 	FILE *fp;
 	double w, e, s, n, area, lon, lat;
-	char source, kind[2] = {'P', 'L'}, *name[2] = {"polygon", "line"};
+	char source, kind[2] = {'P', 'L'};
 	char msg[255];
+	char *name[2] = {"polygon", "line"}, container[8], ancestor[8];
 	int k, line, max_east = 270000000, info, n_read, /*flip,*/ Level, version, greenwich, src;
 	struct POINT p;
 	struct GSHHS h;
@@ -103,9 +112,9 @@ SEXP Rgshhs(SEXP fn, SEXP mode, SEXP dolim, SEXP lim, SEXP level, SEXP minarea)
 
 		rewind(fp);
 
-		PROTECT(res = NEW_LIST(12)); pc++;
+		PROTECT(res = NEW_LIST(14)); pc++;
 
-		PROTECT(resnames = NEW_CHARACTER(12)); pc++;
+		PROTECT(resnames = NEW_CHARACTER(14)); pc++;
 		SET_STRING_ELT(resnames, 0, COPY_TO_USER_STRING("id"));
 		SET_STRING_ELT(resnames, 1, COPY_TO_USER_STRING("n"));
 		SET_STRING_ELT(resnames, 2, COPY_TO_USER_STRING("level"));
@@ -118,6 +127,8 @@ SEXP Rgshhs(SEXP fn, SEXP mode, SEXP dolim, SEXP lim, SEXP level, SEXP minarea)
 		SET_STRING_ELT(resnames, 9, COPY_TO_USER_STRING("south"));
 		SET_STRING_ELT(resnames, 10, COPY_TO_USER_STRING("north"));
 		SET_STRING_ELT(resnames, 11, COPY_TO_USER_STRING("line"));
+		SET_STRING_ELT(resnames, 12, COPY_TO_USER_STRING("container"));
+		SET_STRING_ELT(resnames, 13, COPY_TO_USER_STRING("ancestor"));
 		setAttrib(res, R_NamesSymbol, resnames);
 
 		SET_VECTOR_ELT(res, 0, NEW_INTEGER(npols));
@@ -132,6 +143,8 @@ SEXP Rgshhs(SEXP fn, SEXP mode, SEXP dolim, SEXP lim, SEXP level, SEXP minarea)
 		SET_VECTOR_ELT(res, 9, NEW_NUMERIC(npols));
 		SET_VECTOR_ELT(res, 10, NEW_NUMERIC(npols));
 		SET_VECTOR_ELT(res, 11, NEW_INTEGER(npols));
+		SET_VECTOR_ELT(res, 12, NEW_INTEGER(npols));
+		SET_VECTOR_ELT(res, 13, NEW_INTEGER(npols));
 
 		fpos =  (signed int) ftell(fp);
 		n_read = fread ((void *)&h, (size_t)sizeof (struct GSHHS), 
@@ -155,10 +168,12 @@ SEXP Rgshhs(SEXP fn, SEXP mode, SEXP dolim, SEXP lim, SEXP level, SEXP minarea)
 			h.greenwich = swabi2 ((unsigned int)h.greenwich);
 			h.source = swabi2 ((unsigned int)h.source);*/
 			swapb (&h.flag, sizeof(int));
+                        swapb (&h.ancestor, sizeof(int));
+                        swapb (&h.container, sizeof(int));
 /*		    }*/
 		    Level = h.flag & 255;
 		    version = (h.flag >> 8) & 255;
-		    if (version != GSHHS_DATA_VERSION) 
+		    if (version != GSHHS_DATA_RELEASE) 
 			error("Data not same version as software");
 		    greenwich = (h.flag >> 16) & 255;
 		    src = (h.flag >> 24) & 255;
@@ -186,6 +201,8 @@ SEXP Rgshhs(SEXP fn, SEXP mode, SEXP dolim, SEXP lim, SEXP level, SEXP minarea)
 		    NUMERIC_POINTER(VECTOR_ELT(res, 9))[i] = s;
 		    NUMERIC_POINTER(VECTOR_ELT(res, 10))[i] = n;
 		    INTEGER_POINTER(VECTOR_ELT(res, 11))[i] = (signed int) line;
+		    INTEGER_POINTER(VECTOR_ELT(res, 12))[i] = (signed int) h.container;
+		    INTEGER_POINTER(VECTOR_ELT(res, 13))[i] = (signed int) h.ancestor;
 
 		    fseek (fp, (long)(h.n * sizeof(struct POINT)), SEEK_CUR);
 
diff --git a/src/Rgshhs.h b/src/Rgshhs.h
index c888b87..5decb31 100644
--- a/src/Rgshhs.h
+++ b/src/Rgshhs.h
@@ -1,10 +1,10 @@
-/*	$Id: Rgshhs.h,v 1.4 2008/05/24 16:27:26 rsbivand Exp $
+/*	$Id: Rgshhs.h,v 1.5 2009/12/18 21:56:57 rsbivand Exp $
  *
  * Include file defining structures used in gshhs.c
  *
  * Paul Wessel, SOEST
  *
- *	Copyright (c) 1996-2008 by P. Wessel and W. H. F. Smith
+ *	Copyright (c) 1996-2009 by P. Wessel and W. H. F. Smith
  *	See COPYING file for copying and redistribution conditions.
  *
  *	This program is free software; you can redistribute it and/or modify
@@ -27,9 +27,15 @@
  *	28-AUG-2007.  PW: Version 1.6.  no format change
  *			  For use with version 1.6 of GSHHS which now has WDBII
  *			  borders and rivers.
+ *	03-JUL-2008.  PW: Version 1.11. New -I<id> option to pull out a single pol
+ *	27-MAY-2009.  PW: Version 1.12. Now includes container polygon ID in header,
+ *			  an ancestor ID, and area of the reduced polygon. Works on
+ *			  GSHHS 2.0 data.
+ *			  Header is now 44 bytes (all 4-byte integers)
  */
+
 /*
-This modification of gshhs.h is Copyright (c) 2005-7 Roger Bivand
+This modification of gshhs.h is Copyright (c) 2005-9 Roger Bivand
 */
 
 #ifndef _GSHHS
@@ -48,31 +54,50 @@ This modification of gshhs.h is Copyright (c) 2005-7 Roger Bivand
 #define SEEK_CUR 1
 #endif
 
-#define GSHHS_DATA_VERSION	6	/* For v1.5 data set */
-#define GSHHS_PROG_VERSION	"1.9"
+#define GSHHS_DATA_RELEASE	7	/* For v2.0 data set */
+#define GSHHS_DATA_VERSION	"2.0"	/* For v2.0 data set */
+#define GSHHS_PROG_VERSION	"1.12"
 
 #define GSHHS_SCL	1.0e-6	/* COnvert micro-degrees to degrees */
 
 
 /* For byte swapping on little-endian systems (GSHHS is bigendian) */
 
-/* #define swabi2(i2) (((i2) >> 8) + (((i2) & 255) << 8))
-#define swabi4(i4) (((i4) >> 24) + (((i4) >> 8) & 65280) + (((i4) & 65280) << 8) + (((i4) & 255) << 24)) */
+/* #define swabi4(i4) (((i4) >> 24) + (((i4) >> 8) & 65280) + (((i4) & 65280) << 8) + (((i4) & 255) << 24)) */
 
-struct GSHHS {	/* Global Self-consistent Hierarchical High-resolution Shorelines */
-	int id;				/* Unique polygon id number, starting at 0 */
-	int n;				/* Number of points in this polygon */
-	int flag;			/* = level + version << 8 + greenwich << 16 + source << 24 */
+//struct GSHHS {	/* Global Self-consistent Hierarchical High-resolution Shorelines */
+//	int id;				/* Unique polygon id number, starting at 0 */
+//	int n;				/* Number of points in this polygon */
+//	int flag;			/* = level + version << 8 + greenwich << 16 + source << 24 */
 	/* flag contains 4 items, one in each byte, as follows:
 	 * low byte:	level = flag & 255: Values: 1 land, 2 lake, 3 island_in_lake, 4 pond_in_island_in_lake
 	 * 2nd byte:	version = (flag >> 8) & 255: Values: Should be 4 for GSHHS version 1.4
 	 * 3rd byte:	greenwich = (flag >> 16) & 255: Values: Greenwich is 1 if Greenwich is crossed
 	 * 4th byte:	source = (flag >> 24) & 255: Values: 0 = CIA WDBII, 1 = WVS
 	 */
+//	int west, east, south, north;	/* min/max extent in micro-degrees */
+//	int area;			/* Area of polygon in 1/10 km^2 */
+//};
+
+struct GSHHS {	/* Global Self-consistent Hierarchical High-resolution Shorelines */
+	int id;		/* Unique polygon id number, starting at 0 */
+	int n;		/* Number of points in this polygon */
+	int flag;	/* = level + version << 8 + greenwich << 16 + source << 24 + river << 25 */
+	/* flag contains 5 items, as follows:
+	 * low byte:	level = flag & 255: Values: 1 land, 2 lake, 3 island_in_lake, 4 pond_in_island_in_lake
+	 * 2nd byte:	version = (flag >> 8) & 255: Values: Should be 7 for GSHHS release 7
+	 * 3rd byte:	greenwich = (flag >> 16) & 1: Values: Greenwich is 1 if Greenwich is crossed
+	 * 4th byte:	source = (flag >> 24) & 1: Values: 0 = CIA WDBII, 1 = WVS
+	 * 4th byte:	river = (flag >> 25) & 1: Values: 0 = not set, 1 = river-lake and level = 2
+	 */
 	int west, east, south, north;	/* min/max extent in micro-degrees */
-	int area;			/* Area of polygon in 1/10 km^2 */
+	int area;	/* Area of polygon in 1/10 km^2 */
+	int area_full;	/* Area of original full-resolution polygon in 1/10 km^2 */
+	int container;	/* Id of container polygon that encloses this polygon (-1 if none) */
+	int ancestor;	/* Id of ancestor polygon in the full resolution set that was the source of this polygon (-1 if none) */
 };
 
+
 struct	POINT {	/* Each lon, lat pair is stored in micro-degrees in 4-byte integer format */
 	int	x;
 	int	y;

-- 
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