Skip to content

Commit

Permalink
Merge pull request #20 from paleolimbot/development
Browse files Browse the repository at this point in the history
North arrow and documentation update in prep for CRAN release
  • Loading branch information
paleolimbot authored Jul 11, 2018
2 parents 1393076 + 6c4e50a commit 8723175
Show file tree
Hide file tree
Showing 41 changed files with 1,063 additions and 202 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ language: R
sudo: false
cache: packages

r_github_packages:
- tidyverse/ggplot2

addons:
apt:
sources:
Expand Down
15 changes: 10 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
Package: ggspatial
Type: Package
Title: Spatial Data Framework for ggplot2
Version: 0.3.0.9000
Author: Dewey Dunnington <[email protected]>
Version: 1.0.0
Authors@R: c(
person("Dewey", "Dunnington", , "[email protected]", c("aut", "cre")),
person("Brent", "Thorne", role = "ctb")
)
Maintainer: Dewey Dunnington <[email protected]>
Description: Spatial data plus the power of the ggplot2 framework means easier mapping when input
data are already in the form of Spatial* objects.
data are already in the form of spatial objects.
License: GPL-3
Depends:
R (>= 2.10),
ggplot2 (>= 2.0),
sf
ggplot2 (>= 2.2.1.9000)
Imports:
sf,
rosm (>= 0.2),
abind,
reshape2,
Expand All @@ -31,6 +34,8 @@ Suggests:
rgdal,
testthat,
dplyr,
withr,
ggrepel,
covr
URL: https://github.com/paleolimbot/ggspatial
BugReports: https://github.com/paleolimbot/ggspatial/issues
Expand Down
11 changes: 10 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ S3method(geom_spatial,sf)
S3method(geom_spatial,sfc)
S3method(layer_spatial,Raster)
S3method(layer_spatial,default)
S3method(makeContent,geom_spatial_raster_lazy)
S3method(spatial_default_aes,Raster)
S3method(spatial_default_aes,sf)
S3method(spatial_default_aes,sfc)
Expand All @@ -43,6 +44,10 @@ S3method(spatial_geom,sfc)
export(GeomMapTile)
export(GeomNorthArrow)
export(GeomScaleBar)
export(GeomSpatialRaster)
export(StatSpatialRaster)
export(StatSpatialRasterAnnotation)
export(StatSpatialRasterDf)
export(annotation_map_tile)
export(annotation_north_arrow)
export(annotation_scale)
Expand All @@ -61,12 +66,16 @@ export(ggraster)
export(ggspatial)
export(layer_spatial)
export(load_longlake_data)
export(north_arrow_fancy_orienteering)
export(north_arrow_minimal)
export(north_arrow_nautical)
export(north_arrow_orienteering)
export(spatial_fortify)
export(stat_project)
export(stat_spatial_identity)
export(xy_transform)
importFrom(ggplot2,aes)
importFrom(ggplot2,fortify)
importFrom(ggplot2,waiver)
importFrom(grid,makeContent)
importFrom(grid,unit)
importFrom(sf,st_zm)
30 changes: 16 additions & 14 deletions R/geom-osm.R → R/annotation-map-tile.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
#' @return A ggplot2 layer
#' @export
#'
#' @examples
#' load_longlake_data()
#'
#' ggplot() +
#' annotation_map_tile(zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) +
#' geom_sf(data = longlake_waterdf, fill = NA, col = "grey50")
#'
annotation_map_tile <- function(type = "osm", zoom = NULL, zoomin = -2,
forcedownload = FALSE, cachedir = NULL,
progress = c("text", "none"), quiet = TRUE,
Expand Down Expand Up @@ -90,21 +97,16 @@ GeomMapTile <- ggplot2::ggproto(

coord_crs <- sf::st_crs(panel_params$crs)
if(!is.null(coord_crs)) {

proj_corners <- sf::st_sfc(
st_point(c(panel_params$x_range[1], panel_params$y_range[1])),
st_point(c(panel_params$x_range[2], panel_params$y_range[2])),
crs = coord_crs
)
proj_grid <- sf::st_make_grid(proj_corners, n = 50, what = "corners")
latlon_grid <- sf::st_transform(proj_grid, crs = 4326)
latlon_bbox <- sf::st_bbox(latlon_grid)
sp_bbox <- prettymapr::makebbox(
n = latlon_bbox["ymax"],
e = latlon_bbox["xmax"],
s = latlon_bbox["ymin"],
w = latlon_bbox["xmin"]
sp_bbox <- project_extent(
xmin = panel_params$x_range[1],
ymin = panel_params$y_range[1],
xmax = panel_params$x_range[2],
ymax = panel_params$y_range[2],
from_crs = coord_crs,
to_crs = 4326,
format = "sp"
)

} else {
stop("geom_map_tile() requires coord_sf().", call. = FALSE)
}
Expand Down
Loading

0 comments on commit 8723175

Please sign in to comment.