Skip to content

Commit 6c1f99a

Browse files
authored
v3.4.3 (#32)
* Remove some trailing spaces * Update DESCRIPTION
1 parent 7a235ae commit 6c1f99a

6 files changed

Lines changed: 32 additions & 36 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
Package: maps
22
Title: Draw Geographical Maps
3-
Version: 3.4.2.9008
4-
Date: 2025-05-14
5-
Author: Original S code by Richard A. Becker and Allan R. Wilks.
6-
R version by Ray Brownrigg.
7-
Enhancements by Thomas P. Minka and Alex Deckmyn.
3+
Version: 3.4.3
4+
Date: 2025-05-15
85
Description: Display of maps. Projection code and larger maps are in
96
separate packages ('mapproj' and 'mapdata').
107
Depends: R (>= 3.5.0)
@@ -14,7 +11,6 @@ Suggests: mapproj (>= 1.2-0), mapdata (>= 2.3.0), sf, rnaturalearth
1411
License: GPL-2
1512
URL: https://github.com/adeckmyn/maps
1613
BugReports: https://github.com/adeckmyn/maps/issues
17-
Maintainer: Alex Deckmyn <alex.deckmyn@meteo.be>
1814
Authors@R: c(person(given = c("Richard", "A."),
1915
family = "Becker",
2016
role = "aut",

R/db.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function(database = "world", patterns, exact = FALSE)
136136
}
137137
} else {
138138
## QUICK FIX: there is a problem now for UK vs Ukrain...
139-
if (database=="world") patterns <- fix_exceptions(patterns)
139+
if (database=="world") patterns <- fix_exceptions(patterns)
140140
regexp <- paste("(^", patterns, ")", sep = "", collapse = "|")
141141
# BUGFIX: perl regex is limited to about 30000 characters
142142
# so this crashes if patterns includes the whole world map
@@ -164,7 +164,7 @@ function(database = "world")
164164
if (!is.null(database$maptype)) return(database$maptype)
165165
# if (!is.null(database$projection)) return("planar")
166166
return("spherical")
167-
# you may also look at $projection ...
167+
# you may also look at $projection ...
168168
} else "spherical"
169169
}
170170
}

R/iso.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ iso.alpha <- function(x,n=2){
4949
if (any(is.na(sel))) {
5050
sel2 <- which(is.na(sel))
5151
nam2 <- unlist(lapply(x[sel2],
52-
function(nn) {regx <- paste("(^",nn,")",sep="") ;
52+
function(nn) {regx <- paste("(^",nn,")",sep="") ;
5353
ttt <- grep(regx, iso3166$mapname, perl=TRUE, ignore.case=TRUE);
5454
if (length(ttt)==1) ttt else NA}))
5555
sel[sel2] <- nam2
56-
}
56+
}
5757

5858
if (n==2) iso3166$a2[sel]
5959
else if (n==3) iso3166$a3[sel]

R/map.r

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ map.poly <- function(database, regions = ".", exact = FALSE,
5454
the.map <- SpatialPolygons2map(database, namefield=namefield)
5555
} else if (inherits(database,"SpatialLines")) {
5656
the.map <- SpatialLines2map(database, namefield=namefield)
57-
} else if (is.list(database) &&
57+
} else if (is.list(database) &&
5858
all(c("x", "y", "names") %in% names(database))) {
5959
the.map <- database
6060
} else {
@@ -98,7 +98,7 @@ map.poly <- function(database, regions = ".", exact = FALSE,
9898
stop("nothing to draw: all regions out of bounds")
9999
# turn the polyline numbers into x and y coordinates
100100
if (as.polygon) {
101-
coord <- mapgetl(database, line$number, xlim, ylim, fill)
101+
coord <- mapgetl(database, line$number, xlim, ylim, fill)
102102
# assemble lines into polygons
103103
gonsize <- line$size
104104
keep <- rep(TRUE, length(gonsize))
@@ -128,14 +128,14 @@ map <-
128128
function(database = "world", regions = ".", exact = FALSE,
129129
boundary = TRUE, interior = TRUE, projection = "",
130130
parameters = NULL, orientation = NULL, fill = FALSE,
131-
col = 1, plot = TRUE, add = FALSE, namesonly = FALSE,
131+
col = 1, plot = TRUE, add = FALSE, namesonly = FALSE,
132132
xlim = NULL, ylim = NULL, wrap = FALSE,
133133
resolution = if (plot) 1 else 0, type = "l", bg = par("bg"),
134-
mar = c(4.1, 4.1, par("mar")[3], 0.1), myborder = 0.01,
134+
mar = c(4.1, 4.1, par("mar")[3], 0.1), myborder = 0.01,
135135
namefield="name", lforce = "n", ...)
136136
{
137137
# parameter checks
138-
if (resolution>0 && !plot)
138+
if (resolution>0 && !plot)
139139
stop("must have plot=TRUE if resolution is given")
140140
if (!fill && !boundary && !interior)
141141
stop("one of boundary and interior must be TRUE")
@@ -145,11 +145,11 @@ function(database = "world", regions = ".", exact = FALSE,
145145
stop("Please install the package 'mapproj' for projections.")
146146
}
147147
coordtype <- maptype(database)
148-
if (coordtype == "unknown")
148+
if (coordtype == "unknown")
149149
stop("missing database or unknown coordinate type")
150-
if (doproj && coordtype != "spherical")
150+
if (doproj && coordtype != "spherical")
151151
stop(paste(database, "database is not spherical; projections not allowed"))
152-
if (length(wrap)>=2 && !doproj && wrap[2] - wrap[1] != 360)
152+
if (length(wrap)>=2 && !doproj && wrap[2] - wrap[1] != 360)
153153
stop("The specified longitudes for wrapping are inconsistent, they should be 360 apart.")
154154
# turn the region names into x and y coordinates
155155
if (is.character(database)) as.polygon = fill
@@ -158,7 +158,7 @@ function(database = "world", regions = ".", exact = FALSE,
158158
# to get all necessary polylines/polygons is to set xlim=NULL *temporarily*
159159
# (alternatively, the C code must shift longitudes by +/- 360 to fit in boundaries)
160160
xlim_tmp <- if (length(wrap)>=2) NULL else xlim
161-
coord <- map.poly(database, regions, exact, xlim_tmp, ylim,
161+
coord <- map.poly(database, regions, exact, xlim_tmp, ylim,
162162
boundary, interior, fill, as.polygon, namefield=namefield)
163163
if (is.na(coord$x[1])) stop("first coordinate is NA. Bad map data?")
164164
if (length(wrap)>=2) {
@@ -215,7 +215,7 @@ function(database = "world", regions = ".", exact = FALSE,
215215
if (is.null(ylim) || (doproj && !(lforce %in% c("s","l")))) yrange <- range(coord$y, na.rm = TRUE)
216216
else yrange <- ylim
217217
if (coordtype != "spherical" || doproj) {
218-
aspect <- c(1, 1)
218+
aspect <- c(1, 1)
219219
} else
220220
aspect <- c(cos((mean(yrange) * pi)/180), 1)
221221
d <- c(diff(xrange), diff(yrange)) * (1 + 2 * myborder) * aspect

R/misc.r

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ function(...)
2626
}
2727

2828
"map.cities" <-
29-
function (x = world.cities, country = "", label = NULL, minpop = 0,
29+
function (x = world.cities, country = "", label = NULL, minpop = 0,
3030
maxpop = Inf, capitals = 0, cex = par("cex"), projection = FALSE,
31-
parameters = NULL, orientation = NULL, pch = 1, ...)
31+
parameters = NULL, orientation = NULL, pch = 1, ...)
3232
{
3333
if (missing(x) && !exists("world.cities")) {
3434
world.cities <- maps::world.cities
@@ -48,27 +48,27 @@ function (x = world.cities, country = "", label = NULL, minpop = 0,
4848
x$lat <- projx$y
4949
} else stop("mapproj package not available\n")
5050
} else {
51-
if (usr[2] > (180 + 0.04*(usr[2] - usr[1])))
51+
if (usr[2] > (180 + 0.04*(usr[2] - usr[1])))
5252
x$long[x$long < 0] <- 360 + x$long[x$long < 0]
5353
}
5454
selection <- x$long >= usr[1] & x$long <= usr[2] & x$lat >= usr[3] &
5555
x$lat <= usr[4] & (x$pop >= minpop & x$pop <= maxpop) & ((capitals == 0) |
5656
(x$capital >= 1))
57-
if (country != "")
57+
if (country != "")
5858
selection <- selection & x$country.etc == country
5959
selection0 <- selection & (x$capital == 0) & (capitals == 0)
6060
selection01 <- selection & (x$capital <= 1) & (capitals <= 1)
6161
selection1 <- selection & (x$capital == 1) & (capitals == 1)
6262
selection2 <- selection & (x$capital == 2) & (capitals == 2)
6363
selection3 <- selection & (x$capital == 3) & (capitals == 3)
64-
if (is.null(label))
64+
if (is.null(label))
6565
label <- sum(selection) < 20
6666
cxy <- par("cxy")
67-
if (sum(selection01) > 0)
68-
points(x$long[selection01], x$lat[selection01], pch = pch,
67+
if (sum(selection01) > 0)
68+
points(x$long[selection01], x$lat[selection01], pch = pch,
6969
cex = cex * 0.6, ...)
70-
if (sum(selection0) > 0)
71-
if (label)
70+
if (sum(selection0) > 0)
71+
if (label)
7272
text(x$long[selection0], x$lat[selection0] + cxy[2] * cex * 0.7,
7373
paste(" ", x$name[selection0], sep = ""), cex = cex * 0.7, ...)
7474
if (sum(selection1) > 0) {
@@ -97,7 +97,7 @@ function (x = world.cities, country = "", label = NULL, minpop = 0,
9797

9898
# draw a scale bar on a map
9999
"map.scale" <-
100-
function (x, y, relwidth = 0.15, metric = TRUE, ratio = TRUE, ...)
100+
function (x, y, relwidth = 0.15, metric = TRUE, ratio = TRUE, ...)
101101
{
102102
# old version
103103
# format.pretty <- function(x) {
@@ -109,17 +109,17 @@ function (x, y, relwidth = 0.15, metric = TRUE, ratio = TRUE, ...)
109109
prettyNum(formatC(x, format = "fg", digits = digits), big.mark = ",")
110110
}
111111
usr <- par("usr")
112-
if (missing(y))
112+
if (missing(y))
113113
y <- (9 * usr[3] + usr[4])/10
114-
if (abs(y) >= 90)
114+
if (abs(y) >= 90)
115115
warning("location of scale out of this world!")
116-
if (missing(x))
116+
if (missing(x))
117117
#x <- (0.9 - relwidth) * usr[2] + (0.1 + relwidth) * usr[1]
118118
x <- (9 * usr[1] + usr[2])/10
119119
cosy <- cos((2 * pi * y)/360)
120120
perdeg <- (2 * pi * (6356.78 + 21.38 * cosy) * cosy)/360
121121
scale <- (perdeg * 100000)/(2.54 * (par("pin")/diff(par("usr"))[-2])[1])
122-
if (metric)
122+
if (metric)
123123
unit <- "km"
124124
else {
125125
perdeg <- perdeg * 0.6213712
@@ -174,7 +174,7 @@ map.wrap <- function(p, xlim=NULL) {
174174
j <- c(j, length(p$x))
175175
ind <- seq_along(p$x)
176176

177-
index <- c(ind[1:j[1]],
177+
index <- c(ind[1:j[1]],
178178
unlist(lapply(1:(length(j)-1), function(k) c(NA, ind[(j[k]+1):j[(k + 1)]]) )) )
179179
# notice that p$name is not returned!
180180
# so if wrapping is applied, you loose polygon names

R/read_external.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ sf2map <- function(database, namefield="name"){
108108
} else {
109109
line_names <- 1:nplines
110110
}
111-
if (inherits(database[[gname]], "sfc_MULTILINESTRING") ||
111+
if (inherits(database[[gname]], "sfc_MULTILINESTRING") ||
112112
inherits(database[[gname]], "sfc_MULTIPOLYGON")) {
113113
nlines <- vapply(1:nplines,
114114
FUN=function(r) sum(vapply(1:length(database[[gname]][[r]]),

0 commit comments

Comments
 (0)