Skip to content

Commit

Permalink
move lwgeom dependency to Suggests:
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Aug 17, 2023
1 parent fa8ca6a commit 4f32c65
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 29 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ Imports:
methods,
parallel,
classInt (>= 0.4-1),
lwgeom,
rlang,
units
Suggests:
Expand All @@ -60,6 +59,7 @@ Suggests:
httr,
jsonlite,
knitr,
lwgeom,
maps,
mapdata,
ncdfgeom,
Expand Down
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ S3method(st_set_bbox,dimensions)
S3method(st_set_bbox,stars)
S3method(st_set_bbox,stars_proxy)
S3method(st_transform,stars)
S3method(st_transform_proj,stars)
S3method(time,stars)
S3method(write_stars,stars)
S3method(write_stars,stars_proxy)
Expand Down Expand Up @@ -165,7 +164,6 @@ export(st_set_bbox)
export(st_set_dimensions)
export(st_sfc2xy)
export(st_tile)
export(st_transform_proj)
export(st_warp)
export(st_xy2sfc)
export(write_mdim)
Expand Down Expand Up @@ -197,7 +195,6 @@ importFrom(graphics,plot.window)
importFrom(graphics,rasterImage)
importFrom(graphics,text)
importFrom(graphics,title)
importFrom(lwgeom,st_transform_proj)
importFrom(methods,as)
importFrom(methods,new)
importFrom(methods,slot)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# version 0.6-4

* move `lwgeom` dependency to Suggests; using `st_transform_proj()` requires loading `lwgeom` first

# version 0.6-3

* `st_downsample()` has argument `offset` to pixel-shift downsampled images
Expand Down
5 changes: 0 additions & 5 deletions R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
#' @import units
NULL

# re-export:
#' @importFrom lwgeom st_transform_proj
#' @export
lwgeom::st_transform_proj

setOldClass("stars")
setOldClass("stars_proxy")

Expand Down
5 changes: 2 additions & 3 deletions R/transform.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,16 @@ st_transform.stars = function(x, crs, ...) {
}

#' @name st_transform
#' @export
st_transform_proj.stars = function(x, crs, ...) {

stopifnot(!is.na(crs), !is.na(st_crs(x)))

if (has_sfc(x)) {
if (!requireNamespace("lwgeom", quietly = TRUE))
stop("package lwgeom required, please install it first") # nocov
try_proj = function(x, crs) {
ret = try(st_transform(x, crs), silent = TRUE)
if (inherits(ret, "try-error")) {
if (!requireNamespace("lwgeom", quietly = TRUE))
stop("package lwgeom required, please install it first") # nocov
if (inherits(crs, "crs"))
crs = crs$proj4string
ret = lwgeom::st_transform_proj(x, crs)
Expand Down
16 changes: 0 additions & 16 deletions man/reexports.Rd

This file was deleted.

2 changes: 1 addition & 1 deletion man/st_transform.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4f32c65

Please sign in to comment.