Skip to content

Commit 8723175

Browse files
authored
Merge pull request #20 from paleolimbot/development
North arrow and documentation update in prep for CRAN release
2 parents 1393076 + 6c4e50a commit 8723175

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1063
-202
lines changed

.travis.yml

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ language: R
44
sudo: false
55
cache: packages
66

7-
r_github_packages:
8-
- tidyverse/ggplot2
9-
107
addons:
118
apt:
129
sources:

DESCRIPTION

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
Package: ggspatial
22
Type: Package
33
Title: Spatial Data Framework for ggplot2
4-
Version: 0.3.0.9000
5-
Author: Dewey Dunnington <[email protected]>
4+
Version: 1.0.0
5+
Authors@R: c(
6+
person("Dewey", "Dunnington", , "[email protected]", c("aut", "cre")),
7+
person("Brent", "Thorne", role = "ctb")
8+
)
69
Maintainer: Dewey Dunnington <[email protected]>
710
Description: Spatial data plus the power of the ggplot2 framework means easier mapping when input
8-
data are already in the form of Spatial* objects.
11+
data are already in the form of spatial objects.
912
License: GPL-3
1013
Depends:
1114
R (>= 2.10),
12-
ggplot2 (>= 2.0),
13-
sf
15+
ggplot2 (>= 2.2.1.9000)
1416
Imports:
17+
sf,
1518
rosm (>= 0.2),
1619
abind,
1720
reshape2,
@@ -31,6 +34,8 @@ Suggests:
3134
rgdal,
3235
testthat,
3336
dplyr,
37+
withr,
38+
ggrepel,
3439
covr
3540
URL: https://github.com/paleolimbot/ggspatial
3641
BugReports: https://github.com/paleolimbot/ggspatial/issues

NAMESPACE

+10-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ S3method(geom_spatial,sf)
2727
S3method(geom_spatial,sfc)
2828
S3method(layer_spatial,Raster)
2929
S3method(layer_spatial,default)
30+
S3method(makeContent,geom_spatial_raster_lazy)
3031
S3method(spatial_default_aes,Raster)
3132
S3method(spatial_default_aes,sf)
3233
S3method(spatial_default_aes,sfc)
@@ -43,6 +44,10 @@ S3method(spatial_geom,sfc)
4344
export(GeomMapTile)
4445
export(GeomNorthArrow)
4546
export(GeomScaleBar)
47+
export(GeomSpatialRaster)
48+
export(StatSpatialRaster)
49+
export(StatSpatialRasterAnnotation)
50+
export(StatSpatialRasterDf)
4651
export(annotation_map_tile)
4752
export(annotation_north_arrow)
4853
export(annotation_scale)
@@ -61,12 +66,16 @@ export(ggraster)
6166
export(ggspatial)
6267
export(layer_spatial)
6368
export(load_longlake_data)
69+
export(north_arrow_fancy_orienteering)
70+
export(north_arrow_minimal)
71+
export(north_arrow_nautical)
72+
export(north_arrow_orienteering)
6473
export(spatial_fortify)
6574
export(stat_project)
6675
export(stat_spatial_identity)
6776
export(xy_transform)
6877
importFrom(ggplot2,aes)
6978
importFrom(ggplot2,fortify)
70-
importFrom(ggplot2,waiver)
79+
importFrom(grid,makeContent)
7180
importFrom(grid,unit)
7281
importFrom(sf,st_zm)

R/geom-osm.R R/annotation-map-tile.R

+16-14
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
#' @return A ggplot2 layer
1717
#' @export
1818
#'
19+
#' @examples
20+
#' load_longlake_data()
21+
#'
22+
#' ggplot() +
23+
#' annotation_map_tile(zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) +
24+
#' geom_sf(data = longlake_waterdf, fill = NA, col = "grey50")
25+
#'
1926
annotation_map_tile <- function(type = "osm", zoom = NULL, zoomin = -2,
2027
forcedownload = FALSE, cachedir = NULL,
2128
progress = c("text", "none"), quiet = TRUE,
@@ -90,21 +97,16 @@ GeomMapTile <- ggplot2::ggproto(
9097

9198
coord_crs <- sf::st_crs(panel_params$crs)
9299
if(!is.null(coord_crs)) {
93-
94-
proj_corners <- sf::st_sfc(
95-
st_point(c(panel_params$x_range[1], panel_params$y_range[1])),
96-
st_point(c(panel_params$x_range[2], panel_params$y_range[2])),
97-
crs = coord_crs
98-
)
99-
proj_grid <- sf::st_make_grid(proj_corners, n = 50, what = "corners")
100-
latlon_grid <- sf::st_transform(proj_grid, crs = 4326)
101-
latlon_bbox <- sf::st_bbox(latlon_grid)
102-
sp_bbox <- prettymapr::makebbox(
103-
n = latlon_bbox["ymax"],
104-
e = latlon_bbox["xmax"],
105-
s = latlon_bbox["ymin"],
106-
w = latlon_bbox["xmin"]
100+
sp_bbox <- project_extent(
101+
xmin = panel_params$x_range[1],
102+
ymin = panel_params$y_range[1],
103+
xmax = panel_params$x_range[2],
104+
ymax = panel_params$y_range[2],
105+
from_crs = coord_crs,
106+
to_crs = 4326,
107+
format = "sp"
107108
)
109+
108110
} else {
109111
stop("geom_map_tile() requires coord_sf().", call. = FALSE)
110112
}

0 commit comments

Comments
 (0)